Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87121acc authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Some new API cleanup.

- Tweak Fragment docs to match new sample code.
- Make some new attributes public.
- Hide all of the XmlAdapter stuff, since it is not actually being used.

Change-Id: Iae2062f91d1ca0c6b1d656ae948417d3d048482f
parent b4ff35df
Loading
Loading
Loading
Loading
+199 −454

File changed.

Preview size limit exceeded, changes collapsed.

+17 −15
Original line number Diff line number Diff line
@@ -225,12 +225,11 @@ final class FragmentState implements Parcelable {
 * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java
 *      main}
 *
 * <p>The titles fragment, showing a list of titles, is very simple, relying
 * <p>The titles fragment, showing a list of titles, is fairly simple, relying
 * on {@link ListFragment} for most of its work.  Note the implementation of
 * clicking an item, which can either update
 * the content of the details fragment or start a new activity show the
 * details depending on whether the current activity's layout can show the
 * details.</p>
 * clicking an item: depending on the current activity's layout, it can either
 * create and display a new fragment to show the details in-place (more about
 * this later), or start a new activity show the details.</p>
 *
 * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java
 *      titles}
@@ -243,7 +242,7 @@ final class FragmentState implements Parcelable {
 *      details}
 *
 * <p>In this case when the user clicks on a title, there is no details
 * fragment in the current activity, so the title title fragment's click code will
 * container in the current activity, so the title title fragment's click code will
 * launch a new activity to display the details fragment:</p>
 *
 * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java
@@ -255,22 +254,25 @@ final class FragmentState implements Parcelable {
 *
 * {@sample development/samples/ApiDemos/res/layout-land/fragment_layout.xml layout}
 *
 * <p>Note how the prior code will adjust to this alternative UI flow: the
 * titles fragment will now show its text inside of its activity, and the
 * details activity will finish of it finds itself running in a configuration
 * where the details can be shown inline.
 * <p>Note how the prior code will adjust to this alternative UI flow: the titles
 * fragment will now embed the details fragment inside of this activity, and the
 * details activity will finish itself if it is running in a configuration
 * where the details can be shown in-place.
 *
 * <p>When a configuration change causes the activity hosting these fragments
 * to restart, its new instance may use a different layout that doesn't
 * include the same fragments as the previous layout.  In this case all of
 * the previous fragments will still be instantiated and running in the new
 * instance; however, any that are no longer associated with a &lt;fragment&gt;
 * tag in the view hierarchy will not have their content view created and will
 * return false from {@link #isInLayout}.
 * instance.  However, any that are no longer associated with a &lt;fragment&gt;
 * tag in the view hierarchy will not have their content view created
 * and will return false from {@link #isInLayout}.  (The code here also shows
 * how you can determine if a fragment placed in a container is no longer
 * running in a layout with that container and avoid creating its view hierarchy
 * in that case.)
 * 
 * <p>The attributes of the &lt;fragment&gt; tag are used to control the
 * LayoutParams provider when attaching the fragment's view to the parent
 * container.  They can alse be parsed by the fragment in {@link #onInflate}
 * LayoutParams provided when attaching the fragment's view to the parent
 * container.  They can also be parsed by the fragment in {@link #onInflate}
 * as parameters.
 * 
 * <p>The fragment being instantiated must have some kind of unique identifier
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package android.text;

/**
 * @deprecated Old text-only interace to the clipboard.  See
 * @deprecated Old text-only interface to the clipboard.  See
 * {@link android.content.ClipboardManager} for the modern API.
 */
@Deprecated
+32 −30
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import java.util.ArrayList;
import java.util.HashMap;

/**
 * @hide -- not sure if we really want this in the framework.
 *
 * <p>This class can be used to load {@link android.widget.Adapter adapters} defined in
 * XML resources. XML-defined adapters can be used to easily create adapters in your
 * own application or to pass adapters to other processes.</p>
@@ -239,18 +241,18 @@ import java.util.HashMap;
 * @see android.widget.Adapter
 * @see android.content.ContentProvider
 * 
 * @attr ref android.R.styleable#CursorAdapter_layout 
 * @attr ref android.R.styleable#CursorAdapter_selection 
 * @attr ref android.R.styleable#CursorAdapter_sortOrder 
 * @attr ref android.R.styleable#CursorAdapter_uri 
 * @attr ref android.R.styleable#CursorAdapter_BindItem_as 
 * @attr ref android.R.styleable#CursorAdapter_BindItem_from 
 * @attr ref android.R.styleable#CursorAdapter_BindItem_to
 * @attr ref android.R.styleable#CursorAdapter_MapItem_fromValue 
 * @attr ref android.R.styleable#CursorAdapter_MapItem_toValue 
 * @attr ref android.R.styleable#CursorAdapter_SelectItem_column 
 * @attr ref android.R.styleable#CursorAdapter_TransformItem_withClass 
 * @attr ref android.R.styleable#CursorAdapter_TransformItem_withExpression 
 * attr ref android.R.styleable#CursorAdapter_layout
 * attr ref android.R.styleable#CursorAdapter_selection
 * attr ref android.R.styleable#CursorAdapter_sortOrder
 * attr ref android.R.styleable#CursorAdapter_uri
 * attr ref android.R.styleable#CursorAdapter_BindItem_as
 * attr ref android.R.styleable#CursorAdapter_BindItem_from
 * attr ref android.R.styleable#CursorAdapter_BindItem_to
 * attr ref android.R.styleable#CursorAdapter_MapItem_fromValue
 * attr ref android.R.styleable#CursorAdapter_MapItem_toValue
 * attr ref android.R.styleable#CursorAdapter_SelectItem_column
 * attr ref android.R.styleable#CursorAdapter_TransformItem_withClass
 * attr ref android.R.styleable#CursorAdapter_TransformItem_withExpression
 */
@SuppressWarnings({"JavadocReference"})
public class Adapters {
@@ -614,12 +616,12 @@ public class Adapters {
               throws IOException, XmlPullParserException {

            Resources resources = mResources;
            TypedArray a = resources.obtainAttributes(mAttrs, android.R.styleable.CursorAdapter);
            TypedArray a = resources.obtainAttributes(mAttrs, com.android.internal.R.styleable.CursorAdapter);

            String uri = a.getString(android.R.styleable.CursorAdapter_uri);
            String selection = a.getString(android.R.styleable.CursorAdapter_selection);
            String sortOrder = a.getString(android.R.styleable.CursorAdapter_sortOrder);
            int layout = a.getResourceId(android.R.styleable.CursorAdapter_layout, 0);
            String uri = a.getString(com.android.internal.R.styleable.CursorAdapter_uri);
            String selection = a.getString(com.android.internal.R.styleable.CursorAdapter_selection);
            String sortOrder = a.getString(com.android.internal.R.styleable.CursorAdapter_sortOrder);
            int layout = a.getResourceId(com.android.internal.R.styleable.CursorAdapter_layout, 0);
            if (layout == 0) {
                throw new IllegalArgumentException("The layout specified in " +
                        resources.getResourceEntryName(mId) + " does not exist");
@@ -670,9 +672,9 @@ public class Adapters {

        private void parseSelectTag() {
            TypedArray a = mResources.obtainAttributes(mAttrs,
                    android.R.styleable.CursorAdapter_SelectItem);
                    com.android.internal.R.styleable.CursorAdapter_SelectItem);

            String fromName = a.getString(android.R.styleable.CursorAdapter_SelectItem_column);
            String fromName = a.getString(com.android.internal.R.styleable.CursorAdapter_SelectItem_column);
            if (fromName == null) {
                throw new IllegalArgumentException("A select item in " +
                        mResources.getResourceEntryName(mId) +
@@ -688,21 +690,21 @@ public class Adapters {
        private void parseBindTag() throws IOException, XmlPullParserException {
            Resources resources = mResources;
            TypedArray a = resources.obtainAttributes(mAttrs,
                    android.R.styleable.CursorAdapter_BindItem);
                    com.android.internal.R.styleable.CursorAdapter_BindItem);

            String fromName = a.getString(android.R.styleable.CursorAdapter_BindItem_from);
            String fromName = a.getString(com.android.internal.R.styleable.CursorAdapter_BindItem_from);
            if (fromName == null) {
                throw new IllegalArgumentException("A bind item in " +
                        resources.getResourceEntryName(mId) + " does not have a 'from' attribute");
            }

            int toName = a.getResourceId(android.R.styleable.CursorAdapter_BindItem_to, 0);
            int toName = a.getResourceId(com.android.internal.R.styleable.CursorAdapter_BindItem_to, 0);
            if (toName == 0) {
                throw new IllegalArgumentException("A bind item in " +
                        resources.getResourceEntryName(mId) + " does not have a 'to' attribute");
            }

            String asType = a.getString(android.R.styleable.CursorAdapter_BindItem_as);
            String asType = a.getString(com.android.internal.R.styleable.CursorAdapter_BindItem_as);
            if (asType == null) {
                throw new IllegalArgumentException("A bind item in " +
                        resources.getResourceEntryName(mId) + " does not have an 'as' attribute");
@@ -796,9 +798,9 @@ public class Adapters {
            Resources resources = mResources;

            TypedArray a = resources.obtainAttributes(mAttrs,
                    android.R.styleable.CursorAdapter_MapItem);
                    com.android.internal.R.styleable.CursorAdapter_MapItem);

            String from = a.getString(android.R.styleable.CursorAdapter_MapItem_fromValue);
            String from = a.getString(com.android.internal.R.styleable.CursorAdapter_MapItem_fromValue);
            if (from == null) {
                throw new IllegalArgumentException("A map item in " +
                        resources.getResourceEntryName(mId) +
@@ -806,7 +808,7 @@ public class Adapters {
            }

            if (!drawable) {
                String to = a.getString(android.R.styleable.CursorAdapter_MapItem_toValue);
                String to = a.getString(com.android.internal.R.styleable.CursorAdapter_MapItem_toValue);
                if (to == null) {
                    throw new IllegalArgumentException("A map item in " +
                            resources.getResourceEntryName(mId) +
@@ -814,7 +816,7 @@ public class Adapters {
                }
                transformation.addStringMapping(from, to);
            } else {
                int to = a.getResourceId(android.R.styleable.CursorAdapter_MapItem_toValue, 0);
                int to = a.getResourceId(com.android.internal.R.styleable.CursorAdapter_MapItem_toValue, 0);
                if (to == 0) {
                    throw new IllegalArgumentException("A map item in " +
                            resources.getResourceEntryName(mId) +
@@ -830,12 +832,12 @@ public class Adapters {
            Resources resources = mResources;
            CursorTransformation transformation = null;
            TypedArray a = resources.obtainAttributes(mAttrs,
                    android.R.styleable.CursorAdapter_TransformItem);
                    com.android.internal.R.styleable.CursorAdapter_TransformItem);

            String className = a.getString(android.R.styleable.CursorAdapter_TransformItem_withClass);
            String className = a.getString(com.android.internal.R.styleable.CursorAdapter_TransformItem_withClass);
            if (className == null) {
                String expression = a.getString(
                        android.R.styleable.CursorAdapter_TransformItem_withExpression);
                        com.android.internal.R.styleable.CursorAdapter_TransformItem_withExpression);
                transformation = createExpressionTransformation(expression);
            } else if (!mContext.isRestricted()) {
                try {
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@
                android:layout_marginRight="@dimen/preference_screen_side_margin"
                android:layout_marginTop="16dp"
                android:layout_marginBottom="16dp"
                android:background="?attr/preferencePanelBackground"
                android:background="?attr/detailsElementBackground"
                android:orientation="vertical"
                android:visibility="gone" >

Loading