Snap for 7968112 from ad890ac5af to sc-v2-release
Change-Id: I0cbddcffd031e9ccc24a4c088fdfef8918f365b2
This commit is contained in:
+9
-1
@@ -258,6 +258,10 @@ android_library {
|
||||
"go/res",
|
||||
"go/quickstep/res",
|
||||
],
|
||||
// Note the ordering here is important when it comes to resource
|
||||
// overriding. We want the most specific resource overrides defined
|
||||
// in QuickstepResLib to take precendece, so it should be the final
|
||||
// dependency. See b/205278434 for how this can go wrong.
|
||||
static_libs: [
|
||||
"Launcher3CommonDepsLib",
|
||||
"QuickstepResLib",
|
||||
@@ -283,11 +287,15 @@ android_library {
|
||||
libs: [
|
||||
"framework-statsd",
|
||||
],
|
||||
// Note the ordering here is important when it comes to resource
|
||||
// overriding. We want the most specific resource overrides defined
|
||||
// in QuickstepResLib to take precendece, so it should be the final
|
||||
// dependency. See b/208647810 for how this can go wrong.
|
||||
static_libs: [
|
||||
"QuickstepResLib",
|
||||
"SystemUI-statsd",
|
||||
"SystemUISharedLib",
|
||||
"Launcher3CommonDepsLib",
|
||||
"QuickstepResLib",
|
||||
],
|
||||
manifest: "quickstep/AndroidManifest.xml",
|
||||
platform_apis: true,
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -55,6 +55,7 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -96,6 +97,7 @@ import com.android.quickstep.GestureState.GestureEndTarget;
|
||||
import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle;
|
||||
import com.android.quickstep.util.ActiveGestureLog;
|
||||
import com.android.quickstep.util.ActivityInitListener;
|
||||
import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter;
|
||||
import com.android.quickstep.util.AnimatorControllerWithResistance;
|
||||
import com.android.quickstep.util.InputConsumerProxy;
|
||||
import com.android.quickstep.util.InputProxyHandlerFactory;
|
||||
@@ -153,6 +155,17 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
protected MultiStateCallback mStateCallback;
|
||||
protected boolean mCanceled;
|
||||
private boolean mRecentsViewScrollLinked = false;
|
||||
private final ActivityLifecycleCallbacksAdapter mLifecycleCallbacks =
|
||||
new ActivityLifecycleCallbacksAdapter() {
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
if (mActivity != activity) {
|
||||
return;
|
||||
}
|
||||
mRecentsView = null;
|
||||
mActivity = null;
|
||||
}
|
||||
};
|
||||
|
||||
private static int getFlagForIndex(int index, String name) {
|
||||
if (DEBUG_STATES) {
|
||||
@@ -416,6 +429,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
setupRecentsViewUi();
|
||||
linkRecentsViewScroll();
|
||||
|
||||
mActivity.registerActivityLifecycleCallbacks(mLifecycleCallbacks);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1542,6 +1556,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
|
||||
private void reset() {
|
||||
mStateCallback.setStateOnUiThread(STATE_HANDLER_INVALIDATED);
|
||||
if (mActivity != null) {
|
||||
mActivity.unregisterActivityLifecycleCallbacks(mLifecycleCallbacks);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -115,8 +115,6 @@ public class LauncherSwipeHandlerV2 extends
|
||||
}
|
||||
|
||||
private HomeAnimationFactory createIconHomeAnimationFactory(View workspaceView) {
|
||||
final ResourceProvider rp = DynamicResource.provider(mActivity);
|
||||
final float transY = dpToPx(rp.getFloat(R.dimen.swipe_up_trans_y_dp));
|
||||
RectF iconLocation = new RectF();
|
||||
FloatingIconView floatingIconView = getFloatingIconView(mActivity, workspaceView,
|
||||
true /* hideOriginal */, iconLocation, false /* isOpening */);
|
||||
@@ -127,19 +125,15 @@ public class LauncherSwipeHandlerV2 extends
|
||||
|
||||
return new FloatingViewHomeAnimationFactory(floatingIconView) {
|
||||
|
||||
// There is a delay in loading the icon, so we need to keep the window
|
||||
// opaque until it is ready.
|
||||
private boolean mIsFloatingIconReady = false;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected View getViewIgnoredInWorkspaceRevealAnimation() {
|
||||
return workspaceView;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RectF getWindowTargetRect() {
|
||||
super.getWindowTargetRect();
|
||||
return iconLocation;
|
||||
}
|
||||
|
||||
@@ -151,15 +145,6 @@ public class LauncherSwipeHandlerV2 extends
|
||||
floatingIconView.setFastFinishRunnable(anim::end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keepWindowOpaque() {
|
||||
if (mIsFloatingIconReady || floatingIconView.isVisibleToUser()) {
|
||||
mIsFloatingIconReady = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(RectF currentRect, float progress, float radius) {
|
||||
super.update(currentRect, progress, radius);
|
||||
@@ -214,11 +199,6 @@ public class LauncherSwipeHandlerV2 extends
|
||||
floatingWidgetView.setFastFinishRunnable(anim::end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keepWindowOpaque() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(RectF currentRect, float progress, float radius) {
|
||||
super.update(currentRect, progress, radius);
|
||||
|
||||
@@ -183,8 +183,6 @@ public abstract class SwipeUpAnimationLogic implements
|
||||
|
||||
public void setAnimation(RectFSpringAnim anim) { }
|
||||
|
||||
public boolean keepWindowOpaque() { return false; }
|
||||
|
||||
public void update(RectF currentRect, float progress, float radius) { }
|
||||
|
||||
public void onCancel() { }
|
||||
@@ -338,9 +336,6 @@ public abstract class SwipeUpAnimationLogic implements
|
||||
mMatrix.setRectToRect(mCropRectF, mWindowCurrentRect, ScaleToFit.FILL);
|
||||
float cornerRadius = Utilities.mapRange(progress, mStartRadius, mEndRadius);
|
||||
float alpha = mAnimationFactory.getWindowAlpha(progress);
|
||||
if (mAnimationFactory.keepWindowOpaque()) {
|
||||
alpha = 1f;
|
||||
}
|
||||
mLocalTransformParams
|
||||
.setTargetAlpha(alpha)
|
||||
.setCornerRadius(cornerRadius);
|
||||
|
||||
@@ -316,7 +316,7 @@ public final class TaskViewUtils {
|
||||
mt[i] = localMt;
|
||||
|
||||
Matrix localMti = new Matrix();
|
||||
localMti.invert(localMt);
|
||||
localMt.invert(localMti);
|
||||
mti[i] = localMti;
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ public class GroupedTaskView extends TaskView {
|
||||
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
|
||||
getPagedOrientationHandler().setSplitIconParams(mIconView, mIconView2,
|
||||
taskIconHeight, mSnapshotView.getWidth(), mSnapshotView.getHeight(),
|
||||
taskIconHeight, mSnapshotView.getMeasuredWidth(), mSnapshotView.getMeasuredHeight(),
|
||||
isRtl, deviceProfile, mSplitBoundsConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -300,6 +300,7 @@
|
||||
<dimen name="snackbar_elevation">3dp</dimen>
|
||||
<dimen name="snackbar_min_text_size">12sp</dimen>
|
||||
<dimen name="snackbar_max_text_size">14sp</dimen>
|
||||
<dimen name="snackbar_max_width">504dp</dimen>
|
||||
|
||||
<!-- Developer Options -->
|
||||
<dimen name="developer_options_filter_margins">10dp</dimen>
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -542,17 +541,18 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
|
||||
if (deviceProfile.isLandscape) {
|
||||
primaryIconParams.gravity = TOP | START;
|
||||
primaryIconView.setTranslationX(primarySnapshotWidth - primaryIconView.getWidth());
|
||||
primaryIconView.setTranslationX(
|
||||
primarySnapshotWidth - primaryIconView.getMeasuredWidth());
|
||||
primaryIconView.setTranslationY(0);
|
||||
secondaryIconParams.gravity = TOP | START;
|
||||
secondaryIconView.setTranslationX(primarySnapshotWidth + dividerBar);
|
||||
} else {
|
||||
primaryIconParams.gravity = TOP | CENTER_HORIZONTAL;
|
||||
primaryIconView.setTranslationX(-(primaryIconView.getWidth()) / 2f);
|
||||
primaryIconView.setTranslationX(-(primaryIconView.getMeasuredWidth()) / 2f);
|
||||
primaryIconView.setTranslationY(0);
|
||||
|
||||
secondaryIconParams.gravity = TOP | CENTER_HORIZONTAL;
|
||||
secondaryIconView.setTranslationX(secondaryIconView.getWidth() / 2f);
|
||||
secondaryIconView.setTranslationX(secondaryIconView.getMeasuredWidth() / 2f);
|
||||
}
|
||||
secondaryIconView.setTranslationY(0);
|
||||
primaryIconView.setLayoutParams(primaryIconParams);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application.ActivityLifecycleCallbacks;
|
||||
import android.os.Bundle;
|
||||
|
||||
public interface ActivityLifecycleCallbacksAdapter extends ActivityLifecycleCallbacks {
|
||||
|
||||
default void onActivityCreated(Activity activity, Bundle bundle) {
|
||||
}
|
||||
|
||||
default void onActivityDestroyed(Activity activity) {
|
||||
}
|
||||
|
||||
default void onActivityPaused(Activity activity) {
|
||||
}
|
||||
|
||||
default void onActivityResumed(Activity activity) {
|
||||
}
|
||||
|
||||
default void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
||||
}
|
||||
|
||||
default void onActivityStarted(Activity activity) {
|
||||
}
|
||||
|
||||
default void onActivityStopped(Activity activity) {
|
||||
}
|
||||
}
|
||||
@@ -88,9 +88,14 @@ public class Snackbar extends AbstractFloatingView {
|
||||
int maxMarginLeftRight = res.getDimensionPixelSize(R.dimen.snackbar_max_margin_left_right);
|
||||
int minMarginLeftRight = res.getDimensionPixelSize(R.dimen.snackbar_min_margin_left_right);
|
||||
int marginBottom = res.getDimensionPixelSize(R.dimen.snackbar_margin_bottom);
|
||||
int absoluteMaxWidth = res.getDimensionPixelSize(R.dimen.snackbar_max_width);
|
||||
Rect insets = activity.getDeviceProfile().getInsets();
|
||||
int maxWidth = dragLayer.getWidth() - minMarginLeftRight * 2 - insets.left - insets.right;
|
||||
int minWidth = dragLayer.getWidth() - maxMarginLeftRight * 2 - insets.left - insets.right;
|
||||
int maxWidth = Math.min(
|
||||
dragLayer.getWidth() - minMarginLeftRight * 2 - insets.left - insets.right,
|
||||
absoluteMaxWidth);
|
||||
int minWidth = Math.min(
|
||||
dragLayer.getWidth() - maxMarginLeftRight * 2 - insets.left - insets.right,
|
||||
absoluteMaxWidth);
|
||||
params.width = minWidth;
|
||||
params.setMargins(0, 0, 0, marginBottom + insets.bottom);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user