Change task view / all apps/ widgets / folder radius to dialogCornerRadius

Bug: 123985787
Change-Id: Iaa8088beb51d37dba90d57ad065f9eac0dd46270
This commit is contained in:
Hyunyoung Song
2019-04-05 16:22:55 -07:00
parent 2a059c7802
commit 2aec9c42f5
13 changed files with 72 additions and 20 deletions
@@ -35,6 +35,7 @@ import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.views.RecentsView;
@@ -101,9 +102,7 @@ public class ClipAnimationHelper {
public ClipAnimationHelper(Context context) {
mWindowCornerRadius = getWindowCornerRadius(context.getResources());
mSupportsRoundedCornersOnWindows = supportsRoundedCornersOnWindows(context.getResources());
int taskCornerRadiusRes = mSupportsRoundedCornersOnWindows ?
R.dimen.task_corner_radius : R.dimen.task_corner_radius_small;
mTaskCornerRadius = context.getResources().getDimension(taskCornerRadiusRes);
mTaskCornerRadius = Themes.getDialogCornerRadius(context);
}
private void updateSourceStack(RemoteAnimationTargetCompat target) {
@@ -40,6 +40,7 @@ import com.android.launcher3.R;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.TaskSystemShortcut;
import com.android.quickstep.TaskUtils;
@@ -270,7 +271,7 @@ public class TaskMenuView extends AbstractFloatingView {
}
private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
float radius = getResources().getDimension(R.dimen.task_corner_radius);
float radius = Themes.getDialogCornerRadius(getContext());
Rect fromRect = new Rect(0, 0, getWidth(), 0);
Rect toRect = new Rect(0, 0, getWidth(), getHeight());
return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);
@@ -108,7 +108,7 @@ public class TaskThumbnailView extends View {
public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mCornerRadius = getResources().getDimension(R.dimen.task_corner_radius);
mCornerRadius = Themes.getDialogCornerRadius(context);
mOverlay = TaskOverlayFactory.INSTANCE.get(context).createOverlay(this);
mPaint.setFilterBitmap(true);
mBackgroundPaint.setColor(Color.WHITE);
@@ -52,6 +52,7 @@ import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.ViewPool.Reusable;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskIconCache;
@@ -196,7 +197,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
fromContext(context).getStatsLogManager().logTaskLaunch(getRecentsView(),
TaskUtils.getLaunchComponentKeyForTask(getTask().key));
});
setOutlineProvider(new TaskOutlineProvider(getResources()));
setOutlineProvider(new TaskOutlineProvider(context, getResources()));
}
@Override
@@ -514,9 +515,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
private final int mMarginTop;
private final float mRadius;
TaskOutlineProvider(Resources res) {
TaskOutlineProvider(Context context, Resources res) {
mMarginTop = res.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
mRadius = res.getDimension(R.dimen.task_corner_radius);
mRadius = Themes.getDialogCornerRadius(context);
}
@Override
@@ -15,5 +15,5 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#E61A73E8" />
<corners android:radius="@dimen/task_corner_radius" />
<corners android:radius="?android:attr/dialogCornerRadius" />
</shape>
+2 -2
View File
@@ -28,8 +28,8 @@
<!-- Background -->
<shape>
<corners
android:topLeftRadius="@dimen/task_corner_radius"
android:topRightRadius="@dimen/task_corner_radius"
android:topLeftRadius="?android:attr/dialogCornerRadius"
android:topRightRadius="?android:attr/dialogCornerRadius"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp" />
<solid android:color="?attr/popupColorPrimary" />
+1 -4
View File
@@ -19,9 +19,7 @@
<dimen name="task_thumbnail_top_margin">24dp</dimen>
<dimen name="task_thumbnail_half_top_margin">12dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_corner_radius">8dp</dimen>
<!-- For screens without rounded corners -->
<dimen name="task_corner_radius_small">2dp</dimen>
<dimen name="recents_page_spacing">10dp</dimen>
<dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
<dimen name="overview_peek_distance">32dp</dimen>
@@ -61,7 +59,6 @@
docked_stack_divider_thickness - 2 * docked_stack_divider_insets -->
<dimen name="multi_window_task_divider_size">10dp</dimen>
<dimen name="shelf_surface_radius">16dp</dimen>
<!-- same as vertical_drag_handle_size -->
<dimen name="shelf_surface_offset">24dp</dimen>
@@ -53,6 +53,9 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis
// cover the whole screen
private static final float SCRIM_CATCHUP_THRESHOLD = 0.2f;
// Temporarily needed until android.R.attr.bottomDialogCornerRadius becomes public
private static final float BOTTOM_CORNER_RADIUS_RATIO = 2f;
// In transposed layout, we simply draw a flat color.
private boolean mDrawingFlatColor;
@@ -87,7 +90,7 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis
mMaxScrimAlpha = Math.round(OVERVIEW.getWorkspaceScrimAlpha(mLauncher) * 255);
mEndAlpha = Color.alpha(mEndScrim);
mRadius = mLauncher.getResources().getDimension(R.dimen.shelf_surface_radius);
mRadius = BOTTOM_CORNER_RADIUS_RATIO * Themes.getDialogCornerRadius(context);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mShelfOffset = context.getResources().getDimension(R.dimen.shelf_surface_offset);
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?android:attr/colorPrimary" />
<corners android:radius="?android:attr/dialogCornerRadius" />
</shape>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?android:attr/colorPrimary" />
<corners
android:topLeftRadius="?android:attr/dialogCornerRadius"
android:topRightRadius="?android:attr/dialogCornerRadius"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
/>
</shape>
+4
View File
@@ -235,4 +235,8 @@
<!-- Hints -->
<dimen name="chip_hint_height">26dp</dimen>
<dimen name="chip_hint_bottom_margin">194dp</dimen>
<!-- Theming related -->
<dimen name="default_dialog_corner_radius">8dp</dimen>
</resources>
@@ -82,8 +82,7 @@ public abstract class ArrowPopup extends AbstractFloatingView {
public ArrowPopup(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mInflater = LayoutInflater.from(context);
mOutlineRadius = Themes.getDialogCornerRadius(context,
getResources().getDimension(R.dimen.bg_round_rect_radius));
mOutlineRadius = Themes.getDialogCornerRadius(context);
mLauncher = Launcher.getLauncher(context);
mIsRtl = Utilities.isRtl(getResources());
+3 -2
View File
@@ -32,8 +32,9 @@ import com.android.launcher3.R;
*/
public class Themes {
public static float getDialogCornerRadius(Context context, float defaultValue) {
return getDimension(context, android.R.attr.dialogCornerRadius, defaultValue);
public static float getDialogCornerRadius(Context context) {
return getDimension(context, android.R.attr.dialogCornerRadius,
context.getResources().getDimension(R.dimen.default_dialog_corner_radius));
}
public static float getDimension(Context context, int attr, float defaultValue) {