Snap for 7911557 from ea77e49524 to sc-v2-release
Change-Id: Id383c09186f44aaad173f851ad9fa1aec055546f
This commit is contained in:
@@ -271,9 +271,6 @@ public class AppEventProducer implements StatsLogConsumer {
|
||||
case ALL_APPS_CONTAINER: {
|
||||
return "all-apps";
|
||||
}
|
||||
case SEARCH_RESULT_CONTAINER: {
|
||||
return "search-results";
|
||||
}
|
||||
case PREDICTED_HOTSEAT_CONTAINER: {
|
||||
return "predictions/hotseat";
|
||||
}
|
||||
@@ -293,6 +290,16 @@ public class AppEventProducer implements StatsLogConsumer {
|
||||
}
|
||||
return "folder";
|
||||
}
|
||||
case SEARCH_RESULT_CONTAINER:
|
||||
return "search-results";
|
||||
case EXTENDED_CONTAINERS: {
|
||||
switch(ci.getExtendedContainers().getContainerCase()) {
|
||||
case DEVICE_SEARCH_RESULT_CONTAINER:
|
||||
case CORRECTED_DEVICE_SEARCH_RESULT_CONTAINER:
|
||||
return "search-results";
|
||||
}
|
||||
}
|
||||
default: // fall out
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -329,6 +329,8 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
}
|
||||
if (state.predictor != null) {
|
||||
state.predictor.notifyAppTargetEvent(event);
|
||||
Log.d(TAG, "notifyAppTargetEvent action=" + event.getAction()
|
||||
+ " launchLocation=" + event.getLaunchLocation());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -322,11 +322,11 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
public final void calculateGridTaskSize(Context context, DeviceProfile dp, Rect outRect,
|
||||
PagedOrientationHandler orientedState) {
|
||||
Resources res = context.getResources();
|
||||
Rect gridRect = new Rect();
|
||||
calculateGridSize(context, dp, gridRect);
|
||||
Rect taskRect = new Rect();
|
||||
calculateTaskSize(context, dp, taskRect);
|
||||
|
||||
float rowHeight =
|
||||
(gridRect.height() + dp.overviewTaskThumbnailTopMarginPx - dp.overviewRowSpacing)
|
||||
(taskRect.height() + dp.overviewTaskThumbnailTopMarginPx - dp.overviewRowSpacing)
|
||||
/ 2f;
|
||||
|
||||
PointF taskDimension = getTaskDimension(context, dp);
|
||||
@@ -336,7 +336,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
|
||||
int gravity = Gravity.TOP;
|
||||
gravity |= orientedState.getRecentsRtlSetting(res) ? Gravity.RIGHT : Gravity.LEFT;
|
||||
Gravity.apply(gravity, outWidth, outHeight, gridRect, outRect);
|
||||
Gravity.apply(gravity, outWidth, outHeight, taskRect, outRect);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -215,6 +215,7 @@ public final class TaskViewUtils {
|
||||
tvsLocal.taskSecondaryTranslation.value = gridTranslationSecondary;
|
||||
}
|
||||
tvsLocal.setScroll(startScroll);
|
||||
tvsLocal.setIsGridTask(v.isGridTask());
|
||||
|
||||
// Fade in the task during the initial 20% of the animation
|
||||
out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1,
|
||||
|
||||
@@ -21,8 +21,10 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.ActivityThread;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
@@ -78,14 +80,15 @@ public class SplitSelectStateController {
|
||||
*/
|
||||
public void setSecondTaskId(Task taskView, Consumer<Boolean> callback) {
|
||||
mSecondTask = taskView;
|
||||
launchTasks(mInitialTask, mSecondTask, mStagePosition, callback);
|
||||
launchTasks(mInitialTask, mSecondTask, mStagePosition, callback,
|
||||
false /* freezeTaskList */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stagePosition representing location of task1
|
||||
*/
|
||||
public void launchTasks(Task task1, Task task2, @StagePosition int stagePosition,
|
||||
Consumer<Boolean> callback) {
|
||||
Consumer<Boolean> callback, boolean freezeTaskList) {
|
||||
// Assume initial task is for top/left part of screen
|
||||
final int[] taskIds = stagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
? new int[]{task1.key.id, task2.key.id}
|
||||
@@ -105,8 +108,13 @@ public class SplitSelectStateController {
|
||||
300, 150,
|
||||
ActivityThread.currentActivityThread().getApplicationThread());
|
||||
|
||||
mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], null /* mainOptions */,
|
||||
taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, adapter);
|
||||
ActivityOptions mainOpts = ActivityOptions.makeBasic();
|
||||
if (freezeTaskList) {
|
||||
mainOpts.setFreezeRecentTasksReordering();
|
||||
}
|
||||
mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], mainOpts.toBundle(),
|
||||
taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT,
|
||||
adapter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
private int mOrientationStateId;
|
||||
private StagedSplitBounds mStagedSplitBounds;
|
||||
private boolean mDrawsBelowRecents;
|
||||
private boolean mIsGridTask;
|
||||
|
||||
public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
|
||||
mContext = context;
|
||||
@@ -140,18 +141,23 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
if (mDp == null) {
|
||||
return 1;
|
||||
}
|
||||
Rect fullTaskSize = new Rect();
|
||||
mSizeStrategy.calculateTaskSize(mContext, mDp, fullTaskSize);
|
||||
if (mIsGridTask) {
|
||||
mSizeStrategy.calculateGridTaskSize(mContext, mDp, mTaskRect,
|
||||
mOrientationState.getOrientationHandler());
|
||||
} else {
|
||||
mSizeStrategy.calculateTaskSize(mContext, mDp, mTaskRect);
|
||||
}
|
||||
|
||||
Rect fullTaskSize;
|
||||
if (mStagedSplitBounds != null) {
|
||||
// The task rect changes according to the staged split task sizes, but recents
|
||||
// fullscreen scale and pivot remains the same since the task fits into the existing
|
||||
// sized task space bounds
|
||||
mSizeStrategy.calculateTaskSize(mContext, mDp, mTaskRect);
|
||||
fullTaskSize = new Rect(mTaskRect);
|
||||
mOrientationState.getOrientationHandler()
|
||||
.setSplitTaskSwipeRect(mDp, mTaskRect, mStagedSplitBounds, mStagePosition);
|
||||
} else {
|
||||
mTaskRect.set(fullTaskSize);
|
||||
fullTaskSize = mTaskRect;
|
||||
}
|
||||
return mOrientationState.getFullScreenScaleAndPivot(fullTaskSize, mDp, mPivot);
|
||||
}
|
||||
@@ -204,6 +210,13 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
mDrawsBelowRecents = drawsBelowRecents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the task is part of overview grid and not being focused.
|
||||
*/
|
||||
public void setIsGridTask(boolean isGridTask) {
|
||||
mIsGridTask = isGridTask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds animation for all the components corresponding to transition from an app to overview.
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,8 @@ import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.InsettableFrameLayout;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAnimUtils;
|
||||
@@ -51,11 +53,11 @@ public class FloatingTaskView extends FrameLayout {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public FloatingTaskView(Context context, AttributeSet attrs) {
|
||||
public FloatingTaskView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public FloatingTaskView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public FloatingTaskView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mLauncher = Launcher.getLauncher(context);
|
||||
mIsRtl = Utilities.isRtl(getResources());
|
||||
|
||||
@@ -30,6 +30,8 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
@@ -68,11 +70,11 @@ public class FloatingWidgetView extends FrameLayout implements AnimatorListener,
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public FloatingWidgetView(Context context, AttributeSet attrs) {
|
||||
public FloatingWidgetView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public FloatingWidgetView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public FloatingWidgetView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mLauncher = Launcher.getLauncher(context);
|
||||
mListenerView = new ListenerView(context, attrs);
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.annotation.Nullable;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds;
|
||||
import com.android.launcher3.util.TransformingTouchDelegate;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
@@ -157,14 +156,15 @@ public class GroupedTaskView extends TaskView {
|
||||
@Override
|
||||
public RunnableList launchTaskAnimated() {
|
||||
getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask,
|
||||
STAGE_POSITION_TOP_OR_LEFT, null /*callback*/);
|
||||
STAGE_POSITION_TOP_OR_LEFT, null /*callback*/,
|
||||
false /* freezeTaskList */);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchTask(@NonNull Consumer<Boolean> callback, boolean freezeTaskList) {
|
||||
getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask,
|
||||
STAGE_POSITION_TOP_OR_LEFT, callback);
|
||||
STAGE_POSITION_TOP_OR_LEFT, callback, freezeTaskList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,4 +241,10 @@ public class GroupedTaskView extends TaskView {
|
||||
taskIconHeight, mPrimaryTempRect, mSecondaryTempRect,
|
||||
isRtl, deviceProfile, mSplitBoundsConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateSnapshotRadius() {
|
||||
super.updateSnapshotRadius();
|
||||
mSnapshotView2.setFullscreenParams(mCurrentFullscreenParams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
@@ -49,11 +51,11 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher, Laun
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public LauncherRecentsView(Context context, AttributeSet attrs) {
|
||||
public LauncherRecentsView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public LauncherRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public LauncherRecentsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr, LauncherActivityInterface.INSTANCE);
|
||||
mActivity.getStateManager().addStateListener(this);
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@ import com.android.quickstep.TaskOverlayFactory;
|
||||
import com.android.quickstep.TaskThumbnailCache;
|
||||
import com.android.quickstep.TaskViewUtils;
|
||||
import com.android.quickstep.ViewUtils;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.util.LayoutUtils;
|
||||
import com.android.quickstep.util.RecentsOrientedState;
|
||||
import com.android.quickstep.util.SplitScreenBounds;
|
||||
@@ -166,7 +167,6 @@ import com.android.quickstep.util.TaskViewSimulator;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
import com.android.quickstep.util.VibratorWrapper;
|
||||
import com.android.systemui.plugins.ResourceProvider;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.model.Task.TaskKey;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
@@ -1018,8 +1018,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
|
||||
private TaskView getLastGridTaskView() {
|
||||
IntArray topRowIdArray = getTopRowIdArray();
|
||||
IntArray bottomRowIdArray = getBottomRowIdArray();
|
||||
return getLastGridTaskView(getTopRowIdArray(), getBottomRowIdArray());
|
||||
}
|
||||
|
||||
private TaskView getLastGridTaskView(IntArray topRowIdArray, IntArray bottomRowIdArray) {
|
||||
if (topRowIdArray.isEmpty() && bottomRowIdArray.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -3145,38 +3147,23 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
TaskView newLastGridTaskView = getLastGridTaskView();
|
||||
IntArray topRowIdArray = getTopRowIdArray();
|
||||
IntArray bottomRowIdArray = getBottomRowIdArray();
|
||||
if (finalSnapToLastTask) {
|
||||
// If snapping to last task, find the last task after dismissal.
|
||||
pageToSnapTo = indexOfChild(newLastGridTaskView);
|
||||
pageToSnapTo = indexOfChild(
|
||||
getLastGridTaskView(topRowIdArray, bottomRowIdArray));
|
||||
} else if (taskViewIdToSnapTo != -1) {
|
||||
// If snapping to another page due to indices rearranging, find
|
||||
// the new index after dismissal & rearrange using the task view id.
|
||||
pageToSnapTo = indexOfChild(
|
||||
getTaskViewFromTaskViewId(taskViewIdToSnapTo));
|
||||
int taskViewToSnapToScroll = getScrollForPage(pageToSnapTo);
|
||||
int lastGridTaskScroll = getScrollForPage(
|
||||
indexOfChild(newLastGridTaskView));
|
||||
if (!currentPageSnapsToEndOfGrid
|
||||
&& taskViewToSnapToScroll == lastGridTaskScroll) {
|
||||
if (!currentPageSnapsToEndOfGrid) {
|
||||
// If it wasn't snapped to one of the last pages, but is now
|
||||
// snapped to last pages, we'll need to compensate for the
|
||||
// difference as last pages' scroll is the position where
|
||||
// ClearAllButton is barely invisible, instead of aligned to
|
||||
// mLastComputedTaskSize.
|
||||
int normalTaskEnd = mIsRtl
|
||||
? mLastComputedTaskSize.right
|
||||
: mLastComputedTaskSize.left;
|
||||
int lastTaskStart = mIsRtl
|
||||
? mLastComputedGridSize.left
|
||||
: mLastComputedGridSize.right;
|
||||
// As snapped task is not the last task, it can only be the
|
||||
// second last task.
|
||||
int distanceToSnappedTaskEnd =
|
||||
(mPageSpacing + mLastComputedGridTaskSize.width()) * 2;
|
||||
int snappedTaskEnd = lastTaskStart + (mIsRtl
|
||||
? distanceToSnappedTaskEnd : -distanceToSnappedTaskEnd);
|
||||
mCurrentPageScrollDiff += snappedTaskEnd - normalTaskEnd;
|
||||
// offset from the page's scroll to its visual position.
|
||||
mCurrentPageScrollDiff += getOffsetFromScrollPosition(
|
||||
pageToSnapTo, topRowIdArray, bottomRowIdArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4613,7 +4600,58 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
overScrollShift, getUndampedOverScrollShift());
|
||||
}
|
||||
return getScrollForPage(pageIndex) - mOrientationHandler.getPrimaryScroll(this)
|
||||
+ overScrollShift;
|
||||
+ overScrollShift + getOffsetFromScrollPosition(pageIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how many pixels the page is offset from its scroll position.
|
||||
*/
|
||||
private int getOffsetFromScrollPosition(int pageIndex) {
|
||||
return getOffsetFromScrollPosition(pageIndex, getTopRowIdArray(), getBottomRowIdArray());
|
||||
}
|
||||
|
||||
private int getOffsetFromScrollPosition(
|
||||
int pageIndex, IntArray topRowIdArray, IntArray bottomRowIdArray) {
|
||||
if (!showAsGrid()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TaskView taskView = getTaskViewAt(pageIndex);
|
||||
if (taskView == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TaskView lastGridTaskView = getLastGridTaskView(topRowIdArray, bottomRowIdArray);
|
||||
if (lastGridTaskView == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (getScrollForPage(pageIndex) != getScrollForPage(indexOfChild(lastGridTaskView))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check distance from lastGridTaskView to taskView.
|
||||
int lastGridTaskViewPosition =
|
||||
getPositionInRow(lastGridTaskView, topRowIdArray, bottomRowIdArray);
|
||||
int taskViewPosition = getPositionInRow(taskView, topRowIdArray, bottomRowIdArray);
|
||||
int gridTaskSizeAndSpacing = mLastComputedGridTaskSize.width() + mPageSpacing;
|
||||
int positionDiff = gridTaskSizeAndSpacing * (lastGridTaskViewPosition - taskViewPosition);
|
||||
|
||||
int lastTaskEnd = (mIsRtl
|
||||
? mLastComputedGridSize.left
|
||||
: mLastComputedGridSize.right)
|
||||
+ (mIsRtl ? mPageSpacing : -mPageSpacing);
|
||||
int taskEnd = lastTaskEnd + (mIsRtl ? positionDiff : -positionDiff);
|
||||
int normalTaskEnd = mIsRtl
|
||||
? mLastComputedGridTaskSize.left
|
||||
: mLastComputedGridTaskSize.right;
|
||||
return taskEnd - normalTaskEnd;
|
||||
}
|
||||
|
||||
private int getPositionInRow(
|
||||
TaskView taskView, IntArray topRowIdArray, IntArray bottomRowIdArray) {
|
||||
int position = topRowIdArray.indexOf(taskView.getTaskViewId());
|
||||
return position != -1 ? position : bottomRowIdArray.indexOf(taskView.getTaskViewId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,7 @@ import android.util.Property;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
@@ -102,11 +103,11 @@ public class TaskThumbnailView extends View {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TaskThumbnailView(Context context, AttributeSet attrs) {
|
||||
public TaskThumbnailView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public TaskThumbnailView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mPaint.setFilterBitmap(true);
|
||||
mBackgroundPaint.setColor(Color.WHITE);
|
||||
|
||||
@@ -92,7 +92,6 @@ import com.android.quickstep.TaskThumbnailCache;
|
||||
import com.android.quickstep.TaskUtils;
|
||||
import com.android.quickstep.TaskViewUtils;
|
||||
import com.android.quickstep.util.CancellableTask;
|
||||
import com.android.quickstep.util.LauncherSplitScreenListener;
|
||||
import com.android.quickstep.util.RecentsOrientedState;
|
||||
import com.android.quickstep.util.TaskCornerRadius;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
@@ -369,7 +368,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
private float mGridProgress;
|
||||
private float mNonGridScale = 1;
|
||||
private float mDismissScale = 1;
|
||||
private final FullscreenDrawParams mCurrentFullscreenParams;
|
||||
protected final FullscreenDrawParams mCurrentFullscreenParams;
|
||||
protected final StatefulActivity mActivity;
|
||||
|
||||
// Various causes of changing primary translation, which we aggregate to setTranslationX/Y().
|
||||
@@ -425,11 +424,11 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TaskView(Context context, AttributeSet attrs) {
|
||||
public TaskView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public TaskView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mActivity = StatefulActivity.fromContext(context);
|
||||
setOnClickListener(this::onClick);
|
||||
@@ -878,7 +877,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
|
||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||
snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
|
||||
boolean isGridTask = deviceProfile.overviewShowAsGrid && !isFocusedTask();
|
||||
boolean isGridTask = isGridTask();
|
||||
int taskIconHeight = deviceProfile.overviewTaskIconSizePx;
|
||||
int taskMargin = isGridTask ? deviceProfile.overviewTaskMarginGridPx
|
||||
: deviceProfile.overviewTaskMarginPx;
|
||||
@@ -898,6 +897,14 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
mSnapshotView.getTaskOverlay().updateOrientationState(orientationState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the task is part of overview grid and not being focused.
|
||||
*/
|
||||
public boolean isGridTask() {
|
||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||
return deviceProfile.overviewShowAsGrid && !isFocusedTask();
|
||||
}
|
||||
|
||||
private void setIconAndDimTransitionProgress(float progress, boolean invert) {
|
||||
if (invert) {
|
||||
progress = 1 - progress;
|
||||
@@ -1374,7 +1381,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
invalidateOutline();
|
||||
}
|
||||
|
||||
void updateSnapshotRadius() {
|
||||
protected void updateSnapshotRadius() {
|
||||
updateCurrentFullscreenParams(mSnapshotView.getPreviewPositionHelper());
|
||||
mSnapshotView.setFullscreenParams(mCurrentFullscreenParams);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2021 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.
|
||||
-->
|
||||
<com.android.launcher3.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res-auto"
|
||||
style="@style/BaseIcon.AllApps"
|
||||
android:id="@+id/icon"
|
||||
android:singleLine="false"
|
||||
android:lines="2"
|
||||
android:inputType="textMultiLine"
|
||||
launcher:iconDisplay="all_apps"
|
||||
launcher:centerVertically="true" />
|
||||
|
||||
@@ -104,8 +104,9 @@
|
||||
<dimen name="all_apps_divider_height">2dp</dimen>
|
||||
<dimen name="all_apps_divider_width">128dp</dimen>
|
||||
<dimen name="all_apps_content_fade_in_offset">150dp</dimen>
|
||||
|
||||
<dimen name="all_apps_tip_bottom_margin">8dp</dimen>
|
||||
<dimen name="all_apps_height_extra">6dp</dimen>
|
||||
|
||||
<!-- The size of corner radius of the arrow in the arrow toast. -->
|
||||
<dimen name="arrow_toast_corner_radius">2dp</dimen>
|
||||
<dimen name="arrow_toast_elevation">2dp</dimen>
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
<!-- Options for recent tasks -->
|
||||
<!-- Title for an option to enter split screen mode for a given app -->
|
||||
<string name="recent_task_option_split_screen">Split screen</string>
|
||||
<string translatable="false" name="split_screen_position_top">Pin to top</string>
|
||||
<string translatable="false" name="split_screen_position_left">Pin to left</string>
|
||||
<string translatable="false" name="split_screen_position_right">Pin to right</string>
|
||||
<string translatable="false" name="split_screen_position_top">Split top</string>
|
||||
<string translatable="false" name="split_screen_position_left">Split left</string>
|
||||
<string translatable="false" name="split_screen_position_right">Split right</string>
|
||||
|
||||
<!-- Widgets -->
|
||||
<!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] -->
|
||||
|
||||
@@ -41,6 +41,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.util.PackageManagerHelper;
|
||||
@@ -273,6 +274,8 @@ public class AllAppsGridAdapter extends
|
||||
// The intent to send off to the market app, updated each time the search query changes.
|
||||
private Intent mMarketSearchIntent;
|
||||
|
||||
private final int mExtraHeight;
|
||||
|
||||
public AllAppsGridAdapter(BaseDraggingActivity launcher, LayoutInflater inflater,
|
||||
AlphabeticalAppsList apps, BaseAdapterProvider[] adapterProviders) {
|
||||
Resources res = launcher.getResources();
|
||||
@@ -288,6 +291,7 @@ public class AllAppsGridAdapter extends
|
||||
|
||||
mAdapterProviders = adapterProviders;
|
||||
setAppsPerRow(mLauncher.getDeviceProfile().numShownAllAppsColumns);
|
||||
mExtraHeight = launcher.getResources().getDimensionPixelSize(R.dimen.all_apps_height_extra);
|
||||
}
|
||||
|
||||
public void setAppsPerRow(int appsPerRow) {
|
||||
@@ -347,14 +351,19 @@ public class AllAppsGridAdapter extends
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
case VIEW_TYPE_ICON:
|
||||
int layout = !FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get() ? R.layout.all_apps_icon
|
||||
: R.layout.all_apps_icon_twoline;
|
||||
BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
|
||||
R.layout.all_apps_icon, parent, false);
|
||||
layout, parent, false);
|
||||
icon.setLongPressTimeoutFactor(1f);
|
||||
icon.setOnFocusChangeListener(mIconFocusListener);
|
||||
icon.setOnClickListener(mOnIconClickListener);
|
||||
icon.setOnLongClickListener(mOnIconLongClickListener);
|
||||
// Ensure the all apps icon height matches the workspace icons in portrait mode.
|
||||
icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx;
|
||||
if (FeatureFlags.ENABLE_TWOLINE_ALLAPPS.get()) {
|
||||
icon.getLayoutParams().height += mExtraHeight;
|
||||
}
|
||||
return new ViewHolder(icon);
|
||||
case VIEW_TYPE_EMPTY_SEARCH:
|
||||
return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search,
|
||||
|
||||
@@ -94,6 +94,9 @@ public final class FeatureFlags {
|
||||
public static final BooleanFlag ENABLE_ONE_SEARCH = new DeviceFlag("ENABLE_ONE_SEARCH", false,
|
||||
"Use homescreen search box to complete allApps searches");
|
||||
|
||||
public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(
|
||||
"ENABLE_TWOLINE_ALLAPPS", false, "Enables two line label inside all apps.");
|
||||
|
||||
public static final BooleanFlag ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING = new DeviceFlag(
|
||||
"ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING", true,
|
||||
"Allows on device search in all apps logging");
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.ArrayList;
|
||||
@ProvidesInterface(action = OneSearch.ACTION, version = OneSearch.VERSION)
|
||||
public interface OneSearch extends Plugin {
|
||||
String ACTION = "com.android.systemui.action.PLUGIN_ONE_SEARCH";
|
||||
int VERSION = 4;
|
||||
int VERSION = 5;
|
||||
|
||||
/**
|
||||
* Get the content provider warmed up.
|
||||
@@ -37,10 +37,18 @@ public interface OneSearch extends Plugin {
|
||||
|
||||
/**
|
||||
* Get the suggest search target list for the query.
|
||||
*
|
||||
* @param query The query to get the search suggests for.
|
||||
*/
|
||||
ArrayList<Parcelable> getSuggests(Parcelable query);
|
||||
|
||||
/** Get image bitmap with the URL. */
|
||||
Parcelable getImageBitmap(String imageUrl);
|
||||
|
||||
/**
|
||||
* Notifies search events to plugin
|
||||
*
|
||||
* @param event the SearchTargetEvent event created due to user action
|
||||
*/
|
||||
void notifyEvent(Parcelable event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user