Fix a bunch of API review bugs.
3362464 API REVIEW: android.content potpourri 3362445 API REVIEW: Fragment transaction stuff 3362428 API REVIEW: Fragment stuff 3362418 API REVIEW: Loader stuff 3362414 API REVIEW: android.content.pm.ActivityInfo Change-Id: I6475421a4735759b458acb67df4380cc6234f147
This commit is contained in:
@@ -267,6 +267,14 @@ final class BackStackRecord extends FragmentTransaction implements
|
||||
return mIndex;
|
||||
}
|
||||
|
||||
public int getBreadCrumbTitleRes() {
|
||||
return mBreadCrumbTitleRes;
|
||||
}
|
||||
|
||||
public int getBreadCrumbShortTitleRes() {
|
||||
return mBreadCrumbShortTitleRes;
|
||||
}
|
||||
|
||||
public CharSequence getBreadCrumbTitle() {
|
||||
if (mBreadCrumbTitleRes != 0) {
|
||||
return mManager.mActivity.getText(mBreadCrumbTitleRes);
|
||||
|
||||
@@ -295,7 +295,7 @@ public class DialogFragment extends Fragment
|
||||
/**
|
||||
* Return the current value of {@link #setCancelable(boolean)}.
|
||||
*/
|
||||
public boolean getCancelable() {
|
||||
public boolean isCancelable() {
|
||||
return mCancelable;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,13 +204,13 @@ public class FragmentBreadCrumbs extends ViewGroup
|
||||
|
||||
void updateCrumbs() {
|
||||
FragmentManager fm = mActivity.getFragmentManager();
|
||||
int numEntries = fm.countBackStackEntries();
|
||||
int numEntries = fm.getBackStackEntryCount();
|
||||
int numPreEntries = getPreEntryCount();
|
||||
int numViews = mContainer.getChildCount();
|
||||
for (int i = 0; i < numEntries + numPreEntries; i++) {
|
||||
BackStackEntry bse = i < numPreEntries
|
||||
? getPreEntry(i)
|
||||
: fm.getBackStackEntry(i - numPreEntries);
|
||||
: fm.getBackStackEntryAt(i - numPreEntries);
|
||||
if (i < numViews) {
|
||||
View v = mContainer.getChildAt(i);
|
||||
Object tag = v.getTag();
|
||||
|
||||
@@ -49,7 +49,7 @@ public abstract class FragmentManager {
|
||||
* Representation of an entry on the fragment back stack, as created
|
||||
* with {@link FragmentTransaction#addToBackStack(String)
|
||||
* FragmentTransaction.addToBackStack()}. Entries can later be
|
||||
* retrieved with {@link FragmentManager#getBackStackEntry(int)
|
||||
* retrieved with {@link FragmentManager#getBackStackEntryAt(int)
|
||||
* FragmentManager.getBackStackEntry()}.
|
||||
*
|
||||
* <p>Note that you should never hold on to a BackStackEntry object;
|
||||
@@ -64,6 +64,18 @@ public abstract class FragmentManager {
|
||||
*/
|
||||
public int getId();
|
||||
|
||||
/**
|
||||
* Return the full bread crumb title resource identifier for the entry,
|
||||
* or 0 if it does not have one.
|
||||
*/
|
||||
public int getBreadCrumbTitleRes();
|
||||
|
||||
/**
|
||||
* Return the short bread crumb title resource identifier for the entry,
|
||||
* or 0 if it does not have one.
|
||||
*/
|
||||
public int getBreadCrumbShortTitleRes();
|
||||
|
||||
/**
|
||||
* Return the full bread crumb title for the entry, or null if it
|
||||
* does not have one.
|
||||
@@ -102,7 +114,8 @@ public abstract class FragmentManager {
|
||||
*/
|
||||
public abstract FragmentTransaction beginTransaction();
|
||||
|
||||
/** Old API */
|
||||
/** @deprecated Old API */
|
||||
@Deprecated
|
||||
public FragmentTransaction openTransaction() {
|
||||
return beginTransaction();
|
||||
}
|
||||
@@ -153,7 +166,9 @@ public abstract class FragmentManager {
|
||||
|
||||
/**
|
||||
* Pop the top state off the back stack. Returns true if there was one
|
||||
* to pop, else false.
|
||||
* to pop, else false. This function is asynchronous -- it enqueues the
|
||||
* request to pop, but the action will not be performed until the application
|
||||
* returns to its event loop.
|
||||
*/
|
||||
public abstract void popBackStack();
|
||||
|
||||
@@ -168,6 +183,10 @@ public abstract class FragmentManager {
|
||||
/**
|
||||
* Pop the last fragment transition from the manager's fragment
|
||||
* back stack. If there is nothing to pop, false is returned.
|
||||
* This function is asynchronous -- it enqueues the
|
||||
* request to pop, but the action will not be performed until the application
|
||||
* returns to its event loop.
|
||||
*
|
||||
* @param name If non-null, this is the name of a previous back state
|
||||
* to look for; if found, all states up to that state will be popped. The
|
||||
* {@link #POP_BACK_STACK_INCLUSIVE} flag can be used to control whether
|
||||
@@ -186,6 +205,10 @@ public abstract class FragmentManager {
|
||||
|
||||
/**
|
||||
* Pop all back stack states up to the one with the given identifier.
|
||||
* This function is asynchronous -- it enqueues the
|
||||
* request to pop, but the action will not be performed until the application
|
||||
* returns to its event loop.
|
||||
*
|
||||
* @param id Identifier of the stated to be popped. If no identifier exists,
|
||||
* false is returned.
|
||||
* The identifier is the number returned by
|
||||
@@ -207,14 +230,24 @@ public abstract class FragmentManager {
|
||||
/**
|
||||
* Return the number of entries currently in the back stack.
|
||||
*/
|
||||
public abstract int countBackStackEntries();
|
||||
public abstract int getBackStackEntryCount();
|
||||
|
||||
@Deprecated
|
||||
public int countBackStackEntries() {
|
||||
return getBackStackEntryCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BackStackEntry at index <var>index</var> in the back stack;
|
||||
* entries start index 0 being the bottom of the stack.
|
||||
*/
|
||||
public abstract BackStackEntry getBackStackEntry(int index);
|
||||
public abstract BackStackEntry getBackStackEntryAt(int index);
|
||||
|
||||
@Deprecated
|
||||
public BackStackEntry getBackStackEntry(int index) {
|
||||
return getBackStackEntryAt(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new listener for changes to the fragment back stack.
|
||||
*/
|
||||
@@ -416,12 +449,12 @@ final class FragmentManagerImpl extends FragmentManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countBackStackEntries() {
|
||||
public int getBackStackEntryCount() {
|
||||
return mBackStack != null ? mBackStack.size() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackStackEntry getBackStackEntry(int index) {
|
||||
public BackStackEntry getBackStackEntryAt(int index) {
|
||||
return mBackStack.get(index);
|
||||
}
|
||||
|
||||
@@ -1678,11 +1711,8 @@ final class FragmentManagerImpl extends FragmentManager {
|
||||
case FragmentTransaction.TRANSIT_FRAGMENT_CLOSE:
|
||||
rev = FragmentTransaction.TRANSIT_FRAGMENT_OPEN;
|
||||
break;
|
||||
case FragmentTransaction.TRANSIT_FRAGMENT_NEXT:
|
||||
rev = FragmentTransaction.TRANSIT_FRAGMENT_PREV;
|
||||
break;
|
||||
case FragmentTransaction.TRANSIT_FRAGMENT_PREV:
|
||||
rev = FragmentTransaction.TRANSIT_FRAGMENT_NEXT;
|
||||
case FragmentTransaction.TRANSIT_FRAGMENT_FADE:
|
||||
rev = FragmentTransaction.TRANSIT_FRAGMENT_FADE;
|
||||
break;
|
||||
}
|
||||
return rev;
|
||||
@@ -1702,15 +1732,10 @@ final class FragmentManagerImpl extends FragmentManager {
|
||||
? com.android.internal.R.styleable.FragmentAnimation_fragmentCloseEnterAnimation
|
||||
: com.android.internal.R.styleable.FragmentAnimation_fragmentCloseExitAnimation;
|
||||
break;
|
||||
case FragmentTransaction.TRANSIT_FRAGMENT_NEXT:
|
||||
case FragmentTransaction.TRANSIT_FRAGMENT_FADE:
|
||||
animAttr = enter
|
||||
? com.android.internal.R.styleable.FragmentAnimation_fragmentNextEnterAnimation
|
||||
: com.android.internal.R.styleable.FragmentAnimation_fragmentNextExitAnimation;
|
||||
break;
|
||||
case FragmentTransaction.TRANSIT_FRAGMENT_PREV:
|
||||
animAttr = enter
|
||||
? com.android.internal.R.styleable.FragmentAnimation_fragmentPrevEnterAnimation
|
||||
: com.android.internal.R.styleable.FragmentAnimation_fragmentPrevExitAnimation;
|
||||
? com.android.internal.R.styleable.FragmentAnimation_fragmentFadeEnterAnimation
|
||||
: com.android.internal.R.styleable.FragmentAnimation_fragmentFadeExitAnimation;
|
||||
break;
|
||||
}
|
||||
return animAttr;
|
||||
|
||||
@@ -110,11 +110,16 @@ public abstract class FragmentTransaction {
|
||||
public static final int TRANSIT_FRAGMENT_OPEN = 1 | TRANSIT_ENTER_MASK;
|
||||
/** Fragment is being removed from the stack */
|
||||
public static final int TRANSIT_FRAGMENT_CLOSE = 2 | TRANSIT_EXIT_MASK;
|
||||
/** Fragment is being added in a 'next' operation*/
|
||||
public static final int TRANSIT_FRAGMENT_NEXT = 3 | TRANSIT_ENTER_MASK;
|
||||
/** Fragment is being removed in a 'previous' operation */
|
||||
public static final int TRANSIT_FRAGMENT_PREV = 4 | TRANSIT_EXIT_MASK;
|
||||
/** Fragment should simply fade in or out; that is, no strong navigation associated
|
||||
* with it except that it is appearing or disappearing for some reason. */
|
||||
public static final int TRANSIT_FRAGMENT_FADE = 3 | TRANSIT_ENTER_MASK;
|
||||
|
||||
// Temp compat.
|
||||
@Deprecated
|
||||
public static final int TRANSIT_FRAGMENT_NEXT = TRANSIT_FRAGMENT_FADE;
|
||||
@Deprecated
|
||||
public static final int TRANSIT_FRAGMENT_PREV = TRANSIT_FRAGMENT_FADE;
|
||||
|
||||
/**
|
||||
* Set specific animation resources to run for the fragments that are
|
||||
* entering and exiting in this transaction.
|
||||
|
||||
@@ -158,14 +158,6 @@ public abstract class LoaderManager {
|
||||
*/
|
||||
public abstract void destroyLoader(int id);
|
||||
|
||||
/**
|
||||
* @deprecated Renamed to {@link #destroyLoader}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void stopLoader(int id) {
|
||||
destroyLoader(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Loader with the given id or null if no matching Loader
|
||||
* is found.
|
||||
|
||||
@@ -168,9 +168,14 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> {
|
||||
* Called if the task was canceled before it was completed. Gives the class a chance
|
||||
* to properly dispose of the result.
|
||||
*/
|
||||
public void onCancelled(D data) {
|
||||
public void onCanceled(D data) {
|
||||
onCancelled(data);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void onCancelled(D data) {
|
||||
}
|
||||
|
||||
void executePendingTask() {
|
||||
if (mCancellingTask == null && mTask != null) {
|
||||
if (mTask.waiting) {
|
||||
@@ -195,7 +200,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> {
|
||||
}
|
||||
|
||||
void dispatchOnCancelled(LoadTask task, D data) {
|
||||
onCancelled(data);
|
||||
onCanceled(data);
|
||||
if (mCancellingTask == task) {
|
||||
if (DEBUG) Slog.v(TAG, "Cancelled task is now canceled!");
|
||||
mLastLoadCompleteTime = SystemClock.uptimeMillis();
|
||||
|
||||
@@ -170,6 +170,16 @@ public abstract class BroadcastReceiver {
|
||||
* State for a result that is pending for a broadcast receiver. Returned
|
||||
* by {@link BroadcastReceiver#goAsync() goAsync()}
|
||||
* while in {@link BroadcastReceiver#onReceive BroadcastReceiver.onReceive()}.
|
||||
* This allows you to return from onReceive() without having the broadcast
|
||||
* terminate; you must call {@link #finish()} once you are done with the
|
||||
* broadcast. This allows you to process the broadcast off of the main
|
||||
* thread of your app.
|
||||
*
|
||||
* <p>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 */
|
||||
|
||||
@@ -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)}.
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* <p>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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* <p>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<Cursor> {
|
||||
final ForceLoadContentObserver mObserver;
|
||||
@@ -81,6 +92,22 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an empty unspecified CursorLoader. You must follow this with
|
||||
* calls to {@link #setUri(Uri)}, {@link #setSelection(String)}, etc
|
||||
* to specify the query to perform.
|
||||
*/
|
||||
public CursorLoader(Context context) {
|
||||
super(context);
|
||||
mObserver = new ForceLoadContentObserver();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a fully-specified CursorLoader. See
|
||||
* {@link ContentResolver#query(Uri, String[], String, String[], String)
|
||||
* ContentResolver.query()} for documentation on the meaning of the
|
||||
* parameters. These will be passed as-is to that call.
|
||||
*/
|
||||
public CursorLoader(Context context, Uri uri, String[] projection, String selection,
|
||||
String[] selectionArgs, String sortOrder) {
|
||||
super(context);
|
||||
@@ -119,7 +146,7 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(Cursor cursor) {
|
||||
public void onCanceled(Cursor cursor) {
|
||||
if (cursor != null && !cursor.isClosed()) {
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ import java.util.Stack;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @hide -- not yet ready to support, should be provided just as a static lib.
|
||||
*
|
||||
* A read-only content provider which extracts data out of an XML document.
|
||||
*
|
||||
* <p>A XPath-like selection pattern is used to select some nodes in the XML document. Each such
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -7942,7 +7942,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
for (int i=0; i<urls.length; i++) {
|
||||
Uri uri = Uri.parse(urls[0].getURL());
|
||||
if (clip == null) {
|
||||
clip = ClipData.newRawUri(null, null, uri);
|
||||
clip = ClipData.newRawUri(null, uri);
|
||||
} else {
|
||||
clip.addItem(new ClipData.Item(uri));
|
||||
}
|
||||
@@ -7976,15 +7976,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
return true;
|
||||
|
||||
case ID_CUT:
|
||||
setPrimaryClip(ClipData.newPlainText(null, null,
|
||||
mTransformed.subSequence(min, max)));
|
||||
setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
|
||||
((Editable) mText).delete(min, max);
|
||||
stopSelectionActionMode();
|
||||
return true;
|
||||
|
||||
case ID_COPY:
|
||||
setPrimaryClip(ClipData.newPlainText(null, null,
|
||||
mTransformed.subSequence(min, max)));
|
||||
setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
|
||||
stopSelectionActionMode();
|
||||
return true;
|
||||
}
|
||||
@@ -8105,7 +8103,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
final int start = getSelectionStart();
|
||||
final int end = getSelectionEnd();
|
||||
CharSequence selectedText = mTransformed.subSequence(start, end);
|
||||
ClipData data = ClipData.newPlainText(null, null, selectedText);
|
||||
ClipData data = ClipData.newPlainText(null, selectedText);
|
||||
DragLocalState localState = new DragLocalState(this, start, end);
|
||||
startDrag(data, getTextThumbnailBuilder(selectedText), localState, 0);
|
||||
stopSelectionActionMode();
|
||||
@@ -8257,7 +8255,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
if (clip != null) {
|
||||
boolean didfirst = false;
|
||||
for (int i=0; i<clip.getItemCount(); i++) {
|
||||
CharSequence paste = clip.getItem(i).coerceToText(getContext());
|
||||
CharSequence paste = clip.getItemAt(i).coerceToText(getContext());
|
||||
if (paste != null) {
|
||||
if (!didfirst) {
|
||||
long minMax = prepareSpacesAroundPaste(min, max, paste);
|
||||
@@ -9300,7 +9298,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
ClipData clipData = event.getClipData();
|
||||
final int itemCount = clipData.getItemCount();
|
||||
for (int i=0; i < itemCount; i++) {
|
||||
Item item = clipData.getItem(i);
|
||||
Item item = clipData.getItemAt(i);
|
||||
content.append(item.coerceToText(TextView.this.mContext));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2010, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:zAdjustment="top">
|
||||
<objectAnimator
|
||||
android:interpolator="@interpolator/decelerate_cubic"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:valueType="floatType"
|
||||
android:propertyName="alpha"
|
||||
android:duration="@android:integer/config_activityDefaultDur"/>
|
||||
</set>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2010, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:zAdjustment="normal">
|
||||
<objectAnimator
|
||||
android:interpolator="@interpolator/decelerate_cubic"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType"
|
||||
android:propertyName="alpha"
|
||||
android:duration="@android:integer/config_activityShortDur"/>
|
||||
</set>
|
||||
@@ -1379,10 +1379,8 @@
|
||||
<attr name="fragmentOpenExitAnimation" format="reference" />
|
||||
<attr name="fragmentCloseEnterAnimation" format="reference" />
|
||||
<attr name="fragmentCloseExitAnimation" format="reference" />
|
||||
<attr name="fragmentNextEnterAnimation" format="reference" />
|
||||
<attr name="fragmentNextExitAnimation" format="reference" />
|
||||
<attr name="fragmentPrevEnterAnimation" format="reference" />
|
||||
<attr name="fragmentPrevExitAnimation" format="reference" />
|
||||
<attr name="fragmentFadeEnterAnimation" format="reference" />
|
||||
<attr name="fragmentFadeExitAnimation" format="reference" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- Window animation class attributes. -->
|
||||
|
||||
@@ -1311,10 +1311,8 @@
|
||||
<public type="attr" name="fragmentOpenExitAnimation" />
|
||||
<public type="attr" name="fragmentCloseEnterAnimation" />
|
||||
<public type="attr" name="fragmentCloseExitAnimation" />
|
||||
<public type="attr" name="fragmentNextEnterAnimation" />
|
||||
<public type="attr" name="fragmentNextExitAnimation" />
|
||||
<public type="attr" name="fragmentPrevEnterAnimation" />
|
||||
<public type="attr" name="fragmentPrevExitAnimation" />
|
||||
<public type="attr" name="fragmentFadeEnterAnimation" />
|
||||
<public type="attr" name="fragmentFadeExitAnimation" />
|
||||
<public type="attr" name="actionBarSize" />
|
||||
<public type="attr" name="imeSubtypeLocale" />
|
||||
<public type="attr" name="imeSubtypeMode" />
|
||||
|
||||
@@ -85,10 +85,8 @@
|
||||
<item name="fragmentOpenExitAnimation">@animator/fragment_open_exit</item>
|
||||
<item name="fragmentCloseEnterAnimation">@animator/fragment_close_enter</item>
|
||||
<item name="fragmentCloseExitAnimation">@animator/fragment_close_exit</item>
|
||||
<item name="fragmentNextEnterAnimation">@animator/fragment_next_enter</item>
|
||||
<item name="fragmentNextExitAnimation">@animator/fragment_next_exit</item>
|
||||
<item name="fragmentPrevEnterAnimation">@animator/fragment_prev_enter</item>
|
||||
<item name="fragmentPrevExitAnimation">@animator/fragment_prev_exit</item>
|
||||
<item name="fragmentFadeEnterAnimation">@animator/fragment_fade_enter</item>
|
||||
<item name="fragmentFadeExitAnimation">@animator/fragment_fade_exit</item>
|
||||
</style>
|
||||
|
||||
<!-- Standard animations for a non-full-screen window or activity. -->
|
||||
|
||||
Reference in New Issue
Block a user