Snap for 8827652 from bf7df8e7d2 to udc-release
Change-Id: Ibf146ac5bd0baa5c73a8f8cd505ba110f4324dbc
This commit is contained in:
commit
b4e649527d
47 files changed
+6684
-855
No files matched your search
@@ -36,6 +36,7 @@
|
||||
<dimen name="task_thumbnail_icon_drawable_size">44dp</dimen>
|
||||
<dimen name="overview_task_margin">16dp</dimen>
|
||||
<dimen name="overview_page_spacing">16dp</dimen>
|
||||
<dimen name="task_icon_cache_default_icon_size">72dp</dimen>
|
||||
|
||||
<item name="overview_max_scale" format="float" type="dimen">0.7</item>
|
||||
<item name="overview_modal_max_scale" format="float" type="dimen">1.1</item>
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.uioverrides.ApiWrapper;
|
||||
import com.android.launcher3.uioverrides.PredictedAppIcon;
|
||||
import com.android.launcher3.views.AbstractSlideInView;
|
||||
|
||||
@@ -107,8 +106,7 @@ public class HotseatEduDialog extends AbstractSlideInView<Launcher> implements I
|
||||
mDismissBtn.setOnClickListener(this::onDismiss);
|
||||
|
||||
LinearLayout buttonContainer = findViewById(R.id.button_container);
|
||||
int adjustedMarginEnd = ApiWrapper.getHotseatEndOffset(context)
|
||||
- buttonContainer.getPaddingEnd();
|
||||
int adjustedMarginEnd = grid.hotseatBarEndOffset - buttonContainer.getPaddingEnd();
|
||||
if (InvariantDeviceProfile.INSTANCE.get(context)
|
||||
.getDeviceProfile(context).isTaskbarPresent && adjustedMarginEnd > 0) {
|
||||
((LinearLayout.LayoutParams) buttonContainer.getLayoutParams()).setMarginEnd(
|
||||
|
||||
@@ -17,9 +17,11 @@ package com.android.launcher3.taskbar
|
||||
|
||||
import android.graphics.Insets
|
||||
import android.graphics.Region
|
||||
import android.view.InsetsFrameProvider
|
||||
import android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES
|
||||
import android.view.InsetsState
|
||||
import android.view.WindowManager
|
||||
import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD
|
||||
import com.android.launcher3.AbstractFloatingView
|
||||
import com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS
|
||||
import com.android.launcher3.DeviceProfile
|
||||
@@ -87,8 +89,14 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
|
||||
}
|
||||
|
||||
var imeInsetsSize = Insets.of(0, 0, 0, taskbarHeightForIme)
|
||||
var insetsSizeOverride = arrayOf(
|
||||
InsetsFrameProvider.InsetsSizeOverride(
|
||||
TYPE_INPUT_METHOD,
|
||||
imeInsetsSize
|
||||
)
|
||||
)
|
||||
for (provider in windowLayoutParams.providedInsets) {
|
||||
provider.imeInsetsSize = imeInsetsSize
|
||||
provider.insetsSizeOverrides = insetsSizeOverride
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,9 +149,16 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
|
||||
pw.println(prefix + "TaskbarInsetsController:")
|
||||
pw.println("$prefix\twindowHeight=${windowLayoutParams.height}")
|
||||
for (provider in windowLayoutParams.providedInsets) {
|
||||
pw.println("$prefix\tprovidedInsets: (type=" + InsetsState.typeToString(provider.type)
|
||||
+ " insetsSize=" + provider.insetsSize
|
||||
+ " imeInsetsSize=" + provider.imeInsetsSize + ")")
|
||||
pw.print("$prefix\tprovidedInsets: (type=" + InsetsState.typeToString(provider.type)
|
||||
+ " insetsSize=" + provider.insetsSize)
|
||||
if (provider.insetsSizeOverrides != null) {
|
||||
pw.print(" insetsSizeOverrides={")
|
||||
for (overrideSize in provider.insetsSizeOverrides) {
|
||||
pw.print(overrideSize)
|
||||
}
|
||||
pw.print("})")
|
||||
}
|
||||
pw.println()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,6 @@ import com.android.launcher3.icons.ThemedIconDrawable;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.uioverrides.ApiWrapper;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.views.AllAppsButton;
|
||||
@@ -292,7 +291,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
countExcludingQsb--;
|
||||
}
|
||||
int spaceNeeded = countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize);
|
||||
int navSpaceNeeded = ApiWrapper.getHotseatEndOffset(getContext());
|
||||
int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
|
||||
boolean layoutRtl = isLayoutRtl();
|
||||
int iconEnd = right - (right - left - spaceNeeded) / 2;
|
||||
boolean needMoreSpaceForNav = layoutRtl ?
|
||||
|
||||
@@ -17,14 +17,9 @@
|
||||
package com.android.launcher3.uioverrides;
|
||||
|
||||
import android.app.Person;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.DisplayController.NavigationMode;
|
||||
|
||||
public class ApiWrapper {
|
||||
|
||||
@@ -34,24 +29,4 @@ public class ApiWrapper {
|
||||
Person[] persons = si.getPersons();
|
||||
return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum space that should be left empty at the end of hotseat
|
||||
*/
|
||||
public static int getHotseatEndOffset(Context context) {
|
||||
if (DisplayController.getNavigationMode(context) == NavigationMode.THREE_BUTTONS) {
|
||||
Resources res = context.getResources();
|
||||
/*
|
||||
* 3 nav buttons +
|
||||
* Little space at the end for contextual buttons +
|
||||
* Little space between icons and nav buttons
|
||||
*/
|
||||
return 3 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size)
|
||||
+ res.getDimensionPixelSize(R.dimen.taskbar_contextual_button_margin)
|
||||
+ res.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TR
|
||||
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
|
||||
import static com.android.launcher3.testing.TestProtocol.BAD_STATE;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.OVERVIEW_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
|
||||
@@ -74,6 +75,7 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness());
|
||||
RECENTS_GRID_PROGRESS.set(mRecentsView,
|
||||
state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f);
|
||||
OVERVIEW_PROGRESS.set(mRecentsView, state == LauncherState.OVERVIEW ? 1f : 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,6 +119,9 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
boolean showAsGrid = toState.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile());
|
||||
setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, showAsGrid ? 1f : 0f,
|
||||
showAsGrid ? INSTANT : FINAL_FRAME);
|
||||
|
||||
setter.setFloat(mRecentsView, OVERVIEW_PROGRESS,
|
||||
toState == LauncherState.OVERVIEW ? 1f : 0f, INSTANT);
|
||||
}
|
||||
|
||||
abstract FloatProperty getTaskModalnessProperty();
|
||||
|
||||
@@ -141,7 +141,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
RecentsAnimationCallbacks.RecentsAnimationListener {
|
||||
private static final String TAG = "AbsSwipeUpHandler";
|
||||
|
||||
private static final String[] STATE_NAMES = DEBUG_STATES ? new String[17] : null;
|
||||
private static final ArrayList<String> STATE_NAMES = new ArrayList<>();
|
||||
|
||||
protected final BaseActivityInterface<S, T> mActivityInterface;
|
||||
protected final InputConsumerProxy mInputConsumerProxy;
|
||||
@@ -172,59 +172,62 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
}
|
||||
};
|
||||
|
||||
private static int getFlagForIndex(int index, String name) {
|
||||
private static int FLAG_COUNT = 0;
|
||||
private static int getNextStateFlag(String name) {
|
||||
if (DEBUG_STATES) {
|
||||
STATE_NAMES[index] = name;
|
||||
STATE_NAMES.add(name);
|
||||
}
|
||||
return 1 << index;
|
||||
int index = 1 << FLAG_COUNT;
|
||||
FLAG_COUNT++;
|
||||
return index;
|
||||
}
|
||||
|
||||
// Launcher UI related states
|
||||
protected static final int STATE_LAUNCHER_PRESENT =
|
||||
getFlagForIndex(0, "STATE_LAUNCHER_PRESENT");
|
||||
getNextStateFlag("STATE_LAUNCHER_PRESENT");
|
||||
protected static final int STATE_LAUNCHER_STARTED =
|
||||
getFlagForIndex(1, "STATE_LAUNCHER_STARTED");
|
||||
getNextStateFlag("STATE_LAUNCHER_STARTED");
|
||||
protected static final int STATE_LAUNCHER_DRAWN =
|
||||
getFlagForIndex(2, "STATE_LAUNCHER_DRAWN");
|
||||
getNextStateFlag("STATE_LAUNCHER_DRAWN");
|
||||
// Called when the Launcher has connected to the touch interaction service (and the taskbar
|
||||
// ui controller is initialized)
|
||||
protected static final int STATE_LAUNCHER_BIND_TO_SERVICE =
|
||||
getFlagForIndex(3, "STATE_LAUNCHER_BIND_TO_SERVICE");
|
||||
getNextStateFlag("STATE_LAUNCHER_BIND_TO_SERVICE");
|
||||
|
||||
// Internal initialization states
|
||||
private static final int STATE_APP_CONTROLLER_RECEIVED =
|
||||
getFlagForIndex(4, "STATE_APP_CONTROLLER_RECEIVED");
|
||||
getNextStateFlag("STATE_APP_CONTROLLER_RECEIVED");
|
||||
|
||||
// Interaction finish states
|
||||
private static final int STATE_SCALED_CONTROLLER_HOME =
|
||||
getFlagForIndex(5, "STATE_SCALED_CONTROLLER_HOME");
|
||||
getNextStateFlag("STATE_SCALED_CONTROLLER_HOME");
|
||||
private static final int STATE_SCALED_CONTROLLER_RECENTS =
|
||||
getFlagForIndex(6, "STATE_SCALED_CONTROLLER_RECENTS");
|
||||
getNextStateFlag("STATE_SCALED_CONTROLLER_RECENTS");
|
||||
|
||||
protected static final int STATE_HANDLER_INVALIDATED =
|
||||
getFlagForIndex(7, "STATE_HANDLER_INVALIDATED");
|
||||
getNextStateFlag("STATE_HANDLER_INVALIDATED");
|
||||
private static final int STATE_GESTURE_STARTED =
|
||||
getFlagForIndex(8, "STATE_GESTURE_STARTED");
|
||||
getNextStateFlag("STATE_GESTURE_STARTED");
|
||||
private static final int STATE_GESTURE_CANCELLED =
|
||||
getFlagForIndex(9, "STATE_GESTURE_CANCELLED");
|
||||
getNextStateFlag("STATE_GESTURE_CANCELLED");
|
||||
private static final int STATE_GESTURE_COMPLETED =
|
||||
getFlagForIndex(10, "STATE_GESTURE_COMPLETED");
|
||||
getNextStateFlag("STATE_GESTURE_COMPLETED");
|
||||
|
||||
private static final int STATE_CAPTURE_SCREENSHOT =
|
||||
getFlagForIndex(11, "STATE_CAPTURE_SCREENSHOT");
|
||||
getNextStateFlag("STATE_CAPTURE_SCREENSHOT");
|
||||
protected static final int STATE_SCREENSHOT_CAPTURED =
|
||||
getFlagForIndex(12, "STATE_SCREENSHOT_CAPTURED");
|
||||
getNextStateFlag("STATE_SCREENSHOT_CAPTURED");
|
||||
private static final int STATE_SCREENSHOT_VIEW_SHOWN =
|
||||
getFlagForIndex(13, "STATE_SCREENSHOT_VIEW_SHOWN");
|
||||
getNextStateFlag("STATE_SCREENSHOT_VIEW_SHOWN");
|
||||
|
||||
private static final int STATE_RESUME_LAST_TASK =
|
||||
getFlagForIndex(14, "STATE_RESUME_LAST_TASK");
|
||||
getNextStateFlag("STATE_RESUME_LAST_TASK");
|
||||
private static final int STATE_START_NEW_TASK =
|
||||
getFlagForIndex(15, "STATE_START_NEW_TASK");
|
||||
getNextStateFlag("STATE_START_NEW_TASK");
|
||||
private static final int STATE_CURRENT_TASK_FINISHED =
|
||||
getFlagForIndex(16, "STATE_CURRENT_TASK_FINISHED");
|
||||
getNextStateFlag("STATE_CURRENT_TASK_FINISHED");
|
||||
private static final int STATE_FINISH_WITH_NO_END =
|
||||
getFlagForIndex(17, "STATE_FINISH_WITH_NO_END");
|
||||
getNextStateFlag("STATE_FINISH_WITH_NO_END");
|
||||
|
||||
private static final int LAUNCHER_UI_STATES =
|
||||
STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN | STATE_LAUNCHER_STARTED |
|
||||
@@ -318,7 +321,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
}
|
||||
|
||||
private void initStateCallbacks() {
|
||||
mStateCallback = new MultiStateCallback(STATE_NAMES);
|
||||
mStateCallback = new MultiStateCallback(STATE_NAMES.toArray(new String[0]));
|
||||
|
||||
mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT | STATE_GESTURE_STARTED,
|
||||
this::onLauncherPresentAndGestureStarted);
|
||||
|
||||
@@ -60,7 +60,6 @@ import com.android.launcher3.views.ScrimView;
|
||||
import com.android.quickstep.util.ActivityInitListener;
|
||||
import com.android.quickstep.util.AnimatorControllerWithResistance;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.quickstep.views.TaskView;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
|
||||
@@ -280,17 +279,8 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
public static void getTaskDimension(DeviceProfile dp, PointF out) {
|
||||
out.x = dp.widthPx;
|
||||
out.y = dp.heightPx;
|
||||
if (TaskView.clipLeft(dp)) {
|
||||
out.x -= dp.getInsets().left;
|
||||
}
|
||||
if (TaskView.clipRight(dp)) {
|
||||
out.x -= dp.getInsets().right;
|
||||
}
|
||||
if (TaskView.clipTop(dp)) {
|
||||
out.y -= dp.getInsets().top;
|
||||
}
|
||||
if (TaskView.clipBottom(dp)) {
|
||||
out.y -= Math.max(dp.getInsets().bottom, dp.taskbarSize);
|
||||
if (dp.isTablet) {
|
||||
out.y -= dp.taskbarSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -82,11 +83,11 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
|
||||
private static final String TAG = "GestureState";
|
||||
|
||||
private static final ArrayList<String> STATE_NAMES = new ArrayList<>();
|
||||
private static final List<String> STATE_NAMES = new ArrayList<>();
|
||||
public static final GestureState DEFAULT_STATE = new GestureState();
|
||||
|
||||
private static int FLAG_COUNT = 0;
|
||||
private static int getFlagForIndex(String name) {
|
||||
private static int getNextStateFlag(String name) {
|
||||
if (DEBUG_STATES) {
|
||||
STATE_NAMES.add(name);
|
||||
}
|
||||
@@ -97,36 +98,36 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
|
||||
// Called when the end target as been set
|
||||
public static final int STATE_END_TARGET_SET =
|
||||
getFlagForIndex("STATE_END_TARGET_SET");
|
||||
getNextStateFlag("STATE_END_TARGET_SET");
|
||||
|
||||
// Called when the end target animation has finished
|
||||
public static final int STATE_END_TARGET_ANIMATION_FINISHED =
|
||||
getFlagForIndex("STATE_END_TARGET_ANIMATION_FINISHED");
|
||||
getNextStateFlag("STATE_END_TARGET_ANIMATION_FINISHED");
|
||||
|
||||
// Called when the recents animation has been requested to start
|
||||
public static final int STATE_RECENTS_ANIMATION_INITIALIZED =
|
||||
getFlagForIndex("STATE_RECENTS_ANIMATION_INITIALIZED");
|
||||
getNextStateFlag("STATE_RECENTS_ANIMATION_INITIALIZED");
|
||||
|
||||
// Called when the recents animation is started and the TaskAnimationManager has been updated
|
||||
// with the controller and targets
|
||||
public static final int STATE_RECENTS_ANIMATION_STARTED =
|
||||
getFlagForIndex("STATE_RECENTS_ANIMATION_STARTED");
|
||||
getNextStateFlag("STATE_RECENTS_ANIMATION_STARTED");
|
||||
|
||||
// Called when the recents animation is canceled
|
||||
public static final int STATE_RECENTS_ANIMATION_CANCELED =
|
||||
getFlagForIndex("STATE_RECENTS_ANIMATION_CANCELED");
|
||||
getNextStateFlag("STATE_RECENTS_ANIMATION_CANCELED");
|
||||
|
||||
// Called when the recents animation finishes
|
||||
public static final int STATE_RECENTS_ANIMATION_FINISHED =
|
||||
getFlagForIndex("STATE_RECENTS_ANIMATION_FINISHED");
|
||||
getNextStateFlag("STATE_RECENTS_ANIMATION_FINISHED");
|
||||
|
||||
// Always called when the recents animation ends (regardless of cancel or finish)
|
||||
public static final int STATE_RECENTS_ANIMATION_ENDED =
|
||||
getFlagForIndex("STATE_RECENTS_ANIMATION_ENDED");
|
||||
getNextStateFlag("STATE_RECENTS_ANIMATION_ENDED");
|
||||
|
||||
// Called when RecentsView stops scrolling and settles on a TaskView.
|
||||
public static final int STATE_RECENTS_SCROLLING_FINISHED =
|
||||
getFlagForIndex("STATE_RECENTS_SCROLLING_FINISHED");
|
||||
getNextStateFlag("STATE_RECENTS_SCROLLING_FINISHED");
|
||||
|
||||
// Needed to interact with the current activity
|
||||
private final Intent mHomeIntent;
|
||||
|
||||
@@ -263,7 +263,8 @@ public class TaskIconCache implements DisplayInfoChangeListener {
|
||||
if (mIconFactory == null) {
|
||||
mIconFactory = new BaseIconFactory(mContext,
|
||||
DisplayController.INSTANCE.get(mContext).getInfo().getDensityDpi(),
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.taskbar_icon_size));
|
||||
mContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.task_icon_cache_default_icon_size));
|
||||
}
|
||||
return mIconFactory;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
|
||||
import static com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET;
|
||||
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.OVERVIEW_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
import static com.android.quickstep.views.RecentsView.TASK_MODALNESS;
|
||||
@@ -105,6 +106,8 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
|
||||
boolean showAsGrid = state.displayOverviewTasksAsGrid(mActivity.getDeviceProfile());
|
||||
setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, showAsGrid ? 1f : 0f,
|
||||
showAsGrid ? INSTANT : FINAL_FRAME);
|
||||
setter.setFloat(mRecentsView, OVERVIEW_PROGRESS, state == RecentsState.DEFAULT ? 1f : 0f,
|
||||
INSTANT);
|
||||
|
||||
setter.setViewBackgroundColor(mActivity.getScrimView(), state.getScrimColor(mActivity),
|
||||
config.getInterpolator(ANIM_SCRIM_FADE, LINEAR));
|
||||
|
||||
@@ -83,6 +83,8 @@ public class AllSetActivity extends Activity {
|
||||
|
||||
private static final int MAX_SWIPE_DURATION = 350;
|
||||
|
||||
private static final float ANIMATION_PAUSE_ALPHA_THRESHOLD = 0.1f;
|
||||
|
||||
private TISBindHelper mTISBindHelper;
|
||||
private TISBinder mBinder;
|
||||
|
||||
@@ -145,6 +147,10 @@ public class AllSetActivity extends Activity {
|
||||
}
|
||||
|
||||
private void runOnUiHelperThread(Runnable runnable) {
|
||||
if (!isResumed()
|
||||
|| getContentViewAlphaForSwipeProgress() <= ANIMATION_PAUSE_ALPHA_THRESHOLD) {
|
||||
return;
|
||||
}
|
||||
Executors.UI_HELPER_EXECUTOR.execute(runnable);
|
||||
}
|
||||
|
||||
@@ -198,6 +204,7 @@ public class AllSetActivity extends Activity {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
maybeResumeOrPauseBackgroundAnimation();
|
||||
if (mBinder != null) {
|
||||
mBinder.getTaskbarManager().setSetupUIVisible(true);
|
||||
mBinder.setSwipeUpProxy(this::createSwipeUpProxy);
|
||||
@@ -216,6 +223,7 @@ public class AllSetActivity extends Activity {
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
clearBinderOverride();
|
||||
maybeResumeOrPauseBackgroundAnimation();
|
||||
if (mSwipeProgress.value >= 1) {
|
||||
finishAndRemoveTask();
|
||||
}
|
||||
@@ -250,10 +258,25 @@ public class AllSetActivity extends Activity {
|
||||
return mSwipeProgress;
|
||||
}
|
||||
|
||||
private float getContentViewAlphaForSwipeProgress() {
|
||||
return Utilities.mapBoundToRange(
|
||||
mSwipeProgress.value, 0, HINT_BOTTOM_FACTOR, 1, 0, LINEAR);
|
||||
}
|
||||
|
||||
private void maybeResumeOrPauseBackgroundAnimation() {
|
||||
boolean shouldPlayAnimation =
|
||||
getContentViewAlphaForSwipeProgress() > ANIMATION_PAUSE_ALPHA_THRESHOLD
|
||||
&& isResumed();
|
||||
if (mAnimatedBackground.isAnimating() && !shouldPlayAnimation) {
|
||||
mAnimatedBackground.pauseAnimation();
|
||||
} else if (!mAnimatedBackground.isAnimating() && shouldPlayAnimation) {
|
||||
mAnimatedBackground.resumeAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
private void onSwipeProgressUpdate() {
|
||||
mBackground.setProgress(mSwipeProgress.value);
|
||||
float alpha = Utilities.mapBoundToRange(
|
||||
mSwipeProgress.value, 0, HINT_BOTTOM_FACTOR, 1, 0, LINEAR);
|
||||
float alpha = getContentViewAlphaForSwipeProgress();
|
||||
mContentView.setAlpha(alpha);
|
||||
mContentView.setTranslationY((alpha - 1) * mSwipeUpShift);
|
||||
|
||||
@@ -265,12 +288,7 @@ public class AllSetActivity extends Activity {
|
||||
mLauncherStartAnim.setPlayFraction(Utilities.mapBoundToRange(
|
||||
mSwipeProgress.value, 0, 1, 0, 1, FAST_OUT_SLOW_IN));
|
||||
}
|
||||
|
||||
if (alpha == 0f) {
|
||||
mAnimatedBackground.pauseAnimation();
|
||||
} else if (!mAnimatedBackground.isAnimating()) {
|
||||
mAnimatedBackground.resumeAnimation();
|
||||
}
|
||||
maybeResumeOrPauseBackgroundAnimation();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,6 @@ import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.quickstep.BaseActivityInterface;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TaskAnimationManager;
|
||||
import com.android.quickstep.views.TaskView;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.util.function.IntConsumer;
|
||||
@@ -399,31 +398,10 @@ public class RecentsOrientedState implements
|
||||
* Returns the scale and pivot so that the provided taskRect can fit the provided full size
|
||||
*/
|
||||
public float getFullScreenScaleAndPivot(Rect taskView, DeviceProfile dp, PointF outPivot) {
|
||||
Rect insets = dp.getInsets();
|
||||
float fullWidth = dp.widthPx;
|
||||
float fullHeight = dp.heightPx;
|
||||
if (TaskView.clipLeft(dp)) {
|
||||
fullWidth -= insets.left;
|
||||
}
|
||||
if (TaskView.clipRight(dp)) {
|
||||
fullWidth -= insets.right;
|
||||
}
|
||||
if (TaskView.clipTop(dp)) {
|
||||
fullHeight -= insets.top;
|
||||
}
|
||||
if (TaskView.clipBottom(dp)) {
|
||||
fullHeight -= insets.bottom;
|
||||
}
|
||||
|
||||
getTaskDimension(dp, outPivot);
|
||||
float scale = Math.min(outPivot.x / taskView.width(), outPivot.y / taskView.height());
|
||||
// We also scale the preview as part of fullScreenParams, so account for that as well.
|
||||
if (fullWidth > 0) {
|
||||
scale = scale * dp.widthPx / fullWidth;
|
||||
}
|
||||
|
||||
if (scale == 1) {
|
||||
outPivot.set(fullWidth / 2, fullHeight / 2);
|
||||
outPivot.set(taskView.centerX(), taskView.centerY());
|
||||
} else {
|
||||
float factor = scale / (scale - 1);
|
||||
outPivot.set(taskView.left * factor, taskView.top * factor);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.android.quickstep.views;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.DEFAULT_SPLIT_RATIO;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
@@ -313,4 +314,11 @@ public class GroupedTaskView extends TaskView {
|
||||
mSnapshotView2.setDimAlpha(amount);
|
||||
mDigitalWellBeingToast2.setBannerColorTint(tintColor, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyThumbnailSplashAlpha() {
|
||||
super.applyThumbnailSplashAlpha();
|
||||
mSnapshotView2.setSplashAlpha(
|
||||
Utilities.mapToRange(mOverviewProgress, 0f, 1f, 1f, 0f, LINEAR));
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,6 @@ import androidx.annotation.Nullable;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.uioverrides.ApiWrapper;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.DisplayController.NavigationMode;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
@@ -206,10 +205,9 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
if (mDp == null) {
|
||||
return;
|
||||
}
|
||||
boolean alignFor3ButtonTaskbar = mDp.isTaskbarPresent && !mDp.isGestureMode;
|
||||
if (alignFor3ButtonTaskbar) {
|
||||
if (mDp.areNavButtonsInline) {
|
||||
// Add extra horizontal spacing
|
||||
int additionalPadding = ApiWrapper.getHotseatEndOffset(getContext());
|
||||
int additionalPadding = mDp.hotseatBarEndOffset;
|
||||
if (isLayoutRtl()) {
|
||||
setPadding(mInsets.left + additionalPadding, 0, mInsets.right, 0);
|
||||
} else {
|
||||
|
||||
@@ -363,6 +363,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Progress of Recents view from carousel layout to grid layout. If Recents is not shown as a
|
||||
* grid, then the value remains 0.
|
||||
*/
|
||||
public static final FloatProperty<RecentsView> RECENTS_GRID_PROGRESS =
|
||||
new FloatProperty<RecentsView>("recentsGrid") {
|
||||
@Override
|
||||
@@ -376,6 +380,23 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Progress to and from the OVERVIEW state, where being in OverviewState has a value of 1, and
|
||||
* being in any other LauncherState has a value of 0.
|
||||
*/
|
||||
public static final FloatProperty<RecentsView> OVERVIEW_PROGRESS =
|
||||
new FloatProperty<RecentsView>("overviewProgress") {
|
||||
@Override
|
||||
public void setValue(RecentsView view, float overviewProgress) {
|
||||
view.setOverviewProgress(overviewProgress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(RecentsView view) {
|
||||
return view.mOverviewProgress;
|
||||
}
|
||||
};
|
||||
|
||||
// OverScroll constants
|
||||
private static final int OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION = 270;
|
||||
|
||||
@@ -466,6 +487,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
protected float mTaskViewsSecondarySplitTranslation = 0;
|
||||
// Progress from 0 to 1 where 0 is a carousel and 1 is a 2 row grid.
|
||||
private float mGridProgress = 0;
|
||||
private float mOverviewProgress = 0;
|
||||
private boolean mShowAsGridLastOnLayout = false;
|
||||
private final IntSet mTopRowIdSet = new IntSet();
|
||||
|
||||
@@ -2661,6 +2683,18 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mClearAllButton.setGridProgress(gridProgress);
|
||||
}
|
||||
|
||||
private void setOverviewProgress(float overviewProgress) {
|
||||
int taskCount = getTaskViewCount();
|
||||
if (taskCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
mOverviewProgress = overviewProgress;
|
||||
for (int i = 0; i < taskCount; i++) {
|
||||
requireTaskViewAt(i).setOverviewProgress(overviewProgress);
|
||||
}
|
||||
}
|
||||
|
||||
private void enableLayoutTransitions() {
|
||||
if (mLayoutTransition == null) {
|
||||
mLayoutTransition = new LayoutTransition();
|
||||
@@ -4301,6 +4335,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
properties));
|
||||
}
|
||||
}
|
||||
anim.play(ObjectAnimator.ofFloat(recentsView, OVERVIEW_PROGRESS, 1, 0));
|
||||
return anim;
|
||||
}
|
||||
|
||||
@@ -4360,6 +4395,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
BACKGROUND_APP.getDepth(mActivity));
|
||||
anim.play(depthAnimator);
|
||||
}
|
||||
anim.play(ObjectAnimator.ofFloat(this, OVERVIEW_PROGRESS, 1f, 0f));
|
||||
|
||||
anim.play(progressAnim);
|
||||
anim.setInterpolator(interpolator);
|
||||
|
||||
|
||||
@@ -36,12 +36,14 @@ import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Property;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
@@ -50,6 +52,7 @@ import androidx.core.graphics.ColorUtils;
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.SystemUiController;
|
||||
import com.android.launcher3.util.SystemUiController.SystemUiControllerFlags;
|
||||
@@ -64,6 +67,7 @@ import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
public class TaskThumbnailView extends View {
|
||||
private static final MainThreadInitializedObject<FullscreenDrawParams> TEMP_PARAMS =
|
||||
new MainThreadInitializedObject<>(FullscreenDrawParams::new);
|
||||
private static final float MAX_PCT_BEFORE_ASPECT_RATIOS_CONSIDERED_DIFFERENT = 0.1f;
|
||||
|
||||
public static final Property<TaskThumbnailView, Float> DIM_ALPHA =
|
||||
new FloatProperty<TaskThumbnailView>("dimAlpha") {
|
||||
@@ -83,6 +87,7 @@ public class TaskThumbnailView extends View {
|
||||
private TaskOverlay mOverlay;
|
||||
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint mSplashBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint mClearPaint = new Paint();
|
||||
private final Paint mDimmingPaintAfterClearing = new Paint();
|
||||
private final int mDimColor;
|
||||
@@ -91,6 +96,8 @@ public class TaskThumbnailView extends View {
|
||||
private final Rect mPreviewRect = new Rect();
|
||||
private final PreviewPositionHelper mPreviewPositionHelper = new PreviewPositionHelper();
|
||||
private TaskView.FullscreenDrawParams mFullscreenParams;
|
||||
private ImageView mSplashView;
|
||||
private Drawable mSplashViewDrawable;
|
||||
|
||||
@Nullable
|
||||
private Task mTask;
|
||||
@@ -101,6 +108,8 @@ public class TaskThumbnailView extends View {
|
||||
|
||||
/** How much this thumbnail is dimmed, 0 not dimmed at all, 1 totally dimmed. */
|
||||
private float mDimAlpha = 0f;
|
||||
/** Controls visibility of the splash view, 0 is transparent, 255 fully opaque. */
|
||||
private int mSplashAlpha = 0;
|
||||
|
||||
private boolean mOverlayEnabled;
|
||||
|
||||
@@ -116,6 +125,7 @@ public class TaskThumbnailView extends View {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mPaint.setFilterBitmap(true);
|
||||
mBackgroundPaint.setColor(Color.WHITE);
|
||||
mSplashBackgroundPaint.setColor(Color.WHITE);
|
||||
mClearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
||||
mActivity = BaseActivity.fromContext(context);
|
||||
// Initialize with placeholder value. It is overridden later by TaskView
|
||||
@@ -135,6 +145,8 @@ public class TaskThumbnailView extends View {
|
||||
int color = task == null ? Color.BLACK : task.colorBackground | 0xFF000000;
|
||||
mPaint.setColor(color);
|
||||
mBackgroundPaint.setColor(color);
|
||||
mSplashBackgroundPaint.setColor(color);
|
||||
updateSplashView(mTask.icon);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,6 +164,9 @@ public class TaskThumbnailView extends View {
|
||||
boolean thumbnailWasNull = mThumbnailData == null;
|
||||
mThumbnailData =
|
||||
(thumbnailData != null && thumbnailData.thumbnail != null) ? thumbnailData : null;
|
||||
if (mTask != null) {
|
||||
updateSplashView(mTask.icon);
|
||||
}
|
||||
if (refreshNow) {
|
||||
refresh(thumbnailWasNull && mThumbnailData != null);
|
||||
}
|
||||
@@ -202,6 +217,18 @@ public class TaskThumbnailView extends View {
|
||||
updateThumbnailPaintFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the alpha of the splash view.
|
||||
*/
|
||||
public void setSplashAlpha(float splashAlpha) {
|
||||
mSplashAlpha = (int) (splashAlpha * 255);
|
||||
if (mSplashViewDrawable != null) {
|
||||
mSplashViewDrawable.setAlpha(mSplashAlpha);
|
||||
}
|
||||
mSplashBackgroundPaint.setAlpha(mSplashAlpha);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public TaskOverlay getTaskOverlay() {
|
||||
if (mOverlay == null) {
|
||||
mOverlay = getTaskView().getRecentsView().getTaskOverlayFactory().createOverlay(this);
|
||||
@@ -238,13 +265,9 @@ public class TaskThumbnailView extends View {
|
||||
boundsToBitmapSpace.mapRect(boundsInBitmapSpace, viewRect);
|
||||
|
||||
DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
int leftInset = TaskView.clipLeft(dp) ? Math.round(boundsInBitmapSpace.left) : 0;
|
||||
int topInset = TaskView.clipTop(dp) ? Math.round(boundsInBitmapSpace.top) : 0;
|
||||
int rightInset = TaskView.clipRight(dp) ? Math.round(
|
||||
bitmapRect.right - boundsInBitmapSpace.right) : 0;
|
||||
int bottomInset = TaskView.clipBottom(dp)
|
||||
int bottomInset = dp.isTablet
|
||||
? Math.round(bitmapRect.bottom - boundsInBitmapSpace.bottom) : 0;
|
||||
return Insets.of(leftInset, topInset, rightInset, bottomInset);
|
||||
return Insets.of(0, 0, 0, bottomInset);
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +286,12 @@ public class TaskThumbnailView extends View {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
updateSplashView(mSplashViewDrawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
RectF currentDrawnInsets = mFullscreenParams.mCurrentDrawnInsets;
|
||||
@@ -313,6 +342,17 @@ public class TaskThumbnailView extends View {
|
||||
}
|
||||
|
||||
canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
|
||||
|
||||
// Draw splash above thumbnail to hide inconsistencies in rotation and aspect ratios.
|
||||
if (shouldShowSplashView()) {
|
||||
if (mSplashView != null) {
|
||||
canvas.drawRoundRect(x, y, width + 1, height + 1, cornerRadius,
|
||||
cornerRadius, mSplashBackgroundPaint);
|
||||
|
||||
mSplashView.layout((int) x, (int) (y + 1), (int) width, (int) height - 1);
|
||||
mSplashView.draw(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TaskView getTaskView() {
|
||||
@@ -327,6 +367,78 @@ public class TaskThumbnailView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the splash should be shown over top of the thumbnail.
|
||||
*
|
||||
* <p>We want to show the splash if the aspect ratio or rotation of the thumbnail would be
|
||||
* different from the task.
|
||||
*/
|
||||
boolean shouldShowSplashView() {
|
||||
return isThumbnailAspectRatioDifferentFromThumbnailData()
|
||||
|| isThumbnailRotationDifferentFromTask();
|
||||
}
|
||||
|
||||
private void updateSplashView(Drawable icon) {
|
||||
if (icon == null || icon.getConstantState() == null) {
|
||||
return;
|
||||
}
|
||||
mSplashViewDrawable = icon.getConstantState().newDrawable().mutate();
|
||||
mSplashViewDrawable.setAlpha(mSplashAlpha);
|
||||
ImageView imageView = mSplashView == null ? new ImageView(getContext()) : mSplashView;
|
||||
imageView.setImageDrawable(mSplashViewDrawable);
|
||||
|
||||
imageView.setScaleType(ImageView.ScaleType.MATRIX);
|
||||
Matrix matrix = new Matrix();
|
||||
|
||||
float drawableWidth = mSplashViewDrawable.getIntrinsicWidth();
|
||||
float drawableHeight = mSplashViewDrawable.getIntrinsicHeight();
|
||||
float viewWidth = getMeasuredWidth();
|
||||
float viewCenterX = viewWidth / 2f;
|
||||
float viewHeight = getMeasuredHeight();
|
||||
float viewCenterY = viewHeight / 2f;
|
||||
float centeredDrawableLeft = (viewWidth - drawableWidth) / 2f;
|
||||
float centeredDrawableTop = (viewHeight - drawableHeight) / 2f;
|
||||
float nonGridScale = getTaskView() == null ? 1 : 1 / getTaskView().getNonGridScale();
|
||||
float recentsMaxScale = getTaskView() == null || getTaskView().getRecentsView() == null
|
||||
? 1 : 1 / getTaskView().getRecentsView().getMaxScaleForFullScreen();
|
||||
float scale = nonGridScale * recentsMaxScale;
|
||||
|
||||
// Center the image in the view.
|
||||
matrix.setTranslate(centeredDrawableLeft, centeredDrawableTop);
|
||||
// Apply scale transformation after translation, pivoting around center of view.
|
||||
matrix.postScale(scale, scale, viewCenterX, viewCenterY);
|
||||
|
||||
imageView.setImageMatrix(matrix);
|
||||
mSplashView = imageView;
|
||||
}
|
||||
|
||||
private boolean isThumbnailAspectRatioDifferentFromThumbnailData() {
|
||||
if (mThumbnailData == null || mThumbnailData.thumbnail == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float thumbnailViewAspect = getWidth() / (float) getHeight();
|
||||
float thumbnailDataAspect =
|
||||
mThumbnailData.thumbnail.getWidth() / (float) mThumbnailData.thumbnail.getHeight();
|
||||
|
||||
return Utilities.isRelativePercentDifferenceGreaterThan(thumbnailViewAspect,
|
||||
thumbnailDataAspect, MAX_PCT_BEFORE_ASPECT_RATIOS_CONSIDERED_DIFFERENT);
|
||||
}
|
||||
|
||||
private boolean isThumbnailRotationDifferentFromTask() {
|
||||
RecentsView recents = getTaskView().getRecentsView();
|
||||
if (recents == null || mThumbnailData == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (recents.getPagedOrientationHandler() == PagedOrientationHandler.PORTRAIT) {
|
||||
int currentRotation = recents.getPagedViewOrientedState().getRecentsActivityRotation();
|
||||
return (currentRotation - mThumbnailData.rotation) % 2 != 0;
|
||||
} else {
|
||||
return recents.getPagedOrientationHandler().getRotation() != mThumbnailData.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Potentially re-init the task overlay. Be cautious when calling this as the overlay may
|
||||
* do processing on initialization.
|
||||
@@ -435,18 +547,9 @@ public class TaskThumbnailView extends View {
|
||||
int thumbnailRotation = thumbnailData.rotation;
|
||||
int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation);
|
||||
RectF thumbnailClipHint = new RectF();
|
||||
if (TaskView.clipLeft(dp)) {
|
||||
thumbnailClipHint.left = thumbnailData.insets.left;
|
||||
}
|
||||
if (TaskView.clipRight(dp)) {
|
||||
thumbnailClipHint.right = thumbnailData.insets.right;
|
||||
}
|
||||
if (TaskView.clipTop(dp)) {
|
||||
thumbnailClipHint.top = thumbnailData.insets.top;
|
||||
}
|
||||
if (TaskView.clipBottom(dp)) {
|
||||
thumbnailClipHint.bottom = thumbnailData.insets.bottom;
|
||||
}
|
||||
float canvasScreenRatio = canvasWidth / (float) dp.widthPx;
|
||||
float scaledTaskbarSize = dp.taskbarSize * canvasScreenRatio;
|
||||
thumbnailClipHint.bottom = dp.isTablet ? scaledTaskbarSize : 0;
|
||||
|
||||
float scale = thumbnailData.scale;
|
||||
final float thumbnailScale;
|
||||
@@ -476,8 +579,9 @@ public class TaskThumbnailView extends View {
|
||||
float availableAspect = isRotated
|
||||
? availableHeight / availableWidth
|
||||
: availableWidth / availableHeight;
|
||||
boolean isAspectLargelyDifferent = Utilities.isRelativePercentDifferenceGreaterThan(
|
||||
canvasAspect, availableAspect, 0.1f);
|
||||
boolean isAspectLargelyDifferent =
|
||||
Utilities.isRelativePercentDifferenceGreaterThan(canvasAspect,
|
||||
availableAspect, MAX_PCT_BEFORE_ASPECT_RATIOS_CONSIDERED_DIFFERENT);
|
||||
if (isRotated && isAspectLargelyDifferent) {
|
||||
// Do not rotate thumbnail if it would not improve fit
|
||||
isRotated = false;
|
||||
@@ -486,18 +590,10 @@ public class TaskThumbnailView extends View {
|
||||
|
||||
if (isAspectLargelyDifferent) {
|
||||
// Crop letterbox insets if insets isn't already clipped
|
||||
if (!TaskView.clipLeft(dp)) {
|
||||
thumbnailClipHint.left = thumbnailData.letterboxInsets.left;
|
||||
}
|
||||
if (!TaskView.clipRight(dp)) {
|
||||
thumbnailClipHint.right = thumbnailData.letterboxInsets.right;
|
||||
}
|
||||
if (!TaskView.clipTop(dp)) {
|
||||
thumbnailClipHint.top = thumbnailData.letterboxInsets.top;
|
||||
}
|
||||
if (!TaskView.clipBottom(dp)) {
|
||||
thumbnailClipHint.bottom = thumbnailData.letterboxInsets.bottom;
|
||||
}
|
||||
thumbnailClipHint.left = thumbnailData.letterboxInsets.left;
|
||||
thumbnailClipHint.right = thumbnailData.letterboxInsets.right;
|
||||
thumbnailClipHint.top = thumbnailData.letterboxInsets.top;
|
||||
thumbnailClipHint.bottom = thumbnailData.letterboxInsets.bottom;
|
||||
availableWidth = surfaceWidth
|
||||
- (thumbnailClipHint.left + thumbnailClipHint.right);
|
||||
availableHeight = surfaceHeight
|
||||
@@ -568,8 +664,7 @@ public class TaskThumbnailView extends View {
|
||||
setThumbnailRotation(deltaRotate, thumbnailBounds);
|
||||
}
|
||||
|
||||
float canvasScreenRatio = canvasWidth / (float) dp.widthPx;
|
||||
mClippedInsets.set(0, 0, 0, dp.taskbarSize * canvasScreenRatio);
|
||||
mClippedInsets.set(0, 0, 0, scaledTaskbarSize);
|
||||
|
||||
mMatrix.postScale(thumbnailScale, thumbnailScale);
|
||||
mIsOrientationChanged = isOrientationDifferent;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.quickstep.views;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static android.window.SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR;
|
||||
|
||||
import static com.android.launcher3.Utilities.comp;
|
||||
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
|
||||
@@ -136,34 +137,6 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
/** The maximum amount that a task view can be scrimmed, dimmed or tinted. */
|
||||
public static final float MAX_PAGE_SCRIM_ALPHA = 0.4f;
|
||||
|
||||
/**
|
||||
* Should the TaskView display clip off the left inset in RecentsView.
|
||||
*/
|
||||
public static boolean clipLeft(DeviceProfile deviceProfile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the TaskView display clip off the top inset in RecentsView.
|
||||
*/
|
||||
public static boolean clipTop(DeviceProfile deviceProfile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the TaskView display clip off the right inset in RecentsView.
|
||||
*/
|
||||
public static boolean clipRight(DeviceProfile deviceProfile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the TaskView display clip off the bottom inset in RecentsView.
|
||||
*/
|
||||
public static boolean clipBottom(DeviceProfile deviceProfile) {
|
||||
return deviceProfile.isTablet;
|
||||
}
|
||||
|
||||
private static final float EDGE_SCALE_DOWN_FACTOR_CAROUSEL = 0.03f;
|
||||
private static final float EDGE_SCALE_DOWN_FACTOR_GRID = 0.00f;
|
||||
|
||||
@@ -361,6 +334,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
protected final DigitalWellBeingToast mDigitalWellBeingToast;
|
||||
private float mFullscreenProgress;
|
||||
private float mGridProgress;
|
||||
protected float mOverviewProgress;
|
||||
private float mNonGridScale = 1;
|
||||
private float mDismissScale = 1;
|
||||
protected final FullscreenDrawParams mCurrentFullscreenParams;
|
||||
@@ -420,7 +394,6 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
|
||||
private boolean mIsClickableAsLiveTile = true;
|
||||
|
||||
|
||||
public TaskView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -688,6 +661,9 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
if (freezeTaskList) {
|
||||
ActivityOptionsCompat.setFreezeRecentTasksList(opts);
|
||||
}
|
||||
// TODO(b/202826469): Replace setSplashScreenStyle with setDisableStartingWindow.
|
||||
opts.setSplashScreenStyle(mSnapshotView.shouldShowSplashView()
|
||||
? SPLASH_SCREEN_STYLE_SOLID_COLOR : opts.getSplashScreenStyle());
|
||||
Task.TaskKey key = mTask.key;
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
if (!ActivityManagerWrapper.getInstance().startActivityFromRecents(key, opts)) {
|
||||
@@ -1088,6 +1064,21 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
return scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates progress of task view for entering/exiting overview on swipe up/down.
|
||||
*
|
||||
* <p>Updates the alpha of any splash screen over the thumbnail if it exists.
|
||||
*/
|
||||
public void setOverviewProgress(float overviewProgress) {
|
||||
mOverviewProgress = overviewProgress;
|
||||
applyThumbnailSplashAlpha();
|
||||
}
|
||||
|
||||
protected void applyThumbnailSplashAlpha() {
|
||||
mSnapshotView.setSplashAlpha(
|
||||
Utilities.mapToRange(mOverviewProgress, 0f, 1f, 1f, 0f, LINEAR));
|
||||
}
|
||||
|
||||
private void setSplitSelectTranslationX(float x) {
|
||||
mSplitSelectTranslationX = x;
|
||||
applyTranslationX();
|
||||
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for phone with 3-Button navigation.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfilePhone3ButtonTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForPhone(isGestureMode = false)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(265)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(343)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.getCellSize().x).isEqualTo(265)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.getCellSize().y).isEqualTo(552)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(66)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(66)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(49)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(265)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(343)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(49)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(27)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1050)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(232)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(58)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(409)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(265)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(66)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(66)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(91)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(669)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomPaddingPx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(266)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(135)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(1189)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(91)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(53)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(53)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(573)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.182266f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(154)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(280)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(-112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.74417657f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(2447)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(1334)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(364)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(2185)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(147)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(558)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(125)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(125)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(448)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for phone.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfilePhoneTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForPhone()
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(265)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(343)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.getCellSize().x).isEqualTo(265)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.getCellSize().y).isEqualTo(552)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(66)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(66)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(49)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(265)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(343)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(49)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(27)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1050)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(232)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(58)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(409)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(265)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(66)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(66)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(91)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(669)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomPaddingPx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(266)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(135)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(1189)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(91)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(53)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(53)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(573)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.182266f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(154)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(280)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(-112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.74417657f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(2447)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(1334)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(364)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(2185)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(147)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(558)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(125)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(125)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(448)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.android.launcher3.InvariantDeviceProfile
|
||||
import com.android.launcher3.util.WindowBounds
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.Mockito.`when` as whenever
|
||||
|
||||
/**
|
||||
* Test for [DeviceProfile] quickstep.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileQuickstepTest : DeviceProfileBaseTest() {
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidthAndHeight_twoPanelLandscapeScalable4By4GridTablet() {
|
||||
val tabletWidth = 2560
|
||||
val tabletHeight = 1600
|
||||
val availableWidth = 2560
|
||||
val availableHeight = 1500
|
||||
windowBounds = WindowBounds(tabletWidth, tabletHeight, availableWidth, availableHeight, 0)
|
||||
useTwoPanels = true
|
||||
whenever(info.isTablet(ArgumentMatchers.any())).thenReturn(true)
|
||||
whenever(info.densityDpi).thenReturn(320)
|
||||
whenever(info.smallestSizeDp(ArgumentMatchers.any())).thenReturn(800f)
|
||||
inv = newScalableInvariantDeviceProfile()
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(1237)
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(1215)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSize_twoPanelLandscapeScalable4By4GridTablet() {
|
||||
val tabletWidth = 2560
|
||||
val tabletHeight = 1600
|
||||
val availableWidth = 2560
|
||||
val availableHeight = 1500
|
||||
windowBounds = WindowBounds(tabletWidth, tabletHeight, availableWidth, availableHeight, 0)
|
||||
useTwoPanels = true
|
||||
whenever(info.isTablet(ArgumentMatchers.any())).thenReturn(true)
|
||||
whenever(info.densityDpi).thenReturn(320)
|
||||
whenever(info.smallestSizeDp(ArgumentMatchers.any())).thenReturn(800f)
|
||||
inv = newScalableInvariantDeviceProfile()
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.getCellSize().y).isEqualTo(260)
|
||||
assertThat(dp.getCellSize().x).isEqualTo(259)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount_twoPanelLandscapeScalable4By4GridTablet() {
|
||||
val tabletWidth = 2560
|
||||
val tabletHeight = 1600
|
||||
val availableWidth = 2560
|
||||
val availableHeight = 1500
|
||||
windowBounds = WindowBounds(tabletWidth, tabletHeight, availableWidth, availableHeight, 0)
|
||||
useTwoPanels = true
|
||||
whenever(info.isTablet(ArgumentMatchers.any())).thenReturn(true)
|
||||
whenever(info.densityDpi).thenReturn(320)
|
||||
whenever(info.smallestSizeDp(ArgumentMatchers.any())).thenReturn(800f)
|
||||
inv = newScalableInvariantDeviceProfile()
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.panelCount).isEqualTo(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadShrunkTopBottom_landscapePhoneVerticalBar() {
|
||||
inv = newScalableInvariantDeviceProfile()
|
||||
initializeVarsForPhone(true)
|
||||
inv = newScalableInvariantDeviceProfile().apply {
|
||||
deviceType = InvariantDeviceProfile.TYPE_PHONE
|
||||
transposeLayoutWithOrientation = true
|
||||
}
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(true)
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(168)
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1358)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadShrunkTopBottom_portraitPhone() {
|
||||
inv = newScalableInvariantDeviceProfile()
|
||||
initializeVarsForPhone()
|
||||
inv = newScalableInvariantDeviceProfile().apply {
|
||||
deviceType = InvariantDeviceProfile.TYPE_PHONE
|
||||
}
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(364)
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(2185)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for tablet in landscape with 3-Button navigation.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileTabletLandscape3ButtonTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForTablet(isLandscape = true, isGestureMode = false)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(227)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(558)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(57)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(57)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(59)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(59)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(59)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(227)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(199)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(351)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(227)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(57)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(57)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(1244)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(228)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(116)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(5)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(1237)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(120)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(78)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(93)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.7736843f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(160)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(144)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.7363184f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(1407)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(2522)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(208)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1244)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(1443)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(-7)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(428)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(428)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for tablet in landscape.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileTabletLandscapeTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForTablet(isLandscape = true)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(227)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(558)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(57)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(57)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(59)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(59)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(59)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(227)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(199)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(351)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(227)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(57)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(57)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(1244)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(228)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(116)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(503)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(-503)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(120)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(78)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(93)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.7736843f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(160)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(144)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.7363184f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(1407)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(2522)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(208)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1244)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(301)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(-7)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(301)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for tablet in portrait with 3-Button navigation.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileTabletPortrait3ButtonTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForTablet(isGestureMode = false)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(382)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(482)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(74)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(74)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(382)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(77)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1960)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(257)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(456)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(74)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(74)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(781)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(386)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(116)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(216)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(1216)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(120)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(101)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(29)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(29)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(238)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(2.2988505f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(160)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(220)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(144)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.6741674f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(2222)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(1542)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(460)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1958)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(272)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(528)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(151)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(528)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(428)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for tablet in portrait.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileTabletPortraitTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForTablet()
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(382)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(482)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(74)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(74)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(382)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(77)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1960)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(257)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(456)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(294)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(74)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(74)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(781)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(386)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(116)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(216)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(256)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(1216)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(120)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(101)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(29)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(29)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(238)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(2.2988505f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(160)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(220)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(144)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.6741674f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(2222)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(1542)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(460)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1958)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(272)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(192)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(151)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(192)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
+486
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for two panel in landscape with 3-Button navigation.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileTwoPanelLandscape3ButtonTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForTablet(isLandscape = true, isTwoPanel = true, isGestureMode = false)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(200)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(260)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(259)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(260)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(200)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(260)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(36)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(175)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(44)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(310)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(200)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(1241)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(386)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(116)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(6)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(1039)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(120)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(68)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(43)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(43)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(285)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.5657895f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(160)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(144)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.7226337f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(1215)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(1237)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(208)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1086)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(272)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(864)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(151)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(864)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(428)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for two panel in landscape.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileTwoPanelLandscapeTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForTablet(isLandscape = true, isTwoPanel = true)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(200)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(260)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(259)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(260)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(25)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(200)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(260)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(36)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(175)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(44)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(310)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(200)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(1241)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(386)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(116)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(6)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(73)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(1039)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(120)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(68)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(43)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(43)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(285)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.5657895f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(160)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(144)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(64)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.7226337f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(1215)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(1237)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(208)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1086)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(272)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(761)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(151)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(761)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
+486
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for two panel in portrait with 3-Button navigation.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileTwoPanelPortrait3ButtonTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForTablet(isTwoPanel = true, isGestureMode = false)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(153)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(199)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(153)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(509)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(153)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(199)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(16)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1960)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(134)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(34)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(237)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(153)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(763)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(386)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(116)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(216)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(6)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(685)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(120)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(52)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(33)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(33)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(291)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.1976048f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(160)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(220)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(144)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.69064087f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(2169)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(767)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(460)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1958)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(272)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(340)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(151)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(428)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(428)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for two panel in portrait.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileTwoPanelPortraitTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForTablet(isTwoPanel = true)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(153)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(199)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(153)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(509)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(19)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(153)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(199)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(16)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1960)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(600)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(134)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(34)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(237)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(153)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(38)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(763)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(386)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(116)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(216)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(6)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(685)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(120)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(52)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(33)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(33)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(291)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.1976048f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(32)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(160)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(72)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(88)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(40)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(128)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(220)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(144)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(96)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(48)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.69064087f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(2169)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(767)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(460)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1958)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(272)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(459)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(151)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(459)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(109)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for landscape phone with vertical bar and 3-Button navigation.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileVerticalBar3ButtonTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForPhone(isVerticalBar = true, isGestureMode = false)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(210)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(675)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(321)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(70)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(70)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(53)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(260)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(304)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(49)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(53)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1050)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(49)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(422)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(252)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(336)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(158)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(2221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(266)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.0f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(154)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(280)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(42)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(-112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(21)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(21)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.8880597f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(1340)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(2840)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1358)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(147)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(225)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(165)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Tests for DeviceProfile for landscape phone with vertical bar.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class DeviceProfileVerticalBarTest : DeviceProfileBaseTest() {
|
||||
|
||||
lateinit var dp: DeviceProfile
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
initializeVarsForPhone(isVerticalBar = true)
|
||||
dp = newDP()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isScalableGrid() {
|
||||
assertThat(dp.isScalableGrid).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellWidthPx() {
|
||||
assertThat(dp.cellWidthPx).isEqualTo(210)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellHeightPx() {
|
||||
assertThat(dp.cellHeightPx).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeX() {
|
||||
assertThat(dp.cellSize.x).isEqualTo(675)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellSizeY() {
|
||||
assertThat(dp.cellSize.y).isEqualTo(321)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxLeft() {
|
||||
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(70)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxTop() {
|
||||
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxRight() {
|
||||
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(70)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellLayoutPaddingPxBottom() {
|
||||
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(53)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconSizePx() {
|
||||
assertThat(dp.iconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTextSizePx() {
|
||||
assertThat(dp.iconTextSizePx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconDrawablePaddingPx() {
|
||||
assertThat(dp.iconDrawablePaddingPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellWidthPx() {
|
||||
assertThat(dp.folderCellWidthPx).isEqualTo(260)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellHeightPx() {
|
||||
assertThat(dp.folderCellHeightPx).isEqualTo(304)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildIconSizePx() {
|
||||
assertThat(dp.folderChildIconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildTextSizePx() {
|
||||
assertThat(dp.folderChildTextSizePx).isEqualTo(49)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderChildDrawablePaddingPx() {
|
||||
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpaceOriginalPx() {
|
||||
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxX() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun folderCellLayoutBorderSpacePxY() {
|
||||
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bottomSheetTopPadding() {
|
||||
assertThat(dp.bottomSheetTopPadding).isEqualTo(53)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsShiftRange() {
|
||||
assertThat(dp.allAppsShiftRange).isEqualTo(1050)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsTopPadding() {
|
||||
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconSizePx() {
|
||||
assertThat(dp.allAppsIconSizePx).isEqualTo(196)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconTextSizePx() {
|
||||
assertThat(dp.allAppsIconTextSizePx).isEqualTo(49)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsIconDrawablePaddingPx() {
|
||||
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(28)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellHeightPx() {
|
||||
assertThat(dp.allAppsCellHeightPx).isEqualTo(422)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsCellWidthPx() {
|
||||
assertThat(dp.allAppsCellWidthPx).isEqualTo(252)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxX() {
|
||||
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsBorderSpacePxY() {
|
||||
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownAllAppsColumns() {
|
||||
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightPadding() {
|
||||
assertThat(dp.allAppsLeftRightPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allAppsLeftRightMargin() {
|
||||
assertThat(dp.allAppsLeftRightMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSizePx() {
|
||||
assertThat(dp.hotseatBarSizePx).isEqualTo(336)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatCellHeightPx() {
|
||||
assertThat(dp.hotseatCellHeightPx).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarBottomSpacePx() {
|
||||
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingStartPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarSidePaddingEndPx() {
|
||||
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbSpace() {
|
||||
assertThat(dp.hotseatQsbSpace).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatQsbHeight() {
|
||||
assertThat(dp.hotseatQsbHeight).isEqualTo(221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun springLoadedHotseatBarTopMarginPx() {
|
||||
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(158)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun numShownHotseatIcons() {
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBorderSpace() {
|
||||
assertThat(dp.hotseatBorderSpace).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isQsbInline() {
|
||||
assertThat(dp.isQsbInline).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsbWidth() {
|
||||
assertThat(dp.qsbWidth).isEqualTo(2221)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresent() {
|
||||
assertThat(dp.isTaskbarPresent).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isTaskbarPresentInApps() {
|
||||
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun taskbarSize() {
|
||||
assertThat(dp.taskbarSize).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desiredWorkspaceHorizontalMarginPx() {
|
||||
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingLeft() {
|
||||
assertThat(dp.workspacePadding.left).isEqualTo(14)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingTop() {
|
||||
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingRight() {
|
||||
assertThat(dp.workspacePadding.right).isEqualTo(266)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspacePaddingBottom() {
|
||||
assertThat(dp.workspacePadding.bottom).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconScale() {
|
||||
assertThat(dp.iconScale).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cellScaleToFit() {
|
||||
assertThat(dp.cellScaleToFit).isEqualTo(1.0f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceTopPadding() {
|
||||
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceBottomPadding() {
|
||||
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginPx() {
|
||||
assertThat(dp.overviewTaskMarginPx).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskMarginGridPx() {
|
||||
assertThat(dp.overviewTaskMarginGridPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconSizePx() {
|
||||
assertThat(dp.overviewTaskIconSizePx).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizePx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(154)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskIconDrawableSizeGridPx() {
|
||||
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewTaskThumbnailTopMarginPx() {
|
||||
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(280)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsTopMarginPx() {
|
||||
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(42)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsHeight() {
|
||||
assertThat(dp.overviewActionsHeight).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewActionsButtonSpacing() {
|
||||
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewPageSpacing() {
|
||||
assertThat(dp.overviewPageSpacing).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewRowSpacing() {
|
||||
assertThat(dp.overviewRowSpacing).isEqualTo(-112)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overviewGridSideMargin() {
|
||||
assertThat(dp.overviewGridSideMargin).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarTopMarginPx() {
|
||||
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(21)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarSizePx() {
|
||||
assertThat(dp.dropTargetBarSizePx).isEqualTo(126)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dropTargetBarBottomMarginPx() {
|
||||
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(21)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
||||
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getWorkspaceSpringLoadScale() {
|
||||
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.8880597f)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutHeight() {
|
||||
assertThat(dp.cellLayoutHeight).isEqualTo(1340)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutWidth() {
|
||||
assertThat(dp.cellLayoutWidth).isEqualTo(2840)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getPanelCount() {
|
||||
assertThat(dp.panelCount).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isVerticalBarLayout() {
|
||||
assertThat(dp.isVerticalBarLayout).isEqualTo(true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkTop() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(168)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getCellLayoutSpringLoadShrunkBottom() {
|
||||
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1358)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getQsbOffsetY() {
|
||||
assertThat(dp.qsbOffsetY).isEqualTo(147)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTaskbarOffsetY() {
|
||||
assertThat(dp.taskbarOffsetY).isEqualTo(225)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingLeft() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(56)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingTop() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingRight() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(84)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getHotseatLayoutPaddingBottom() {
|
||||
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(165)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseatBarEndOffset() {
|
||||
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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
|
||||
|
||||
import android.graphics.Rect
|
||||
import android.graphics.RectF
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.DeviceProfileBaseTest
|
||||
import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mockito.mock
|
||||
|
||||
/**
|
||||
* Test for TaskThumbnailView class.
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class TaskThumbnailViewTest : DeviceProfileBaseTest() {
|
||||
|
||||
private var mThumbnailData: ThumbnailData = mock(ThumbnailData::class.java)
|
||||
|
||||
private val mPreviewPositionHelper = PreviewPositionHelper()
|
||||
|
||||
@Test
|
||||
fun getInsetsToDrawInFullscreen_clipTaskbarSizeFromBottomForTablets() {
|
||||
initializeVarsForTablet()
|
||||
val dp = newDP()
|
||||
val previewRect = Rect(0, 0, 100, 100)
|
||||
val canvasWidth = dp.widthPx / 2
|
||||
val canvasHeight = dp.heightPx / 2
|
||||
val currentRotation = 0
|
||||
val isRtl = false
|
||||
|
||||
mPreviewPositionHelper.updateThumbnailMatrix(previewRect, mThumbnailData, canvasWidth,
|
||||
canvasHeight, dp, currentRotation, isRtl)
|
||||
|
||||
val expectedClippedInsets = RectF(0f, 0f, 0f, dp.taskbarSize / 2f)
|
||||
assertThat(mPreviewPositionHelper.getInsetsToDrawInFullscreen(dp))
|
||||
.isEqualTo(expectedClippedInsets)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getInsetsToDrawInFullscreen_doNotClipTaskbarSizeFromBottomForPhones() {
|
||||
initializeVarsForPhone()
|
||||
val dp = newDP()
|
||||
val previewRect = Rect(0, 0, 100, 100)
|
||||
val canvasWidth = dp.widthPx / 2
|
||||
val canvasHeight = dp.heightPx / 2
|
||||
val currentRotation = 0
|
||||
val isRtl = false
|
||||
|
||||
mPreviewPositionHelper.updateThumbnailMatrix(previewRect, mThumbnailData, canvasWidth,
|
||||
canvasHeight, dp, currentRotation, isRtl)
|
||||
|
||||
val expectedClippedInsets = RectF(0f, 0f, 0f, 0f)
|
||||
assertThat(mPreviewPositionHelper.getInsetsToDrawInFullscreen(dp))
|
||||
.isEqualTo(expectedClippedInsets)
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@
|
||||
</com.android.launcher3.widget.picker.WidgetPagedView>
|
||||
|
||||
<!-- SearchAndRecommendationsView contains the tab layout as well -->
|
||||
<com.android.launcher3.widget.picker.SearchAndRecommendationsView
|
||||
<com.android.launcher3.views.StickyHeaderLayout
|
||||
android:id="@+id/search_and_recommendations_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -68,7 +68,7 @@
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingHorizontal="@dimen/widget_list_horizontal_margin"
|
||||
android:clipToPadding="false">
|
||||
launcher:layout_sticky="true">
|
||||
<include layout="@layout/widgets_search_bar" />
|
||||
</FrameLayout>
|
||||
|
||||
@@ -92,7 +92,8 @@
|
||||
android:paddingLeft="@dimen/widget_tabs_horizontal_padding"
|
||||
android:paddingRight="@dimen/widget_tabs_horizontal_padding"
|
||||
android:background="?android:attr/colorBackground"
|
||||
style="@style/TextHeadline">
|
||||
style="@style/TextHeadline"
|
||||
launcher:layout_sticky="true">
|
||||
|
||||
<Button
|
||||
android:id="@+id/tab_personal"
|
||||
@@ -121,5 +122,5 @@
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
</com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip>
|
||||
|
||||
</com.android.launcher3.widget.picker.SearchAndRecommendationsView>
|
||||
</com.android.launcher3.views.StickyHeaderLayout>
|
||||
</merge>
|
||||
@@ -13,7 +13,8 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res-auto" >
|
||||
<com.android.launcher3.widget.picker.WidgetsRecyclerView
|
||||
android:id="@+id/primary_widgets_list_view"
|
||||
android:layout_below="@id/collapse_handle"
|
||||
@@ -23,7 +24,7 @@
|
||||
android:clipToPadding="false" />
|
||||
|
||||
<!-- SearchAndRecommendationsView without the tab layout as well -->
|
||||
<com.android.launcher3.widget.picker.SearchAndRecommendationsView
|
||||
<com.android.launcher3.views.StickyHeaderLayout
|
||||
android:id="@+id/search_and_recommendations_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -50,7 +51,8 @@
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:paddingHorizontal="@dimen/widget_list_horizontal_margin"
|
||||
android:paddingBottom="8dp"
|
||||
android:clipToPadding="false">
|
||||
android:clipToPadding="false"
|
||||
launcher:layout_sticky="true" >
|
||||
<include layout="@layout/widgets_search_bar" />
|
||||
</FrameLayout>
|
||||
|
||||
@@ -63,6 +65,6 @@
|
||||
android:paddingVertical="@dimen/recommended_widgets_table_vertical_padding"
|
||||
android:paddingHorizontal="@dimen/widget_list_horizontal_margin"
|
||||
android:visibility="gone" />
|
||||
</com.android.launcher3.widget.picker.SearchAndRecommendationsView>
|
||||
</com.android.launcher3.views.StickyHeaderLayout>
|
||||
|
||||
</merge>
|
||||
@@ -136,6 +136,10 @@
|
||||
<attr name="layout_ignoreInsets" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="StickyScroller_Layout">
|
||||
<attr name="layout_sticky" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="GridDisplayOption">
|
||||
<attr name="name" format="string" />
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
<dimen name="dynamic_grid_edge_margin">10.77dp</dimen>
|
||||
<dimen name="dynamic_grid_left_right_margin">8dp</dimen>
|
||||
<dimen name="dynamic_grid_icon_drawable_padding">7dp</dimen>
|
||||
<!-- Minimum space between workspace and hotseat in spring loaded mode -->
|
||||
<dimen name="dynamic_grid_min_spring_loaded_space">8dp</dimen>
|
||||
<!-- Minimum amount of next page visible in spring loaded mode -->
|
||||
<dimen name="dynamic_grid_spring_loaded_min_next_space_visible">24dp</dimen>
|
||||
|
||||
@@ -362,6 +360,9 @@
|
||||
<dimen name="taskbar_icon_size">44dp</dimen>
|
||||
<!-- Note that this applies to both sides of all icons, so visible space is double this. -->
|
||||
<dimen name="taskbar_icon_spacing">8dp</dimen>
|
||||
<dimen name="taskbar_nav_buttons_size">0dp</dimen>
|
||||
<dimen name="taskbar_contextual_button_margin">0dp</dimen>
|
||||
<dimen name="taskbar_hotseat_nav_spacing">0dp</dimen>
|
||||
|
||||
<!-- Size of the maximum radius for the enforced rounded rectangles. -->
|
||||
<dimen name="enforced_rounded_corner_max_radius">16dp</dimen>
|
||||
|
||||
@@ -108,9 +108,8 @@ public class DeviceProfile {
|
||||
|
||||
public final int edgeMarginPx;
|
||||
public final float workspaceContentScale;
|
||||
public float workspaceSpringLoadShrunkTop;
|
||||
public float workspaceSpringLoadShrunkBottom;
|
||||
public final int workspaceSpringLoadedBottomSpace;
|
||||
private float mWorkspaceSpringLoadShrunkTop;
|
||||
private float mWorkspaceSpringLoadShrunkBottom;
|
||||
public final int workspaceSpringLoadedMinNextPageVisiblePx;
|
||||
|
||||
private final int extraSpace;
|
||||
@@ -159,10 +158,11 @@ public class DeviceProfile {
|
||||
// Hotseat
|
||||
public final int numShownHotseatIcons;
|
||||
public int hotseatCellHeightPx;
|
||||
private final boolean areNavButtonsInline;
|
||||
public final boolean areNavButtonsInline;
|
||||
// In portrait: size = height, in landscape: size = width
|
||||
public int hotseatBarSizePx;
|
||||
public int hotseatBarBottomSpacePx;
|
||||
public int hotseatBarEndOffset;
|
||||
public int hotseatQsbSpace;
|
||||
public int springLoadedHotseatBarTopMarginPx;
|
||||
// Start is the side next to the nav bar, end is the side next to the workspace
|
||||
@@ -351,8 +351,6 @@ public class DeviceProfile {
|
||||
dropTargetButtonWorkspaceEdgeGapPx = res.getDimensionPixelSize(
|
||||
R.dimen.drop_target_button_workspace_edge_gap);
|
||||
|
||||
workspaceSpringLoadedBottomSpace =
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_min_spring_loaded_space);
|
||||
workspaceSpringLoadedMinNextPageVisiblePx = res.getDimensionPixelSize(
|
||||
R.dimen.dynamic_grid_spring_loaded_min_next_space_visible);
|
||||
|
||||
@@ -412,6 +410,18 @@ public class DeviceProfile {
|
||||
// Add a bit of space between nav bar and hotseat in vertical bar layout.
|
||||
hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? workspacePageIndicatorHeight : 0;
|
||||
updateHotseatSizes(pxFromDp(inv.iconSize[INDEX_DEFAULT], mMetrics));
|
||||
if (areNavButtonsInline) {
|
||||
/*
|
||||
* 3 nav buttons +
|
||||
* Little space at the end for contextual buttons +
|
||||
* Little space between icons and nav buttons
|
||||
*/
|
||||
hotseatBarEndOffset = 3 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size)
|
||||
+ res.getDimensionPixelSize(R.dimen.taskbar_contextual_button_margin)
|
||||
+ res.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing);
|
||||
} else {
|
||||
hotseatBarEndOffset = 0;
|
||||
}
|
||||
|
||||
overviewTaskMarginPx = res.getDimensionPixelSize(R.dimen.overview_task_margin);
|
||||
overviewTaskMarginGridPx = res.getDimensionPixelSize(R.dimen.overview_task_margin_grid);
|
||||
@@ -918,9 +928,9 @@ public class DeviceProfile {
|
||||
* Gets the scaled top of the workspace in px for the spring-loaded edit state.
|
||||
*/
|
||||
public float getCellLayoutSpringLoadShrunkTop() {
|
||||
workspaceSpringLoadShrunkTop = mInsets.top + dropTargetBarTopMarginPx + dropTargetBarSizePx
|
||||
mWorkspaceSpringLoadShrunkTop = mInsets.top + dropTargetBarTopMarginPx + dropTargetBarSizePx
|
||||
+ dropTargetBarBottomMarginPx;
|
||||
return workspaceSpringLoadShrunkTop;
|
||||
return mWorkspaceSpringLoadShrunkTop;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -928,10 +938,10 @@ public class DeviceProfile {
|
||||
*/
|
||||
public float getCellLayoutSpringLoadShrunkBottom() {
|
||||
int topOfHotseat = hotseatBarSizePx + springLoadedHotseatBarTopMarginPx;
|
||||
workspaceSpringLoadShrunkBottom =
|
||||
mWorkspaceSpringLoadShrunkBottom =
|
||||
heightPx - (isVerticalBarLayout() ? getVerticalHotseatLastItemBottomOffset()
|
||||
: topOfHotseat);
|
||||
return workspaceSpringLoadShrunkBottom;
|
||||
return mWorkspaceSpringLoadShrunkBottom;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1054,8 +1064,7 @@ public class DeviceProfile {
|
||||
int requiredWidth = iconSizePx * numShownHotseatIcons
|
||||
+ hotseatBorderSpace * (numShownHotseatIcons - 1)
|
||||
+ additionalQsbSpace;
|
||||
int endOffset = ApiWrapper.getHotseatEndOffset(context);
|
||||
int hotseatWidth = Math.min(requiredWidth, availableWidthPx - endOffset);
|
||||
int hotseatWidth = Math.min(requiredWidth, availableWidthPx - hotseatBarEndOffset);
|
||||
int sideSpacing = (availableWidthPx - hotseatWidth) / 2;
|
||||
|
||||
mHotseatBarPadding.set(sideSpacing, hotseatBarTopPadding, sideSpacing,
|
||||
@@ -1068,10 +1077,10 @@ public class DeviceProfile {
|
||||
mHotseatBarPadding.left += additionalQsbSpace;
|
||||
}
|
||||
|
||||
if (endOffset > sideSpacing) {
|
||||
if (hotseatBarEndOffset > sideSpacing) {
|
||||
int diff = isRtl
|
||||
? sideSpacing - endOffset
|
||||
: endOffset - sideSpacing;
|
||||
? sideSpacing - hotseatBarEndOffset
|
||||
: hotseatBarEndOffset - sideSpacing;
|
||||
mHotseatBarPadding.left -= diff;
|
||||
mHotseatBarPadding.right += diff;
|
||||
}
|
||||
@@ -1235,6 +1244,7 @@ public class DeviceProfile {
|
||||
return "\t" + name + ": " + value + "px (" + dpiFromPx(value, mMetrics.densityDpi) + "dp)";
|
||||
}
|
||||
|
||||
// LINT.IfChange
|
||||
public void dump(String prefix, PrintWriter writer) {
|
||||
writer.println(prefix + "DeviceProfile:");
|
||||
writer.println(prefix + "\t1 dp = " + mMetrics.density + " px");
|
||||
@@ -1314,7 +1324,8 @@ public class DeviceProfile {
|
||||
allAppsIconDrawablePaddingPx));
|
||||
writer.println(prefix + pxToDpStr("allAppsCellHeightPx", allAppsCellHeightPx));
|
||||
writer.println(prefix + pxToDpStr("allAppsCellWidthPx", allAppsCellWidthPx));
|
||||
writer.println(prefix + pxToDpStr("allAppsBorderSpacePx", allAppsBorderSpacePx.x));
|
||||
writer.println(prefix + pxToDpStr("allAppsBorderSpacePxX", allAppsBorderSpacePx.x));
|
||||
writer.println(prefix + pxToDpStr("allAppsBorderSpacePxY", allAppsBorderSpacePx.y));
|
||||
writer.println(prefix + "\tnumShownAllAppsColumns: " + numShownAllAppsColumns);
|
||||
writer.println(prefix + pxToDpStr("allAppsLeftRightPadding", allAppsLeftRightPadding));
|
||||
writer.println(prefix + pxToDpStr("allAppsLeftRightMargin", allAppsLeftRightMargin));
|
||||
@@ -1322,11 +1333,12 @@ public class DeviceProfile {
|
||||
writer.println(prefix + pxToDpStr("hotseatBarSizePx", hotseatBarSizePx));
|
||||
writer.println(prefix + "\tinv.hotseatColumnSpan: " + inv.hotseatColumnSpan[mTypeIndex]);
|
||||
writer.println(prefix + pxToDpStr("hotseatCellHeightPx", hotseatCellHeightPx));
|
||||
writer.println(prefix + pxToDpStr("hotseatBarBottomPaddingPx", hotseatBarBottomSpacePx));
|
||||
writer.println(prefix + pxToDpStr("hotseatBarBottomSpacePx", hotseatBarBottomSpacePx));
|
||||
writer.println(prefix + pxToDpStr("hotseatBarSidePaddingStartPx",
|
||||
hotseatBarSidePaddingStartPx));
|
||||
writer.println(prefix + pxToDpStr("hotseatBarSidePaddingEndPx",
|
||||
hotseatBarSidePaddingEndPx));
|
||||
writer.println(prefix + pxToDpStr("hotseatBarEndOffset", hotseatBarEndOffset));
|
||||
writer.println(prefix + pxToDpStr("hotseatQsbSpace", hotseatQsbSpace));
|
||||
writer.println(prefix + pxToDpStr("hotseatQsbHeight", hotseatQsbHeight));
|
||||
writer.println(prefix + pxToDpStr("springLoadedHotseatBarTopMarginPx",
|
||||
@@ -1389,11 +1401,9 @@ public class DeviceProfile {
|
||||
prefix + pxToDpStr("dropTargetBarBottomMarginPx", dropTargetBarBottomMarginPx));
|
||||
|
||||
writer.println(
|
||||
prefix + pxToDpStr("workspaceSpringLoadShrunkTop", workspaceSpringLoadShrunkTop));
|
||||
prefix + pxToDpStr("workspaceSpringLoadShrunkTop", mWorkspaceSpringLoadShrunkTop));
|
||||
writer.println(prefix + pxToDpStr("workspaceSpringLoadShrunkBottom",
|
||||
workspaceSpringLoadShrunkBottom));
|
||||
writer.println(prefix + pxToDpStr("workspaceSpringLoadedBottomSpace",
|
||||
workspaceSpringLoadedBottomSpace));
|
||||
mWorkspaceSpringLoadShrunkBottom));
|
||||
writer.println(prefix + pxToDpStr("workspaceSpringLoadedMinNextPageVisiblePx",
|
||||
workspaceSpringLoadedMinNextPageVisiblePx));
|
||||
writer.println(
|
||||
@@ -1401,6 +1411,19 @@ public class DeviceProfile {
|
||||
writer.println(prefix + pxToDpStr("getCellLayoutHeight()", getCellLayoutHeight()));
|
||||
writer.println(prefix + pxToDpStr("getCellLayoutWidth()", getCellLayoutWidth()));
|
||||
}
|
||||
// LINT.ThenChange(
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfilePhoneTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileVerticalBarTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfilePhone3ButtonTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileVerticalBar3ButtonTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileTabletLandscapeTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileTabletPortraitTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileTabletLandscape3ButtonTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileTabletPortrait3ButtonTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileTwoPanelLandscapeTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileTwoPanelPortraitTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileTwoPanelLandscape3ButtonTest.kt,
|
||||
// packages/apps/Launcher3/quickstep/tests/src/com/android/quickstep/DeviceProfileTwoPanelPortrait3ButtonTest.kt)
|
||||
|
||||
private static Context getContext(Context c, Info info, int orientation, WindowBounds bounds) {
|
||||
Configuration config = new Configuration(c.getResources().getConfiguration());
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
* 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.launcher3.views;
|
||||
|
||||
import static android.view.View.MeasureSpec.EXACTLY;
|
||||
import static android.view.View.MeasureSpec.makeMeasureSpec;
|
||||
|
||||
import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.FloatProperty;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
||||
/**
|
||||
* A {@link LinearLayout} container which allows scrolling parts of its content based on the
|
||||
* scroll of a different view. Views which are marked as sticky are not scrolled, giving the
|
||||
* illusion of a sticky header.
|
||||
*/
|
||||
public class StickyHeaderLayout extends LinearLayout implements
|
||||
RecyclerView.OnChildAttachStateChangeListener {
|
||||
|
||||
private static final FloatProperty<StickyHeaderLayout> SCROLL_OFFSET =
|
||||
new FloatProperty<StickyHeaderLayout>("scrollAnimOffset") {
|
||||
@Override
|
||||
public void setValue(StickyHeaderLayout view, float offset) {
|
||||
view.mScrollOffset = offset;
|
||||
view.updateHeaderScroll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(StickyHeaderLayout view) {
|
||||
return view.mScrollOffset;
|
||||
}
|
||||
};
|
||||
|
||||
private static final MotionEventProxyMethod INTERCEPT_PROXY = ViewGroup::onInterceptTouchEvent;
|
||||
private static final MotionEventProxyMethod TOUCH_PROXY = ViewGroup::onTouchEvent;
|
||||
|
||||
private RecyclerView mCurrentRecyclerView;
|
||||
private EmptySpaceView mCurrentEmptySpaceView;
|
||||
|
||||
private float mLastScroll = 0;
|
||||
private float mScrollOffset = 0;
|
||||
private Animator mOffsetAnimator;
|
||||
|
||||
private boolean mShouldForwardToRecyclerView = false;
|
||||
private int mHeaderHeight;
|
||||
|
||||
public StickyHeaderLayout(Context context) {
|
||||
this(context, /* attrs= */ null);
|
||||
}
|
||||
|
||||
public StickyHeaderLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, /* defStyleAttr= */ 0);
|
||||
}
|
||||
|
||||
public StickyHeaderLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
this(context, attrs, defStyleAttr, /* defStyleRes= */ 0);
|
||||
}
|
||||
|
||||
public StickyHeaderLayout(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the recycler view, this sticky header should track
|
||||
*/
|
||||
public void setCurrentRecyclerView(RecyclerView currentRecyclerView) {
|
||||
boolean animateReset = mCurrentRecyclerView != null;
|
||||
if (mCurrentRecyclerView != null) {
|
||||
mCurrentRecyclerView.removeOnChildAttachStateChangeListener(this);
|
||||
}
|
||||
mCurrentRecyclerView = currentRecyclerView;
|
||||
mCurrentRecyclerView.addOnChildAttachStateChangeListener(this);
|
||||
findCurrentEmptyView();
|
||||
reset(animateReset);
|
||||
}
|
||||
|
||||
public int getHeaderHeight() {
|
||||
return mHeaderHeight;
|
||||
}
|
||||
|
||||
private void updateHeaderScroll() {
|
||||
mLastScroll = getCurrentScroll();
|
||||
int count = getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
View child = getChildAt(i);
|
||||
MyLayoutParams lp = (MyLayoutParams) child.getLayoutParams();
|
||||
child.setTranslationY(Math.max(mLastScroll, lp.scrollLimit));
|
||||
}
|
||||
}
|
||||
|
||||
private float getCurrentScroll() {
|
||||
return mScrollOffset + (mCurrentEmptySpaceView == null ? 0 : mCurrentEmptySpaceView.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
mHeaderHeight = getMeasuredHeight();
|
||||
if (mCurrentEmptySpaceView != null) {
|
||||
mCurrentEmptySpaceView.setFixedHeight(mHeaderHeight);
|
||||
}
|
||||
}
|
||||
|
||||
/** Resets any previous view translation. */
|
||||
public void reset(boolean animate) {
|
||||
if (mOffsetAnimator != null) {
|
||||
mOffsetAnimator.cancel();
|
||||
mOffsetAnimator = null;
|
||||
}
|
||||
|
||||
mScrollOffset = 0;
|
||||
if (!animate) {
|
||||
updateHeaderScroll();
|
||||
} else {
|
||||
float startValue = mLastScroll - getCurrentScroll();
|
||||
mOffsetAnimator = ObjectAnimator.ofFloat(this, SCROLL_OFFSET, startValue, 0);
|
||||
mOffsetAnimator.addListener(forEndCallback(() -> mOffsetAnimator = null));
|
||||
mOffsetAnimator.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
return (mShouldForwardToRecyclerView = proxyMotionEvent(event, INTERCEPT_PROXY))
|
||||
|| super.onInterceptTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return mShouldForwardToRecyclerView && proxyMotionEvent(event, TOUCH_PROXY)
|
||||
|| super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
private boolean proxyMotionEvent(MotionEvent event, MotionEventProxyMethod method) {
|
||||
float dx = mCurrentRecyclerView.getLeft() - getLeft();
|
||||
float dy = mCurrentRecyclerView.getTop() - getTop();
|
||||
event.offsetLocation(dx, dy);
|
||||
try {
|
||||
return method.proxyEvent(mCurrentRecyclerView, event);
|
||||
} finally {
|
||||
event.offsetLocation(-dx, -dy);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildViewAttachedToWindow(@NonNull View view) {
|
||||
if (view instanceof EmptySpaceView) {
|
||||
findCurrentEmptyView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildViewDetachedFromWindow(@NonNull View view) {
|
||||
if (view == mCurrentEmptySpaceView) {
|
||||
findCurrentEmptyView();
|
||||
}
|
||||
}
|
||||
|
||||
private void findCurrentEmptyView() {
|
||||
if (mCurrentEmptySpaceView != null) {
|
||||
mCurrentEmptySpaceView.setOnYChangeCallback(null);
|
||||
mCurrentEmptySpaceView = null;
|
||||
}
|
||||
int childCount = mCurrentRecyclerView.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View view = mCurrentRecyclerView.getChildAt(i);
|
||||
if (view instanceof EmptySpaceView) {
|
||||
mCurrentEmptySpaceView = (EmptySpaceView) view;
|
||||
mCurrentEmptySpaceView.setFixedHeight(getHeaderHeight());
|
||||
mCurrentEmptySpaceView.setOnYChangeCallback(this::updateHeaderScroll);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed, l, t, r, b);
|
||||
|
||||
// Update various stick parameters
|
||||
int count = getChildCount();
|
||||
int stickyHeaderHeight = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
View v = getChildAt(i);
|
||||
MyLayoutParams lp = (MyLayoutParams) v.getLayoutParams();
|
||||
if (lp.sticky) {
|
||||
lp.scrollLimit = -v.getTop() + stickyHeaderHeight;
|
||||
stickyHeaderHeight += v.getHeight();
|
||||
} else {
|
||||
lp.scrollLimit = Integer.MIN_VALUE;
|
||||
}
|
||||
}
|
||||
updateHeaderScroll();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayoutParams generateDefaultLayoutParams() {
|
||||
return new MyLayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams lp) {
|
||||
return new MyLayoutParams(lp.width, lp.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayoutParams generateLayoutParams(AttributeSet attrs) {
|
||||
return new MyLayoutParams(getContext(), attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
|
||||
return p instanceof MyLayoutParams;
|
||||
}
|
||||
|
||||
private static class MyLayoutParams extends LayoutParams {
|
||||
|
||||
public final boolean sticky;
|
||||
public int scrollLimit;
|
||||
|
||||
MyLayoutParams(int width, int height) {
|
||||
super(width, height);
|
||||
sticky = false;
|
||||
}
|
||||
|
||||
MyLayoutParams(Context c, AttributeSet attrs) {
|
||||
super(c, attrs);
|
||||
TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.StickyScroller_Layout);
|
||||
sticky = a.getBoolean(R.styleable.StickyScroller_Layout_layout_sticky, false);
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
private interface MotionEventProxyMethod {
|
||||
|
||||
boolean proxyEvent(ViewGroup view, MotionEvent event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty view which allows listening for 'Y' changes
|
||||
*/
|
||||
public static class EmptySpaceView extends View {
|
||||
|
||||
private Runnable mOnYChangeCallback;
|
||||
private int mHeight = 0;
|
||||
|
||||
public EmptySpaceView(Context context) {
|
||||
super(context);
|
||||
animate().setUpdateListener(v -> notifyYChanged());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the height for the empty view
|
||||
* @return true if the height changed, false otherwise
|
||||
*/
|
||||
public boolean setFixedHeight(int height) {
|
||||
if (mHeight != height) {
|
||||
mHeight = height;
|
||||
requestLayout();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, makeMeasureSpec(mHeight, EXACTLY));
|
||||
}
|
||||
|
||||
public void setOnYChangeCallback(Runnable callback) {
|
||||
mOnYChangeCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
notifyYChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void offsetTopAndBottom(int offset) {
|
||||
super.offsetTopAndBottom(offset);
|
||||
notifyYChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTranslationY(float translationY) {
|
||||
super.setTranslationY(translationY);
|
||||
notifyYChanged();
|
||||
}
|
||||
|
||||
private void notifyYChanged() {
|
||||
if (mOnYChangeCallback != null) {
|
||||
mOnYChangeCallback.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-223
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* 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.launcher3.widget.picker;
|
||||
|
||||
import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.util.FloatProperty;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.widget.picker.WidgetsSpaceViewHolderBinder.EmptySpaceView;
|
||||
import com.android.launcher3.widget.picker.search.WidgetsSearchBar;
|
||||
|
||||
/**
|
||||
* A controller which measures & updates {@link WidgetsFullSheet}'s views padding, margin and
|
||||
* vertical displacement upon scrolling.
|
||||
*/
|
||||
final class SearchAndRecommendationsScrollController implements
|
||||
RecyclerView.OnChildAttachStateChangeListener {
|
||||
|
||||
private static final FloatProperty<SearchAndRecommendationsScrollController> SCROLL_OFFSET =
|
||||
new FloatProperty<SearchAndRecommendationsScrollController>("scrollAnimOffset") {
|
||||
@Override
|
||||
public void setValue(SearchAndRecommendationsScrollController controller, float offset) {
|
||||
controller.mScrollOffset = offset;
|
||||
controller.updateHeaderScroll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(SearchAndRecommendationsScrollController controller) {
|
||||
return controller.mScrollOffset;
|
||||
}
|
||||
};
|
||||
|
||||
private static final MotionEventProxyMethod INTERCEPT_PROXY = ViewGroup::onInterceptTouchEvent;
|
||||
private static final MotionEventProxyMethod TOUCH_PROXY = ViewGroup::onTouchEvent;
|
||||
|
||||
final SearchAndRecommendationsView mContainer;
|
||||
final View mSearchBarContainer;
|
||||
final WidgetsSearchBar mSearchBar;
|
||||
final TextView mHeaderTitle;
|
||||
final WidgetsRecommendationTableLayout mRecommendedWidgetsTable;
|
||||
@Nullable final View mTabBar;
|
||||
|
||||
private WidgetsRecyclerView mCurrentRecyclerView;
|
||||
private EmptySpaceView mCurrentEmptySpaceView;
|
||||
|
||||
private float mLastScroll = 0;
|
||||
private float mScrollOffset = 0;
|
||||
private Animator mOffsetAnimator;
|
||||
|
||||
private boolean mShouldForwardToRecyclerView = false;
|
||||
|
||||
private int mHeaderHeight;
|
||||
|
||||
SearchAndRecommendationsScrollController(
|
||||
SearchAndRecommendationsView searchAndRecommendationContainer) {
|
||||
mContainer = searchAndRecommendationContainer;
|
||||
mSearchBarContainer = mContainer.findViewById(R.id.search_bar_container);
|
||||
mSearchBar = mContainer.findViewById(R.id.widgets_search_bar);
|
||||
mHeaderTitle = mContainer.findViewById(R.id.title);
|
||||
mRecommendedWidgetsTable = mContainer.findViewById(R.id.recommended_widget_table);
|
||||
mTabBar = mContainer.findViewById(R.id.tabs);
|
||||
|
||||
mContainer.setSearchAndRecommendationScrollController(this);
|
||||
}
|
||||
|
||||
public void setCurrentRecyclerView(WidgetsRecyclerView currentRecyclerView) {
|
||||
boolean animateReset = mCurrentRecyclerView != null;
|
||||
if (mCurrentRecyclerView != null) {
|
||||
mCurrentRecyclerView.removeOnChildAttachStateChangeListener(this);
|
||||
}
|
||||
mCurrentRecyclerView = currentRecyclerView;
|
||||
mCurrentRecyclerView.addOnChildAttachStateChangeListener(this);
|
||||
findCurrentEmptyView();
|
||||
reset(animateReset);
|
||||
}
|
||||
|
||||
public int getHeaderHeight() {
|
||||
return mHeaderHeight;
|
||||
}
|
||||
|
||||
private void updateHeaderScroll() {
|
||||
mLastScroll = getCurrentScroll();
|
||||
mHeaderTitle.setTranslationY(mLastScroll);
|
||||
mRecommendedWidgetsTable.setTranslationY(mLastScroll);
|
||||
|
||||
float searchYDisplacement = Math.max(mLastScroll, -mSearchBarContainer.getTop());
|
||||
mSearchBarContainer.setTranslationY(searchYDisplacement);
|
||||
|
||||
if (mTabBar != null) {
|
||||
float tabsDisplacement = Math.max(mLastScroll, -mTabBar.getTop()
|
||||
+ mSearchBarContainer.getHeight());
|
||||
mTabBar.setTranslationY(tabsDisplacement);
|
||||
}
|
||||
}
|
||||
|
||||
private float getCurrentScroll() {
|
||||
return mScrollOffset + (mCurrentEmptySpaceView == null ? 0 : mCurrentEmptySpaceView.getY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the scrollable header height
|
||||
*
|
||||
* @return {@code true} if the header height or dependent property changed.
|
||||
*/
|
||||
public boolean updateHeaderHeight() {
|
||||
boolean hasSizeUpdated = false;
|
||||
|
||||
int headerHeight = mContainer.getMeasuredHeight();
|
||||
if (headerHeight != mHeaderHeight) {
|
||||
mHeaderHeight = headerHeight;
|
||||
hasSizeUpdated = true;
|
||||
}
|
||||
|
||||
if (mCurrentEmptySpaceView != null
|
||||
&& mCurrentEmptySpaceView.setFixedHeight(mHeaderHeight)) {
|
||||
hasSizeUpdated = true;
|
||||
}
|
||||
return hasSizeUpdated;
|
||||
}
|
||||
|
||||
/** Resets any previous view translation. */
|
||||
public void reset(boolean animate) {
|
||||
if (mOffsetAnimator != null) {
|
||||
mOffsetAnimator.cancel();
|
||||
mOffsetAnimator = null;
|
||||
}
|
||||
|
||||
mScrollOffset = 0;
|
||||
if (!animate) {
|
||||
updateHeaderScroll();
|
||||
} else {
|
||||
float startValue = mLastScroll - getCurrentScroll();
|
||||
mOffsetAnimator = ObjectAnimator.ofFloat(this, SCROLL_OFFSET, startValue, 0);
|
||||
mOffsetAnimator.addListener(forEndCallback(() -> mOffsetAnimator = null));
|
||||
mOffsetAnimator.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if a touch event should be intercepted by this controller.
|
||||
*/
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
return (mShouldForwardToRecyclerView = proxyMotionEvent(event, INTERCEPT_PROXY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this controller has intercepted and consumed a touch event.
|
||||
*/
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return mShouldForwardToRecyclerView && proxyMotionEvent(event, TOUCH_PROXY);
|
||||
}
|
||||
|
||||
private boolean proxyMotionEvent(MotionEvent event, MotionEventProxyMethod method) {
|
||||
float dx = mCurrentRecyclerView.getLeft() - mContainer.getLeft();
|
||||
float dy = mCurrentRecyclerView.getTop() - mContainer.getTop();
|
||||
event.offsetLocation(dx, dy);
|
||||
try {
|
||||
return method.proxyEvent(mCurrentRecyclerView, event);
|
||||
} finally {
|
||||
event.offsetLocation(-dx, -dy);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildViewAttachedToWindow(@NonNull View view) {
|
||||
if (view instanceof EmptySpaceView) {
|
||||
findCurrentEmptyView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildViewDetachedFromWindow(@NonNull View view) {
|
||||
if (view == mCurrentEmptySpaceView) {
|
||||
findCurrentEmptyView();
|
||||
}
|
||||
}
|
||||
|
||||
private void findCurrentEmptyView() {
|
||||
if (mCurrentEmptySpaceView != null) {
|
||||
mCurrentEmptySpaceView.setOnYChangeCallback(null);
|
||||
mCurrentEmptySpaceView = null;
|
||||
}
|
||||
int childCount = mCurrentRecyclerView.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View view = mCurrentRecyclerView.getChildAt(i);
|
||||
if (view instanceof EmptySpaceView) {
|
||||
mCurrentEmptySpaceView = (EmptySpaceView) view;
|
||||
mCurrentEmptySpaceView.setFixedHeight(getHeaderHeight());
|
||||
mCurrentEmptySpaceView.setOnYChangeCallback(this::updateHeaderScroll);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private interface MotionEventProxyMethod {
|
||||
|
||||
boolean proxyEvent(ViewGroup view, MotionEvent event);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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.launcher3.widget.picker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/**
|
||||
* A {@link LinearLayout} container for holding search and widgets recommendation.
|
||||
*
|
||||
* <p>This class intercepts touch events and dispatch them to the right view.
|
||||
*/
|
||||
public class SearchAndRecommendationsView extends LinearLayout {
|
||||
private SearchAndRecommendationsScrollController mController;
|
||||
|
||||
public SearchAndRecommendationsView(Context context) {
|
||||
this(context, /* attrs= */ null);
|
||||
}
|
||||
|
||||
public SearchAndRecommendationsView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, /* defStyleAttr= */ 0);
|
||||
}
|
||||
|
||||
public SearchAndRecommendationsView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
this(context, attrs, defStyleAttr, /* defStyleRes= */ 0);
|
||||
}
|
||||
|
||||
public SearchAndRecommendationsView(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
public void setSearchAndRecommendationScrollController(
|
||||
SearchAndRecommendationsScrollController controller) {
|
||||
mController = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
return mController.onInterceptTouchEvent(event) || super.onInterceptTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return mController.onTouchEvent(event) || super.onTouchEvent(event);
|
||||
}
|
||||
}
|
||||
@@ -62,11 +62,13 @@ import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.views.ArrowTipView;
|
||||
import com.android.launcher3.views.RecyclerViewFastScroller;
|
||||
import com.android.launcher3.views.SpringRelativeLayout;
|
||||
import com.android.launcher3.views.StickyHeaderLayout;
|
||||
import com.android.launcher3.views.WidgetsEduView;
|
||||
import com.android.launcher3.widget.BaseWidgetSheet;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetHost.ProviderChangedListener;
|
||||
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
|
||||
import com.android.launcher3.widget.picker.search.SearchModeListener;
|
||||
import com.android.launcher3.widget.picker.search.WidgetsSearchBar;
|
||||
import com.android.launcher3.widget.util.WidgetsTableUtils;
|
||||
import com.android.launcher3.workprofile.PersonalWorkPagedView;
|
||||
import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.OnActivePageChangedListener;
|
||||
@@ -161,7 +163,13 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
private boolean mIsNoWidgetsViewNeeded;
|
||||
private int mMaxSpansPerRow = DEFAULT_MAX_HORIZONTAL_SPANS;
|
||||
private TextView mNoWidgetsView;
|
||||
private SearchAndRecommendationsScrollController mSearchScrollController;
|
||||
|
||||
private StickyHeaderLayout mSearchScrollView;
|
||||
private WidgetsRecommendationTableLayout mRecommendedWidgetsTable;
|
||||
private View mTabBar;
|
||||
private View mSearchBarContainer;
|
||||
private WidgetsSearchBar mSearchBar;
|
||||
private TextView mHeaderTitle;
|
||||
|
||||
public WidgetsFullSheet(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
@@ -214,17 +222,23 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
}
|
||||
|
||||
mNoWidgetsView = findViewById(R.id.no_widgets_text);
|
||||
mSearchScrollController = new SearchAndRecommendationsScrollController(
|
||||
findViewById(R.id.search_and_recommendations_container));
|
||||
mSearchScrollController.setCurrentRecyclerView(
|
||||
findViewById(R.id.primary_widgets_list_view));
|
||||
mSearchScrollController.mRecommendedWidgetsTable.setWidgetCellLongClickListener(this);
|
||||
mSearchScrollController.mRecommendedWidgetsTable.setWidgetCellOnClickListener(this);
|
||||
|
||||
mSearchScrollView = findViewById(R.id.search_and_recommendations_container);
|
||||
mSearchScrollView.setCurrentRecyclerView(findViewById(R.id.primary_widgets_list_view));
|
||||
|
||||
mRecommendedWidgetsTable = mSearchScrollView.findViewById(R.id.recommended_widget_table);
|
||||
mRecommendedWidgetsTable.setWidgetCellLongClickListener(this);
|
||||
mRecommendedWidgetsTable.setWidgetCellOnClickListener(this);
|
||||
|
||||
mTabBar = mSearchScrollView.findViewById(R.id.tabs);
|
||||
mSearchBarContainer = mSearchScrollView.findViewById(R.id.search_bar_container);
|
||||
mSearchBar = mSearchScrollView.findViewById(R.id.widgets_search_bar);
|
||||
mHeaderTitle = mSearchScrollView.findViewById(R.id.title);
|
||||
|
||||
onRecommendedWidgetsBound();
|
||||
onWidgetsBound();
|
||||
|
||||
mSearchScrollController.mSearchBar.initialize(
|
||||
mSearchBar.initialize(
|
||||
mActivityContext.getPopupDataProvider(), /* searchModeListener= */ this);
|
||||
|
||||
setUpEducationViewsIfNeeded();
|
||||
@@ -258,7 +272,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
reset();
|
||||
resetExpandedHeaders();
|
||||
mCurrentWidgetsRecyclerView = recyclerView;
|
||||
mSearchScrollController.setCurrentRecyclerView(recyclerView);
|
||||
mSearchScrollView.setCurrentRecyclerView(recyclerView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +299,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
mAdapters.get(AdapterHolder.WORK).mWidgetsRecyclerView.scrollToTop();
|
||||
}
|
||||
mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView.scrollToTop();
|
||||
mSearchScrollController.reset(/* animate= */ true);
|
||||
mSearchScrollView.reset(/* animate= */ true);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -355,8 +369,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
|
||||
@Override
|
||||
protected void onContentHorizontalMarginChanged(int contentHorizontalMarginInPx) {
|
||||
setContentViewChildHorizontalMargin(mSearchScrollController.mContainer,
|
||||
contentHorizontalMarginInPx);
|
||||
setContentViewChildHorizontalMargin(mSearchScrollView, contentHorizontalMarginInPx);
|
||||
if (mViewPager == null) {
|
||||
setContentViewChildHorizontalPadding(
|
||||
mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView,
|
||||
@@ -390,16 +403,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
doMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
if (mSearchScrollController.updateHeaderHeight()) {
|
||||
doMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
if (updateMaxSpansPerRow()) {
|
||||
doMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
if (mSearchScrollController.updateHeaderHeight()) {
|
||||
doMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +465,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
|
||||
if (mHasWorkProfile) {
|
||||
mViewPager.setVisibility(VISIBLE);
|
||||
mSearchScrollController.mTabBar.setVisibility(VISIBLE);
|
||||
mTabBar.setVisibility(VISIBLE);
|
||||
AdapterHolder workUserAdapterHolder = mAdapters.get(AdapterHolder.WORK);
|
||||
workUserAdapterHolder.mWidgetsListAdapter.setWidgets(allWidgets);
|
||||
onActivePageChanged(mViewPager.getCurrentPage());
|
||||
@@ -508,10 +513,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
private void setViewVisibilityBasedOnSearch(boolean isInSearchMode) {
|
||||
mIsInSearchMode = isInSearchMode;
|
||||
if (isInSearchMode) {
|
||||
mSearchScrollController.mRecommendedWidgetsTable.setVisibility(GONE);
|
||||
mRecommendedWidgetsTable.setVisibility(GONE);
|
||||
if (mHasWorkProfile) {
|
||||
mViewPager.setVisibility(GONE);
|
||||
mSearchScrollController.mTabBar.setVisibility(GONE);
|
||||
mTabBar.setVisibility(GONE);
|
||||
} else {
|
||||
mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView.setVisibility(GONE);
|
||||
}
|
||||
@@ -539,7 +544,6 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
}
|
||||
List<WidgetItem> recommendedWidgets =
|
||||
mActivityContext.getPopupDataProvider().getRecommendedWidgets();
|
||||
WidgetsRecommendationTableLayout table = mSearchScrollController.mRecommendedWidgetsTable;
|
||||
if (recommendedWidgets.size() > 0) {
|
||||
float noWidgetsViewHeight = 0;
|
||||
if (mIsNoWidgetsViewNeeded) {
|
||||
@@ -562,9 +566,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
List<ArrayList<WidgetItem>> recommendedWidgetsInTable =
|
||||
WidgetsTableUtils.groupWidgetItemsIntoTableWithoutReordering(
|
||||
recommendedWidgets, mMaxSpansPerRow);
|
||||
table.setRecommendedWidgets(recommendedWidgetsInTable, maxTableHeight);
|
||||
mRecommendedWidgetsTable.setRecommendedWidgets(
|
||||
recommendedWidgetsInTable, maxTableHeight);
|
||||
} else {
|
||||
table.setVisibility(GONE);
|
||||
mRecommendedWidgetsTable.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,10 +624,9 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
mNoIntercept = !getRecyclerView().shouldContainerScroll(ev, getPopupContainer());
|
||||
}
|
||||
|
||||
if (mSearchScrollController.mSearchBar.isSearchBarFocused()
|
||||
&& !getPopupContainer().isEventOverView(
|
||||
mSearchScrollController.mSearchBarContainer, ev)) {
|
||||
mSearchScrollController.mSearchBar.clearSearchBarFocus();
|
||||
if (mSearchBar.isSearchBarFocused()
|
||||
&& !getPopupContainer().isEventOverView(mSearchBarContainer, ev)) {
|
||||
mSearchBar.clearSearchBarFocus();
|
||||
}
|
||||
}
|
||||
return super.onControllerInterceptTouchEvent(ev);
|
||||
@@ -663,8 +667,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
|
||||
@Override
|
||||
public int getHeaderViewHeight() {
|
||||
return measureHeightWithVerticalMargins(mSearchScrollController.mHeaderTitle)
|
||||
+ measureHeightWithVerticalMargins(mSearchScrollController.mSearchBarContainer);
|
||||
return measureHeightWithVerticalMargins(mHeaderTitle)
|
||||
+ measureHeightWithVerticalMargins(mSearchBarContainer);
|
||||
}
|
||||
|
||||
/** private the height, in pixel, + the vertical margins of a given view. */
|
||||
@@ -681,14 +685,14 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (mIsInSearchMode) {
|
||||
mSearchScrollController.mSearchBar.reset();
|
||||
mSearchBar.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
if (mIsInSearchMode) {
|
||||
mSearchScrollController.mSearchBar.reset();
|
||||
mSearchBar.reset();
|
||||
return true;
|
||||
}
|
||||
return super.onBackPressed();
|
||||
@@ -701,10 +705,9 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
}
|
||||
|
||||
@Nullable private View getViewToShowEducationTip() {
|
||||
if (mSearchScrollController.mRecommendedWidgetsTable.getVisibility() == VISIBLE
|
||||
&& mSearchScrollController.mRecommendedWidgetsTable.getChildCount() > 0) {
|
||||
return ((ViewGroup) mSearchScrollController.mRecommendedWidgetsTable.getChildAt(0))
|
||||
.getChildAt(0);
|
||||
if (mRecommendedWidgetsTable.getVisibility() == VISIBLE
|
||||
&& mRecommendedWidgetsTable.getChildCount() > 0) {
|
||||
return ((ViewGroup) mRecommendedWidgetsTable.getChildAt(0)).getChildAt(0);
|
||||
}
|
||||
|
||||
AdapterHolder adapterHolder = mAdapters.get(mIsInSearchMode
|
||||
@@ -801,7 +804,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
}
|
||||
|
||||
private int getEmptySpaceHeight() {
|
||||
return mSearchScrollController.getHeaderHeight();
|
||||
return mSearchScrollView.getHeaderHeight();
|
||||
}
|
||||
|
||||
void setup(WidgetsRecyclerView recyclerView) {
|
||||
|
||||
@@ -15,16 +15,12 @@
|
||||
*/
|
||||
package com.android.launcher3.widget.picker;
|
||||
|
||||
import static android.view.View.MeasureSpec.EXACTLY;
|
||||
import static android.view.View.MeasureSpec.makeMeasureSpec;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.android.launcher3.recyclerview.ViewHolderBinder;
|
||||
import com.android.launcher3.views.StickyHeaderLayout.EmptySpaceView;
|
||||
import com.android.launcher3.widget.model.WidgetListSpaceEntry;
|
||||
|
||||
import java.util.List;
|
||||
@@ -52,64 +48,4 @@ public class WidgetsSpaceViewHolderBinder
|
||||
@ListPosition int position, List<Object> payloads) {
|
||||
((EmptySpaceView) holder.itemView).setFixedHeight(mEmptySpaceHeightProvider.getAsInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty view which allows listening for 'Y' changes
|
||||
*/
|
||||
public static class EmptySpaceView extends View {
|
||||
|
||||
private Runnable mOnYChangeCallback;
|
||||
private int mHeight = 0;
|
||||
|
||||
private EmptySpaceView(Context context) {
|
||||
super(context);
|
||||
animate().setUpdateListener(v -> notifyYChanged());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the height for the empty view
|
||||
* @return true if the height changed, false otherwise
|
||||
*/
|
||||
public boolean setFixedHeight(int height) {
|
||||
if (mHeight != height) {
|
||||
mHeight = height;
|
||||
requestLayout();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, makeMeasureSpec(mHeight, EXACTLY));
|
||||
}
|
||||
|
||||
public void setOnYChangeCallback(Runnable callback) {
|
||||
mOnYChangeCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
notifyYChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void offsetTopAndBottom(int offset) {
|
||||
super.offsetTopAndBottom(offset);
|
||||
notifyYChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTranslationY(float translationY) {
|
||||
super.setTranslationY(translationY);
|
||||
notifyYChanged();
|
||||
}
|
||||
|
||||
private void notifyYChanged() {
|
||||
if (mOnYChangeCallback != null) {
|
||||
mOnYChangeCallback.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,8 @@ import com.android.launcher3.util.WindowBounds
|
||||
import org.junit.Before
|
||||
import org.mockito.ArgumentMatchers.any
|
||||
import org.mockito.Mockito.mock
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
import org.mockito.Mockito.`when` as whenever
|
||||
|
||||
abstract class DeviceProfileBaseTest {
|
||||
@@ -55,8 +57,9 @@ abstract class DeviceProfileBaseTest {
|
||||
isGestureMode
|
||||
)
|
||||
|
||||
protected fun initializeVarsForPhone(isLandscape: Boolean = false) {
|
||||
val (x, y) = if (isLandscape)
|
||||
protected fun initializeVarsForPhone(isGestureMode: Boolean = true,
|
||||
isVerticalBar: Boolean = false) {
|
||||
val (x, y) = if (isVerticalBar)
|
||||
Pair(3120, 1440)
|
||||
else
|
||||
Pair(1440, 3120)
|
||||
@@ -67,10 +70,17 @@ abstract class DeviceProfileBaseTest {
|
||||
whenever(info.getDensityDpi()).thenReturn(560)
|
||||
whenever(info.smallestSizeDp(any())).thenReturn(411f)
|
||||
|
||||
inv = newScalableInvariantDeviceProfile()
|
||||
this.isGestureMode = isGestureMode
|
||||
|
||||
inv = newScalableInvariantDeviceProfile().apply {
|
||||
deviceType = InvariantDeviceProfile.TYPE_PHONE
|
||||
transposeLayoutWithOrientation = isVerticalBar
|
||||
}
|
||||
}
|
||||
|
||||
protected fun initializeVarsForTablet(isLandscape: Boolean = false) {
|
||||
protected fun initializeVarsForTablet(isLandscape: Boolean = false,
|
||||
isTwoPanel: Boolean = false,
|
||||
isGestureMode: Boolean = true) {
|
||||
val (x, y) = if (isLandscape)
|
||||
Pair(2560, 1600)
|
||||
else
|
||||
@@ -82,7 +92,19 @@ abstract class DeviceProfileBaseTest {
|
||||
whenever(info.getDensityDpi()).thenReturn(320)
|
||||
whenever(info.smallestSizeDp(any())).thenReturn(800f)
|
||||
|
||||
inv = newScalableInvariantDeviceProfile()
|
||||
this.isGestureMode = isGestureMode
|
||||
useTwoPanels = isTwoPanel
|
||||
|
||||
inv = newScalableInvariantDeviceProfile().apply {
|
||||
deviceType = if (isTwoPanel)
|
||||
InvariantDeviceProfile.TYPE_MULTI_DISPLAY else InvariantDeviceProfile.TYPE_TABLET
|
||||
inlineQsb = booleanArrayOf(
|
||||
false,
|
||||
isLandscape,
|
||||
false,
|
||||
false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,4 +159,12 @@ abstract class DeviceProfileBaseTest {
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
fun dump(dp: DeviceProfile): StringWriter {
|
||||
val stringWriter = StringWriter()
|
||||
val printWriter = PrintWriter(stringWriter)
|
||||
dp.dump("", printWriter)
|
||||
printWriter.flush()
|
||||
return stringWriter
|
||||
}
|
||||
}
|
||||
@@ -31,33 +31,6 @@ import org.junit.runner.RunWith
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class HotseatShownIconsTest : DeviceProfileBaseTest() {
|
||||
|
||||
@Test
|
||||
fun hotseat_size_is_normal_for_handhelds() {
|
||||
initializeVarsForPhone()
|
||||
inv = newScalableInvariantDeviceProfile().apply {
|
||||
deviceType = TYPE_PHONE
|
||||
}
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.isQsbInline).isFalse()
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseat_size_is_max_when_large_screen() {
|
||||
initializeVarsForTablet(isLandscape = true)
|
||||
inv = newScalableInvariantDeviceProfile().apply {
|
||||
deviceType = TYPE_MULTI_DISPLAY
|
||||
}
|
||||
useTwoPanels = true
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.isQsbInline).isFalse()
|
||||
assertThat(dp.numShownHotseatIcons).isEqualTo(6)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hotseat_size_is_shrunk_if_needed_when_large_screen() {
|
||||
initializeVarsForTablet(isLandscape = true)
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.launcher3
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Test for [DeviceProfile]
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class InlineQsbTest : DeviceProfileBaseTest() {
|
||||
|
||||
@Test
|
||||
fun qsb_is_not_inline_for_phones() {
|
||||
initializeVarsForPhone()
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.isQsbInline).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsb_is_inline_for_tablet_portrait() {
|
||||
initializeVarsForTablet()
|
||||
inv = newScalableInvariantDeviceProfile().apply {
|
||||
inlineQsb = booleanArrayOf(
|
||||
false,
|
||||
true, // landscape
|
||||
false,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
val dp = DeviceProfile(
|
||||
context,
|
||||
inv,
|
||||
info,
|
||||
windowBounds,
|
||||
isMultiWindowMode,
|
||||
transposeLayoutWithOrientation,
|
||||
useTwoPanels,
|
||||
isGestureMode
|
||||
)
|
||||
|
||||
assertThat(dp.isQsbInline).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun qsb_is_inline_for_tablet_landscape() {
|
||||
initializeVarsForTablet(isLandscape = true)
|
||||
inv = newScalableInvariantDeviceProfile().apply {
|
||||
inlineQsb = booleanArrayOf(
|
||||
false,
|
||||
true, // landscape
|
||||
false,
|
||||
false
|
||||
)
|
||||
numColumns = 6
|
||||
numRows = 5
|
||||
numShownHotseatIcons = 6
|
||||
}
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
if (dp.hotseatQsbHeight > 0) {
|
||||
assertThat(dp.isQsbInline).isTrue()
|
||||
} else { // Launcher3 doesn't have QSB height
|
||||
assertThat(dp.isQsbInline).isFalse()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test is to make sure that a tablet doesn't inline the QSB if the layout doesn't support
|
||||
*/
|
||||
@Test
|
||||
fun qsb_is_not_inline_for_tablet_landscape_without_inline() {
|
||||
initializeVarsForTablet(isLandscape = true)
|
||||
useTwoPanels = true
|
||||
|
||||
val dp = newDP()
|
||||
|
||||
assertThat(dp.isQsbInline).isFalse()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -373,6 +373,17 @@ public final class LauncherInstrumentation {
|
||||
sActiveContainer = new WeakReference<>(container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the accesibility interactive timeout to be effectively indefinite (UI using this
|
||||
* accesibility timeout will not automatically dismiss if true).
|
||||
*/
|
||||
void setIndefiniteAccessibilityInteractiveUiTimeout(boolean indefiniteTimeout) {
|
||||
final String cmd = indefiniteTimeout
|
||||
? "settings put secure accessibility_interactive_ui_timeout_ms 10000"
|
||||
: "settings delete secure accessibility_interactive_ui_timeout_ms";
|
||||
logShellCommand(cmd);
|
||||
}
|
||||
|
||||
public NavigationModel getNavigationModel() {
|
||||
final Context baseContext = mInstrumentation.getTargetContext();
|
||||
try {
|
||||
|
||||
@@ -41,6 +41,8 @@ public class OverviewActions {
|
||||
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
|
||||
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to click screenshot button and exit screenshot ui")) {
|
||||
mLauncher.setIndefiniteAccessibilityInteractiveUiTimeout(true);
|
||||
|
||||
UiObject2 screenshot = mLauncher.waitForObjectInContainer(mOverviewActions,
|
||||
"action_screenshot");
|
||||
|
||||
@@ -62,6 +64,8 @@ public class OverviewActions {
|
||||
return new Overview(mLauncher);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mLauncher.setIndefiniteAccessibilityInteractiveUiTimeout(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user