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

Commit 9215b6c2 authored by James Sullins's avatar James Sullins
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 9bb7a6f1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="380px"
    android:layout_height="match_parent"
    android:layout_width="match_parent">

<com.android.systemui.statusbar.tablet.SettingsView
+14 −0
Original line number Diff line number Diff line
@@ -24,11 +24,13 @@ import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.Display;
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;
@@ -345,6 +347,18 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
    void addSettingsView() {
        LayoutInflater infl = LayoutInflater.from(getContext());
        mSettingsView = infl.inflate(R.layout.status_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);
    }