Refine layouts for large screen
- Support dynamic paddings depending on app's screen width - Add round corners to homepage ripple effect to improve the transition of being highlighted - Add an interface to support dynamic split layout for suggestion cards Bug: 223300824 Test: robotest, manual Change-Id: Iaca6b4fd3f7369179416ef084a800d7eb2ee4640
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.activityembedding;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.FeatureFlagUtils;
|
||||
@@ -33,6 +34,8 @@ public class ActivityEmbeddingUtils {
|
||||
// The smallest value of the smallest-width (sw) of the window in any rotation when
|
||||
// the split should be used.
|
||||
private static final float MIN_SMALLEST_SCREEN_SPLIT_WIDTH_DP = 600f;
|
||||
// The minimum width of the activity to show the regular homepage layout.
|
||||
private static final float MIN_REGULAR_HOMEPAGE_LAYOUT_WIDTH_DP = 380f;
|
||||
private static final String TAG = "ActivityEmbeddingUtils";
|
||||
|
||||
/** Get the smallest pixel value of width of the window when the split should be used. */
|
||||
@@ -71,4 +74,11 @@ public class ActivityEmbeddingUtils {
|
||||
|
||||
return isFlagEnabled && isSplitSupported;
|
||||
}
|
||||
|
||||
/** Whether to show the regular or simplified homepage layout. */
|
||||
public static boolean isRegularHomepageLayout(Activity activity) {
|
||||
DisplayMetrics dm = activity.getResources().getDisplayMetrics();
|
||||
return dm.widthPixels >= (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, MIN_REGULAR_HOMEPAGE_LAYOUT_WIDTH_DP, dm);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user