Portrait grid changes for Workspace/All Apps.
Bug: 37015359 Change-Id: Ifbdd0e71c36e532b189e02283e3eeb562ebe2654
This commit is contained in:
parent
663bb990f0
commit
0966072c91
|
@ -23,7 +23,6 @@
|
|||
android:stateListAnimator="@animator/all_apps_fastscroll_icon_anim"
|
||||
launcher:iconDisplay="all_apps"
|
||||
launcher:centerVertically="true"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:drawablePadding="@dimen/dynamic_grid_icon_drawable_padding" />
|
||||
android:paddingLeft="@dimen/dynamic_grid_cell_padding_x"
|
||||
android:paddingRight="@dimen/dynamic_grid_cell_padding_x" />
|
||||
|
||||
|
|
|
@ -23,6 +23,6 @@
|
|||
android:id="@+id/all_apps_handle"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_gravity="top|center"
|
||||
android:scaleType="centerInside"/>
|
||||
</com.android.launcher3.pageindicators.PageIndicatorLineCaret>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@drawable/round_rect_primary"
|
||||
android:elevation="2dp"
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
<resources>
|
||||
<!-- Dynamic Grid -->
|
||||
<dimen name="dynamic_grid_edge_margin">8dp</dimen>
|
||||
<dimen name="dynamic_grid_page_indicator_height">28dp</dimen>
|
||||
<dimen name="dynamic_grid_edge_margin">16dp</dimen>
|
||||
<dimen name="dynamic_grid_page_indicator_height">32dp</dimen>
|
||||
<dimen name="dynamic_grid_page_indicator_line_height">1dp</dimen>
|
||||
<dimen name="dynamic_grid_page_indicator_gutter_width_left_nav_bar">38dp</dimen>
|
||||
<dimen name="dynamic_grid_page_indicator_gutter_width_right_nav_bar">48dp</dimen>
|
||||
|
@ -26,14 +26,17 @@
|
|||
<dimen name="dynamic_grid_overview_max_icon_zone_height">120dp</dimen>
|
||||
<dimen name="dynamic_grid_overview_bar_item_width">80dp</dimen>
|
||||
<dimen name="dynamic_grid_overview_bar_spacer_width">25dp</dimen>
|
||||
<dimen name="dynamic_grid_workspace_top_padding">12dp</dimen>
|
||||
<dimen name="dynamic_grid_workspace_top_padding">8dp</dimen>
|
||||
<dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen>
|
||||
<!-- Minimum space between workspace and hotseat in spring loaded mode -->
|
||||
<dimen name="dynamic_grid_min_spring_loaded_space">8dp</dimen>
|
||||
|
||||
<!-- dynamic_grid_edge_margin / 2 -->
|
||||
<dimen name="dynamic_grid_cell_padding_x">8dp</dimen>
|
||||
|
||||
<!-- Hotseat -->
|
||||
<dimen name="dynamic_grid_hotseat_top_padding">8dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_bottom_padding">0dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_bottom_padding">2dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_height">80dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_land_gutter_width">24dp</dimen>
|
||||
|
||||
|
|
|
@ -168,6 +168,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
|
|||
int defaultIconSize = grid.iconSizePx;
|
||||
if (display == DISPLAY_WORKSPACE) {
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
|
||||
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
|
||||
} else if (display == DISPLAY_ALL_APPS) {
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx);
|
||||
setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
|
||||
|
|
|
@ -32,6 +32,7 @@ import android.widget.FrameLayout;
|
|||
|
||||
import com.android.launcher3.CellLayout.ContainerType;
|
||||
import com.android.launcher3.badge.BadgeRenderer;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -92,6 +93,7 @@ public class DeviceProfile {
|
|||
|
||||
public int cellWidthPx;
|
||||
public int cellHeightPx;
|
||||
public int cellPaddingXPx;
|
||||
|
||||
// Folder
|
||||
public int folderBackgroundOffset;
|
||||
|
@ -192,6 +194,8 @@ public class DeviceProfile {
|
|||
workspaceSpringLoadedBottomSpace =
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_min_spring_loaded_space);
|
||||
|
||||
cellPaddingXPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_padding_x);
|
||||
|
||||
hotseatBarTopPaddingPx =
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding);
|
||||
hotseatBarBottomPaddingPx =
|
||||
|
@ -264,36 +268,34 @@ public class DeviceProfile {
|
|||
}
|
||||
|
||||
private void updateAvailableDimensions(DisplayMetrics dm, Resources res) {
|
||||
updateIconSize(1f, iconDrawablePaddingOriginalPx, res, dm);
|
||||
updateIconSize(1f, res, dm);
|
||||
|
||||
// Check to see if the icons fit within the available height. If not, then scale down.
|
||||
float usedHeight = (cellHeightPx * inv.numRows);
|
||||
int maxHeight = (availableHeightPx - getTotalWorkspacePadding().y);
|
||||
if (usedHeight > maxHeight) {
|
||||
float scale = maxHeight / usedHeight;
|
||||
updateIconSize(scale, 0, res, dm);
|
||||
updateIconSize(scale, res, dm);
|
||||
}
|
||||
|
||||
updateAvailableFolderCellDimensions(dm, res);
|
||||
}
|
||||
|
||||
private void updateIconSize(float scale, int drawablePadding, Resources res,
|
||||
DisplayMetrics dm) {
|
||||
private void updateIconSize(float scale, Resources res, DisplayMetrics dm) {
|
||||
iconSizePx = (int) (Utilities.pxFromDp(inv.iconSize, dm) * scale);
|
||||
iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, dm) * scale);
|
||||
iconDrawablePaddingPx = drawablePadding;
|
||||
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);
|
||||
hotseatIconSizePx = (int) (Utilities.pxFromDp(inv.hotseatIconSize, dm) * scale);
|
||||
allAppsIconSizePx = iconSizePx;
|
||||
allAppsIconDrawablePaddingPx = iconDrawablePaddingPx;
|
||||
allAppsIconTextSizePx = iconTextSizePx;
|
||||
|
||||
cellWidthPx = iconSizePx;
|
||||
cellWidthPx = iconSizePx + iconDrawablePaddingPx;
|
||||
cellHeightPx = iconSizePx + iconDrawablePaddingPx
|
||||
+ Utilities.calculateTextHeight(iconTextSizePx);
|
||||
|
||||
// Hotseat
|
||||
hotseatCellWidthPx = iconSizePx;
|
||||
hotseatCellHeightPx = iconSizePx;
|
||||
hotseatCellWidthPx = cellWidthPx;
|
||||
hotseatCellHeightPx = iconSizePx + iconDrawablePaddingPx;
|
||||
|
||||
if (!isVerticalBarLayout()) {
|
||||
int expectedWorkspaceHeight = availableHeightPx - hotseatBarHeightPx
|
||||
|
@ -308,7 +310,7 @@ public class DeviceProfile {
|
|||
}
|
||||
|
||||
// Folder icon
|
||||
folderBackgroundOffset = -edgeMarginPx;
|
||||
folderBackgroundOffset = -iconDrawablePaddingPx;
|
||||
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
|
||||
folderIconPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding);
|
||||
}
|
||||
|
@ -522,7 +524,7 @@ public class DeviceProfile {
|
|||
lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
|
||||
lp.width = searchBarBounds.x;
|
||||
lp.height = searchBarBounds.y;
|
||||
lp.topMargin = mInsets.top + edgeMarginPx;
|
||||
lp.topMargin = mInsets.top + edgeMarginPx / 2;
|
||||
searchBar.setLayoutParams(lp);
|
||||
|
||||
// Layout the workspace
|
||||
|
|
|
@ -749,7 +749,7 @@ public class IconCache {
|
|||
}
|
||||
|
||||
private static final class IconDB extends SQLiteCacheHelper {
|
||||
private final static int DB_VERSION = 14;
|
||||
private final static int DB_VERSION = 15;
|
||||
|
||||
private final static int RELEASE_VERSION = DB_VERSION +
|
||||
(FeatureFlags.LAUNCHER3_DISABLE_ICON_NORMALIZATION ? 0 : 1);
|
||||
|
|
|
@ -1413,7 +1413,6 @@ public class Launcher extends BaseActivity
|
|||
BubbleTextView favorite = (BubbleTextView) LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.app_icon, parent, false);
|
||||
favorite.applyFromShortcutInfo(info);
|
||||
favorite.setCompoundDrawablePadding(mDeviceProfile.iconDrawablePaddingPx);
|
||||
favorite.setOnClickListener(this);
|
||||
favorite.setOnFocusChangeListener(mFocusHandler);
|
||||
return favorite;
|
||||
|
|
|
@ -120,7 +120,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
|
|||
// Center the icon/folder
|
||||
int cHeight = getCellContentHeight();
|
||||
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
|
||||
int cellPaddingX = (int) (profile.edgeMarginPx / 2f);
|
||||
int cellPaddingX = profile.cellPaddingXPx;
|
||||
child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -111,7 +111,7 @@ public class WidgetPreviewLoader {
|
|||
* sizes (landscape vs portrait).
|
||||
*/
|
||||
private static class CacheDb extends SQLiteCacheHelper {
|
||||
private static final int DB_VERSION = 6;
|
||||
private static final int DB_VERSION = 7;
|
||||
|
||||
private static final String TABLE_NAME = "shortcut_and_widget_previews";
|
||||
private static final String COLUMN_COMPONENT = "componentName";
|
||||
|
|
Loading…
Reference in New Issue