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

Commit 001bd612 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Hide security footer container (QSBH) in portrait

In order to have both sides of the notch protection be of the same size
(and the notch protection be centered), we need to hide the other
container in the date_privacy header. This is fine to hide in portrait
as it should only have content in landscape.

Test: manual, using display cutout and checking layout dump
Fixes: 197768177
Change-Id: I4e5754c92c386cb9ce9e2ecc7e22a0f0c0c3fd04
parent 1bc5c4fe
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -49,6 +49,11 @@
        />
    </FrameLayout>

    <!-- We want this to be centered (to align with notches). In order to do that, the following
         has to hold (in portrait):
         * date_container and privacy_container must have the same width and weight
         * header_text_container must be gone
         -->
    <android.widget.Space
        android:id="@+id/space"
        android:layout_width="0dp"
+10 −0
Original line number Diff line number Diff line
@@ -140,6 +140,10 @@ public class QuickStatusBarHeader extends FrameLayout {
        mBatteryRemainingIcon = findViewById(R.id.batteryRemainingIcon);

        updateResources();
        Configuration config = mContext.getResources().getConfiguration();
        setDatePrivacyContainersWidth(config.orientation == Configuration.ORIENTATION_LANDSCAPE);
        setSecurityHeaderContainerVisibility(
                config.orientation == Configuration.ORIENTATION_LANDSCAPE);

        // Don't need to worry about tuner settings for this icon
        mBatteryRemainingIcon.setIgnoreTunerUpdates(true);
@@ -191,6 +195,8 @@ public class QuickStatusBarHeader extends FrameLayout {
        super.onConfigurationChanged(newConfig);
        updateResources();
        setDatePrivacyContainersWidth(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
        setSecurityHeaderContainerVisibility(
                newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
    }

    @Override
@@ -211,6 +217,10 @@ public class QuickStatusBarHeader extends FrameLayout {
        mPrivacyContainer.setLayoutParams(lp);
    }

    private void setSecurityHeaderContainerVisibility(boolean landscape) {
        mSecurityHeaderView.setVisibility(landscape ? VISIBLE : GONE);
    }

    private void updateBatteryMode() {
        if (mConfigShowBatteryEstimate && !mHasCenterCutout) {
            mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE);