diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 14:04:24 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 14:04:24 -0800 |
| commit | 076357b8567458d4b6dfdcf839ef751634cd2bfb (patch) | |
| tree | efbb2fd6f1dc67d2d606382fc3b82983e7cb2e1f /core/java/android/app | |
| parent | 3dec7d563a2f3e1eb967ce2054a00b6620e3558c (diff) | |
auto import from //depot/cupcake/@132589
Diffstat (limited to 'core/java/android/app')
| -rw-r--r-- | core/java/android/app/ApplicationContext.java | 39 | ||||
| -rw-r--r-- | core/java/android/app/ExpandableListActivity.java | 23 | ||||
| -rw-r--r-- | core/java/android/app/IntentService.java | 74 | ||||
| -rw-r--r-- | core/java/android/app/ListActivity.java | 26 | ||||
| -rw-r--r-- | core/java/android/app/NotificationManager.java | 4 | ||||
| -rw-r--r-- | core/java/android/app/SearchDialog.java | 2 | ||||
| -rw-r--r-- | core/java/android/app/SearchManager.java | 8 |
7 files changed, 29 insertions, 147 deletions
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java index 3b5ad862710f..394b8e3b361c 100644 --- a/core/java/android/app/ApplicationContext.java +++ b/core/java/android/app/ApplicationContext.java @@ -1487,7 +1487,7 @@ class ApplicationContext extends Context { static final class ApplicationPackageManager extends PackageManager { @Override public PackageInfo getPackageInfo(String packageName, int flags) - throws NameNotFoundException { + throws NameNotFoundException { try { PackageInfo pi = mPM.getPackageInfo(packageName, flags); if (pi != null) { @@ -1500,43 +1500,6 @@ class ApplicationContext extends Context { throw new NameNotFoundException(packageName); } - public Intent getLaunchIntentForPackage(String packageName) - throws NameNotFoundException { - // First see if the package has an INFO activity; the existence of - // such an activity is implied to be the desired front-door for the - // overall package (such as if it has multiple launcher entries). - Intent intent = getLaunchIntentForPackageCategory(this, packageName, - Intent.CATEGORY_INFO); - if (intent != null) { - return intent; - } - - // Otherwise, try to find a main launcher activity. - return getLaunchIntentForPackageCategory(this, packageName, - Intent.CATEGORY_LAUNCHER); - } - - // XXX This should be implemented as a call to the package manager, - // to reduce the work needed. - static Intent getLaunchIntentForPackageCategory(PackageManager pm, - String packageName, String category) { - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - Intent intentToResolve = new Intent(Intent.ACTION_MAIN, null); - intentToResolve.addCategory(category); - final List<ResolveInfo> apps = - pm.queryIntentActivities(intentToResolve, 0); - // I wish there were a way to directly get the "main" activity of a - // package but ... - for (ResolveInfo app : apps) { - if (app.activityInfo.packageName.equals(packageName)) { - intent.setClassName(packageName, app.activityInfo.name); - return intent; - } - } - return null; - } - @Override public int[] getPackageGids(String packageName) throws NameNotFoundException { diff --git a/core/java/android/app/ExpandableListActivity.java b/core/java/android/app/ExpandableListActivity.java index a2e048f53f48..75dfcae5a8f9 100644 --- a/core/java/android/app/ExpandableListActivity.java +++ b/core/java/android/app/ExpandableListActivity.java @@ -63,21 +63,21 @@ import java.util.Map; * * <pre> * <?xml version="1.0" encoding="UTF-8"?> - * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + * <LinearLayout * android:orientation="vertical" * android:layout_width="fill_parent" * android:layout_height="fill_parent" - * android:paddingLeft="8dp" - * android:paddingRight="8dp"> + * android:paddingLeft="8" + * android:paddingRight="8"> * - * <ExpandableListView android:id="@id/android:list" + * <ExpandableListView id="android:list" * android:layout_width="fill_parent" * android:layout_height="fill_parent" * android:background="#00FF00" * android:layout_weight="1" * android:drawSelectorOnTop="false"/> * - * <TextView android:id="@id/android:empty" + * <TextView id="android:empty" * android:layout_width="fill_parent" * android:layout_height="fill_parent" * android:background="#FF0000" @@ -113,19 +113,19 @@ import java.util.Map; * * <pre> * <?xml version="1.0" encoding="utf-8"?> - * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + * <LinearLayout * android:layout_width="fill_parent" * android:layout_height="wrap_content" * android:orientation="vertical"> * - * <TextView android:id="@+id/text1" - * android:textSize="16sp" + * <TextView id="text1" + * android:textSize="16" * android:textStyle="bold" * android:layout_width="fill_parent" * android:layout_height="wrap_content"/> * - * <TextView android:id="@+id/text2" - * android:textSize="16sp" + * <TextView id="text2" + * android:textSize="16" * android:layout_width="fill_parent" * android:layout_height="wrap_content"/> * </LinearLayout> @@ -162,8 +162,7 @@ public class ExpandableListActivity extends Activity implements /** * Override this to populate the context menu when an item is long pressed. menuInfo - * will contain an {@link android.widget.ExpandableListView.ExpandableListContextMenuInfo} - * whose packedPosition is a packed position + * will contain a {@link AdapterContextMenuInfo} whose position is a packed position * that should be used with {@link ExpandableListView#getPackedPositionType(long)} and * the other similar methods. * <p> diff --git a/core/java/android/app/IntentService.java b/core/java/android/app/IntentService.java deleted file mode 100644 index 2b12a2a1304d..000000000000 --- a/core/java/android/app/IntentService.java +++ /dev/null @@ -1,74 +0,0 @@ -package android.app; - -import android.content.Intent; -import android.os.Handler; -import android.os.HandlerThread; -import android.os.IBinder; -import android.os.Looper; -import android.os.Message; - -/** - * An abstract {@link Service} that serializes the handling of the Intents passed upon service - * start and handles them on a handler thread. - * - * <p>To use this class extend it and implement {@link #onHandleIntent}. The {@link Service} will - * automatically be stopped when the last enqueued {@link Intent} is handled. - */ -public abstract class IntentService extends Service { - private volatile Looper mServiceLooper; - private volatile ServiceHandler mServiceHandler; - private String mName; - - private final class ServiceHandler extends Handler { - public ServiceHandler(Looper looper) { - super(looper); - } - - @Override - public void handleMessage(Message msg) { - onHandleIntent((Intent)msg.obj); - stopSelf(msg.arg1); - } - } - - public IntentService(String name) { - super(); - mName = name; - } - - @Override - public void onCreate() { - super.onCreate(); - HandlerThread thread = new HandlerThread("IntentService[" + mName + "]"); - thread.start(); - - mServiceLooper = thread.getLooper(); - mServiceHandler = new ServiceHandler(mServiceLooper); - } - - @Override - public void onStart(Intent intent, int startId) { - super.onStart(intent, startId); - Message msg = mServiceHandler.obtainMessage(); - msg.arg1 = startId; - msg.obj = intent; - mServiceHandler.sendMessage(msg); - } - - @Override - public void onDestroy() { - mServiceLooper.quit(); - } - - @Override - public IBinder onBind(Intent intent) { - return null; - } - - /** - * Invoked on the Handler thread with the {@link Intent} that is passed to {@link #onStart}. - * Note that this will be invoked from a different thread than the one that handles the - * {@link #onStart} call. - */ - protected abstract void onHandleIntent(Intent intent); -} diff --git a/core/java/android/app/ListActivity.java b/core/java/android/app/ListActivity.java index 5523c185f21a..281893734b0d 100644 --- a/core/java/android/app/ListActivity.java +++ b/core/java/android/app/ListActivity.java @@ -53,22 +53,22 @@ import android.widget.ListView; * </p> * * <pre> - * <?xml version="1.0" encoding="utf-8"?> - * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + * <?xml version="1.0" encoding="UTF-8"?> + * <LinearLayout * android:orientation="vertical" * android:layout_width="fill_parent" * android:layout_height="fill_parent" - * android:paddingLeft="8dp" - * android:paddingRight="8dp"> + * android:paddingLeft="8" + * android:paddingRight="8"> * - * <ListView android:id="@id/android:list" + * <ListView id="android:list" * android:layout_width="fill_parent" * android:layout_height="fill_parent" * android:background="#00FF00" * android:layout_weight="1" * android:drawSelectorOnTop="false"/> * - * <TextView id="@id/android:empty" + * <TextView id="android:empty" * android:layout_width="fill_parent" * android:layout_height="fill_parent" * android:background="#FF0000" @@ -99,19 +99,19 @@ import android.widget.ListView; * * <pre> * <?xml version="1.0" encoding="utf-8"?> - * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + * <LinearLayout * android:layout_width="fill_parent" * android:layout_height="wrap_content" * android:orientation="vertical"> * - * <TextView android:id="@+id/text1" - * android:textSize="16sp" + * <TextView id="text1" + * android:textSize="16" * android:textStyle="bold" * android:layout_width="fill_parent" * android:layout_height="wrap_content"/> * - * <TextView android:id="@+id/text2" - * android:textSize="16sp" + * <TextView id="text2" + * android:textSize="16" * android:layout_width="fill_parent" * android:layout_height="wrap_content"/> * </LinearLayout> @@ -142,8 +142,8 @@ import android.widget.ListView; * public class MyListAdapter extends ListActivity { * * @Override - * protected void onCreate(Bundle savedInstanceState){ - * super.onCreate(savedInstanceState); + * protected void onCreate(Bundle icicle){ + * super.onCreate(icicle); * * // We'll define a custom screen layout here (the one shown above), but * // typically, you could just use the standard ListActivity layout. diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 39edab70d141..afb3827878ed 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -82,7 +82,9 @@ public class NotificationManager * @param id An identifier for this notification unique within your * application. * @param notification A {@link Notification} object describing how to - * notify the user, other than the view you're providing. Must not be null. + * notify the user, other than the view you're providing. If you + * pass null, there will be no persistent notification and no + * flashing, vibration, etc. */ public void notify(int id, Notification notification) { diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index d447eb22d5df..7b8256c46a00 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -448,7 +448,6 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS } } mSearchTextField.setInputType(inputType); - mSearchTextField.setImeOptions(mSearchable.getImeOptions()); } } @@ -794,6 +793,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // otherwise, dispatch an "edit view" key switch (keyCode) { case KeyEvent.KEYCODE_ENTER: + case KeyEvent.KEYCODE_DPAD_CENTER: if (event.getAction() == KeyEvent.ACTION_UP) { v.cancelLongPress(); launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null); diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index c1d66f4e7d7b..2cc6de951532 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -747,14 +747,6 @@ import android.view.KeyEvent; * <a href="../R.attr.html#inputType">inputType</a> attribute.</td> * <td align="center">No</td> * </tr> - * <tr><th>android:imeOptions</th> - * <td>If provided, supplies additional options for the input method. - * For most searches, in which free form text is expected, this attribute - * need not be provided, and will default to "actionSearch". - * Suitable values for this attribute are described in the - * <a href="../R.attr.html#imeOptions">imeOptions</a> attribute.</td> - * <td align="center">No</td> - * </tr> * * </tbody> * </table> |
