diff options
Diffstat (limited to 'packages/SystemUI')
13 files changed, 138 insertions, 65 deletions
diff --git a/packages/SystemUI/res/drawable/system_bar_notification_header_bg.xml b/packages/SystemUI/res/drawable/system_bar_notification_header_bg.xml new file mode 100644 index 0000000..85f1ea2 --- /dev/null +++ b/packages/SystemUI/res/drawable/system_bar_notification_header_bg.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@*android:drawable/list_selector_pressed_holo_dark" /> + <item android:drawable="@*android:drawable/list_selector_disabled_holo_dark" /> +</selector> diff --git a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml b/packages/SystemUI/res/layout-land/status_bar_search_panel.xml index e6c0087..c8a120d 100644 --- a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml +++ b/packages/SystemUI/res/layout-land/status_bar_search_panel.xml @@ -54,7 +54,6 @@ prvandroid:outerRadius="@dimen/navbar_search_outerring_radius" prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius" prvandroid:snapMargin="@dimen/navbar_search_snap_margin" - prvandroid:hitRadius="@dimen/navbar_search_hit_radius" prvandroid:feedbackCount="0" prvandroid:vibrationDuration="@integer/config_vibration_duration" prvandroid:alwaysTrackFinger="true" diff --git a/packages/SystemUI/res/layout-port/status_bar_search_panel.xml b/packages/SystemUI/res/layout-port/status_bar_search_panel.xml index 3828136..1e4bb57 100644 --- a/packages/SystemUI/res/layout-port/status_bar_search_panel.xml +++ b/packages/SystemUI/res/layout-port/status_bar_search_panel.xml @@ -54,7 +54,6 @@ prvandroid:outerRadius="@dimen/navbar_search_outerring_radius" prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius" prvandroid:snapMargin="@dimen/navbar_search_snap_margin" - prvandroid:hitRadius="@dimen/navbar_search_hit_radius" prvandroid:feedbackCount="0" prvandroid:vibrationDuration="@integer/config_vibration_duration" prvandroid:alwaysTrackFinger="true" diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml index c17f858..3b6c52e 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml @@ -40,7 +40,6 @@ prvandroid:outerRadius="@dimen/navbar_search_outerring_radius" prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius" prvandroid:snapMargin="@dimen/navbar_search_snap_margin" - prvandroid:hitRadius="@dimen/navbar_search_hit_radius" prvandroid:feedbackCount="0" prvandroid:vibrationDuration="@integer/config_vibration_duration" prvandroid:alwaysTrackFinger="true" diff --git a/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml b/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml index 100f81d..8c2360e 100644 --- a/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml +++ b/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml @@ -41,7 +41,6 @@ prvandroid:outerRadius="@dimen/navbar_search_outerring_radius" prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius" prvandroid:snapMargin="@dimen/navbar_search_snap_margin" - prvandroid:hitRadius="@dimen/navbar_search_hit_radius" prvandroid:feedbackCount="0" prvandroid:vibrationDuration="@integer/config_vibration_duration" prvandroid:alwaysTrackFinger="true" diff --git a/packages/SystemUI/res/layout/system_bar_notification_panel_title.xml b/packages/SystemUI/res/layout/system_bar_notification_panel_title.xml index afe3b49..480d979 100644 --- a/packages/SystemUI/res/layout/system_bar_notification_panel_title.xml +++ b/packages/SystemUI/res/layout/system_bar_notification_panel_title.xml @@ -18,7 +18,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:id="@+id/title_area" - android:background="@color/notification_panel_solid_background" + android:background="@drawable/system_bar_notification_header_bg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index c88ae2a..6a96c6b 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -110,11 +110,8 @@ <!-- The width of the view containing the menu status bar icon --> <dimen name="navigation_menu_key_width">40dip</dimen> - <!-- Default distance beyond which snaps to the target radius --> - <dimen name="navbar_search_snap_margin">20dip</dimen> - - <!-- Default distance from each snap target considers a "hit" --> - <dimen name="navbar_search_hit_radius">60dip</dimen> + <!-- Default distance beyond which snaps to the matching target --> + <dimen name="navbar_search_snap_margin">40dip</dimen> <!-- Diameter of outer shape drawable shown in navbar search--> <dimen name="navbar_search_outerring_diameter">340dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java index df41d25..48efbc7 100644 --- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java +++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java @@ -23,11 +23,14 @@ import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; import android.util.Log; +import android.view.Gravity; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; +import android.widget.ScrollView; +import android.widget.FrameLayout; public class ExpandHelper implements Gefingerpoken, OnClickListener { public interface Callback { @@ -38,7 +41,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { } private static final String TAG = "ExpandHelper"; - protected static final boolean DEBUG = false; + protected static final boolean DEBUG = true; private static final long EXPAND_DURATION = 250; private static final long GLOW_DURATION = 150; @@ -82,8 +85,11 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { private int mLargeSize; private float mMaximumStretch; + private int mGravity; + private class ViewScaler { View mView; + public ViewScaler() {} public void setView(View v) { mView = v; @@ -119,6 +125,15 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { } } + /** + * Handle expansion gestures to expand and contract children of the callback. + * + * @param context application context + * @param callback the container that holds the items to be manipulated + * @param small the smallest allowable size for the manuipulated items. + * @param large the largest allowable size for the manuipulated items. + * @param scoller if non-null also manipulate the scroll position to obey the gravity. + */ public ExpandHelper(Context context, Callback callback, int small, int large) { mSmallSize = small; mMaximumStretch = mSmallSize * STRETCH_INTERVAL; @@ -126,7 +141,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { mContext = context; mCallback = callback; mScaler = new ViewScaler(); - + mGravity = Gravity.TOP; mScaleAnimation = ObjectAnimator.ofFloat(mScaler, "height", 0f); mScaleAnimation.setDuration(EXPAND_DURATION); @@ -194,6 +209,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { span *= USE_SPAN ? 1f : 0f; float drag = detector.getFocusY() - mInitialTouchFocusY; drag *= USE_DRAG ? 1f : 0f; + drag *= mGravity == Gravity.BOTTOM ? -1f : 1f; float pull = Math.abs(drag) + Math.abs(span) + 1f; float hand = drag * Math.abs(drag) / pull + span * Math.abs(span) / pull; if (DEBUG) Log.d(TAG, "current span handle is: " + hand); @@ -227,6 +243,10 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { mEventSource = eventSource; } + public void setGravity(int gravity) { + mGravity = gravity; + } + public void setGlow(float glow) { if (!mGlowAnimationSet.isRunning() || glow == 0f) { if (mGlowAnimationSet.isRunning()) { diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java index 923bcba..c082c97 100644 --- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java @@ -23,7 +23,6 @@ import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageManager; import android.content.res.Resources; import android.os.Vibrator; import android.provider.Settings; @@ -35,6 +34,7 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.ViewTreeObserver.OnPreDrawListener; import android.widget.FrameLayout; + import com.android.internal.widget.multiwaveview.GlowPadView; import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener; import com.android.systemui.R; @@ -53,6 +53,7 @@ public class SearchPanelView extends FrameLayout implements private static final String ASSIST_ICON_METADATA_NAME = "com.android.systemui.action_assist_icon"; private final Context mContext; + private final SearchManager mSearchManager; private BaseStatusBar mBar; private StatusBarTouchProxy mStatusBarTouchProxy; @@ -73,38 +74,12 @@ public class SearchPanelView extends FrameLayout implements } } - private SearchManager mSearchManager; - - // This code should be the same as that used in LockScreen.java public boolean isAssistantAvailable() { - Intent intent = getAssistIntent(); - return intent == null ? false - : mContext.getPackageManager().queryIntentActivities(intent, - PackageManager.MATCH_DEFAULT_ONLY).size() > 0; + return mSearchManager != null && mSearchManager.isAssistantAvailable(); } private Intent getAssistIntent() { - Intent intent = null; - SearchManager searchManager = getSearchManager(); - if (searchManager != null) { - ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity(); - if (globalSearchActivity != null) { - intent = new Intent(Intent.ACTION_ASSIST); - intent.setPackage(globalSearchActivity.getPackageName()); - } else { - Slog.w(TAG, "No global search activity"); - } - } else { - Slog.w(TAG, "No SearchManager"); - } - return intent; - } - - private SearchManager getSearchManager() { - if (mSearchManager == null) { - mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); - } - return mSearchManager; + return mSearchManager != null ? mSearchManager.getAssistIntent() : null; } private void startAssistActivity() { @@ -175,9 +150,8 @@ public class SearchPanelView extends FrameLayout implements // TODO: fetch views mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view); mGlowPadView.setOnTriggerListener(mGlowPadViewListener); - SearchManager searchManager = getSearchManager(); - if (searchManager != null) { - ComponentName component = searchManager.getGlobalSearchActivity(); + if (mSearchManager != null) { + ComponentName component = mSearchManager.getGlobalSearchActivity(); if (component != null) { if (!mGlowPadView.replaceTargetDrawablesIfPresent(component, ASSIST_ICON_METADATA_NAME, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 9c773a5..00d6d6f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -225,11 +225,28 @@ public class NavigationBarView extends LinearLayout { final boolean disableRecent = ((disabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0); final boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0); + setSlippery(disableHome && disableRecent && disableBack); + getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE); getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); } + public void setSlippery(boolean newSlippery) { + WindowManager.LayoutParams lp = (WindowManager.LayoutParams) getLayoutParams(); + if (lp != null) { + boolean oldSlippery = (lp.flags & WindowManager.LayoutParams.FLAG_SLIPPERY) != 0; + if (!oldSlippery && newSlippery) { + lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY; + } else if (oldSlippery && !newSlippery) { + lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY; + } else { + return; + } + WindowManagerImpl.getDefault().updateViewLayout(this, lp); + } + } + public void setMenuVisibility(final boolean show) { setMenuVisibility(show, false); } 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 56de506..393ff0b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -171,6 +171,7 @@ public class PhoneStatusBar extends BaseStatusBar { final Rect mNotificationPanelBackgroundPadding = new Rect(); int mNotificationPanelGravity; int mNotificationPanelMinHeight; + boolean mNotificationPanelIsFullScreenWidth; // top bar View mClearButton; @@ -361,9 +362,11 @@ public class PhoneStatusBar extends BaseStatusBar { return true; } }); + mNotificationPanelIsFullScreenWidth = + (mNotificationPanel.getLayoutParams().width == ViewGroup.LayoutParams.MATCH_PARENT); mNotificationPanel.setSystemUiVisibility( View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER - | View.STATUS_BAR_DISABLE_SYSTEM_INFO); + | (mNotificationPanelIsFullScreenWidth ? 0 : View.STATUS_BAR_DISABLE_SYSTEM_INFO)); if (!ActivityManager.isHighEndGfx(mDisplay)) { mStatusBarWindow.setBackground(null); @@ -376,6 +379,8 @@ public class PhoneStatusBar extends BaseStatusBar { mIntruderAlertView.setBar(this); } + updateShowSearchHoldoff(); + mStatusBarView.mService = this; mChoreographer = Choreographer.getInstance(); @@ -663,7 +668,6 @@ public class PhoneStatusBar extends BaseStatusBar { lp.setTitle("NavigationBar"); lp.windowAnimations = 0; - return lp; } @@ -808,8 +812,12 @@ public class PhoneStatusBar extends BaseStatusBar { @Override protected void onConfigurationChanged(Configuration newConfig) { updateRecentsPanel(); - mShowSearchHoldoff = mContext.getResources().getInteger( - R.integer.config_show_search_delay); + updateShowSearchHoldoff(); + } + + private void updateShowSearchHoldoff() { + mShowSearchHoldoff = mContext.getResources().getInteger( + R.integer.config_show_search_delay); } private void loadNotificationShade() { @@ -1174,7 +1182,8 @@ public class PhoneStatusBar extends BaseStatusBar { mExpandedVisible = true; mPile.setLayoutTransitionsEnabled(true); - makeSlippery(mNavigationBarView, true); + if (mNavigationBarView != null) + mNavigationBarView.setSlippery(true); updateCarrierLabelVisibility(true); @@ -1198,19 +1207,6 @@ public class PhoneStatusBar extends BaseStatusBar { visibilityChanged(true); } - private static void makeSlippery(View view, boolean slippery) { - if (view == null) { - return; - } - WindowManager.LayoutParams lp = (WindowManager.LayoutParams) view.getLayoutParams(); - if (slippery) { - lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY; - } else { - lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY; - } - WindowManagerImpl.getDefault().updateViewLayout(view, lp); - } - public void animateExpand() { if (SPEW) Slog.d(TAG, "Animate expand: expanded=" + mExpanded); if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) { @@ -1295,8 +1291,9 @@ public class PhoneStatusBar extends BaseStatusBar { } mExpandedVisible = false; mPile.setLayoutTransitionsEnabled(false); + if (mNavigationBarView != null) + mNavigationBarView.setSlippery(false); visibilityChanged(false); - makeSlippery(mNavigationBarView, false); // Shrink the window to the size of the status bar only WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams(); @@ -1379,12 +1376,59 @@ public class PhoneStatusBar extends BaseStatusBar { if (!mTracking) return; mTracking = false; - mPile.setLayerType(View.LAYER_TYPE_NONE, null); + setPileLayers(View.LAYER_TYPE_NONE); mVelocityTracker.recycle(); mVelocityTracker = null; mCloseView.setPressed(false); } + /** + * Enables or disables layers on the children of the notifications pile. + * + * When layers are enabled, this method attempts to enable layers for the minimal + * number of children. Only children visible when the notification area is fully + * expanded will receive a layer. The technique used in this method might cause + * more children than necessary to get a layer (at most one extra child with the + * current UI.) + * + * @param layerType {@link View#LAYER_TYPE_NONE} or {@link View#LAYER_TYPE_HARDWARE} + */ + private void setPileLayers(int layerType) { + final int count = mPile.getChildCount(); + + switch (layerType) { + case View.LAYER_TYPE_NONE: + for (int i = 0; i < count; i++) { + mPile.getChildAt(i).setLayerType(layerType, null); + } + break; + case View.LAYER_TYPE_HARDWARE: + final int[] location = new int[2]; + mNotificationPanel.getLocationInWindow(location); + + final int left = location[0]; + final int top = location[1]; + final int right = left + mNotificationPanel.getWidth(); + final int bottom = top + getExpandedViewMaxHeight(); + + final Rect childBounds = new Rect(); + + for (int i = 0; i < count; i++) { + final View view = mPile.getChildAt(i); + view.getLocationInWindow(location); + + childBounds.set(location[0], location[1], + location[0] + view.getWidth(), location[1] + view.getHeight()); + + if (childBounds.intersects(left, top, right, bottom)) { + view.setLayerType(layerType, null); + } + } + + break; + } + } + void incrementAnim(long frameTimeNanos) { final long deltaNanos = Math.max(frameTimeNanos - mAnimLastTimeNanos, 0); final float t = deltaNanos * 0.000000001f; // ns -> s @@ -1424,7 +1468,7 @@ public class PhoneStatusBar extends BaseStatusBar { mCloseView.setPressed(true); mTracking = true; - mPile.setLayerType(View.LAYER_TYPE_HARDWARE, null); + setPileLayers(View.LAYER_TYPE_HARDWARE); mVelocityTracker = VelocityTracker.obtain(); if (opening) { makeExpandedVisible(true); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index ed1b2f5..9317561 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -22,6 +22,7 @@ import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; import android.widget.FrameLayout; +import android.widget.ScrollView; import android.widget.TextSwitcher; import com.android.systemui.ExpandHelper; @@ -47,6 +48,7 @@ public class StatusBarWindowView extends FrameLayout protected void onAttachedToWindow () { super.onAttachedToWindow(); latestItems = (NotificationRowLayout) findViewById(R.id.latestItems); + ScrollView scroller = (ScrollView) findViewById(R.id.scroll); int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height); int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height); mExpandHelper = new ExpandHelper(mContext, latestItems, minHeight, maxHeight); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java index d8166f1..af0f9d3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -24,6 +24,7 @@ import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.util.Slog; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -33,6 +34,7 @@ import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.widget.RelativeLayout; +import android.widget.ScrollView; import com.android.systemui.ExpandHelper; import com.android.systemui.R; @@ -114,6 +116,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height); mExpandHelper = new ExpandHelper(mContext, latestItems, minHeight, maxHeight); mExpandHelper.setEventSource(this); + mExpandHelper.setGravity(Gravity.BOTTOM); } private View.OnClickListener mClearButtonListener = new View.OnClickListener() { |