Note on threading: the state inside of this class is not itself + * thread-safe, however you can use it from any thread if you properly + * sure that you do not have races. Typically this means you will hand + * the entire object to another thread, which will be solely responsible + * for setting any results and finally calling {@link #finish()}. */ public static class PendingResult { /** @hide */ diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java index 6f4d098075dc1..7963b509b6aac 100644 --- a/core/java/android/content/ClipData.java +++ b/core/java/android/content/ClipData.java @@ -42,9 +42,9 @@ import java.util.ArrayList; * {@link ClipDescription#getMimeType(int) getDescription().getMimeType(int)} * must return correct MIME type(s) describing the data in the clip. For help * in correctly constructing a clip with the correct MIME type, use - * {@link #newPlainText(CharSequence, Bitmap, CharSequence)}, - * {@link #newUri(ContentResolver, CharSequence, Bitmap, Uri)}, and - * {@link #newIntent(CharSequence, Bitmap, Intent)}. + * {@link #newPlainText(CharSequence, CharSequence)}, + * {@link #newUri(ContentResolver, CharSequence, Uri)}, and + * {@link #newIntent(CharSequence, Intent)}. * *
Each Item instance can be one of three main classes of data: a simple * CharSequence of text, a single Intent object, or a Uri. See {@link Item} @@ -70,7 +70,7 @@ import java.util.ArrayList; * "content:" URIs. A content URI allows the recipient of a ClippedData item * to interact closely with the ContentProvider holding the data in order to * negotiate the transfer of that data. The clip must also be filled in with - * the available MIME types; {@link #newUri(ContentResolver, CharSequence, Bitmap, Uri)} + * the available MIME types; {@link #newUri(ContentResolver, CharSequence, Uri)} * will take care of correctly doing this. * *
For example, here is the paste function of a simple NotePad application. @@ -321,16 +321,14 @@ public class ClipData implements Parcelable { * * @param label Label to show to the user describing this clip. * @param mimeTypes An array of MIME types this data is available as. - * @param icon Bitmap providing the user with an iconing representation of - * the clip. * @param item The contents of the first item in the clip. */ - public ClipData(CharSequence label, String[] mimeTypes, Bitmap icon, Item item) { + public ClipData(CharSequence label, String[] mimeTypes, Item item) { mClipDescription = new ClipDescription(label, mimeTypes); if (item == null) { throw new NullPointerException("item is null"); } - mIcon = icon; + mIcon = null; mItems.add(item); } @@ -338,16 +336,14 @@ public class ClipData implements Parcelable { * Create a new clip. * * @param description The ClipDescription describing the clip contents. - * @param icon Bitmap providing the user with an iconing representation of - * the clip. * @param item The contents of the first item in the clip. */ - public ClipData(ClipDescription description, Bitmap icon, Item item) { + public ClipData(ClipDescription description, Item item) { mClipDescription = description; if (item == null) { throw new NullPointerException("item is null"); } - mIcon = icon; + mIcon = null; mItems.add(item); } @@ -356,13 +352,17 @@ public class ClipData implements Parcelable { * {@link ClipDescription#MIMETYPE_TEXT_PLAIN}. * * @param label User-visible label for the clip data. - * @param icon Iconic representation of the clip data. * @param text The actual text in the clip. * @return Returns a new ClipData containing the specified data. */ - static public ClipData newPlainText(CharSequence label, Bitmap icon, CharSequence text) { + static public ClipData newPlainText(CharSequence label, CharSequence text) { Item item = new Item(text); - return new ClipData(label, MIMETYPES_TEXT_PLAIN, icon, item); + return new ClipData(label, MIMETYPES_TEXT_PLAIN, item); + } + + @Deprecated + static public ClipData newPlainText(CharSequence label, Bitmap icon, CharSequence text) { + return newPlainText(label, text); } /** @@ -370,15 +370,19 @@ public class ClipData implements Parcelable { * {@link ClipDescription#MIMETYPE_TEXT_INTENT}. * * @param label User-visible label for the clip data. - * @param icon Iconic representation of the clip data. * @param intent The actual Intent in the clip. * @return Returns a new ClipData containing the specified data. */ - static public ClipData newIntent(CharSequence label, Bitmap icon, Intent intent) { + static public ClipData newIntent(CharSequence label, Intent intent) { Item item = new Item(intent); - return new ClipData(label, MIMETYPES_TEXT_INTENT, icon, item); + return new ClipData(label, MIMETYPES_TEXT_INTENT, item); } + @Deprecated + static public ClipData newIntent(CharSequence label, Bitmap icon, Intent intent) { + return newIntent(label, intent); + } + /** * Create a new ClipData holding a URI. If the URI is a content: URI, * this will query the content provider for the MIME type of its data and @@ -387,12 +391,11 @@ public class ClipData implements Parcelable { * * @param resolver ContentResolver used to get information about the URI. * @param label User-visible label for the clip data. - * @param icon Iconic representation of the clip data. * @param uri The URI in the clip. * @return Returns a new ClipData containing the specified data. */ static public ClipData newUri(ContentResolver resolver, CharSequence label, - Bitmap icon, Uri uri) { + Uri uri) { Item item = new Item(uri); String[] mimeTypes = null; if ("content".equals(uri.getScheme())) { @@ -417,26 +420,36 @@ public class ClipData implements Parcelable { if (mimeTypes == null) { mimeTypes = MIMETYPES_TEXT_URILIST; } - return new ClipData(label, mimeTypes, icon, item); + return new ClipData(label, mimeTypes, item); } + @Deprecated + static public ClipData newUri(ContentResolver resolver, CharSequence label, + Bitmap icon, Uri uri) { + return newUri(resolver, label, uri); + } + /** * Create a new ClipData holding an URI with MIME type * {@link ClipDescription#MIMETYPE_TEXT_URILIST}. - * Unlike {@link #newUri(ContentResolver, CharSequence, Bitmap, Uri)}, nothing + * Unlike {@link #newUri(ContentResolver, CharSequence, Uri)}, nothing * is inferred about the URI -- if it is a content: URI holding a bitmap, * the reported type will still be uri-list. Use this with care! * * @param label User-visible label for the clip data. - * @param icon Iconic representation of the clip data. * @param uri The URI in the clip. * @return Returns a new ClipData containing the specified data. */ - static public ClipData newRawUri(CharSequence label, Bitmap icon, Uri uri) { + static public ClipData newRawUri(CharSequence label, Uri uri) { Item item = new Item(uri); - return new ClipData(label, MIMETYPES_TEXT_URILIST, icon, item); + return new ClipData(label, MIMETYPES_TEXT_URILIST, item); } + @Deprecated + static public ClipData newRawUri(CharSequence label, Bitmap icon, Uri uri) { + return newRawUri(label, uri); + } + /** * Return the {@link ClipDescription} associated with this data, describing * what it contains. @@ -445,6 +458,9 @@ public class ClipData implements Parcelable { return mClipDescription; } + /** + * Add a new Item to the overall ClipData container. + */ public void addItem(Item item) { if (item == null) { throw new NullPointerException("item is null"); @@ -452,18 +468,31 @@ public class ClipData implements Parcelable { mItems.add(item); } + /** @hide */ public Bitmap getIcon() { return mIcon; } + /** + * Return the number of items in the clip data. + */ public int getItemCount() { return mItems.size(); } - public Item getItem(int index) { + /** + * Return a single item inside of the clip data. The index can range + * from 0 to {@link #getItemCount()}-1. + */ + public Item getItemAt(int index) { return mItems.get(index); } + @Deprecated + public Item getItem(int index) { + return getItemAt(index); + } + @Override public int describeContents() { return 0; diff --git a/core/java/android/content/ClipboardManager.java b/core/java/android/content/ClipboardManager.java index 3e2b763ecdd84..a79f0602ad11b 100644 --- a/core/java/android/content/ClipboardManager.java +++ b/core/java/android/content/ClipboardManager.java @@ -170,7 +170,7 @@ public class ClipboardManager extends android.text.ClipboardManager { public CharSequence getText() { ClipData clip = getPrimaryClip(); if (clip != null && clip.getItemCount() > 0) { - return clip.getItem(0).coerceToText(mContext); + return clip.getItemAt(0).coerceToText(mContext); } return null; } @@ -181,7 +181,7 @@ public class ClipboardManager extends android.text.ClipboardManager { * primary clip. It has no label or icon. */ public void setText(CharSequence text) { - setPrimaryClip(ClipData.newPlainText(null, null, text)); + setPrimaryClip(ClipData.newPlainText(null, text)); } /** diff --git a/core/java/android/content/CursorLoader.java b/core/java/android/content/CursorLoader.java index 38ebaf2ffc203..6228bd059f2d7 100644 --- a/core/java/android/content/CursorLoader.java +++ b/core/java/android/content/CursorLoader.java @@ -26,6 +26,17 @@ import java.util.Arrays; /** * A loader that queries the {@link ContentResolver} and returns a {@link Cursor}. + * This class implements the {@link Loader} protocol in a standard way for + * querying cursors, building on {@link AsyncTaskLoader} to perform the cursor + * query on a background thread so that it does not block the application's UI. + * + *
A CursorLoader must be built with the full information for the query to
+ * perform, either through the
+ * {@link #CursorLoader(Context, Uri, String[], String, String[], String)} or
+ * creating an empty instance with {@link #CursorLoader(Context)} and filling
+ * in the desired paramters with {@link #setUri(Uri)}, {@link #setSelection(String)},
+ * {@link #setSelectionArgs(String[])}, {@link #setSortOrder(String)},
+ * and {@link #setProjection(String[])}.
*/
public class CursorLoader extends AsyncTaskLoader A XPath-like selection pattern is used to select some nodes in the XML document. Each such
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index e688c86d0f9bb..46f611fba8cb9 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -149,7 +149,13 @@ public class ActivityInfo extends ComponentInfo
* {@link android.R.attr#finishOnCloseSystemDialogs} attribute.
*/
public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100;
- /**
+ /**
+ * Value for {@link #flags}: true when the application's rendering should
+ * be hardware accelerated.
+ */
+ public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
+ /**
+ * @hide
* Bit in {@link #flags} corresponding to an immersive activity
* that wishes not to be interrupted by notifications.
* Applications that hide the system notification bar with
@@ -164,12 +170,7 @@ public class ActivityInfo extends ComponentInfo
* "toast" window).
* {@see android.app.Notification#FLAG_HIGH_PRIORITY}
*/
- public static final int FLAG_IMMERSIVE = 0x0200;
- /**
- * Value for {@link #flags}: true when the application's rendering should
- * be hardware accelerated.
- */
- public static final int FLAG_HARDWARE_ACCELERATED = 0x0400;
+ public static final int FLAG_IMMERSIVE = 0x0400;
/**
* Options that have been set in the activity declaration in the
* manifest.
@@ -180,7 +181,7 @@ public class ActivityInfo extends ComponentInfo
* {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
* {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
* {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
- * {@link #FLAG_IMMERSIVE}, {@link #FLAG_HARDWARE_ACCELERATED}
+ * {@link #FLAG_HARDWARE_ACCELERATED}
*/
public int flags;
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index ee3bdab3e0c25..3883451e4b23d 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -1045,9 +1045,7 @@ public abstract class PreferenceActivity extends ListActivity implements
FragmentManager.POP_BACK_STACK_INCLUSIVE);
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
- transaction.setTransition(direction == 0 ? FragmentTransaction.TRANSIT_NONE
- : direction > 0 ? FragmentTransaction.TRANSIT_FRAGMENT_NEXT
- : FragmentTransaction.TRANSIT_FRAGMENT_PREV);
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
transaction.replace(com.android.internal.R.id.prefs, f);
transaction.commit();
}
@@ -1142,7 +1140,7 @@ public abstract class PreferenceActivity extends ListActivity implements
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
} else {
- transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_NEXT);
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
}
transaction.commit();
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 623cd4180c3d8..de886d8019dee 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -7942,7 +7942,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
for (int i=0; i