Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f9e92f4 authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

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

parents d78fc5b9 4d179dc6
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
    android:background="@drawable/notification_panel_bg"
    android:paddingTop="@dimen/notification_panel_padding_top"
    android:layout_marginLeft="@dimen/notification_panel_margin_left"
    android:animateLayoutChanges="true"
    >

    <TextView
@@ -80,18 +79,10 @@
        </ScrollView>
    </LinearLayout>

    <LinearLayout android:id="@+id/handle"
        android:layout_width="match_parent"
        android:layout_height="@dimen/close_handle_height"
        android:layout_gravity="bottom"
        android:orientation="vertical"
        >
        <ImageView
    <View android:id="@+id/handle"
        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 -->
+28 −0
Original line number Diff line number Diff line
@@ -17,11 +17,23 @@
package com.android.systemui.statusbar.phone;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import com.android.systemui.R;

public class NotificationPanelView extends PanelView {

    Drawable mHandleBar;
    float mHandleBarHeight;

    public NotificationPanelView(Context context, AttributeSet 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
@@ -31,4 +43,20 @@ public class NotificationPanelView extends PanelView {
            "notifications,v=" + vel);
        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);
    }
}