Merge "Correct edge to edge issues observed in some screens." into main
diff --git a/src/com/android/phone/settings/AccessibilitySettingsActivity.java b/src/com/android/phone/settings/AccessibilitySettingsActivity.java
index 7cc18f6..7d193af 100644
--- a/src/com/android/phone/settings/AccessibilitySettingsActivity.java
+++ b/src/com/android/phone/settings/AccessibilitySettingsActivity.java
@@ -36,6 +36,8 @@
if (actionBar != null) {
actionBar.setTitle(R.string.accessibility_settings_activity_title);
}
+ SettingsConstants.setupEdgeToEdge(this);
+
getFragmentManager().beginTransaction().replace(
android.R.id.content, new AccessibilitySettingsFragment()).commit();
}
diff --git a/src/com/android/phone/settings/SettingsConstants.java b/src/com/android/phone/settings/SettingsConstants.java
index c17e6df..6ffef06 100644
--- a/src/com/android/phone/settings/SettingsConstants.java
+++ b/src/com/android/phone/settings/SettingsConstants.java
@@ -16,6 +16,12 @@
package com.android.phone.settings;
+import android.app.Activity;
+
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
/**
* Constants related to settings which are shared by two or more classes.
*/
@@ -30,4 +36,23 @@
public static final int HAC_ENABLED = 1;
public static final String HAC_VAL_ON = "ON";
public static final String HAC_VAL_OFF = "OFF";
+
+ /**
+ * Given an activity, configure the activity to adjust for edge to edge restrictions.
+ * @param activity the activity.
+ */
+ public static void setupEdgeToEdge(Activity activity) {
+ ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content),
+ (v, windowInsets) -> {
+ Insets insets = windowInsets.getInsets(
+ WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime());
+
+ // Apply the insets paddings to the view.
+ v.setPadding(insets.left, insets.top, insets.right, insets.bottom);
+
+ // Return CONSUMED if you don't want the window insets to keep being
+ // passed down to descendant views.
+ return WindowInsetsCompat.CONSUMED;
+ });
+ }
}
diff --git a/src/com/android/phone/settings/fdn/FdnList.java b/src/com/android/phone/settings/fdn/FdnList.java
index e50fc60..ca98061 100644
--- a/src/com/android/phone/settings/fdn/FdnList.java
+++ b/src/com/android/phone/settings/fdn/FdnList.java
@@ -39,6 +39,7 @@
import com.android.phone.PhoneGlobals;
import com.android.phone.R;
import com.android.phone.SubscriptionInfoHelper;
+import com.android.phone.settings.SettingsConstants;
/**
* Fixed Dialing Number (FDN) List UI for the Phone app. FDN is a feature of the service provider
@@ -112,6 +113,8 @@
mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
mSubscriptionInfoHelper.setActionBarTitle(
getActionBar(), getResources(), R.string.fdn_list_with_label);
+
+ SettingsConstants.setupEdgeToEdge(this);
}
@Override