diff options
author | Daniel Sandler <dsandler@google.com> | 2011-08-17 16:22:01 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-17 16:22:01 -0700 |
commit | 9a5505f0253a9114aea6192a22da6ec1c1b85ed2 (patch) | |
tree | 628804fcab81a4c7c58bf1994e61467559a077cd /packages | |
parent | 351eb33d84fb76f1addf6a18ce4c7ff5ca40dd5d (diff) | |
parent | 96f4818ef41141649337d4dee09f837594e93d09 (diff) | |
download | frameworks_base-9a5505f0253a9114aea6192a22da6ec1c1b85ed2.zip frameworks_base-9a5505f0253a9114aea6192a22da6ec1c1b85ed2.tar.gz frameworks_base-9a5505f0253a9114aea6192a22da6ec1c1b85ed2.tar.bz2 |
Merge "Fix drawing artifacts on glowing navigation buttons."
Diffstat (limited to 'packages')
6 files changed, 35 insertions, 18 deletions
diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar.xml b/packages/SystemUI/res/layout-sw600dp/status_bar.xml index a204f17..125c87e 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar.xml @@ -44,24 +44,23 @@ /> <!-- navigation controls --> - <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" - android:layout_width="80dip" - android:layout_height="match_parent" - android:src="@drawable/ic_sysbar_back" - android:layout_alignParentLeft="true" - systemui:keyCode="4" - android:contentDescription="@string/accessibility_back" - systemui:glowBackground="@drawable/ic_sysbar_highlight" - /> <LinearLayout android:id="@+id/navigationArea" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_toRightOf="@+id/back" + android:layout_alignParentLeft="true" android:orientation="horizontal" android:clipChildren="false" android:clipToPadding="false" > + <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" + android:layout_width="80dip" + android:layout_height="match_parent" + android:src="@drawable/ic_sysbar_back" + systemui:keyCode="4" + android:contentDescription="@string/accessibility_back" + systemui:glowBackground="@drawable/ic_sysbar_highlight" + /> <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home" android:layout_width="80dip" android:layout_height="match_parent" diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml index d1919ca..6c4c9c1 100644 --- a/packages/SystemUI/res/layout/navigation_bar.xml +++ b/packages/SystemUI/res/layout/navigation_bar.xml @@ -37,6 +37,7 @@ android:orientation="horizontal" android:clipChildren="false" android:clipToPadding="false" + android:id="@+id/nav_buttons" > <!-- navigation controls --> @@ -119,6 +120,7 @@ android:orientation="vertical" android:clipChildren="false" android:clipToPadding="false" + android:id="@+id/nav_buttons" > <!-- navigation controls --> diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 2818f87..e7ed052 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -30,7 +30,7 @@ import android.view.View; public class SwipeHelper { static final String TAG = "com.android.systemui.SwipeHelper"; - private static final boolean DEBUG = true; + private static final boolean DEBUG = false; private static final boolean DEBUG_INVALIDATE = false; private static final boolean SLOW_ANIMATIONS = false; // DEBUG; @@ -142,7 +142,7 @@ public class SwipeHelper { // invalidate a rectangle relative to the view's coordinate system all the way up the view // hierarchy public static void invalidateGlobalRegion(View view, RectF childBounds) { - childBounds.offset(view.getX(), view.getY()); + //childBounds.offset(view.getTranslationX(), view.getTranslationY()); if (DEBUG_INVALIDATE) Log.v(TAG, "-------------"); while (view.getParent() != null && view.getParent() instanceof View) { 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 abf505c..c3f20bc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -29,6 +29,7 @@ import android.view.Display; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; +import android.view.ViewGroup; import android.view.Surface; import android.view.WindowManager; import android.widget.LinearLayout; @@ -67,6 +68,7 @@ public class NavigationBarView extends LinearLayout { public NavigationBarView(Context context, AttributeSet attrs) { super(context, attrs); + mHidden = false; mDisplay = ((WindowManager)context.getSystemService( @@ -129,6 +131,11 @@ public class NavigationBarView extends LinearLayout { ? findViewById(R.id.rot90) : findViewById(R.id.rot270); + for (View v : mRotatedViews) { + // this helps avoid drawing artifacts with glowing navigation keys + ViewGroup group = (ViewGroup) v.findViewById(R.id.nav_buttons); + group.setMotionEventSplittingEnabled(false); + } mCurrentView = mRotatedViews[Surface.ROTATION_0]; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java index fc18eef..6368d1d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java @@ -49,6 +49,8 @@ import com.android.systemui.R; public class KeyButtonView extends ImageView { private static final String TAG = "StatusBar.KeyButtonView"; + final float GLOW_MAX_SCALE_FACTOR = 1.8f; + IWindowManager mWindowManager; long mDownTime; boolean mSending; @@ -159,17 +161,22 @@ public class KeyButtonView extends ImageView { mGlowScale = x; final float w = getWidth(); final float h = getHeight(); - if (x < 1.0f) { + if (GLOW_MAX_SCALE_FACTOR <= 1.0f) { + // this only works if we know the glow will never leave our bounds invalidate(); } else { - final float rx = (w * (x - 1.0f)) / 2.0f; - final float ry = (h * (x - 1.0f)) / 2.0f; + final float rx = (w * (GLOW_MAX_SCALE_FACTOR - 1.0f)) / 2.0f + 1.0f; + final float ry = (h * (GLOW_MAX_SCALE_FACTOR - 1.0f)) / 2.0f + 1.0f; com.android.systemui.SwipeHelper.invalidateGlobalRegion( this, new RectF(getLeft() - rx, getTop() - ry, getRight() + rx, getBottom() + ry)); + + // also invalidate our immediate parent to help avoid situations where nearby glows + // interfere + ((View)getParent()).invalidate(); } } @@ -183,7 +190,7 @@ public class KeyButtonView extends ImageView { setDrawingAlpha(1f); as.playTogether( ObjectAnimator.ofFloat(this, "glowAlpha", 1f), - ObjectAnimator.ofFloat(this, "glowScale", 1.8f) + ObjectAnimator.ofFloat(this, "glowScale", GLOW_MAX_SCALE_FACTOR) ); as.setDuration(50); } else { 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 e787113..201ff2d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -497,6 +497,8 @@ public class TabletStatusBar extends StatusBar implements mRecentButton = mNavigationArea.findViewById(R.id.recent_apps); mRecentButton.setOnClickListener(mOnClickListener); mNavigationArea.setLayoutTransition(mBarContentsLayoutTransition); + // no multi-touch on the nav buttons + mNavigationArea.setMotionEventSplittingEnabled(false); // The bar contents buttons mFeedbackIconArea = (ViewGroup)sb.findViewById(R.id.feedbackIconArea); @@ -966,11 +968,11 @@ public class TabletStatusBar extends StatusBar implements if ((diff & StatusBarManager.DISABLE_BACK) != 0) { if ((state & StatusBarManager.DISABLE_BACK) != 0) { Slog.i(TAG, "DISABLE_BACK: yes"); - mBackButton.setVisibility(View.INVISIBLE); + mBackButton.setEnabled(false); mInputMethodSwitchButton.setScreenLocked(true); } else { Slog.i(TAG, "DISABLE_BACK: no"); - mBackButton.setVisibility(View.VISIBLE); + mBackButton.setEnabled(true); mInputMethodSwitchButton.setScreenLocked(false); } } |