Fix channel panel UI on 3 button nav devices
Test: edit panel on 3 button & gesture nav devices Fixes: 278710039 Change-Id: I45b7e7c942578c4f49be8a0d193893cf872ff36e
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
android:layout_height="@dimen/notif_channel_panel_max_height"
|
android:layout_height="@dimen/notif_channel_panel_max_height"
|
||||||
android:maxHeight="@dimen/notif_channel_panel_max_height"
|
android:maxHeight="@dimen/notif_channel_panel_max_height"
|
||||||
android:background="@drawable/settings_panel_background"
|
android:background="@drawable/settings_panel_background"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent">
|
android:layout_width="match_parent">
|
||||||
|
|
||||||
|
@@ -28,10 +28,13 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsControllerCompat;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
|
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.done).setOnClickListener(v -> finish());
|
||||||
findViewById(R.id.see_more).setOnClickListener(v -> launchFullSettings());
|
findViewById(R.id.see_more).setOnClickListener(v -> launchFullSettings());
|
||||||
|
setupNavigationBar();
|
||||||
mPanelFragment = callingIntent.hasExtra(Settings.EXTRA_CONVERSATION_ID)
|
mPanelFragment = callingIntent.hasExtra(Settings.EXTRA_CONVERSATION_ID)
|
||||||
? new ConversationNotificationSettings()
|
? new ConversationNotificationSettings()
|
||||||
: new ChannelNotificationSettings();
|
: new ChannelNotificationSettings();
|
||||||
@@ -107,4 +110,27 @@ public class ChannelPanelActivity extends FragmentActivity {
|
|||||||
fragmentManager.beginTransaction().replace(
|
fragmentManager.beginTransaction().replace(
|
||||||
android.R.id.list_container, mPanelFragment).commit();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user