summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/PendingAppWidgetHostView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-11-22 16:52:39 +0530
committerSunny Goyal <sunnygoyal@google.com>2016-12-07 13:16:08 -0800
commitd5462aa31b53eb690a3f57c7c6c0cc4021271de6 (patch)
tree63d1162421f45d222ca89e2f41fefcedecf2f6bb /src/com/android/launcher3/PendingAppWidgetHostView.java
parent4633be64e863a96c63f814a2386b23b02d43910b (diff)
downloadandroid_packages_apps_Trebuchet-d5462aa31b53eb690a3f57c7c6c0cc4021271de6.tar.gz
android_packages_apps_Trebuchet-d5462aa31b53eb690a3f57c7c6c0cc4021271de6.tar.bz2
android_packages_apps_Trebuchet-d5462aa31b53eb690a3f57c7c6c0cc4021271de6.zip
Simplifyling widget inflation and addition flow.
> Removing insert parameter used to select the index of the view. ShortcutAndWidgetContainer no longet relies on the index and instead uses x and y to refer a particulat view. > Creating helper methods to easily insert the icon by passing ItemInfo directly. LauncherModel.addItemToDatabase synchronously updates the ItemInfo with proper postion information. So we can directly use the info instead of passing each parameter separately. Bug: 32904959 Change-Id: I021c1b818f2f42604b95a6970e06aacc7211292a
Diffstat (limited to 'src/com/android/launcher3/PendingAppWidgetHostView.java')
-rw-r--r--src/com/android/launcher3/PendingAppWidgetHostView.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/launcher3/PendingAppWidgetHostView.java b/src/com/android/launcher3/PendingAppWidgetHostView.java
index bf397744b..eb1a76388 100644
--- a/src/com/android/launcher3/PendingAppWidgetHostView.java
+++ b/src/com/android/launcher3/PendingAppWidgetHostView.java
@@ -63,7 +63,7 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView implemen
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public PendingAppWidgetHostView(Context context, LauncherAppWidgetInfo info,
- boolean disabledForSafeMode) {
+ IconCache cache, boolean disabledForSafeMode) {
super(new ContextThemeWrapper(context, R.style.WidgetContainerTheme));
mLauncher = Launcher.getLauncher(context);
@@ -82,6 +82,10 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView implemen
if (Utilities.ATLEAST_LOLLIPOP) {
setElevation(getResources().getDimension(R.dimen.pending_widget_elevation));
}
+
+ updateIcon(cache);
+ updateAppWidget(null);
+ setOnClickListener(mLauncher);
}
@Override
@@ -117,7 +121,7 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView implemen
mDrawableSizeChanged = true;
}
- public void updateIcon(IconCache cache) {
+ private void updateIcon(IconCache cache) {
Bitmap icon = cache.getIcon(mIconLookupIntent, mInfo.user);
if (mIcon == icon) {
return;