summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-09-19 17:32:58 -0700
committerWinson Chung <winsonc@google.com>2013-09-19 18:07:05 -0700
commitcdef04403695872db8be6342b8dacd437ee02d52 (patch)
treed9f62bc88cfd30ec2c9a1c5de3540b3026aaa77a
parentbb701aaa83889b208ba8910e08023c84693138d1 (diff)
downloadandroid_packages_apps_Trebuchet-cdef04403695872db8be6342b8dacd437ee02d52.tar.gz
android_packages_apps_Trebuchet-cdef04403695872db8be6342b8dacd437ee02d52.tar.bz2
android_packages_apps_Trebuchet-cdef04403695872db8be6342b8dacd437ee02d52.zip
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
-rw-r--r--res/layout-land/apps_customize_application.xml29
-rw-r--r--res/layout/apps_customize_application.xml (renamed from res/layout-port/apps_customize_application.xml)5
-rw-r--r--res/layout/folder_icon.xml4
-rw-r--r--res/values/styles.xml8
-rw-r--r--src/com/android/launcher3/BubbleTextView.java3
-rw-r--r--src/com/android/launcher3/DynamicGrid.java2
-rw-r--r--src/com/android/launcher3/ShortcutAndWidgetContainer.java3
7 files changed, 12 insertions, 42 deletions
diff --git a/res/layout-land/apps_customize_application.xml b/res/layout-land/apps_customize_application.xml
deleted file mode 100644
index bf0022d76..000000000
--- a/res/layout-land/apps_customize_application.xml
+++ /dev/null
@@ -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" />
diff --git a/res/layout-port/apps_customize_application.xml b/res/layout/apps_customize_application.xml
index 0b7bab6c5..3b0fa6f4e 100644
--- a/res/layout-port/apps_customize_application.xml
+++ b/res/layout/apps_customize_application.xml
@@ -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" />
diff --git a/res/layout/folder_icon.xml b/res/layout/folder_icon.xml
index 5a9a83415..9c5c46bd8 100644
--- a/res/layout/folder_icon.xml
+++ b/res/layout/folder_icon.xml
@@ -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>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index cf77b51d9..48b9dbc9f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -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">
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index bb6903d43..7a7a3b61f 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -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);
}
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index 70f000053..6e101750f 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -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;
}
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 5ce557192..b9511005e 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -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;