DO NOT MERGE: Allow corner UI to decouple from rounded_corner_radius
frameworks/base/core/res/res/dimens value rounded_corner_radius can change not to reflect the actual device size due to tuning the rounding on window corners. This change allows us to decouple corner UI's idea of what the corner size is from the framework dimension Test: manual Change-Id: I6548d74921d6e71250486984869572bdd304b0d0
This commit is contained in:
@@ -1156,4 +1156,9 @@
|
||||
|
||||
<!-- Size of the RAT type for CellularTile -->
|
||||
<dimen name="celltile_rat_type_size">10sp</dimen>
|
||||
|
||||
<!-- Allow CornerHandleView and PathSpecCornerPathRenderer to decouple from corner-radius -->
|
||||
<dimen name="config_rounded_mask_size">@*android:dimen/rounded_corner_radius</dimen>
|
||||
<dimen name="config_rounded_mask_size_top">@*android:dimen/rounded_corner_radius_top</dimen>
|
||||
<dimen name="config_rounded_mask_size_bottom">@*android:dimen/rounded_corner_radius_top</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -152,14 +152,14 @@ public class CornerHandleView extends View {
|
||||
// Attempt to get the bottom corner radius, otherwise fall back on the generic or top
|
||||
// values. If none are available, use the FALLBACK_RADIUS_DP.
|
||||
int radius = getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.rounded_corner_radius_bottom);
|
||||
com.android.systemui.R.dimen.config_rounded_mask_size_bottom);
|
||||
if (radius == 0) {
|
||||
radius = getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.rounded_corner_radius);
|
||||
com.android.systemui.R.dimen.config_rounded_mask_size);
|
||||
}
|
||||
if (radius == 0) {
|
||||
radius = getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.rounded_corner_radius_top);
|
||||
com.android.systemui.R.dimen.config_rounded_mask_size_top);
|
||||
}
|
||||
if (radius == 0) {
|
||||
radius = (int) convertDpToPixel(FALLBACK_RADIUS_DP, mContext);
|
||||
|
||||
@@ -84,8 +84,8 @@ public class DisplayUtils {
|
||||
public static int getCornerRadiusBottom(Context context) {
|
||||
int radius = 0;
|
||||
|
||||
int resourceId = context.getResources().getIdentifier("rounded_corner_radius_bottom",
|
||||
"dimen", "android");
|
||||
int resourceId = context.getResources().getIdentifier("config_rounded_mask_size_bottom",
|
||||
"dimen", "com.android.systemui");
|
||||
if (resourceId > 0) {
|
||||
radius = context.getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
@@ -103,8 +103,8 @@ public class DisplayUtils {
|
||||
public static int getCornerRadiusTop(Context context) {
|
||||
int radius = 0;
|
||||
|
||||
int resourceId = context.getResources().getIdentifier("rounded_corner_radius_top",
|
||||
"dimen", "android");
|
||||
int resourceId = context.getResources().getIdentifier("config_rounded_mask_size_top",
|
||||
"dimen", "com.android.systemui");
|
||||
if (resourceId > 0) {
|
||||
radius = context.getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
@@ -118,8 +118,8 @@ public class DisplayUtils {
|
||||
private static int getCornerRadiusDefault(Context context) {
|
||||
int radius = 0;
|
||||
|
||||
int resourceId = context.getResources().getIdentifier("rounded_corner_radius", "dimen",
|
||||
"android");
|
||||
int resourceId = context.getResources().getIdentifier("config_rounded_mask_size",
|
||||
"dimen", "com.android.systemui");
|
||||
if (resourceId > 0) {
|
||||
radius = context.getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ public final class PathSpecCornerPathRenderer extends CornerPathRenderer {
|
||||
mWidth = DisplayUtils.getWidth(context);
|
||||
mHeight = DisplayUtils.getHeight(context);
|
||||
|
||||
mBottomCornerRadius = DisplayUtils.getCornerRadiusBottom(context);
|
||||
mTopCornerRadius = DisplayUtils.getCornerRadiusTop(context);
|
||||
mBottomCornerRadius = DisplayUtils.getCornerRadiusBottom(context);
|
||||
mTopCornerRadius = DisplayUtils.getCornerRadiusTop(context);
|
||||
|
||||
String pathData = context.getResources().getString(R.string.config_rounded_mask);
|
||||
Path path = PathParser.createPathFromPathData(pathData);
|
||||
|
||||
Reference in New Issue
Block a user