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

Commit a5047709 authored by James Sullins's avatar James Sullins Committed by Andrew Dodd
Browse files

SystemUI: calculate height for tablet status_bar_settings_view

Use the minimum height required for no scrolling. If that height
will exceed the device's display height, reduce it accordingly.

This removes the need for hardcoded height in resource file and
the use of overlays to adjust it.

Change-Id: I0a85f19c2619dedd70a3e686982e0c483f9e3d32
parent 77538ed9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
    android:layout_height="@dimen/system_bar_settings_view_height"
    android:layout_height="match_parent"
    android:layout_width="match_parent">

<com.android.systemui.statusbar.tablet.SettingsView
+0 −2
Original line number Diff line number Diff line
@@ -38,6 +38,4 @@
    <dimen name="status_bar_recents_app_icon_left_margin">8dp</dimen>
    <dimen name="status_bar_recents_app_icon_top_margin">8dp</dimen>

    <!-- Height of the system bar settings view -->
    <dimen name="system_bar_settings_view_height">300dp</dimen>
</resources>
+0 −2
Original line number Diff line number Diff line
@@ -157,6 +157,4 @@
    <!-- Height of the carrier/wifi name label -->
    <dimen name="carrier_label_height">24dp</dimen>

    <!-- Height of the system bar settings view -->
    <dimen name="system_bar_settings_view_height">-1dp</dimen>
</resources>
+14 −0
Original line number Diff line number Diff line
@@ -24,12 +24,14 @@ import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
@@ -306,6 +308,18 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
    void addSettingsView() {
        LayoutInflater infl = LayoutInflater.from(getContext());
        mSettingsView = infl.inflate(R.layout.system_bar_settings_view, mContentFrame, false);

        // set height
        mSettingsView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
        int currentHeight = mSettingsView.getMeasuredHeight();
        WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
        Display d = wm.getDefaultDisplay();
        int maxHeight = d.getHeight() - mTitleArea.getHeight();
        if (currentHeight > maxHeight) {
            currentHeight = maxHeight;
        }
        mSettingsView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, currentHeight));

        mSettingsView.setVisibility(View.GONE);
        mContentFrame.addView(mSettingsView);
    }