summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher2')
-rw-r--r--src/com/android/launcher2/Launcher.java10
-rw-r--r--src/com/android/launcher2/LauncherModel.java9
2 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index c9c690a36..15b272fea 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2457,13 +2457,19 @@ public final class Launcher extends Activity
int buttonId, ComponentName activityName, int fallbackDrawableId) {
TextView button = (TextView) findViewById(buttonId);
Drawable toolbarIcon = getExternalPackageToolbarIcon(activityName);
+ Resources r = getResources();
+ int w = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_width);
+ int h = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_height);
// If we were unable to find the icon via the meta-data, use a generic one
if (toolbarIcon == null) {
- button.setCompoundDrawablesWithIntrinsicBounds(fallbackDrawableId, 0, 0, 0);
+ toolbarIcon = r.getDrawable(fallbackDrawableId);
+ toolbarIcon.setBounds(0, 0, w, h);
+ button.setCompoundDrawables(toolbarIcon, null, null, null);
return null;
} else {
- button.setCompoundDrawablesWithIntrinsicBounds(toolbarIcon, null, null, null);
+ toolbarIcon.setBounds(0, 0, w, h);
+ button.setCompoundDrawables(toolbarIcon, null, null, null);
return toolbarIcon.getConstantState();
}
}
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index ea51d0169..239970e84 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -465,7 +465,7 @@ public class LauncherModel extends BroadcastReceiver {
item.onAddToDatabase(values);
item.updateValuesWithCoordinates(values, item.cellX, item.cellY);
- sWorker.post(new Runnable() {
+ Runnable r = new Runnable() {
public void run() {
cr.update(LauncherSettings.Favorites.getContentUri(item.id, false),
values, null, null);
@@ -481,7 +481,12 @@ public class LauncherModel extends BroadcastReceiver {
throw new RuntimeException(msg);
}
}
- });
+ };
+ if (sWorkerThread.getThreadId() == Process.myTid()) {
+ r.run();
+ } else {
+ sWorker.post(r);
+ }
}
/**