Skip to content

Commit 5f9e92f

Browse files
chethaaseAndroid (Google) Code Review
authored andcommitted
Merge "Fix animation of notification handle bar when panel changes height" into jb-mr1-dev
2 parents d78fc5b + 4d179dc commit 5f9e92f

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

packages/SystemUI/res/layout/status_bar_expanded.xml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
android:background="@drawable/notification_panel_bg"
2828
android:paddingTop="@dimen/notification_panel_padding_top"
2929
android:layout_marginLeft="@dimen/notification_panel_margin_left"
30-
android:animateLayoutChanges="true"
3130
>
3231

3332
<TextView
@@ -80,18 +79,10 @@
8079
</ScrollView>
8180
</LinearLayout>
8281

83-
<LinearLayout android:id="@+id/handle"
82+
<View android:id="@+id/handle"
8483
android:layout_width="match_parent"
8584
android:layout_height="@dimen/close_handle_height"
8685
android:layout_gravity="bottom"
87-
android:orientation="vertical"
88-
>
89-
<ImageView
90-
android:layout_width="match_parent"
91-
android:layout_height="@dimen/close_handle_height"
92-
android:layout_gravity="bottom"
93-
android:scaleType="fitXY"
94-
android:src="@drawable/status_bar_close"
95-
/>
96-
</LinearLayout>
86+
/>
87+
9788
</com.android.systemui.statusbar.phone.NotificationPanelView><!-- end of sliding panel -->

packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,23 @@
1717
package com.android.systemui.statusbar.phone;
1818

1919
import android.content.Context;
20+
import android.content.res.Resources;
21+
import android.graphics.Canvas;
22+
import android.graphics.drawable.Drawable;
2023
import android.util.AttributeSet;
24+
import com.android.systemui.R;
2125

2226
public class NotificationPanelView extends PanelView {
27+
28+
Drawable mHandleBar;
29+
float mHandleBarHeight;
30+
2331
public NotificationPanelView(Context context, AttributeSet attrs) {
2432
super(context, attrs);
33+
34+
Resources resources = context.getResources();
35+
mHandleBar = resources.getDrawable(R.drawable.status_bar_close);
36+
mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height);
2537
}
2638

2739
@Override
@@ -31,4 +43,20 @@ public void fling(float vel, boolean always) {
3143
"notifications,v=" + vel);
3244
super.fling(vel, always);
3345
}
46+
47+
@Override
48+
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
49+
super.onLayout(changed, left, top, right, bottom);
50+
if (changed) {
51+
mHandleBar.setBounds(0, 0, getWidth(), (int) mHandleBarHeight);
52+
}
53+
}
54+
55+
@Override
56+
public void draw(Canvas canvas) {
57+
super.draw(canvas);
58+
canvas.translate(0, getHeight() - mHandleBarHeight);
59+
mHandleBar.draw(canvas);
60+
canvas.translate(0, -getHeight() + mHandleBarHeight);
61+
}
3462
}

0 commit comments

Comments
 (0)