Snap for 7964896 from f30a999841 to tm-release
Change-Id: I0243b56237998eb041381cd65abfcd2ed36eda65
This commit is contained in:
@@ -51,7 +51,6 @@
|
||||
style="@style/OverviewActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_split_screen"
|
||||
android:text="@string/action_split"
|
||||
android:theme="@style/ThemeControlHighlightWorkspaceColor"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.TASKBAR_STASH_DURATION;
|
||||
@@ -68,9 +67,6 @@ import java.util.function.Supplier;
|
||||
private int mPrevState;
|
||||
private int mState;
|
||||
|
||||
private LauncherState mTargetStateOverride = null;
|
||||
private LauncherState mTargetStateOverrideForStateTransition = null;
|
||||
|
||||
private boolean mIsAnimatingToLauncherViaGesture;
|
||||
private boolean mIsAnimatingToLauncherViaResume;
|
||||
|
||||
@@ -79,7 +75,6 @@ import java.util.function.Supplier;
|
||||
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
mTargetStateOverrideForStateTransition = toState;
|
||||
updateStateForFlag(FLAG_TRANSITION_STATE_START_STASHED,
|
||||
toState.isTaskbarStashed());
|
||||
applyState();
|
||||
@@ -134,18 +129,6 @@ import java.util.function.Supplier;
|
||||
updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, true);
|
||||
animatorSet.play(stashController.applyStateWithoutStart(duration));
|
||||
animatorSet.play(applyState(duration, false));
|
||||
animatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
mTargetStateOverride = null;
|
||||
animator.removeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {
|
||||
mTargetStateOverride = toState;
|
||||
}
|
||||
});
|
||||
|
||||
TaskBarRecentsAnimationListener listener = new TaskBarRecentsAnimationListener(callbacks);
|
||||
callbacks.addListener(listener);
|
||||
@@ -284,7 +267,6 @@ import java.util.function.Supplier;
|
||||
// Reset hotseat alpha to default
|
||||
mLauncher.getHotseat().setIconsAlpha(1);
|
||||
}
|
||||
mTargetStateOverrideForStateTransition = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -296,8 +278,6 @@ import java.util.function.Supplier;
|
||||
animatorSet.play(mIconAlignmentForLauncherState.animateToValue(
|
||||
getCurrentIconAlignmentRatioForLauncherState(),
|
||||
isTransitionStateStashed ? 0 : 1));
|
||||
} else {
|
||||
mTargetStateOverrideForStateTransition = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,20 +298,14 @@ import java.util.function.Supplier;
|
||||
}
|
||||
|
||||
private void onIconAlignmentRatioChangedForStateTransition() {
|
||||
onIconAlignmentRatioChanged(
|
||||
mTargetStateOverrideForStateTransition != null
|
||||
? mTargetStateOverrideForStateTransition
|
||||
: mLauncher.getStateManager().getState(),
|
||||
this::getCurrentIconAlignmentRatioForLauncherState);
|
||||
onIconAlignmentRatioChanged(this::getCurrentIconAlignmentRatioForLauncherState);
|
||||
}
|
||||
|
||||
private void onIconAlignmentRatioChanged() {
|
||||
onIconAlignmentRatioChanged(mTargetStateOverride != null ? mTargetStateOverride
|
||||
: mLauncher.getStateManager().getState(), this::getCurrentIconAlignmentRatio);
|
||||
onIconAlignmentRatioChanged(this::getCurrentIconAlignmentRatio);
|
||||
}
|
||||
|
||||
private void onIconAlignmentRatioChanged(LauncherState state,
|
||||
Supplier<Float> alignmentSupplier) {
|
||||
private void onIconAlignmentRatioChanged(Supplier<Float> alignmentSupplier) {
|
||||
if (mControllers == null) {
|
||||
return;
|
||||
}
|
||||
@@ -341,7 +315,8 @@ import java.util.function.Supplier;
|
||||
|
||||
mTaskbarBackgroundAlpha.updateValue(1 - alignment);
|
||||
|
||||
setIconAlpha(state, alignment);
|
||||
// Switch taskbar and hotseat in last frame
|
||||
setTaskbarViewVisible(alignment < 1);
|
||||
}
|
||||
|
||||
private float getCurrentIconAlignmentRatio() {
|
||||
@@ -352,15 +327,6 @@ import java.util.function.Supplier;
|
||||
return mIconAlignmentForLauncherState.value;
|
||||
}
|
||||
|
||||
private void setIconAlpha(LauncherState state, float progress) {
|
||||
if ((state.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) {
|
||||
// If the hotseat icons are visible, then switch taskbar in last frame
|
||||
setTaskbarViewVisible(progress < 1);
|
||||
} else {
|
||||
mIconAlphaForHome.setValue(1 - progress);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTaskbarViewVisible(boolean isVisible) {
|
||||
mIconAlphaForHome.setValue(isVisible ? 1 : 0);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.util.ArraySet;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
|
||||
import androidx.annotation.BinderThread;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.UiThread;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
@@ -77,7 +78,7 @@ public class RecentsAnimationCallbacks implements
|
||||
|
||||
public void notifyAnimationCanceled() {
|
||||
mCancelled = true;
|
||||
onAnimationCanceled(null);
|
||||
onAnimationCanceled(new HashMap<>());
|
||||
}
|
||||
|
||||
// Called only in Q platform
|
||||
@@ -167,16 +168,17 @@ public class RecentsAnimationCallbacks implements
|
||||
* Callback from the system when the recents animation is canceled. {@param thumbnailData}
|
||||
* is passed back for rendering screenshot to replace live tile.
|
||||
*/
|
||||
default void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {}
|
||||
default void onRecentsAnimationCanceled(
|
||||
@NonNull HashMap<Integer, ThumbnailData> thumbnailDatas) {}
|
||||
|
||||
/**
|
||||
* Callback made whenever the recents animation is finished.
|
||||
*/
|
||||
default void onRecentsAnimationFinished(RecentsAnimationController controller) {}
|
||||
default void onRecentsAnimationFinished(@NonNull RecentsAnimationController controller) {}
|
||||
|
||||
/**
|
||||
* Callback made when a task started from the recents is ready for an app transition.
|
||||
*/
|
||||
default void onTasksAppeared(RemoteAnimationTargetCompat[] appearedTaskTarget) {}
|
||||
default void onTasksAppeared(@NonNull RemoteAnimationTargetCompat[] appearedTaskTarget) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import android.annotation.CallSuper;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.systemui.shared.animation.UnfoldMoveFromCenterAnimator;
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Animation that moves launcher icons and widgets from center to the sides (final position)
|
||||
*/
|
||||
public abstract class BaseUnfoldMoveFromCenterAnimator implements TransitionProgressListener {
|
||||
|
||||
private final UnfoldMoveFromCenterAnimator mMoveFromCenterAnimation;
|
||||
|
||||
private final Map<ViewGroup, Boolean> mOriginalClipToPadding = new HashMap<>();
|
||||
private final Map<ViewGroup, Boolean> mOriginalClipChildren = new HashMap<>();
|
||||
|
||||
public BaseUnfoldMoveFromCenterAnimator(WindowManager windowManager) {
|
||||
mMoveFromCenterAnimation = new UnfoldMoveFromCenterAnimator(windowManager,
|
||||
new LauncherViewsMoveFromCenterTranslationApplier());
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void onTransitionStarted() {
|
||||
mMoveFromCenterAnimation.updateDisplayProperties();
|
||||
onPrepareViewsForAnimation();
|
||||
onTransitionProgress(0f);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void onTransitionProgress(float progress) {
|
||||
mMoveFromCenterAnimation.onTransitionProgress(progress);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void onTransitionFinished() {
|
||||
mMoveFromCenterAnimation.onTransitionFinished();
|
||||
mMoveFromCenterAnimation.clearRegisteredViews();
|
||||
|
||||
mOriginalClipChildren.clear();
|
||||
mOriginalClipToPadding.clear();
|
||||
}
|
||||
|
||||
protected void onPrepareViewsForAnimation() {
|
||||
|
||||
}
|
||||
|
||||
protected void registerViewForAnimation(View view) {
|
||||
mMoveFromCenterAnimation.registerViewForAnimation(view);
|
||||
}
|
||||
|
||||
protected void disableClipping(ViewGroup view) {
|
||||
mOriginalClipToPadding.put(view, view.getClipToPadding());
|
||||
mOriginalClipChildren.put(view, view.getClipChildren());
|
||||
view.setClipToPadding(false);
|
||||
view.setClipChildren(false);
|
||||
}
|
||||
|
||||
protected void restoreClipping(ViewGroup view) {
|
||||
final Boolean originalClipToPadding = mOriginalClipToPadding.get(view);
|
||||
if (originalClipToPadding != null) {
|
||||
view.setClipToPadding(originalClipToPadding);
|
||||
}
|
||||
final Boolean originalClipChildren = mOriginalClipChildren.get(view);
|
||||
if (originalClipChildren != null) {
|
||||
view.setClipChildren(originalClipChildren);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,14 +18,17 @@ package com.android.quickstep.util;
|
||||
import static com.android.launcher3.Utilities.comp;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManagerGlobal;
|
||||
|
||||
import androidx.core.view.OneShotPreDrawListener;
|
||||
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.util.HorizontalInsettableView;
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener;
|
||||
import com.android.systemui.unfold.util.NaturalRotationUnfoldProgressProvider;
|
||||
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;
|
||||
|
||||
/**
|
||||
@@ -43,6 +46,7 @@ public class LauncherUnfoldAnimationController {
|
||||
private HorizontalInsettableView mQsbInsettable;
|
||||
|
||||
private final ScopedUnfoldTransitionProgressProvider mProgressProvider;
|
||||
private final NaturalRotationUnfoldProgressProvider mNaturalOrientationProgressProvider;
|
||||
|
||||
public LauncherUnfoldAnimationController(
|
||||
Launcher launcher,
|
||||
@@ -51,10 +55,19 @@ public class LauncherUnfoldAnimationController {
|
||||
mLauncher = launcher;
|
||||
mProgressProvider = new ScopedUnfoldTransitionProgressProvider(
|
||||
unfoldTransitionProgressProvider);
|
||||
mNaturalOrientationProgressProvider = new NaturalRotationUnfoldProgressProvider(launcher,
|
||||
WindowManagerGlobal.getWindowManagerService(), mProgressProvider);
|
||||
mNaturalOrientationProgressProvider.init();
|
||||
|
||||
// Animated in all orientations
|
||||
mProgressProvider.addCallback(new UnfoldMoveFromCenterWorkspaceAnimator(launcher,
|
||||
windowManager));
|
||||
mProgressProvider.addCallback(new QsbAnimationListener());
|
||||
|
||||
// Animated only in natural orientation
|
||||
mNaturalOrientationProgressProvider
|
||||
.addCallback(new QsbAnimationListener());
|
||||
mNaturalOrientationProgressProvider
|
||||
.addCallback(new UnfoldMoveFromCenterHotseatAnimator(launcher, windowManager));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,17 +79,8 @@ public class LauncherUnfoldAnimationController {
|
||||
mQsbInsettable = (HorizontalInsettableView) hotseat.getQsb();
|
||||
}
|
||||
|
||||
final ViewTreeObserver obs = mLauncher.getWorkspace().getViewTreeObserver();
|
||||
obs.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||
@Override
|
||||
public boolean onPreDraw() {
|
||||
if (obs.isAlive()) {
|
||||
mProgressProvider.setReadyToHandleTransition(true);
|
||||
obs.removeOnPreDrawListener(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
OneShotPreDrawListener.add(mLauncher.getWorkspace(),
|
||||
() -> mProgressProvider.setReadyToHandleTransition(true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,6 +96,7 @@ public class LauncherUnfoldAnimationController {
|
||||
*/
|
||||
public void onDestroy() {
|
||||
mProgressProvider.destroy();
|
||||
mNaturalOrientationProgressProvider.destroy();
|
||||
}
|
||||
|
||||
private class QsbAnimationListener implements TransitionProgressListener {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.Launcher;
|
||||
|
||||
/**
|
||||
* Animation that moves hotseat icons from center to the sides (final position)
|
||||
*/
|
||||
public class UnfoldMoveFromCenterHotseatAnimator extends BaseUnfoldMoveFromCenterAnimator {
|
||||
|
||||
private final Launcher mLauncher;
|
||||
|
||||
public UnfoldMoveFromCenterHotseatAnimator(Launcher launcher, WindowManager windowManager) {
|
||||
super(windowManager);
|
||||
mLauncher = launcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPrepareViewsForAnimation() {
|
||||
Hotseat hotseat = mLauncher.getHotseat();
|
||||
|
||||
ViewGroup hotseatIcons = hotseat.getShortcutsAndWidgets();
|
||||
disableClipping(hotseat);
|
||||
|
||||
for (int i = 0; i < hotseatIcons.getChildCount(); i++) {
|
||||
View child = hotseatIcons.getChildAt(i);
|
||||
registerViewForAnimation(child);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionFinished() {
|
||||
restoreClipping(mLauncher.getHotseat());
|
||||
super.onTransitionFinished();
|
||||
}
|
||||
}
|
||||
+5
-61
@@ -16,44 +16,28 @@
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.systemui.shared.animation.UnfoldMoveFromCenterAnimator;
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Animation that moves launcher icons and widgets from center to the sides (final position)
|
||||
*/
|
||||
public class UnfoldMoveFromCenterWorkspaceAnimator
|
||||
implements UnfoldTransitionProgressProvider.TransitionProgressListener {
|
||||
public class UnfoldMoveFromCenterWorkspaceAnimator extends BaseUnfoldMoveFromCenterAnimator {
|
||||
|
||||
private final Launcher mLauncher;
|
||||
private final UnfoldMoveFromCenterAnimator mMoveFromCenterAnimation;
|
||||
|
||||
private final Map<ViewGroup, Boolean> mOriginalClipToPadding = new HashMap<>();
|
||||
private final Map<ViewGroup, Boolean> mOriginalClipChildren = new HashMap<>();
|
||||
|
||||
public UnfoldMoveFromCenterWorkspaceAnimator(Launcher launcher, WindowManager windowManager) {
|
||||
super(windowManager);
|
||||
mLauncher = launcher;
|
||||
mMoveFromCenterAnimation = new UnfoldMoveFromCenterAnimator(windowManager,
|
||||
new LauncherViewsMoveFromCenterTranslationApplier());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionStarted() {
|
||||
mMoveFromCenterAnimation.updateDisplayProperties();
|
||||
|
||||
protected void onPrepareViewsForAnimation() {
|
||||
Workspace workspace = mLauncher.getWorkspace();
|
||||
Hotseat hotseat = mLauncher.getHotseat();
|
||||
|
||||
// App icons and widgets
|
||||
workspace
|
||||
@@ -65,57 +49,17 @@ public class UnfoldMoveFromCenterWorkspaceAnimator
|
||||
|
||||
for (int i = 0; i < itemsContainer.getChildCount(); i++) {
|
||||
View child = itemsContainer.getChildAt(i);
|
||||
mMoveFromCenterAnimation.registerViewForAnimation(child);
|
||||
registerViewForAnimation(child);
|
||||
}
|
||||
});
|
||||
|
||||
disableClipping(workspace);
|
||||
|
||||
// Hotseat icons
|
||||
ViewGroup hotseatIcons = hotseat.getShortcutsAndWidgets();
|
||||
disableClipping(hotseat);
|
||||
|
||||
for (int i = 0; i < hotseatIcons.getChildCount(); i++) {
|
||||
View child = hotseatIcons.getChildAt(i);
|
||||
mMoveFromCenterAnimation.registerViewForAnimation(child);
|
||||
}
|
||||
|
||||
onTransitionProgress(0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionProgress(float progress) {
|
||||
mMoveFromCenterAnimation.onTransitionProgress(progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionFinished() {
|
||||
mMoveFromCenterAnimation.onTransitionFinished();
|
||||
mMoveFromCenterAnimation.clearRegisteredViews();
|
||||
|
||||
restoreClipping(mLauncher.getWorkspace());
|
||||
mLauncher.getWorkspace().forEachVisiblePage(page -> restoreClipping((CellLayout) page));
|
||||
restoreClipping(mLauncher.getHotseat());
|
||||
|
||||
mOriginalClipChildren.clear();
|
||||
mOriginalClipToPadding.clear();
|
||||
}
|
||||
|
||||
private void disableClipping(ViewGroup view) {
|
||||
mOriginalClipToPadding.put(view, view.getClipToPadding());
|
||||
mOriginalClipChildren.put(view, view.getClipChildren());
|
||||
view.setClipToPadding(false);
|
||||
view.setClipChildren(false);
|
||||
}
|
||||
|
||||
private void restoreClipping(ViewGroup view) {
|
||||
final Boolean originalClipToPadding = mOriginalClipToPadding.get(view);
|
||||
if (originalClipToPadding != null) {
|
||||
view.setClipToPadding(originalClipToPadding);
|
||||
}
|
||||
final Boolean originalClipChildren = mOriginalClipChildren.get(view);
|
||||
if (originalClipChildren != null) {
|
||||
view.setClipChildren(originalClipChildren);
|
||||
}
|
||||
super.onTransitionFinished();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
@@ -80,7 +81,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
private static final int INDEX_HIDDEN_FLAGS_ALPHA = 3;
|
||||
|
||||
private final MultiValueAlpha mMultiValueAlpha;
|
||||
private View mSplitButton;
|
||||
private Button mSplitButton;
|
||||
|
||||
@ActionsHiddenFlags
|
||||
private int mHiddenFlags;
|
||||
@@ -215,6 +216,10 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
mDp = dp;
|
||||
updateVerticalMargin(SysUINavigationMode.getMode(getContext()));
|
||||
requestLayout();
|
||||
|
||||
mSplitButton.setCompoundDrawablesWithIntrinsicBounds(
|
||||
(dp.isLandscape ? R.drawable.ic_split_horizontal : R.drawable.ic_split_vertical),
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
public void setSplitButtonVisible(boolean visible) {
|
||||
|
||||
@@ -1041,6 +1041,17 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTaskViewFullyVisible(TaskView tv) {
|
||||
if (showAsGrid()) {
|
||||
int screenStart = mOrientationHandler.getPrimaryScroll(this);
|
||||
int screenEnd = screenStart + mOrientationHandler.getMeasuredSize(this);
|
||||
return isTaskViewFullyWithinBounds(tv, screenStart, screenEnd);
|
||||
} else {
|
||||
// For now, just check if it's the active task
|
||||
return indexOfChild(tv) == getNextPage();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private TaskView getLastGridTaskView() {
|
||||
return getLastGridTaskView(getTopRowIdArray(), getBottomRowIdArray());
|
||||
@@ -1087,6 +1098,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
&& taskEnd <= end);
|
||||
}
|
||||
|
||||
private boolean isTaskViewFullyWithinBounds(TaskView tv, int start, int end) {
|
||||
int taskStart = mOrientationHandler.getChildStart(tv) + (int) tv.getOffsetAdjustment(
|
||||
showAsFullscreen(), showAsGrid());
|
||||
int taskSize = (int) (mOrientationHandler.getMeasuredSize(tv) * tv.getSizeAdjustment(
|
||||
showAsFullscreen()));
|
||||
int taskEnd = taskStart + taskSize;
|
||||
return taskStart >= start && taskEnd <= end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the task is in expected scroll position.
|
||||
*
|
||||
@@ -4853,6 +4873,62 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
return mPipCornerRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scrollLeft() {
|
||||
if (!showAsGrid()) {
|
||||
return super.scrollLeft();
|
||||
}
|
||||
|
||||
int targetPage = getNextPage();
|
||||
if (targetPage >= 0) {
|
||||
// Find the next page that is not fully visible.
|
||||
TaskView taskView = getTaskViewAt(targetPage);
|
||||
while ((taskView == null || isTaskViewFullyVisible(taskView)) && targetPage - 1 >= 0) {
|
||||
taskView = getTaskViewAt(--targetPage);
|
||||
}
|
||||
// Target a scroll where targetPage is on left of screen but still fully visible.
|
||||
int lastTaskEnd = (mIsRtl
|
||||
? mLastComputedGridSize.left
|
||||
: mLastComputedGridSize.right)
|
||||
+ (mIsRtl ? mPageSpacing : -mPageSpacing);
|
||||
int normalTaskEnd = mIsRtl
|
||||
? mLastComputedGridTaskSize.left
|
||||
: mLastComputedGridTaskSize.right;
|
||||
int targetScroll = getScrollForPage(targetPage) + normalTaskEnd - lastTaskEnd;
|
||||
// Find a page that is close to targetScroll while not over it.
|
||||
while (targetPage - 1 >= 0
|
||||
&& (mIsRtl
|
||||
? getScrollForPage(targetPage - 1) < targetScroll
|
||||
: getScrollForPage(targetPage - 1) > targetScroll)) {
|
||||
targetPage--;
|
||||
}
|
||||
snapToPage(targetPage);
|
||||
return true;
|
||||
}
|
||||
|
||||
return mAllowOverScroll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scrollRight() {
|
||||
if (!showAsGrid()) {
|
||||
return super.scrollRight();
|
||||
}
|
||||
|
||||
int targetPage = getNextPage();
|
||||
if (targetPage < getChildCount()) {
|
||||
// Find the next page that is not fully visible.
|
||||
TaskView taskView = getTaskViewAt(targetPage);
|
||||
while ((taskView != null && isTaskViewFullyVisible(taskView))
|
||||
&& targetPage + 1 < getChildCount()) {
|
||||
taskView = getTaskViewAt(++targetPage);
|
||||
}
|
||||
snapToPage(targetPage);
|
||||
return true;
|
||||
}
|
||||
return mAllowOverScroll;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
|
||||
super.onScrollChanged(l, t, oldl, oldt);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="16">
|
||||
<path
|
||||
android:pathData="M18,14L13,14L13,2L18,2L18,14ZM20,14L20,2C20,0.9 19.1,-0 18,-0L13,-0C11.9,-0 11,0.9 11,2L11,14C11,15.1 11.9,16 13,16L18,16C19.1,16 20,15.1 20,14ZM7,14L2,14L2,2L7,2L7,14ZM9,14L9,2C9,0.9 8.1,-0 7,-0L2,-0C0.9,-0 -0,0.9 -0,2L-0,14C-0,15.1 0.9,16 2,16L7,16C8.1,16 9,15.1 9,14Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="16">
|
||||
<path
|
||||
android:pathData="M-0,2L-0,14C-0,15.1 0.9,16 2,16L7,16C8.1,16 9,15.1 9,14L9,2C9,0.9 8.1,-0 7,-0L2,-0C0.9,-0 -0,0.9 -0,2ZM13,2L18,2L18,14L13,14L13,2ZM11,2L11,14C11,15.1 11.9,16 13,16L18,16C19.1,16 20,15.1 20,14L20,2C20,0.9 19.1,-0 18,-0L13,-0C11.9,-0 11,0.9 11,2Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="16">
|
||||
<path
|
||||
android:pathData="M20,14L20,2C20,0.9 19.1,-0 18,-0L13,-0C11.9,-0 11,0.9 11,2L11,14C11,15.1 11.9,16 13,16L18,16C19.1,16 20,15.1 20,14ZM7,14L2,14L2,2L7,2L7,14ZM9,14L9,2C9,0.9 8.1,-0 7,-0L2,-0C0.9,-0 -0,0.9 -0,2L-0,14C-0,15.1 0.9,16 2,16L7,16C8.1,16 9,15.1 9,14Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="16dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="16"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M14,0H2C0.9,0 0,0.9 0,2V7C0,8.1 0.9,9 2,9H14C15.1,9 16,8.1 16,7V2C16,0.9 15.1,0 14,0ZM14,13V18H2V13H14ZM14,11H2C0.9,11 0,11.9 0,13V18C0,19.1 0.9,20 2,20H14C15.1,20 16,19.1 16,18V13C16,11.9 15.1,11 14,11Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M18,4V9H6V4H18ZM18,2H6C4.9,2 4,2.9 4,4V9C4,10.1 4.9,11 6,11H18C19.1,11 20,10.1 20,9V4C20,2.9 19.1,2 18,2ZM18,15V20H6V15H18ZM18,13H6C4.9,13 4,13.9 4,15V20C4,21.1 4.9,22 6,22H18C19.1,22 20,21.1 20,20V15C20,13.9 19.1,13 18,13Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -1749,20 +1749,23 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(info);
|
||||
final boolean pagesFlipped = isPageOrderFlipped();
|
||||
int offset = (mAllowOverScroll ? 0 : 1);
|
||||
info.setScrollable(getPageCount() > offset);
|
||||
if (getCurrentPage() < getPageCount() - offset) {
|
||||
info.setScrollable(getPageCount() > 0);
|
||||
int primaryScroll = mOrientationHandler.getPrimaryScroll(this);
|
||||
if (getCurrentPage() < getPageCount() - getPanelCount()
|
||||
|| (getCurrentPage() == getPageCount() - getPanelCount()
|
||||
&& primaryScroll != getScrollForPage(getPageCount() - getPanelCount()))) {
|
||||
info.addAction(pagesFlipped ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
|
||||
info.addAction(mIsRtl ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT);
|
||||
}
|
||||
if (getCurrentPage() >= offset) {
|
||||
if (getCurrentPage() > 0
|
||||
|| (getCurrentPage() == 0 && primaryScroll != getScrollForPage(0))) {
|
||||
info.addAction(pagesFlipped ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
|
||||
info.addAction(mIsRtl ?
|
||||
AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_RIGHT
|
||||
: AccessibilityNodeInfo.AccessibilityAction.ACTION_PAGE_LEFT);
|
||||
@@ -1807,16 +1810,16 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
} break;
|
||||
case android.R.id.accessibilityActionPageRight: {
|
||||
if (!mIsRtl) {
|
||||
return scrollRight();
|
||||
return scrollRight();
|
||||
} else {
|
||||
return scrollLeft();
|
||||
return scrollLeft();
|
||||
}
|
||||
}
|
||||
case android.R.id.accessibilityActionPageLeft: {
|
||||
if (!mIsRtl) {
|
||||
return scrollLeft();
|
||||
return scrollLeft();
|
||||
} else {
|
||||
return scrollRight();
|
||||
return scrollRight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
|
||||
// Add "left" side of phone which is actually the top
|
||||
return Collections.singletonList(new SplitPositionOption(
|
||||
R.drawable.ic_split_screen, R.string.split_screen_position_left,
|
||||
R.drawable.ic_split_left, R.string.split_screen_position_left,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
}
|
||||
|
||||
|
||||
@@ -370,28 +370,27 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
|
||||
List<SplitPositionOption> options = new ArrayList<>(1);
|
||||
// Add both left and right options if we're in tablet mode
|
||||
// TODO: Add in correct icons
|
||||
if (dp.isTablet && dp.isLandscape) {
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_screen, R.string.split_screen_position_right,
|
||||
R.drawable.ic_split_right, R.string.split_screen_position_right,
|
||||
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_screen, R.string.split_screen_position_left,
|
||||
R.drawable.ic_split_left, R.string.split_screen_position_left,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
} else {
|
||||
if (dp.isSeascape()) {
|
||||
// Add left/right options
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_screen, R.string.split_screen_position_right,
|
||||
R.drawable.ic_split_right, R.string.split_screen_position_right,
|
||||
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
|
||||
} else if (dp.isLandscape) {
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_screen, R.string.split_screen_position_left,
|
||||
R.drawable.ic_split_left, R.string.split_screen_position_left,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
} else {
|
||||
// Only add top option
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_screen, R.string.split_screen_position_top,
|
||||
R.drawable.ic_split_top, R.string.split_screen_position_top,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
|
||||
// Add "right" option which is actually the top
|
||||
return Collections.singletonList(new SplitPositionOption(
|
||||
R.drawable.ic_split_screen, R.string.split_screen_position_right,
|
||||
R.drawable.ic_split_right, R.string.split_screen_position_right,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user