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:
Jason Chiu
2022-03-24 16:58:31 +08:00
parent c4c923d1eb
commit 680fce3acd
17 changed files with 441 additions and 98 deletions

View File

@@ -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);
}
}