diff options
| author | 2010-11-10 23:27:54 -0800 | |
|---|---|---|
| committer | 2010-11-11 22:33:20 -0800 | |
| commit | bdd19bc338286e1042f59808545665a061e73ffc (patch) | |
| tree | 67190c205fe51fad767f56445e580f6860151621 | |
| parent | a4e28d181942018ba8759989799a28fa88764ce3 (diff) | |
Add Theme.Holo.DialogWhenLarge
This theme gives you a dialog look when running on a large
or xlarge screen, otherwise a regular full-screen activity.
Also some new Fragment convenience APIs.
Change-Id: I3d97928ffaa4f3bdfd0cc5daf8823f9235c4ba68
| -rw-r--r-- | api/current.xml | 63 | ||||
| -rw-r--r-- | core/java/android/app/Fragment.java | 41 | ||||
| -rw-r--r-- | core/res/res/values-large/themes.xml | 22 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 14 | ||||
| -rw-r--r-- | core/res/res/values/themes.xml | 6 |
5 files changed, 140 insertions, 6 deletions
diff --git a/api/current.xml b/api/current.xml index 6daeca9d2aa4..992302048277 100644 --- a/api/current.xml +++ b/api/current.xml @@ -14535,6 +14535,17 @@ visibility="public" > </field> +<field name="Theme_Holo_DialogWhenLarge" + type="int" + transient="false" + volatile="false" + value="16973954" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="Theme_Holo_Dialog_Alert" type="int" transient="false" @@ -27381,6 +27392,17 @@ visibility="public" > </method> +<method name="getResources" + return="android.content.res.Resources" + abstract="false" + native="false" + synchronized="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="getRetainInstance" return="boolean" abstract="false" @@ -27392,6 +27414,34 @@ visibility="public" > </method> +<method name="getString" + return="java.lang.String" + abstract="false" + native="false" + synchronized="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +<parameter name="resId" type="int"> +</parameter> +</method> +<method name="getString" + return="java.lang.String" + abstract="false" + native="false" + synchronized="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +<parameter name="resId" type="int"> +</parameter> +<parameter name="formatArgs" type="java.lang.Object..."> +</parameter> +</method> <method name="getTag" return="java.lang.String" abstract="false" @@ -27425,6 +27475,19 @@ visibility="public" > </method> +<method name="getText" + return="java.lang.CharSequence" + abstract="false" + native="false" + synchronized="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +<parameter name="resId" type="int"> +</parameter> +</method> <method name="getView" return="android.view.View" abstract="false" diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java index eaf1aee6794a..b103385ea600 100644 --- a/core/java/android/app/Fragment.java +++ b/core/java/android/app/Fragment.java @@ -21,6 +21,7 @@ import android.content.ComponentCallbacks; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; +import android.content.res.Resources; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; @@ -619,6 +620,46 @@ public class Fragment implements ComponentCallbacks, OnCreateContextMenuListener } /** + * Return <code>getActivity().getResources()</code>. + */ + final public Resources getResources() { + return mActivity.getResources(); + } + + /** + * Return a localized, styled CharSequence from the application's package's + * default string table. + * + * @param resId Resource id for the CharSequence text + */ + public final CharSequence getText(int resId) { + return getResources().getText(resId); + } + + /** + * Return a localized string from the application's package's + * default string table. + * + * @param resId Resource id for the string + */ + public final String getString(int resId) { + return getResources().getString(resId); + } + + /** + * Return a localized formatted string from the application's package's + * default string table, substituting the format arguments as defined in + * {@link java.util.Formatter} and {@link java.lang.String#format}. + * + * @param resId Resource id for the format string + * @param formatArgs The format arguments that will be used for substitution. + */ + + public final String getString(int resId, Object... formatArgs) { + return getResources().getString(resId, formatArgs); + } + + /** * Return the FragmentManager for interacting with fragments associated * with this fragment's activity. Note that this will be non-null slightly * before {@link #getActivity()}, during the time from when the fragment is diff --git a/core/res/res/values-large/themes.xml b/core/res/res/values-large/themes.xml new file mode 100644 index 000000000000..cdf58fe039df --- /dev/null +++ b/core/res/res/values-large/themes.xml @@ -0,0 +1,22 @@ +<?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. +*/ +--> +<resources> + <style name="Theme.Holo.DialogWhenLarge" parent="@android:style/Theme.Holo.Dialog"> + </style> +</resources> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index a1b9dc90cf27..bf0ac47bd239 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1366,6 +1366,12 @@ <public type="attr" name="autoAdvanceViewId" /> <public type="attr" name="useIntrinsicSizeAsMinimum" /> + <public type="attr" name="actionModeCutDrawable" /> + <public type="attr" name="actionModeCopyDrawable" /> + <public type="attr" name="actionModePasteDrawable" /> + <public type="attr" name="textEditPasteWindowLayout" /> + <public type="attr" name="textEditNoPasteWindowLayout" /> + <public type="anim" name="animator_fade_in" /> <public type="anim" name="animator_fade_out" /> @@ -1431,11 +1437,7 @@ <public type="style" name="TextAppearance.Widget.PopupMenu.Small" /> <public type="style" name="Widget.FragmentBreadCrumbs" /> + <public type="style" name="Theme.Holo.DialogWhenLarge" /> + <public type="string" name="selectTextMode" /> - - <public type="attr" name="actionModeCutDrawable" /> - <public type="attr" name="actionModeCopyDrawable" /> - <public type="attr" name="actionModePasteDrawable" /> - <public type="attr" name="textEditPasteWindowLayout" /> - <public type="attr" name="textEditNoPasteWindowLayout" /> </resources> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index b4e3c6f532e8..c8cce8154f47 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -1187,6 +1187,12 @@ <item name="windowContentOverlay">@null</item> </style> + <!-- Theme for a window that will be displayed either full-screen on + smaller screens (small, normal) or as a dialog on larger screens + (large, xlarge) --> + <style name="Theme.Holo.DialogWhenLarge" parent="@android:style/Theme.Holo"> + </style> + <!-- Light holo dialog themes --> <!-- Holo light theme for dialog windows and activities, which is used by the |