Handle the Edge to Edge problem
- Fix the navigation bar overlapped problem in sub-pages. - Use a workaround solution to handle Homepage statusbar problem. Bug: 328622648 Fixes: 330217912 Test: manual test Change-Id: I67a65e2af10def84bf743d4d3cd0047098423ffe
This commit is contained in:
@@ -103,10 +103,14 @@ import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.graphics.drawable.IconCompat;
|
||||
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
|
||||
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
|
||||
import com.android.internal.app.UnlaunchableAppActivity;
|
||||
@@ -1375,6 +1379,27 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
&& userManager.isQuietModeEnabled(userHandle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable new edge to edge feature.
|
||||
*
|
||||
* @param activity the Activity need to setup the edge to edge feature.
|
||||
*/
|
||||
public static void setupEdgeToEdge(@NonNull FragmentActivity activity) {
|
||||
if (com.android.window.flags.Flags.edgeToEdgeByDefault()) {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content),
|
||||
(v, windowInsets) -> {
|
||||
Insets insets = windowInsets.getInsets(
|
||||
WindowInsetsCompat.Type.systemBars());
|
||||
// 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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static FaceManager.RemovalCallback faceManagerRemovalCallback(int userId) {
|
||||
return new FaceManager.RemovalCallback() {
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user