Merge "Fixing issue where holgoraphic icon backgrounds were not being drawn."
diff --git a/res/layout-land/live_folder_grid.xml b/res/layout-land/live_folder_grid.xml
index 44519d4..1796756 100644
--- a/res/layout-land/live_folder_grid.xml
+++ b/res/layout-land/live_folder_grid.xml
@@ -30,21 +30,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <GridView
- android:id="@+id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
-
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom"
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
+ <GridView
+ android:id="@+id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
- android:verticalSpacing="10dip"
- android:numColumns="5" />
+ android:cacheColorHint="#ff333333"
+
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:scrollbarStyle="insideInset"
+ android:drawSelectorOnTop="false"
+ android:listSelector="@drawable/grid_selector"
+
+ android:verticalSpacing="10dip"
+ android:numColumns="5" />
+ </FrameLayout>
</com.android.launcher2.LiveFolder>
diff --git a/res/layout-land/user_folder.xml b/res/layout-land/user_folder.xml
index b05974a..5da4aa5 100644
--- a/res/layout-land/user_folder.xml
+++ b/res/layout-land/user_folder.xml
@@ -27,21 +27,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <GridView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
-
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom"
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
+ <GridView
+ android:id="@id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
- android:verticalSpacing="10dip"
- android:numColumns="5" />
+ android:cacheColorHint="#ff333333"
+
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:scrollbarStyle="insideInset"
+ android:drawSelectorOnTop="false"
+ android:listSelector="@drawable/grid_selector"
+
+ android:verticalSpacing="10dip"
+ android:numColumns="5" />
+ </FrameLayout>
</com.android.launcher2.UserFolder>
diff --git a/res/layout-port/live_folder_grid.xml b/res/layout-port/live_folder_grid.xml
index 745307f..85f74db 100644
--- a/res/layout-port/live_folder_grid.xml
+++ b/res/layout-port/live_folder_grid.xml
@@ -30,21 +30,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <GridView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
+ <GridView
+ android:id="@id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom"
+ android:cacheColorHint="#ff333333"
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:scrollbarStyle="insideInset"
+ android:drawSelectorOnTop="false"
+ android:listSelector="@drawable/grid_selector"
- android:verticalSpacing="10dip"
- android:numColumns="4" />
+ android:verticalSpacing="10dip"
+ android:numColumns="4" />
+ </FrameLayout>
</com.android.launcher2.LiveFolder>
diff --git a/res/layout-port/user_folder.xml b/res/layout-port/user_folder.xml
index 7377cde..0e6df66 100644
--- a/res/layout-port/user_folder.xml
+++ b/res/layout-port/user_folder.xml
@@ -27,21 +27,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <GridView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
+ <GridView
+ android:id="@id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom"
+ android:cacheColorHint="#ff333333"
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:scrollbarStyle="insideInset"
+ android:drawSelectorOnTop="false"
+ android:listSelector="@drawable/grid_selector"
- android:verticalSpacing="10dip"
- android:numColumns="4" />
+ android:verticalSpacing="10dip"
+ android:numColumns="4" />
+ </FrameLayout>
</com.android.launcher2.UserFolder>
diff --git a/res/layout/live_folder_list.xml b/res/layout/live_folder_list.xml
index e5a305f..0dc7b7c 100644
--- a/res/layout/live_folder_list.xml
+++ b/res/layout/live_folder_list.xml
@@ -21,22 +21,25 @@
android:orientation="vertical">
<Button
- android:id="@+id/folder_close"
- android:background="@drawable/box_launcher_top"
- android:gravity="left|center_vertical"
- android:textSize="14sp"
- android:textColor="#404040"
- android:textStyle="bold"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:id="@+id/folder_close"
+ android:background="@drawable/box_launcher_top"
+ android:gravity="left|center_vertical"
+ android:textSize="14sp"
+ android:textColor="#404040"
+ android:textStyle="bold"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
- <ListView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
-
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom" />
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
+ <ListView
+ android:id="@id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:cacheColorHint="#ff333333" />
+ </FrameLayout>
</com.android.launcher2.LiveFolder>
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 4cce81e..c432f37 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -462,7 +462,7 @@
* otherwise, it will try to generate a default image preview with the widget's package icon.
* @return the drawable will be used and sized in the ImageView to represent the widget
*/
- private Drawable getWidgetIcon(AppWidgetProviderInfo info) {
+ private Drawable getWidgetPreview(AppWidgetProviderInfo info) {
PackageManager packageManager = mLauncher.getPackageManager();
String packageName = info.provider.getPackageName();
Drawable drawable = null;
@@ -510,19 +510,21 @@
drawable = new FastBitmapDrawable(bitmap);
} else {
// Scale down the preview if necessary
- final float aspect = (float) info.minWidth / info.minHeight;
- final int boundedWidth = (int) Math.max(minDim, Math.min(maxDim, info.minWidth));
- final int boundedHeight = (int) Math.max(minDim, Math.min(maxDim, info.minHeight));
- final int scaledWidth = (int) (boundedWidth * sScaleFactor);
- final int scaledHeight = (int) (boundedHeight * sScaleFactor);
+ final float imageWidth = drawable.getIntrinsicWidth();
+ final float imageHeight = drawable.getIntrinsicHeight();
+ final float aspect = (float) imageWidth / imageHeight;
+ final int scaledWidth =
+ (int) (Math.max(minDim, Math.min(maxDim, imageWidth)) * sScaleFactor);
+ final int scaledHeight =
+ (int) (Math.max(minDim, Math.min(maxDim, imageHeight)) * sScaleFactor);
int width;
int height;
- if (scaledWidth > scaledHeight) {
+ if (aspect >= 1.0f) {
width = scaledWidth;
- height = (int) (width / aspect);
+ height = (int) (((float) scaledWidth / imageWidth) * imageHeight);
} else {
height = scaledHeight;
- width = (int) (height * aspect);
+ width = (int) (((float) scaledHeight / imageHeight) * imageWidth);
}
final Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
@@ -590,7 +592,7 @@
l.setOnClickListener(this);
l.setOnLongClickListener(this);
- final Drawable icon = getWidgetIcon(info);
+ final Drawable icon = getWidgetPreview(info);
int[] spans = CellLayout.rectToCell(getResources(), info.minWidth, info.minHeight, null);
final int hSpan = spans[0];