Fixing some grid spacing issues. (Bug 10754537, 10754538)

- Ensuring app names don't run into each other in folders and on the workspace
- Ensuring that app names are aligned with folder names

Change-Id: Ie8d546eacd52005778d81c46011c1c84bc24118c
This commit is contained in:
Winson Chung
2013-09-19 17:32:58 -07:00
parent bb701aaa83
commit cdef044036
7 changed files with 12 additions and 42 deletions

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<com.android.launcher3.PagedViewIcon
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
style="@style/WorkspaceIcon.Landscape.AppsCustomize"
android:id="@+id/application_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:focusable="true"
android:background="@drawable/focusable_view_bg" />

View File

@@ -18,12 +18,11 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
style="@style/WorkspaceIcon.Portrait.AppsCustomize"
style="@style/WorkspaceIcon.AppsCustomize"
android:id="@+id/application_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:focusable="true"
android:background="@drawable/focusable_view_bg" />

View File

@@ -28,6 +28,6 @@
android:layout_height="wrap_content"
android:src="@drawable/portal_ring_inner_holo"/>
<com.android.launcher3.BubbleTextView
android:id="@+id/folder_icon_name"
style="@style/WorkspaceIcon"/>
style="@style/WorkspaceIcon"
android:id="@+id/folder_icon_name" />
</com.android.launcher3.FolderIcon>

View File

@@ -82,15 +82,11 @@
<style name="WorkspaceIcon.Landscape">
</style>
<style name="WorkspaceIcon.Portrait.AppsCustomize">
<item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
<item name="android:background">@null</item>
<item name="android:textColor">@color/apps_customize_icon_text_color</item>
</style>
<style name="WorkspaceIcon.Landscape.AppsCustomize">
<style name="WorkspaceIcon.AppsCustomize">
<item name="android:shadowRadius">0.0</item> <!-- Don't use text shadow -->
<item name="android:background">@null</item>
<item name="android:textColor">@color/apps_customize_icon_text_color</item>
<item name="android:drawablePadding">4dp</item>
</style>
<style name="QSBBar">

View File

@@ -102,10 +102,13 @@ public class BubbleTextView extends TextView {
public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache) {
Bitmap b = info.getIcon(iconCache);
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
setCompoundDrawablesWithIntrinsicBounds(null,
new FastBitmapDrawable(b),
null, null);
setCompoundDrawablePadding((int) ((grid.folderIconSizePx - grid.iconSizePx) / 2f));
setText(info.title);
setTag(info);
}

View File

@@ -207,7 +207,7 @@ class DeviceProfile {
// Folder
folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx;
folderCellHeightPx = cellHeightPx + edgeMarginPx;
folderCellHeightPx = cellHeightPx + (int) ((3f/2f) * edgeMarginPx);
folderBackgroundOffset = -edgeMarginPx;
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
}

View File

@@ -137,7 +137,8 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
// Otherwise, center the icon
int cHeight = mIsHotseatLayout ? grid.hotseatCellHeightPx : Math.min(getMeasuredHeight(), grid.cellHeightPx);
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
child.setPadding(0, cellPaddingY, 0, 0);
int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
}
} else {
lp.x = 0;