summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/drawable/system_bar_notification_header_bg.xml20
-rw-r--r--packages/SystemUI/res/layout/system_bar_notification_panel_title.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/ExpandHelper.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/SearchPanelView.java38
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java3
8 files changed, 87 insertions, 54 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/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/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..baf86f3 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();
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() {