Adds additional pages to Taskbar Edu.

Currently there are pages for the following:
 - Splitscreen
 - Customize (add apps/predicted apps)
 - Docking (long press to hide)

At the moment they all use the same placeholder
image from before.

Button states:
 Page 1: Close and Next
 Page 2: Back and Next
 Page 3: Back and Done

You can also swipe left and right between the pages.

Demo: https://drive.google.com/file/d/1_D3i-jZxCRRVHV92p6hG5cm3VGcJ_bhK/view?usp=sharing&resourcekey=0-KHLHTTx67JlmVv-UZoAUAw

Bug: 180605356
Test: Manual
Change-Id: Ibbb81610a611f6ca412e53ed90dc1c67764f417e
This commit is contained in:
Andy Wickham
2021-08-18 15:17:54 -10:00
parent a71426811e
commit a0cc0903e8
6 changed files with 260 additions and 31 deletions

View File

@@ -21,6 +21,9 @@ import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.View;
import android.widget.Button;
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
@@ -34,6 +37,10 @@ public class TaskbarEduView extends AbstractSlideInView<TaskbarActivityContext>
private final Rect mInsets = new Rect();
private Button mStartButton;
private Button mEndButton;
private TaskbarEduPagedView mPagedView;
public TaskbarEduView(Context context, AttributeSet attr) {
this(context, attr, 0);
}
@@ -43,6 +50,12 @@ public class TaskbarEduView extends AbstractSlideInView<TaskbarActivityContext>
super(context, attrs, defStyleAttr);
}
protected void init(TaskbarEduController.TaskbarEduCallbacks callbacks) {
if (mPagedView != null) {
mPagedView.setControllerCallbacks(callbacks);
}
}
@Override
protected void handleClose(boolean animate) {
handleClose(animate, DEFAULT_CLOSE_DURATION);
@@ -57,7 +70,10 @@ public class TaskbarEduView extends AbstractSlideInView<TaskbarActivityContext>
protected void onFinishInflate() {
super.onFinishInflate();
mContent = findViewById(R.id.edu_view);
findViewById(R.id.edu_close_button).setOnClickListener(v -> close(true /* animate */));
mStartButton = findViewById(R.id.edu_start_button);
mEndButton = findViewById(R.id.edu_end_button);
mPagedView = findViewById(R.id.content);
mPagedView.setTaskbarEduView(this);
}
@Override
@@ -81,6 +97,12 @@ public class TaskbarEduView extends AbstractSlideInView<TaskbarActivityContext>
animateOpen();
}
@Override
protected Pair<View, String> getAccessibilityTarget() {
return Pair.create(mContent, mIsOpen ? getContext().getString(R.string.taskbar_edu_opened)
: getContext().getString(R.string.taskbar_edu_closed));
}
@Override
protected int getScrimColor(Context context) {
return context.getResources().getColor(R.color.widgets_picker_scrim);
@@ -110,4 +132,18 @@ public class TaskbarEduView extends AbstractSlideInView<TaskbarActivityContext>
mOpenCloseAnimator.setInterpolator(FAST_OUT_SLOW_IN);
mOpenCloseAnimator.start();
}
void snapToPage(int page) {
mPagedView.snapToPage(page);
}
void updateStartButton(int textResId, OnClickListener onClickListener) {
mStartButton.setText(textResId);
mStartButton.setOnClickListener(onClickListener);
}
void updateEndButton(int textResId, OnClickListener onClickListener) {
mEndButton.setText(textResId);
mEndButton.setOnClickListener(onClickListener);
}
}