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

Commit 6c7a1524 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Fix channel panel UI on 3 button nav devices" into udc-dev

parents 1f4ec625 766ec49e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
    android:layout_height="@dimen/notif_channel_panel_max_height"
    android:maxHeight="@dimen/notif_channel_panel_max_height"
    android:background="@drawable/settings_panel_background"
    android:fitsSystemWindows="true"
    android:orientation="vertical"
    android:layout_width="match_parent">

+27 −1
Original line number Diff line number Diff line
@@ -28,10 +28,13 @@ import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsControllerCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;

import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.SubSettingLauncher;
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;

@@ -99,7 +102,7 @@ public class ChannelPanelActivity extends FragmentActivity {

        findViewById(R.id.done).setOnClickListener(v -> finish());
        findViewById(R.id.see_more).setOnClickListener(v -> launchFullSettings());

        setupNavigationBar();
        mPanelFragment = callingIntent.hasExtra(Settings.EXTRA_CONVERSATION_ID)
                ? new ConversationNotificationSettings()
                : new ChannelNotificationSettings();
@@ -107,4 +110,27 @@ public class ChannelPanelActivity extends FragmentActivity {
        fragmentManager.beginTransaction().replace(
                android.R.id.list_container, mPanelFragment).commit();
    }

    /**
     * Adjust bottom edge and color.
     */
    private void setupNavigationBar() {
        // Extend the panel all the way to the bottom of the screen, as opposed to sitting on top of
        // the navigation bar.
        ViewCompat.setOnApplyWindowInsetsListener(getWindow().getDecorView(),
                (v, windowInsets) -> {
                    v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), 0);
                    return windowInsets; // propagate down to panel layout root element
                });

        // When using 3-button navigation in light mode, the system picks white navigation buttons
        // which are not sufficiently contrasted from the panel background.
        WindowInsetsControllerCompat windowInsetsController =
                ViewCompat.getWindowInsetsController(getWindow().getDecorView());

        if (windowInsetsController != null) {
            boolean forceNavigationButtonsDark = !Utils.isNightMode(this);
            windowInsetsController.setAppearanceLightNavigationBars(forceNavigationButtonsDark);
        }
    }
}