Methods Summary |
---|
protected android.content.Intent | getTargetIntent()Get the base intent to use when running
{@link PackageManager#queryIntentActivities(Intent, int)}.
return new Intent();
|
protected android.content.Intent | intentForPosition(int position)Return the actual Intent for a specific position in our
{@link android.widget.ListView}.
ActivityAdapter adapter = (ActivityAdapter) mAdapter;
return adapter.intentForPosition(position);
|
protected android.app.LauncherActivity$ListItem | itemForPosition(int position)Return the {@link ListItem} for a specific position in our
{@link android.widget.ListView}.
ActivityAdapter adapter = (ActivityAdapter) mAdapter;
return adapter.itemForPosition(position);
|
public java.util.List | makeListItems()Perform the query to determine which results to show and return a list of them.
// Load all matching activities and sort correctly
List<ResolveInfo> list = onQueryPackageManager(mIntent);
onSortResultList(list);
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, null));
}
return result;
|
protected void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
mPackageManager = getPackageManager();
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
}
onSetContentView();
mIconResizer = new IconResizer();
mIntent = new Intent(getTargetIntent());
mIntent.setComponent(null);
mAdapter = new ActivityAdapter(mIconResizer);
setListAdapter(mAdapter);
getListView().setTextFilterEnabled(true);
updateAlertTitle();
updateButtonText();
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)) {
setProgressBarIndeterminateVisibility(false);
}
|
protected boolean | onEvaluateShowIcons()Whether or not to show icons in the list
return true;
|
protected void | onListItemClick(android.widget.ListView l, android.view.View v, int position, long id)
Intent intent = intentForPosition(position);
startActivity(intent);
|
protected java.util.List | onQueryPackageManager(android.content.Intent queryIntent)Perform query on package manager for list items. The default
implementation queries for activities.
return mPackageManager.queryIntentActivities(queryIntent, /* no flags */ 0);
|
protected void | onSetContentView()Override to call setContentView() with your own content view to
customize the list layout.
setContentView(com.android.internal.R.layout.activity_list);
|
protected void | onSortResultList(java.util.List results)
Collections.sort(results, new ResolveInfo.DisplayNameComparator(mPackageManager));
|
public void | setTitle(java.lang.CharSequence title)
super.setTitle(title);
updateAlertTitle();
|
public void | setTitle(int titleId)
super.setTitle(titleId);
updateAlertTitle();
|
private void | updateAlertTitle()
TextView alertTitle = (TextView) findViewById(com.android.internal.R.id.alertTitle);
if (alertTitle != null) {
alertTitle.setText(getTitle());
}
|
private void | updateButtonText()
Button cancelButton = (Button) findViewById(com.android.internal.R.id.button1);
if (cancelButton != null) {
cancelButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
}
|