Add DeviceProfile tests on all attributes across different configurations.
Fix: 237542518 Test: DeviceProfilePhoneTest.kt Test: DeviceProfileVerticalBarTest.kt Test: DeviceProfilePhone3ButtonTest.kt Test: DeviceProfileVerticalBar3ButtonTest.kt Test: DeviceProfileTabletLandscapeTest.kt Test: DeviceProfileTabletPortraitTest.kt Test: DeviceProfileTabletLandscape3ButtonTest.kt Test: DeviceProfileTabletPortrait3ButtonTest.kt Test: DeviceProfileTwoPanelLandscapeTest.kt Test: DeviceProfileTwoPanelPortraitTest.kt Test: DeviceProfileTwoPanelLandscape3ButtonTest.kt Test: DeviceProfileTwoPanelPortrait3ButtonTest.kt Change-Id: I1596dcd1fb8c9b353cdfcab224d7670d88bed716
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user