Merge change 5319 into donut
* changes: Add new APIs to LauncherActivity to be used elsewhere.
This commit is contained in:
@@ -22088,6 +22088,19 @@
|
|||||||
<parameter name="position" type="int">
|
<parameter name="position" type="int">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="itemForPosition"
|
||||||
|
return="android.app.LauncherActivity.ListItem"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="protected"
|
||||||
|
>
|
||||||
|
<parameter name="position" type="int">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
<method name="makeListItems"
|
<method name="makeListItems"
|
||||||
return="java.util.List<android.app.LauncherActivity.ListItem>"
|
return="java.util.List<android.app.LauncherActivity.ListItem>"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@@ -22196,6 +22209,16 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
|
<field name="resolveInfo"
|
||||||
|
type="android.content.pm.ResolveInfo"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
</class>
|
</class>
|
||||||
<class name="ListActivity"
|
<class name="ListActivity"
|
||||||
extends="android.app.Activity"
|
extends="android.app.Activity"
|
||||||
@@ -180577,7 +180600,7 @@
|
|||||||
<method name="startMethodTracing"
|
<method name="startMethodTracing"
|
||||||
return="void"
|
return="void"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
native="true"
|
native="false"
|
||||||
synchronized="false"
|
synchronized="false"
|
||||||
static="true"
|
static="true"
|
||||||
final="false"
|
final="false"
|
||||||
|
|||||||
@@ -60,26 +60,20 @@ public abstract class LauncherActivity extends ListActivity {
|
|||||||
* An item in the list
|
* An item in the list
|
||||||
*/
|
*/
|
||||||
public static class ListItem {
|
public static class ListItem {
|
||||||
|
public ResolveInfo resolveInfo;
|
||||||
public CharSequence label;
|
public CharSequence label;
|
||||||
//public CharSequence description;
|
|
||||||
public Drawable icon;
|
public Drawable icon;
|
||||||
public String packageName;
|
public String packageName;
|
||||||
public String className;
|
public String className;
|
||||||
public Bundle extras;
|
public Bundle extras;
|
||||||
|
|
||||||
ListItem(PackageManager pm, ResolveInfo resolveInfo, IconResizer resizer) {
|
ListItem(PackageManager pm, ResolveInfo resolveInfo, IconResizer resizer) {
|
||||||
|
this.resolveInfo = resolveInfo;
|
||||||
label = resolveInfo.loadLabel(pm);
|
label = resolveInfo.loadLabel(pm);
|
||||||
if (label == null && resolveInfo.activityInfo != null) {
|
if (label == null && resolveInfo.activityInfo != null) {
|
||||||
label = resolveInfo.activityInfo.name;
|
label = resolveInfo.activityInfo.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (resolveInfo.activityInfo != null &&
|
|
||||||
resolveInfo.activityInfo.applicationInfo != null) {
|
|
||||||
description = resolveInfo.activityInfo.applicationInfo.loadDescription(pm);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
icon = resizer.createIconThumbnail(resolveInfo.loadIcon(pm));
|
icon = resizer.createIconThumbnail(resolveInfo.loadIcon(pm));
|
||||||
packageName = resolveInfo.activityInfo.applicationInfo.packageName;
|
packageName = resolveInfo.activityInfo.applicationInfo.packageName;
|
||||||
className = resolveInfo.activityInfo.name;
|
className = resolveInfo.activityInfo.name;
|
||||||
@@ -122,6 +116,14 @@ public abstract class LauncherActivity extends ListActivity {
|
|||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ListItem itemForPosition(int position) {
|
||||||
|
if (mActivitiesList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mActivitiesList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return mActivitiesList != null ? mActivitiesList.size() : 0;
|
return mActivitiesList != null ? mActivitiesList.size() : 0;
|
||||||
}
|
}
|
||||||
@@ -353,6 +355,16 @@ public abstract class LauncherActivity extends ListActivity {
|
|||||||
return adapter.intentForPosition(position);
|
return adapter.intentForPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the {@link ListItem} for a specific position in our
|
||||||
|
* {@link android.widget.ListView}.
|
||||||
|
* @param position The item to return
|
||||||
|
*/
|
||||||
|
protected ListItem itemForPosition(int position) {
|
||||||
|
ActivityAdapter adapter = (ActivityAdapter) mAdapter;
|
||||||
|
return adapter.itemForPosition(position);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the base intent to use when running
|
* Get the base intent to use when running
|
||||||
* {@link PackageManager#queryIntentActivities(Intent, int)}.
|
* {@link PackageManager#queryIntentActivities(Intent, int)}.
|
||||||
|
|||||||
Reference in New Issue
Block a user