Merge "Settings: Adapt edge-to-edge enforcement" into main am: 9befb6cd8f
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/3142636 Change-Id: Ibfc5f8fb007d93d618c4a0c67e396677329b5728 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -37,6 +37,7 @@ public class WifiConfigInfo extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
WifiUtils.setupEdgeToEdge(this);
|
||||||
|
|
||||||
mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||||
setContentView(R.layout.wifi_config_info);
|
setContentView(R.layout.wifi_config_info);
|
||||||
|
@@ -115,6 +115,7 @@ public class WifiStatusTest extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
WifiUtils.setupEdgeToEdge(this);
|
||||||
|
|
||||||
mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||||
|
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi;
|
package com.android.settings.wifi;
|
||||||
|
|
||||||
|
import android.app.ActionBar;
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
@@ -32,8 +34,13 @@ import android.os.UserManager;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
@@ -308,4 +315,34 @@ public class WifiUtils extends com.android.settingslib.wifi.WifiUtils {
|
|||||||
public static void setCanShowWifiHotspotCached(Boolean cached) {
|
public static void setCanShowWifiHotspotCached(Boolean cached) {
|
||||||
sCanShowWifiHotspotCached = cached;
|
sCanShowWifiHotspotCached = cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable new edge to edge feature.
|
||||||
|
*
|
||||||
|
* @param activity the Activity need to setup the edge to edge feature.
|
||||||
|
*/
|
||||||
|
public static void setupEdgeToEdge(@NonNull Activity activity) {
|
||||||
|
final ActionBar actionBar = activity.getActionBar();
|
||||||
|
if (actionBar == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TypedValue typedValue = new TypedValue();
|
||||||
|
if (activity.getTheme().resolveAttribute(
|
||||||
|
com.android.internal.R.attr.actionBarSize, typedValue, true)) {
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user