Updating the paddings in folder cell
am: baec6ffae2
Change-Id: I4bfa78ade93639d3864baeeb5028b9caa3935c29
This commit is contained in:
commit
290e9e2807
|
@ -28,7 +28,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingTop="4dp"
|
||||
launcher:pageIndicator="@+id/folder_page_indicator" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -37,8 +37,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp" >
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp" >
|
||||
|
||||
<com.android.launcher3.ExtendedEditText
|
||||
android:id="@+id/folder_name"
|
||||
|
@ -51,13 +51,14 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:hint="@string/folder_hint_text"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="@dimen/folder_label_padding"
|
||||
android:paddingTop="@dimen/folder_label_padding"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ff777777"
|
||||
android:includeFontPadding="false"
|
||||
android:textColorHighlight="#ffCCCCCC"
|
||||
android:textColorHint="#ff808080"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="@dimen/folder_label_text_size" />
|
||||
|
||||
<com.android.launcher3.pageindicators.PageIndicatorDots
|
||||
android:id="@+id/folder_page_indicator"
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
android:id="@+id/folder_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="4dp"
|
||||
launcher:pageIndicator="@+id/folder_page_indicator" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -37,8 +37,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp" >
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp" >
|
||||
|
||||
<com.android.launcher3.ExtendedEditText
|
||||
android:id="@+id/folder_name"
|
||||
|
@ -52,13 +52,13 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:hint="@string/folder_hint_text"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="@dimen/folder_label_padding"
|
||||
android:paddingTop="@dimen/folder_label_padding"
|
||||
android:singleLine="true"
|
||||
android:textColor="#EE777777"
|
||||
android:textColorHighlight="#ffCCCCCC"
|
||||
android:textColorHint="#ff808080"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="@dimen/folder_label_text_size" />
|
||||
|
||||
<com.android.launcher3.pageindicators.PageIndicatorDots
|
||||
android:id="@+id/folder_page_indicator"
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
<attr name="iconDisplay" format="integer">
|
||||
<enum name="workspace" value="0" />
|
||||
<enum name="all_apps" value="1" />
|
||||
<enum name="widget_section" value="2" />
|
||||
<enum name="folder" value="2" />
|
||||
<enum name="widget_section" value="3" />
|
||||
</attr>
|
||||
<attr name="deferShadowGeneration" format="boolean" />
|
||||
<attr name="customShadows" format="boolean" />
|
||||
|
|
|
@ -137,6 +137,12 @@
|
|||
<dimen name="folder_preview_padding">6dp</dimen>
|
||||
<dimen name="page_indicator_dot_size">8dp</dimen>
|
||||
|
||||
<dimen name="folder_cell_x_padding">9dp</dimen>
|
||||
<dimen name="folder_cell_y_padding">8dp</dimen>
|
||||
<dimen name="folder_child_text_size">13sp</dimen>
|
||||
<dimen name="folder_label_padding">12dp</dimen>
|
||||
<dimen name="folder_label_text_size">14sp</dimen>
|
||||
|
||||
<!-- Sizes for managed profile badges -->
|
||||
<dimen name="profile_badge_size">24dp</dimen>
|
||||
<dimen name="profile_badge_margin">5dp</dimen>
|
||||
|
|
|
@ -74,7 +74,11 @@
|
|||
<item name="android:background">@null</item>
|
||||
<item name="android:textColor">@color/quantum_panel_text_color</item>
|
||||
<item name="android:shadowRadius">0</item>
|
||||
<item name="android:textSize">@dimen/folder_child_text_size</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:includeFontPadding">false</item>
|
||||
<item name="customShadows">false</item>
|
||||
<item name="iconDisplay">folder</item>
|
||||
</style>
|
||||
|
||||
<style name="Icon.DeepShortcut">
|
||||
|
|
|
@ -66,6 +66,7 @@ public class BubbleTextView extends TextView
|
|||
|
||||
private static final int DISPLAY_WORKSPACE = 0;
|
||||
private static final int DISPLAY_ALL_APPS = 1;
|
||||
private static final int DISPLAY_FOLDER = 2;
|
||||
|
||||
private final Launcher mLauncher;
|
||||
private Drawable mIcon;
|
||||
|
@ -126,12 +127,13 @@ public class BubbleTextView extends TextView
|
|||
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx);
|
||||
setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
|
||||
defaultIconSize = grid.allAppsIconSizePx;
|
||||
} else if (display == DISPLAY_FOLDER) {
|
||||
setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx);
|
||||
}
|
||||
mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false);
|
||||
|
||||
mIconSize = a.getDimensionPixelSize(R.styleable.BubbleTextView_iconSizeOverride,
|
||||
defaultIconSize);
|
||||
|
||||
a.recycle();
|
||||
|
||||
if (mCustomShadowsEnabled) {
|
||||
|
|
|
@ -20,8 +20,6 @@ import android.appwidget.AppWidgetHostView;
|
|||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.FontMetrics;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.DisplayMetrics;
|
||||
|
@ -100,6 +98,7 @@ public class DeviceProfile {
|
|||
public int folderIconPreviewPadding;
|
||||
public int folderCellWidthPx;
|
||||
public int folderCellHeightPx;
|
||||
public int folderChildDrawablePaddingPx;
|
||||
|
||||
// Hotseat
|
||||
public int hotseatCellWidthPx;
|
||||
|
@ -255,12 +254,9 @@ public class DeviceProfile {
|
|||
allAppsIconDrawablePaddingPx = iconDrawablePaddingPx;
|
||||
allAppsIconTextSizePx = iconTextSizePx;
|
||||
|
||||
// Calculate the actual text height
|
||||
Paint textPaint = new Paint();
|
||||
textPaint.setTextSize(iconTextSizePx);
|
||||
FontMetrics fm = textPaint.getFontMetrics();
|
||||
cellWidthPx = iconSizePx;
|
||||
cellHeightPx = iconSizePx + iconDrawablePaddingPx + (int) Math.ceil(fm.bottom - fm.top);
|
||||
cellHeightPx = iconSizePx + iconDrawablePaddingPx
|
||||
+ Utilities.calculateTextHeight(iconTextSizePx);
|
||||
final float scaleDps = !FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND ? 0f
|
||||
: res.getDimensionPixelSize(R.dimen.dragViewScale);
|
||||
dragViewScale = (iconSizePx + scaleDps) / iconSizePx;
|
||||
|
@ -281,12 +277,25 @@ public class DeviceProfile {
|
|||
res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f;
|
||||
}
|
||||
|
||||
// Folder
|
||||
int folderCellPadding = isTablet || isLandscape ? 6 * edgeMarginPx : 3 * edgeMarginPx;
|
||||
// Folder cell
|
||||
int cellPaddingX = res.getDimensionPixelSize(R.dimen.folder_cell_x_padding);
|
||||
int cellPaddingY = res.getDimensionPixelSize(R.dimen.folder_cell_y_padding);
|
||||
final int folderChildTextSize =
|
||||
Utilities.calculateTextHeight(res.getDimension(R.dimen.folder_child_text_size));
|
||||
|
||||
final int folderBottomPanelSize =
|
||||
2 * res.getDimensionPixelSize(R.dimen.folder_label_padding)
|
||||
+ Utilities.calculateTextHeight(res.getDimension(R.dimen.folder_label_text_size));
|
||||
|
||||
// Don't let the folder get too close to the edges of the screen.
|
||||
folderCellWidthPx = Math.min(cellWidthPx + folderCellPadding,
|
||||
folderCellWidthPx = Math.min(iconSizePx + 2 * cellPaddingX,
|
||||
(availableWidthPx - 4 * edgeMarginPx) / inv.numFolderColumns);
|
||||
folderCellHeightPx = cellHeightPx + edgeMarginPx;
|
||||
folderCellHeightPx = Math.min(iconSizePx + 3 * cellPaddingY + folderChildTextSize,
|
||||
(availableHeightPx - 4 * edgeMarginPx - folderBottomPanelSize) / inv.numFolderRows);
|
||||
folderChildDrawablePaddingPx = Math.max(0,
|
||||
(folderCellHeightPx - iconSizePx - folderChildTextSize) / 3);
|
||||
|
||||
// Folder icon
|
||||
folderBackgroundOffset = -edgeMarginPx;
|
||||
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
|
||||
folderIconPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding);
|
||||
|
@ -296,9 +305,6 @@ public class DeviceProfile {
|
|||
mInsets.set(insets);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recyclerViewWidth the available width of the AllAppsRecyclerView
|
||||
*/
|
||||
public void updateAppsViewNumCols() {
|
||||
allAppsNumCols = allAppsNumPredictiveCols = inv.numColumns;
|
||||
}
|
||||
|
|
|
@ -472,11 +472,11 @@ public final class Utilities {
|
|||
/**
|
||||
* Calculates the height of a given string at a specific text size.
|
||||
*/
|
||||
public static float calculateTextHeight(float textSizePx) {
|
||||
public static int calculateTextHeight(float textSizePx) {
|
||||
Paint p = new Paint();
|
||||
p.setTextSize(textSizePx);
|
||||
Paint.FontMetrics fm = p.getFontMetrics();
|
||||
return -fm.top + fm.bottom;
|
||||
return (int) Math.ceil(fm.bottom - fm.top);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue