diff options
author | Daniel Sandler <dsandler@android.com> | 2012-09-27 14:46:58 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2012-09-27 15:08:28 -0400 |
commit | 13522a2e40730a0703fd7f185b7fb9be8ae37ab6 (patch) | |
tree | d080cd284ae7eb49a04908a257763a4f46b077fa /packages | |
parent | 9a4a0376a78f9b3bcfe6374660fbe7c28797b36a (diff) | |
download | frameworks_base-13522a2e40730a0703fd7f185b7fb9be8ae37ab6.zip frameworks_base-13522a2e40730a0703fd7f185b7fb9be8ae37ab6.tar.gz frameworks_base-13522a2e40730a0703fd7f185b7fb9be8ae37ab6.tar.bz2 |
Fix panel handles on large screens.
Bug: 7171620
Change-Id: If8445210fe654aa0b8ba508f4e6f93ad6d4fca14
Diffstat (limited to 'packages')
7 files changed, 74 insertions, 31 deletions
diff --git a/packages/SystemUI/res/layout/quick_settings.xml b/packages/SystemUI/res/layout/quick_settings.xml index da4b133..c1bcdfe 100644 --- a/packages/SystemUI/res/layout/quick_settings.xml +++ b/packages/SystemUI/res/layout/quick_settings.xml @@ -24,27 +24,21 @@ <!-- TODO: Put into ScrollView --> <ScrollView android:layout_width="match_parent" - android:layout_height="wrap_content"> - <com.android.systemui.statusbar.phone.QuickSettingsContainerView - android:id="@+id/quick_settings_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:animateLayoutChanges="true" - android:columnCount="@integer/quick_settings_num_columns" - /> - </ScrollView> - <LinearLayout android:id="@+id/handle" - android:layout_width="match_parent" - android:layout_height="@dimen/close_handle_height" - android:layout_gravity="bottom" - android:orientation="vertical" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/close_handle_underlap" > - <ImageView + <com.android.systemui.statusbar.phone.QuickSettingsContainerView + android:id="@+id/quick_settings_container" android:layout_width="match_parent" - android:layout_height="@dimen/close_handle_height" - android:layout_gravity="bottom" - android:scaleType="fitXY" - android:src="@drawable/status_bar_close" + android:layout_height="wrap_content" + android:animateLayoutChanges="true" + android:columnCount="@integer/quick_settings_num_columns" /> - </LinearLayout> + </ScrollView> + + <View + android:id="@+id/handle" + android:layout_width="match_parent" + android:layout_height="@dimen/close_handle_height" + /> </com.android.systemui.statusbar.phone.SettingsPanelView >
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 6436a7f..ffcead0 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -76,10 +76,9 @@ </ScrollView> </LinearLayout> - <View android:id="@+id/handle" + <View + android:id="@+id/handle" android:layout_width="match_parent" android:layout_height="@dimen/close_handle_height" - android:layout_gravity="bottom" /> - </com.android.systemui.statusbar.phone.NotificationPanelView><!-- end of sliding panel --> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 46c3903..5b15844 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -146,10 +146,10 @@ <dimen name="navbar_search_panel_height">230dip</dimen> <!-- Height of the draggable handle at the bottom of the phone notification panel --> - <dimen name="close_handle_height">32dp</dimen> + <dimen name="close_handle_height">36dp</dimen> - <!-- Amount of close_handle that will not overlap the notification list --> - <dimen name="close_handle_underlap">18dp</dimen> + <!-- Amount of close_handle that will NOT overlap the notification list --> + <dimen name="close_handle_underlap">32dp</dimen> <!-- Height of the notification panel header bar --> <dimen name="notification_panel_header_height">48dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CloseDragHandle.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CloseDragHandle.java index ba64282..ee01489 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CloseDragHandle.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CloseDragHandle.java @@ -36,7 +36,9 @@ public class CloseDragHandle extends LinearLayout { */ @Override public boolean onTouchEvent(MotionEvent event) { - if (event.getAction() != MotionEvent.ACTION_DOWN) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + setPressed(true); + } else { mService.interceptTouchEvent(event); } return true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 9c978d5..c9ec481 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -21,19 +21,28 @@ import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.view.View; + import com.android.systemui.R; public class NotificationPanelView extends PanelView { Drawable mHandleBar; float mHandleBarHeight; + View mHandleView; public NotificationPanelView(Context context, AttributeSet attrs) { super(context, attrs); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); - Resources resources = context.getResources(); + Resources resources = getContext().getResources(); mHandleBar = resources.getDrawable(R.drawable.status_bar_close); mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height); + mHandleView = findViewById(R.id.handle); } @Override @@ -44,19 +53,24 @@ public class NotificationPanelView extends PanelView { super.fling(vel, always); } + // We draw the handle ourselves so that it's always glued to the bottom of the window. @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (changed) { - mHandleBar.setBounds(0, 0, getWidth(), (int) mHandleBarHeight); + final int pl = getPaddingLeft(); + final int pr = getPaddingRight(); + mHandleBar.setBounds(pl, 0, getWidth() - pr, (int) mHandleBarHeight); } } @Override public void draw(Canvas canvas) { super.draw(canvas); - canvas.translate(0, getHeight() - mHandleBarHeight); + final int off = (int) (getHeight() - mHandleBarHeight - getPaddingBottom()); + canvas.translate(0, off); + mHandleBar.setState(mHandleView.getDrawableState()); mHandleBar.draw(canvas); - canvas.translate(0, -getHeight() + mHandleBarHeight); + canvas.translate(0, -off); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 45a107d..d94dbe4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -220,6 +220,7 @@ public class PanelView extends FrameLayout { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mTracking = true; + mHandleView.setPressed(true); mInitialTouchY = y; mVelocityTracker = VelocityTracker.obtain(); trackMovement(event); @@ -239,6 +240,7 @@ public class PanelView extends FrameLayout { case MotionEvent.ACTION_CANCEL: mFinalTouchY = y; mTracking = false; + mHandleView.setPressed(false); mBar.onTrackingStopped(PanelView.this); trackMovement(event); mVelocityTracker.computeCurrentVelocity(1000); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java index 2ed450dd..f9d9dac0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SettingsPanelView.java @@ -20,6 +20,8 @@ import android.animation.LayoutTransition; import android.content.Context; import android.content.Intent; import android.content.res.Resources; +import android.graphics.Canvas; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; @@ -37,6 +39,10 @@ public class SettingsPanelView extends PanelView { private QuickSettings mQS; private QuickSettingsContainerView mQSContainer; + Drawable mHandleBar; + float mHandleBarHeight; + View mHandleView; + public SettingsPanelView(Context context, AttributeSet attrs) { super(context, attrs); } @@ -47,6 +53,11 @@ public class SettingsPanelView extends PanelView { mQSContainer = (QuickSettingsContainerView) findViewById(R.id.quick_settings_container); mQS = new QuickSettings(getContext(), mQSContainer); + + Resources resources = getContext().getResources(); + mHandleBar = resources.getDrawable(R.drawable.status_bar_close); + mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height); + mHandleView = findViewById(R.id.handle); } @Override @@ -95,4 +106,25 @@ public class SettingsPanelView extends PanelView { mQS.setService(phoneStatusBar); } } + + // We draw the handle ourselves so that it's always glued to the bottom of the window. + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + if (changed) { + final int pl = getPaddingLeft(); + final int pr = getPaddingRight(); + mHandleBar.setBounds(pl, 0, getWidth() - pr, (int) mHandleBarHeight); + } + } + + @Override + public void draw(Canvas canvas) { + super.draw(canvas); + final int off = (int) (getHeight() - mHandleBarHeight - getPaddingBottom()); + canvas.translate(0, off); + mHandleBar.setState(mHandleView.getDrawableState()); + mHandleBar.draw(canvas); + canvas.translate(0, -off); + } } |