Merge "Update all apps divider to pill shape" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-06-15 18:33:22 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 8 deletions

View File

@@ -74,6 +74,8 @@ public class AppsDividerView extends View implements StateListener<LauncherState
private boolean mIsScrolledOut = false;
private final int[] mDividerSize;
public AppsDividerView(Context context) {
this(context, null);
}
@@ -87,8 +89,10 @@ public class AppsDividerView extends View implements StateListener<LauncherState
mLauncher = Launcher.getLauncher(context);
boolean isMainColorDark = Themes.getAttrBoolean(context, R.attr.isMainColorDark);
mPaint.setStrokeWidth(
getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height));
mDividerSize = new int[]{
getResources().getDimensionPixelSize(R.dimen.all_apps_divider_width),
getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height)
};
mStrokeColor = ContextCompat.getColor(context, isMainColorDark
? R.color.all_apps_prediction_row_separator_dark
@@ -187,11 +191,11 @@ public class AppsDividerView extends View implements StateListener<LauncherState
@Override
protected void onDraw(Canvas canvas) {
if (mDividerType == DividerType.LINE) {
int side = getResources().getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
int y = getHeight() - (getPaddingBottom() / 2);
int x1 = getPaddingLeft() + side;
int x2 = getWidth() - getPaddingRight() - side;
canvas.drawLine(x1, y, x2, y, mPaint);
int l = (getWidth() - getPaddingLeft() - mDividerSize[0]) / 2;
int t = getHeight() - (getPaddingBottom() / 2);
int radius = mDividerSize[1];
canvas.drawRoundRect(l, t, l + mDividerSize[0], t + mDividerSize[1], radius, radius,
mPaint);
} else if (mDividerType == DividerType.ALL_APPS_LABEL) {
Layout textLayout = getAllAppsLabelLayout();
int x = getWidth() / 2 - textLayout.getWidth() / 2;

View File

@@ -102,7 +102,8 @@
<dimen name="all_apps_work_profile_tab_footer_top_padding">16dp</dimen>
<dimen name="all_apps_work_profile_tab_footer_bottom_padding">20dp</dimen>
<dimen name="all_apps_tabs_vertical_padding">6dp</dimen>
<dimen name="all_apps_divider_height">1dp</dimen>
<dimen name="all_apps_divider_height">2dp</dimen>
<dimen name="all_apps_divider_width">128dp</dimen>
<dimen name="all_apps_tip_bottom_margin">8dp</dimen>
<!-- The size of corner radius of the arrow in the arrow toast. -->