am 5f9e92f4: Merge "Fix animation of notification handle bar when panel changes height" into jb-mr1-dev

* commit '5f9e92f46fe06689a3018929590ef5f79688f0bc':
  Fix animation of notification handle bar when panel changes height
This commit is contained in:
Chet Haase
2012-08-22 15:09:19 -07:00
committed by Android Git Automerger
2 changed files with 31 additions and 12 deletions

View File

@@ -27,7 +27,6 @@
android:background="@drawable/notification_panel_bg" android:background="@drawable/notification_panel_bg"
android:paddingTop="@dimen/notification_panel_padding_top" android:paddingTop="@dimen/notification_panel_padding_top"
android:layout_marginLeft="@dimen/notification_panel_margin_left" android:layout_marginLeft="@dimen/notification_panel_margin_left"
android:animateLayoutChanges="true"
> >
<TextView <TextView
@@ -80,18 +79,10 @@
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/handle" <View android:id="@+id/handle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/close_handle_height" android:layout_height="@dimen/close_handle_height"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:orientation="vertical" />
>
<ImageView
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"
/>
</LinearLayout>
</com.android.systemui.statusbar.phone.NotificationPanelView><!-- end of sliding panel --> </com.android.systemui.statusbar.phone.NotificationPanelView><!-- end of sliding panel -->

View File

@@ -17,11 +17,23 @@
package com.android.systemui.statusbar.phone; package com.android.systemui.statusbar.phone;
import android.content.Context; import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import com.android.systemui.R;
public class NotificationPanelView extends PanelView { public class NotificationPanelView extends PanelView {
Drawable mHandleBar;
float mHandleBarHeight;
public NotificationPanelView(Context context, AttributeSet attrs) { public NotificationPanelView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
Resources resources = context.getResources();
mHandleBar = resources.getDrawable(R.drawable.status_bar_close);
mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height);
} }
@Override @Override
@@ -31,4 +43,20 @@ public class NotificationPanelView extends PanelView {
"notifications,v=" + vel); "notifications,v=" + vel);
super.fling(vel, always); super.fling(vel, always);
} }
@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);
}
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
canvas.translate(0, getHeight() - mHandleBarHeight);
mHandleBar.draw(canvas);
canvas.translate(0, -getHeight() + mHandleBarHeight);
}
} }