summaryrefslogtreecommitdiff
path: root/core/java/android/app/LauncherActivity.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-09-07 00:49:58 -0700
committerDianne Hackborn <hackbod@google.com>2009-09-07 22:48:02 -0700
commiteb034652c2037a47ebfd99779e8383bb8bb528af (patch)
tree0d4f6d9b752d6be70083cdf51085872e52610c3b /core/java/android/app/LauncherActivity.java
parent9c93007bcdf684cd15fd9db0cf1eae238dd38191 (diff)
Implement all of the infrastructure for configuring wallpapers.
Actually being able to configure a wallpaper relies on additional work in the launcher and wallpapers that will be in another change. Also note that this breaks all existing wallpapers, since they now need to include a meta-data item about themselves. This also will be fixed in another change. Change-Id: I97d2c2bd07237abc32f92b9147c32530a2f73c71
Diffstat (limited to 'core/java/android/app/LauncherActivity.java')
-rw-r--r--core/java/android/app/LauncherActivity.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/core/java/android/app/LauncherActivity.java b/core/java/android/app/LauncherActivity.java
index a83f4e8d0c4d..0ece2fc23101 100644
--- a/core/java/android/app/LauncherActivity.java
+++ b/core/java/android/app/LauncherActivity.java
@@ -53,9 +53,9 @@ import java.util.List;
*
*/
public abstract class LauncherActivity extends ListActivity {
-
Intent mIntent;
PackageManager mPackageManager;
+ IconResizer mIconResizer;
/**
* An item in the list
@@ -77,7 +77,9 @@ public abstract class LauncherActivity extends ListActivity {
label = resolveInfo.activityInfo.name;
}
- icon = resizer.createIconThumbnail(resolveInfo.loadIcon(pm));
+ if (resizer != null) {
+ icon = resizer.createIconThumbnail(resolveInfo.loadIcon(pm));
+ }
packageName = ci.applicationInfo.packageName;
className = ci.name;
}
@@ -93,13 +95,15 @@ public abstract class LauncherActivity extends ListActivity {
private final Object lock = new Object();
private ArrayList<ListItem> mOriginalValues;
+ protected final IconResizer mIconResizer;
protected final LayoutInflater mInflater;
protected List<ListItem> mActivitiesList;
private Filter mFilter;
- public ActivityAdapter() {
+ public ActivityAdapter(IconResizer resizer) {
+ mIconResizer = resizer;
mInflater = (LayoutInflater) LauncherActivity.this.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mActivitiesList = makeListItems();
@@ -154,6 +158,10 @@ public abstract class LauncherActivity extends ListActivity {
private void bindView(View view, ListItem item) {
TextView text = (TextView) view;
text.setText(item.label);
+ if (item.icon == null) {
+ item.icon = mIconResizer.createIconThumbnail(
+ item.resolveInfo.loadIcon(getPackageManager()));
+ }
text.setCompoundDrawablesWithIntrinsicBounds(item.icon, null, null, null);
}
@@ -330,9 +338,11 @@ public abstract class LauncherActivity extends ListActivity {
setProgressBarIndeterminateVisibility(true);
onSetContentView();
+ mIconResizer = new IconResizer();
+
mIntent = new Intent(getTargetIntent());
mIntent.setComponent(null);
- mAdapter = new ActivityAdapter();
+ mAdapter = new ActivityAdapter(mIconResizer);
setListAdapter(mAdapter);
getListView().setTextFilterEnabled(true);
@@ -398,13 +408,11 @@ public abstract class LauncherActivity extends ListActivity {
List<ResolveInfo> list = onQueryPackageManager(mIntent);
Collections.sort(list, new ResolveInfo.DisplayNameComparator(mPackageManager));
- IconResizer resizer = new IconResizer();
-
ArrayList<ListItem> result = new ArrayList<ListItem>(list.size());
int listSize = list.size();
for (int i = 0; i < listSize; i++) {
ResolveInfo resolveInfo = list.get(i);
- result.add(new ListItem(mPackageManager, resolveInfo, resizer));
+ result.add(new ListItem(mPackageManager, resolveInfo, null));
}
return result;