diff options
Diffstat (limited to 'packages')
5 files changed, 93 insertions, 26 deletions
diff --git a/packages/SystemUI/res/anim/search_launch_enter.xml b/packages/SystemUI/res/anim/search_launch_enter.xml new file mode 100644 index 0000000..055ea5d --- /dev/null +++ b/packages/SystemUI/res/anim/search_launch_enter.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2012, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:shareInterpolator="false" android:zAdjustment="top"> + + <alpha android:fromAlpha="0" android:toAlpha="1.0" + android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" + android:interpolator="@android:interpolator/decelerate_quad" + android:duration="300"/> + + <translate android:fromYDelta="200" android:toYDelta="0" + android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" + android:interpolator="@android:interpolator/decelerate_cubic" + android:duration="300" /> +</set> diff --git a/packages/SystemUI/res/anim/search_launch_exit.xml b/packages/SystemUI/res/anim/search_launch_exit.xml new file mode 100644 index 0000000..b4ed278 --- /dev/null +++ b/packages/SystemUI/res/anim/search_launch_exit.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2012, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<translate xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/accelerate_interpolator" + android:fromXDelta="0" android:toXDelta="0" + android:duration="300" /> diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java index 6b0bb87..28283ef 100644 --- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java @@ -18,6 +18,8 @@ package com.android.systemui; import android.animation.Animator; import android.animation.LayoutTransition; +import android.app.ActivityManagerNative; +import android.app.ActivityOptions; import android.app.SearchManager; import android.content.ActivityNotFoundException; import android.content.ComponentName; @@ -36,6 +38,7 @@ import android.widget.FrameLayout; import com.android.internal.widget.multiwaveview.MultiWaveView; import com.android.internal.widget.multiwaveview.MultiWaveView.OnTriggerListener; +import com.android.server.am.ActivityManagerService; import com.android.systemui.R; import com.android.systemui.recent.StatusBarTouchProxy; import com.android.systemui.statusbar.BaseStatusBar; @@ -103,26 +106,22 @@ public class SearchPanelView extends FrameLayout implements } private void startAssistActivity() { - if (mSearchManager != null) { - ComponentName globalSearchActivity = mSearchManager.getGlobalSearchActivity(); - if (globalSearchActivity != null) { - Intent intent = new Intent(Intent.ACTION_ASSIST); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.setPackage(globalSearchActivity.getPackageName()); - try { - mContext.startActivity(intent); - } catch (ActivityNotFoundException e) { - Slog.w(TAG, "Activity not found for " + intent.getAction()); - } - } else { - Slog.w(TAG, "No global search activity"); - } + Intent intent = getAssistIntent(); + try { + ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, + R.anim.search_launch_enter, R.anim.search_launch_exit); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mContext.startActivity(intent, opts.toBundle()); + } catch (ActivityNotFoundException e) { + Slog.w(TAG, "Activity not found for " + intent.getAction()); } } final MultiWaveView.OnTriggerListener mMultiWaveViewListener = new MultiWaveView.OnTriggerListener() { + private int mTarget = -1; + public void onGrabbed(View v, int handle) { } @@ -136,11 +135,18 @@ public class SearchPanelView extends FrameLayout implements } public void onTrigger(View v, int target) { - final int resId = mMultiWaveView.getResourceIdForTarget(target); - switch (resId) { - case com.android.internal.R.drawable.ic_lockscreen_search: - startAssistActivity(); - break; + mTarget = target; + } + + public void onFinishFinalAnimation() { + if (mTarget != -1) { + final int resId = mMultiWaveView.getResourceIdForTarget(mTarget); + mTarget = -1; // a safety to make sure we never launch w/o prior call to onTrigger + switch (resId) { + case com.android.internal.R.drawable.ic_lockscreen_search: + startAssistActivity(); + break; + } } mBar.hideSearchPanel(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 69d2e73..d38611d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -515,14 +515,8 @@ public class PhoneStatusBar extends BaseStatusBar { public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: - Slog.d(TAG, "showing search panel"); showSearchPanel(); break; - - case MotionEvent.ACTION_UP: - Slog.d(TAG, "hiding search panel"); - hideSearchPanel(); - break; } return false; } @@ -533,8 +527,8 @@ public class PhoneStatusBar extends BaseStatusBar { mNavigationBarView.getRecentsButton().setOnClickListener(mRecentsClickListener); mNavigationBarView.getRecentsButton().setOnTouchListener(mRecentsPanel); + mNavigationBarView.getHomeButton().setOnTouchListener(mHomeSearchActionListener); updateSearchPanel(); -// mNavigationBarView.getHomeButton().setOnTouchListener(mHomeSearchActionListener); } // For small-screen devices (read: phones) that lack hardware navigation buttons diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index dba1606..10c5dd8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -188,6 +188,17 @@ public class TabletStatusBar extends BaseStatusBar implements public Context getContext() { return mContext; } + private View.OnTouchListener mHomeSearchActionListener = new View.OnTouchListener() { + public boolean onTouch(View v, MotionEvent event) { + switch(event.getAction()) { + case MotionEvent.ACTION_DOWN: + showSearchPanel(); + break; + } + return false; + } + }; + @Override protected void createAndAddWindows() { addStatusBarWindow(); @@ -290,6 +301,7 @@ public class TabletStatusBar extends BaseStatusBar implements // Search Panel mStatusBarView.setBar(this); + mHomeButton.setOnTouchListener(mHomeSearchActionListener); updateSearchPanel(); // Input methods Panel |