Merge "Update TutorialFragments to work without hand gesture animations." into ub-launcher3-master
This commit is contained in:
commit
6873cb82f3
|
@ -24,7 +24,7 @@ import com.android.quickstep.interaction.TutorialController.TutorialType;
|
|||
/** Shows the Home gesture interactive tutorial. */
|
||||
public class AssistantGestureTutorialFragment extends TutorialFragment {
|
||||
@Override
|
||||
int getHandAnimationResId() {
|
||||
Integer getHandAnimationResId() {
|
||||
return R.drawable.assistant_gesture;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.android.quickstep.interaction.TutorialController.TutorialType;
|
|||
/** Shows the Back gesture interactive tutorial. */
|
||||
public class BackGestureTutorialFragment extends TutorialFragment {
|
||||
@Override
|
||||
int getHandAnimationResId() {
|
||||
Integer getHandAnimationResId() {
|
||||
return R.drawable.back_gesture;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.android.quickstep.interaction.TutorialController.TutorialType;
|
|||
/** Shows the Home gesture interactive tutorial. */
|
||||
public class HomeGestureTutorialFragment extends TutorialFragment {
|
||||
@Override
|
||||
int getHandAnimationResId() {
|
||||
Integer getHandAnimationResId() {
|
||||
return R.drawable.home_gesture;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.android.quickstep.interaction.TutorialController.TutorialType;
|
|||
/** Shows the Overview gesture interactive tutorial. */
|
||||
public class OverviewGestureTutorialFragment extends TutorialFragment {
|
||||
@Override
|
||||
int getHandAnimationResId() {
|
||||
Integer getHandAnimationResId() {
|
||||
return R.drawable.overview_gesture;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||
final View mFakeTaskView;
|
||||
final View mRippleView;
|
||||
final RippleDrawable mRippleDrawable;
|
||||
final TutorialHandAnimation mHandCoachingAnimation;
|
||||
@Nullable final TutorialHandAnimation mHandCoachingAnimation;
|
||||
final ImageView mHandCoachingView;
|
||||
final Button mActionTextButton;
|
||||
final Button mActionButton;
|
||||
|
@ -145,13 +145,16 @@ abstract class TutorialController implements BackGestureAttemptCallback,
|
|||
void onActionTextButtonClicked(View button) {}
|
||||
|
||||
void showHandCoachingAnimation() {
|
||||
if (isComplete()) {
|
||||
if (isComplete() || mHandCoachingAnimation == null) {
|
||||
return;
|
||||
}
|
||||
mHandCoachingAnimation.startLoopedAnimation(mTutorialType);
|
||||
}
|
||||
|
||||
void hideHandCoachingAnimation() {
|
||||
if (mHandCoachingAnimation == null) {
|
||||
return;
|
||||
}
|
||||
mHandCoachingAnimation.stop();
|
||||
mHandCoachingView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
|||
TutorialType mTutorialType;
|
||||
@Nullable TutorialController mTutorialController = null;
|
||||
View mRootView;
|
||||
TutorialHandAnimation mHandCoachingAnimation;
|
||||
@Nullable TutorialHandAnimation mHandCoachingAnimation = null;
|
||||
EdgeBackGestureHandler mEdgeBackGestureHandler;
|
||||
NavBarGestureHandler mNavBarGestureHandler;
|
||||
private View mLauncherView;
|
||||
|
@ -82,7 +82,9 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
|||
return null;
|
||||
}
|
||||
|
||||
abstract int getHandAnimationResId();
|
||||
@Nullable Integer getHandAnimationResId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
abstract TutorialController createController(TutorialType type);
|
||||
|
||||
|
@ -116,8 +118,11 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
|||
return insets;
|
||||
});
|
||||
mRootView.setOnTouchListener(this);
|
||||
mHandCoachingAnimation =
|
||||
new TutorialHandAnimation(getContext(), mRootView, getHandAnimationResId());
|
||||
Integer handAnimationResId = getHandAnimationResId();
|
||||
if (handAnimationResId != null) {
|
||||
mHandCoachingAnimation =
|
||||
new TutorialHandAnimation(getContext(), mRootView, handAnimationResId);
|
||||
}
|
||||
InvariantDeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(getContext());
|
||||
mLauncherView = new SandboxLauncherRenderer(getContext(), dp, true).getRenderedView();
|
||||
((ViewGroup) mRootView).addView(mLauncherView, 0);
|
||||
|
@ -133,7 +138,10 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
|||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mHandCoachingAnimation.stop();
|
||||
|
||||
if (mHandCoachingAnimation != null) {
|
||||
mHandCoachingAnimation.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -183,7 +191,7 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
|
|||
return mLauncherView;
|
||||
}
|
||||
|
||||
TutorialHandAnimation getHandAnimation() {
|
||||
@Nullable TutorialHandAnimation getHandAnimation() {
|
||||
return mHandCoachingAnimation;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue