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