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

Commit 13522a2e authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Fix panel handles on large screens.

Bug: 7171620
Change-Id: If8445210fe654aa0b8ba508f4e6f93ad6d4fca14
parent 9a4a0376
Loading
Loading
Loading
Loading
+14 −20
Original line number Original line Diff line number Diff line
@@ -24,7 +24,9 @@
    <!-- TODO: Put into ScrollView -->
    <!-- TODO: Put into ScrollView -->
    <ScrollView
    <ScrollView
        android:layout_width="match_parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/close_handle_underlap"
        >
        <com.android.systemui.statusbar.phone.QuickSettingsContainerView
        <com.android.systemui.statusbar.phone.QuickSettingsContainerView
            android:id="@+id/quick_settings_container"
            android:id="@+id/quick_settings_container"
            android:layout_width="match_parent"
            android:layout_width="match_parent"
@@ -33,18 +35,10 @@
            android:columnCount="@integer/quick_settings_num_columns"
            android:columnCount="@integer/quick_settings_num_columns"
            />
            />
    </ScrollView>
    </ScrollView>
    <LinearLayout android:id="@+id/handle"

        android:layout_width="match_parent"
    <View
        android:layout_height="@dimen/close_handle_height"
        android:id="@+id/handle"
        android:layout_gravity="bottom"
        android:orientation="vertical"
        >
        <ImageView
        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:scaleType="fitXY"
            android:src="@drawable/status_bar_close"
        />
        />
    </LinearLayout>
</com.android.systemui.statusbar.phone.SettingsPanelView >
</com.android.systemui.statusbar.phone.SettingsPanelView >
 No newline at end of file
+2 −3
Original line number Original line Diff line number Diff line
@@ -76,10 +76,9 @@
        </ScrollView>
        </ScrollView>
    </LinearLayout>
    </LinearLayout>


    <View 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"
        />
        />

</com.android.systemui.statusbar.phone.NotificationPanelView><!-- end of sliding panel -->
</com.android.systemui.statusbar.phone.NotificationPanelView><!-- end of sliding panel -->
+3 −3
Original line number Original line Diff line number Diff line
@@ -146,10 +146,10 @@
    <dimen name="navbar_search_panel_height">230dip</dimen>
    <dimen name="navbar_search_panel_height">230dip</dimen>


    <!-- Height of the draggable handle at the bottom of the phone notification panel -->
    <!-- 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 -->
    <!-- Amount of close_handle that will NOT overlap the notification list -->
    <dimen name="close_handle_underlap">18dp</dimen>
    <dimen name="close_handle_underlap">32dp</dimen>


    <!-- Height of the notification panel header bar -->
    <!-- Height of the notification panel header bar -->
    <dimen name="notification_panel_header_height">48dp</dimen>
    <dimen name="notification_panel_header_height">48dp</dimen>
+3 −1
Original line number Original line Diff line number Diff line
@@ -36,7 +36,9 @@ public class CloseDragHandle extends LinearLayout {
     */
     */
    @Override
    @Override
    public boolean onTouchEvent(MotionEvent event) {
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() != MotionEvent.ACTION_DOWN) {
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            setPressed(true);
        } else {
            mService.interceptTouchEvent(event);
            mService.interceptTouchEvent(event);
        }
        }
        return true;
        return true;
+18 −4
Original line number Original line Diff line number Diff line
@@ -21,19 +21,28 @@ import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.view.View;

import com.android.systemui.R;
import com.android.systemui.R;


public class NotificationPanelView extends PanelView {
public class NotificationPanelView extends PanelView {


    Drawable mHandleBar;
    Drawable mHandleBar;
    float mHandleBarHeight;
    float mHandleBarHeight;
    View mHandleView;


    public NotificationPanelView(Context context, AttributeSet attrs) {
    public NotificationPanelView(Context context, AttributeSet attrs) {
        super(context, 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);
        mHandleBar = resources.getDrawable(R.drawable.status_bar_close);
        mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height);
        mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height);
        mHandleView = findViewById(R.id.handle);
    }
    }


    @Override
    @Override
@@ -44,19 +53,24 @@ public class NotificationPanelView extends PanelView {
        super.fling(vel, always);
        super.fling(vel, always);
    }
    }


    // We draw the handle ourselves so that it's always glued to the bottom of the window.
    @Override
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        super.onLayout(changed, left, top, right, bottom);
        if (changed) {
        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
    @Override
    public void draw(Canvas canvas) {
    public void draw(Canvas canvas) {
        super.draw(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);
        mHandleBar.draw(canvas);
        canvas.translate(0, -getHeight() + mHandleBarHeight);
        canvas.translate(0, -off);
    }
    }
}
}
Loading