Create specs for hotseat
Some attributes of hotseat change depending on the size of the device. In the future more attributes could be moved to the spec, e.g. hotseat icons. Fix: 292204436 Test: CalculatedHotseatSpecTest Test: HotseatSpecsTest Test: SizeSpecTest Test: DeviceProfileResponsiveDumpTest Test: DeviceProfileResponsiveAlternativeDisplaysDumpTest Flag: ENABLE_RESPONSIVE_WORKSPACE Change-Id: I6a4e05d75af819dbf1444a5ca45c2080f55dc203
This commit is contained in:
1 parent
8648f5f751
commit
f8bfb036ba
13 files changed
+402
-17
No files matched your search
@@ -56,8 +56,10 @@ import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.responsive.AllAppsSpecs;
|
||||
import com.android.launcher3.responsive.CalculatedAllAppsSpec;
|
||||
import com.android.launcher3.responsive.CalculatedFolderSpec;
|
||||
import com.android.launcher3.responsive.CalculatedHotseatSpec;
|
||||
import com.android.launcher3.responsive.CalculatedWorkspaceSpec;
|
||||
import com.android.launcher3.responsive.FolderSpecs;
|
||||
import com.android.launcher3.responsive.HotseatSpecs;
|
||||
import com.android.launcher3.responsive.WorkspaceSpecs;
|
||||
import com.android.launcher3.uioverrides.ApiWrapper;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
@@ -121,6 +123,7 @@ public class DeviceProfile {
|
||||
private CalculatedAllAppsSpec mAllAppsResponsiveHeightSpec;
|
||||
private CalculatedFolderSpec mResponsiveFolderWidthSpec;
|
||||
private CalculatedFolderSpec mResponsiveFolderHeightSpec;
|
||||
private CalculatedHotseatSpec mResponsiveHotseatSpec;
|
||||
|
||||
/**
|
||||
* The maximum amount of left/right workspace padding as a percentage of the screen width.
|
||||
@@ -316,7 +319,8 @@ public class DeviceProfile {
|
||||
// TODO(b/241386436): shouldn't change any launcher behaviour
|
||||
mIsResponsiveGrid = inv.workspaceSpecsId != INVALID_RESOURCE_HANDLE
|
||||
&& inv.allAppsSpecsId != INVALID_RESOURCE_HANDLE
|
||||
&& inv.folderSpecsId != INVALID_RESOURCE_HANDLE;
|
||||
&& inv.folderSpecsId != INVALID_RESOURCE_HANDLE
|
||||
&& inv.hotseatSpecsId != INVALID_RESOURCE_HANDLE;
|
||||
|
||||
mIsScalableGrid = inv.isScalable && !isVerticalBarLayout() && !isMultiWindowMode;
|
||||
// Determine device posture.
|
||||
@@ -495,7 +499,17 @@ public class DeviceProfile {
|
||||
|
||||
int hotseatBarBottomSpace = pxFromDp(inv.hotseatBarBottomSpace[mTypeIndex], mMetrics);
|
||||
int minQsbMargin = res.getDimensionPixelSize(R.dimen.min_qsb_margin);
|
||||
hotseatQsbSpace = pxFromDp(inv.hotseatQsbSpace[mTypeIndex], mMetrics);
|
||||
|
||||
if (mIsResponsiveGrid) {
|
||||
HotseatSpecs hotseatSpecs =
|
||||
HotseatSpecs.create(new ResourceHelper(context,
|
||||
isTwoPanels ? inv.hotseatSpecsTwoPanelId : inv.hotseatSpecsId));
|
||||
mResponsiveHotseatSpec = hotseatSpecs.getCalculatedHeightSpec(heightPx);
|
||||
hotseatQsbSpace = mResponsiveHotseatSpec.getHotseatQsbSpace();
|
||||
} else {
|
||||
hotseatQsbSpace = pxFromDp(inv.hotseatQsbSpace[mTypeIndex], mMetrics);
|
||||
}
|
||||
|
||||
// Have a little space between the inset and the QSB
|
||||
if (mInsets.bottom + minQsbMargin > hotseatBarBottomSpace) {
|
||||
int availableSpace = hotseatQsbSpace - (mInsets.bottom - hotseatBarBottomSpace);
|
||||
@@ -1952,6 +1966,7 @@ public class DeviceProfile {
|
||||
+ mAllAppsResponsiveWidthSpec.toString());
|
||||
writer.println(prefix + "\tmResponsiveFolderHeightSpec:" + mResponsiveFolderHeightSpec);
|
||||
writer.println(prefix + "\tmResponsiveFolderWidthSpec:" + mResponsiveFolderWidthSpec);
|
||||
writer.println(prefix + "\tmResponsiveHotseatSpec:" + mResponsiveHotseatSpec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user