mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 10:18:20 +00:00
Merge "Fix redesigned gesture nav jank" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bd0188abd1
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 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="oval">
|
||||
<solid android:color="?attr/surfaceHome" />
|
||||
</shape>
|
||||
@@ -16,6 +16,5 @@
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="?attr/surfaceHome" />
|
||||
<corners android:radius="@dimen/gesture_tutorial_hotseat_icon_corner_radius" />
|
||||
</shape>
|
||||
@@ -40,28 +40,28 @@
|
||||
android:id="@+id/hotseat_icon_1"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_2"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_3"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_4"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -39,42 +39,42 @@
|
||||
android:id="@+id/hotseat_search_bar"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_search_height"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_1"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_2"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_3"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_4"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_5"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -26,7 +26,7 @@
|
||||
android:id="@+id/hotseat_search_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_search_height"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true"
|
||||
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -50,35 +50,35 @@
|
||||
android:id="@+id/hotseat_icon_1"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_2"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_3"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_4"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_5"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -96,15 +96,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/gesture_tutorial_ripple" />
|
||||
|
||||
<include
|
||||
android:id="@+id/gesture_tutorial_fake_taskbar_view"
|
||||
layout="@layout/gesture_tutorial_tablet_mock_taskbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="@dimen/gesture_tutorial_taskbar_margin_bottom" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gesture_tutorial_edge_gesture_video"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -39,35 +39,36 @@
|
||||
android:id="@+id/hotseat_icon_1"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_2"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_3"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_4"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_search_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_search_height"
|
||||
android:layout_marginTop="@dimen/gesture_tutorial_hotseat_icon_search_margin"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true"
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
android:id="@+id/hotseat_search_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_search_height"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true"
|
||||
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -50,35 +50,35 @@
|
||||
android:id="@+id/hotseat_icon_1"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_2"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_3"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_4"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/hotseat_icon_5"
|
||||
android:layout_width="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:layout_height="@dimen/gesture_tutorial_hotseat_icon_size"
|
||||
android:background="@drawable/hotseat_icon_home"
|
||||
android:background="@drawable/redesigned_hotseat_icon"
|
||||
android:clipToOutline="true" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -130,6 +130,11 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
|
||||
return mTutorialFragment.mRootView.mColorSurfaceHome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHotseatIconColor() {
|
||||
return getExitingAppColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackGestureAttempted(BackGestureResult result) {
|
||||
if (isGestureCompleted()) {
|
||||
|
||||
@@ -134,7 +134,7 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getExitingAppColor() {
|
||||
protected int getHotseatIconColor() {
|
||||
return mTutorialFragment.mRootView.mColorOnSurfaceOverview;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.animation.ValueAnimator;
|
||||
import android.annotation.RawRes;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
@@ -107,7 +108,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
@Nullable View mHotseatIconView;
|
||||
final ClipIconView mFakeIconView;
|
||||
final FrameLayout mFakeTaskView;
|
||||
final AnimatedTaskbarView mFakeTaskbarView;
|
||||
@Nullable final AnimatedTaskbarView mFakeTaskbarView;
|
||||
final AnimatedTaskView mFakePreviousTaskView;
|
||||
final View mRippleView;
|
||||
final RippleDrawable mRippleDrawable;
|
||||
@@ -149,7 +150,8 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
mFakeHotseatView = rootView.findViewById(R.id.gesture_tutorial_fake_hotseat_view);
|
||||
mFakeIconView = rootView.findViewById(R.id.gesture_tutorial_fake_icon_view);
|
||||
mFakeTaskView = rootView.findViewById(R.id.gesture_tutorial_fake_task_view);
|
||||
mFakeTaskbarView = rootView.findViewById(R.id.gesture_tutorial_fake_taskbar_view);
|
||||
mFakeTaskbarView = ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
|
||||
? null : rootView.findViewById(R.id.gesture_tutorial_fake_taskbar_view);
|
||||
mFakePreviousTaskView =
|
||||
rootView.findViewById(R.id.gesture_tutorial_fake_previous_task_view);
|
||||
mRippleView = rootView.findViewById(R.id.gesture_tutorial_ripple_view);
|
||||
@@ -269,12 +271,19 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
protected abstract int getSwipeActionColor();
|
||||
|
||||
@ColorInt
|
||||
protected abstract int getExitingAppColor();
|
||||
protected int getExitingAppColor() {
|
||||
return Color.TRANSPARENT;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
protected int getHotseatIconColor() {
|
||||
return Color.TRANSPARENT;
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
public int getMockAppIconResId() {
|
||||
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
|
||||
? R.drawable.redesigned_default_sandbox_app_icon
|
||||
? R.drawable.redesigned_hotseat_icon
|
||||
: R.drawable.default_sandbox_app_icon;
|
||||
}
|
||||
|
||||
@@ -463,7 +472,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
mFakeTaskView.removeCallbacks(mFakeTaskViewCallback);
|
||||
mFakeTaskViewCallback = null;
|
||||
}
|
||||
if (mFakeTaskbarViewCallback != null) {
|
||||
if (mFakeTaskbarViewCallback != null && mFakeTaskbarView != null) {
|
||||
mFakeTaskbarView.removeCallbacks(mFakeTaskbarViewCallback);
|
||||
mFakeTaskbarViewCallback = null;
|
||||
}
|
||||
@@ -621,7 +630,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
}
|
||||
|
||||
void hideFakeTaskbar(boolean animateToHotseat) {
|
||||
if (!mTutorialFragment.isLargeScreen()) {
|
||||
if (!mTutorialFragment.isLargeScreen() || mFakeTaskbarView == null) {
|
||||
return;
|
||||
}
|
||||
if (mFakeTaskbarViewCallback != null) {
|
||||
@@ -635,7 +644,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
}
|
||||
|
||||
void showFakeTaskbar(boolean animateFromHotseat) {
|
||||
if (!mTutorialFragment.isLargeScreen()) {
|
||||
if (!mTutorialFragment.isLargeScreen() || mFakeTaskbarView == null) {
|
||||
return;
|
||||
}
|
||||
if (mFakeTaskbarViewCallback != null) {
|
||||
@@ -670,6 +679,11 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
}
|
||||
}
|
||||
|
||||
private void updateHotseatChildViewColor(@Nullable View child) {
|
||||
if (child == null) return;
|
||||
child.getBackground().setTint(getHotseatIconColor());
|
||||
}
|
||||
|
||||
private void updateDrawables() {
|
||||
if (mContext != null) {
|
||||
mTutorialFragment.getRootView().setBackground(AppCompatResources.getDrawable(
|
||||
@@ -689,6 +703,12 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
|
||||
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
|
||||
mExitingAppView.setBackgroundColor(getExitingAppColor());
|
||||
updateHotseatChildViewColor(mFakeIconView);
|
||||
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_2));
|
||||
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_3));
|
||||
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_4));
|
||||
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_5));
|
||||
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_search_bar));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -712,8 +732,10 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
||||
? R.dimen.gesture_tutorial_tablet_feedback_margin_top
|
||||
: R.dimen.gesture_tutorial_feedback_margin_top);
|
||||
|
||||
mFakeTaskbarView.setVisibility((mTutorialFragment.isLargeScreen()
|
||||
&& !ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) ? View.VISIBLE : GONE);
|
||||
if (mFakeTaskbarView != null) {
|
||||
mFakeTaskbarView.setVisibility(
|
||||
mTutorialFragment.isLargeScreen() ? View.VISIBLE : GONE);
|
||||
}
|
||||
|
||||
RelativeLayout.LayoutParams hotseatLayoutParams =
|
||||
(RelativeLayout.LayoutParams) mFakeHotseatView.getLayoutParams();
|
||||
|
||||
Reference in New Issue
Block a user