Loading core/java/android/content/pm/ResolveInfo.java +3 −2 Original line number Diff line number Diff line Loading @@ -328,6 +328,7 @@ public class ResolveInfo implements Parcelable { implements Comparator<ResolveInfo> { public DisplayNameComparator(PackageManager pm) { mPM = pm; mCollator.setStrength(Collator.PRIMARY); } public final int compare(ResolveInfo a, ResolveInfo b) { Loading @@ -336,10 +337,10 @@ public class ResolveInfo implements Parcelable { CharSequence sb = b.loadLabel(mPM); if (sb == null) sb = b.activityInfo.name; return sCollator.compare(sa.toString(), sb.toString()); return mCollator.compare(sa.toString(), sb.toString()); } private final Collator sCollator = Collator.getInstance(); private final Collator mCollator = Collator.getInstance(); private PackageManager mPM; } } core/java/com/android/internal/app/ResolverActivity.java +40 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.app; import android.os.AsyncTask; import com.android.internal.R; import com.android.internal.content.PackageMonitor; Loading Loading @@ -621,9 +622,11 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte view = mInflater.inflate( com.android.internal.R.layout.resolve_list_item, parent, false); final ViewHolder holder = new ViewHolder(view); view.setTag(holder); // Fix the icon size even if we have different sized resources ImageView icon = (ImageView)view.findViewById(R.id.icon); ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) icon.getLayoutParams(); ViewGroup.LayoutParams lp = holder.icon.getLayoutParams(); lp.width = lp.height = mIconSize; } else { view = convertView; Loading @@ -633,20 +636,30 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte } private final void bindView(View view, DisplayResolveInfo info) { TextView text = (TextView)view.findViewById(com.android.internal.R.id.text1); TextView text2 = (TextView)view.findViewById(com.android.internal.R.id.text2); ImageView icon = (ImageView)view.findViewById(R.id.icon); text.setText(info.displayLabel); final ViewHolder holder = (ViewHolder) view.getTag(); holder.text.setText(info.displayLabel); if (mShowExtended) { text2.setVisibility(View.VISIBLE); text2.setText(info.extendedInfo); holder.text2.setVisibility(View.VISIBLE); holder.text2.setText(info.extendedInfo); } else { text2.setVisibility(View.GONE); holder.text2.setVisibility(View.GONE); } if (info.displayIcon == null) { info.displayIcon = loadIconForResolveInfo(info.ri); new LoadIconTask().execute(info); } holder.icon.setImageDrawable(info.displayIcon); } } icon.setImageDrawable(info.displayIcon); static class ViewHolder { public TextView text; public TextView text2; public ImageView icon; public ViewHolder(View view) { text = (TextView) view.findViewById(com.android.internal.R.id.text1); text2 = (TextView) view.findViewById(com.android.internal.R.id.text2); icon = (ImageView) view.findViewById(R.id.icon); } } Loading @@ -660,5 +673,21 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte } } class LoadIconTask extends AsyncTask<DisplayResolveInfo, Void, DisplayResolveInfo> { @Override protected DisplayResolveInfo doInBackground(DisplayResolveInfo... params) { final DisplayResolveInfo info = params[0]; if (info.displayIcon == null) { info.displayIcon = loadIconForResolveInfo(info.ri); } return info; } @Override protected void onPostExecute(DisplayResolveInfo info) { mAdapter.notifyDataSetChanged(); } } } Loading
core/java/android/content/pm/ResolveInfo.java +3 −2 Original line number Diff line number Diff line Loading @@ -328,6 +328,7 @@ public class ResolveInfo implements Parcelable { implements Comparator<ResolveInfo> { public DisplayNameComparator(PackageManager pm) { mPM = pm; mCollator.setStrength(Collator.PRIMARY); } public final int compare(ResolveInfo a, ResolveInfo b) { Loading @@ -336,10 +337,10 @@ public class ResolveInfo implements Parcelable { CharSequence sb = b.loadLabel(mPM); if (sb == null) sb = b.activityInfo.name; return sCollator.compare(sa.toString(), sb.toString()); return mCollator.compare(sa.toString(), sb.toString()); } private final Collator sCollator = Collator.getInstance(); private final Collator mCollator = Collator.getInstance(); private PackageManager mPM; } }
core/java/com/android/internal/app/ResolverActivity.java +40 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.app; import android.os.AsyncTask; import com.android.internal.R; import com.android.internal.content.PackageMonitor; Loading Loading @@ -621,9 +622,11 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte view = mInflater.inflate( com.android.internal.R.layout.resolve_list_item, parent, false); final ViewHolder holder = new ViewHolder(view); view.setTag(holder); // Fix the icon size even if we have different sized resources ImageView icon = (ImageView)view.findViewById(R.id.icon); ViewGroup.LayoutParams lp = (ViewGroup.LayoutParams) icon.getLayoutParams(); ViewGroup.LayoutParams lp = holder.icon.getLayoutParams(); lp.width = lp.height = mIconSize; } else { view = convertView; Loading @@ -633,20 +636,30 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte } private final void bindView(View view, DisplayResolveInfo info) { TextView text = (TextView)view.findViewById(com.android.internal.R.id.text1); TextView text2 = (TextView)view.findViewById(com.android.internal.R.id.text2); ImageView icon = (ImageView)view.findViewById(R.id.icon); text.setText(info.displayLabel); final ViewHolder holder = (ViewHolder) view.getTag(); holder.text.setText(info.displayLabel); if (mShowExtended) { text2.setVisibility(View.VISIBLE); text2.setText(info.extendedInfo); holder.text2.setVisibility(View.VISIBLE); holder.text2.setText(info.extendedInfo); } else { text2.setVisibility(View.GONE); holder.text2.setVisibility(View.GONE); } if (info.displayIcon == null) { info.displayIcon = loadIconForResolveInfo(info.ri); new LoadIconTask().execute(info); } holder.icon.setImageDrawable(info.displayIcon); } } icon.setImageDrawable(info.displayIcon); static class ViewHolder { public TextView text; public TextView text2; public ImageView icon; public ViewHolder(View view) { text = (TextView) view.findViewById(com.android.internal.R.id.text1); text2 = (TextView) view.findViewById(com.android.internal.R.id.text2); icon = (ImageView) view.findViewById(R.id.icon); } } Loading @@ -660,5 +673,21 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte } } class LoadIconTask extends AsyncTask<DisplayResolveInfo, Void, DisplayResolveInfo> { @Override protected DisplayResolveInfo doInBackground(DisplayResolveInfo... params) { final DisplayResolveInfo info = params[0]; if (info.displayIcon == null) { info.displayIcon = loadIconForResolveInfo(info.ri); } return info; } @Override protected void onPostExecute(DisplayResolveInfo info) { mAdapter.notifyDataSetChanged(); } } }