diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-03-16 10:43:18 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-03-18 12:54:26 -0700 |
commit | e72f237defd9956a7e2d2e2bee8cd2558c3f83db (patch) | |
tree | 690c037d7a742c07f6c83716e32712cdccbf6bae | |
parent | b18a047de574f188b2c7633164f15ab3c9e40b5b (diff) | |
download | frameworks_base-e72f237defd9956a7e2d2e2bee8cd2558c3f83db.zip frameworks_base-e72f237defd9956a7e2d2e2bee8cd2558c3f83db.tar.gz frameworks_base-e72f237defd9956a7e2d2e2bee8cd2558c3f83db.tar.bz2 |
More work on making prefs work well on small screens.
Tweak padding so layouts now look decent, a few extensions so that
the correct title can be shown.
Change-Id: Ieace16bf4962d66564c6e2f67fb588e582943850
-rw-r--r-- | api/current.xml | 60 | ||||
-rw-r--r-- | core/java/android/preference/Preference.java | 15 | ||||
-rw-r--r-- | core/java/android/preference/PreferenceActivity.java | 98 | ||||
-rw-r--r-- | core/java/android/preference/PreferenceFragment.java | 11 | ||||
-rw-r--r-- | core/res/res/layout/preference_list_content.xml | 26 | ||||
-rw-r--r-- | core/res/res/layout/preference_list_content_large.xml | 140 | ||||
-rw-r--r-- | core/res/res/layout/preference_list_content_single_large.xml (renamed from core/res/res/layout-xlarge/preference_list_content_single.xml) | 0 | ||||
-rw-r--r-- | core/res/res/layout/preference_list_fragment.xml | 4 | ||||
-rw-r--r-- | core/res/res/layout/preference_list_fragment_large.xml | 80 | ||||
-rw-r--r-- | core/res/res/values-large/dimens.xml | 3 | ||||
-rw-r--r-- | core/res/res/values-large/styles.xml | 24 | ||||
-rw-r--r-- | core/res/res/values/dimens.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/styles.xml | 6 |
13 files changed, 415 insertions, 55 deletions
diff --git a/api/current.xml b/api/current.xml index a97bde6..874c74a 100644 --- a/api/current.xml +++ b/api/current.xml @@ -153982,6 +153982,17 @@ visibility="public" > </method> +<method name="getTitleRes" + return="int" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="getView" return="android.view.View" abstract="false" @@ -154889,6 +154900,10 @@ </parameter> <parameter name="args" type="android.os.Bundle"> </parameter> +<parameter name="titleRes" type="int"> +</parameter> +<parameter name="shortTitleRes" type="int"> +</parameter> </method> <method name="onGetInitialHeader" return="android.preference.PreferenceActivity.Header" @@ -155094,6 +155109,29 @@ <parameter name="resultRequestCode" type="int"> </parameter> </method> +<method name="startWithFragment" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="fragmentName" type="java.lang.String"> +</parameter> +<parameter name="args" type="android.os.Bundle"> +</parameter> +<parameter name="resultTo" type="android.app.Fragment"> +</parameter> +<parameter name="resultRequestCode" type="int"> +</parameter> +<parameter name="titleRes" type="int"> +</parameter> +<parameter name="shortTitleRes" type="int"> +</parameter> +</method> <method name="switchToHeader" return="void" abstract="false" @@ -155155,6 +155193,28 @@ visibility="public" > </field> +<field name="EXTRA_SHOW_FRAGMENT_SHORT_TITLE" + type="java.lang.String" + transient="false" + volatile="false" + value="":android:show_fragment_short_title"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="EXTRA_SHOW_FRAGMENT_TITLE" + type="java.lang.String" + transient="false" + volatile="false" + value="":android:show_fragment_title"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="HEADER_ID_UNDEFINED" type="long" transient="false" diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java index 7d37e5b..5e1be21 100644 --- a/core/java/android/preference/Preference.java +++ b/core/java/android/preference/Preference.java @@ -89,6 +89,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis private int mOrder = DEFAULT_ORDER; private CharSequence mTitle; + private int mTitleRes; private CharSequence mSummary; /** * mIconResId is overridden by mIcon, if mIcon is specified. @@ -214,6 +215,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis break; case com.android.internal.R.styleable.Preference_title: + mTitleRes = a.getResourceId(attr, 0); mTitle = a.getString(attr); break; @@ -582,6 +584,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis */ public void setTitle(CharSequence title) { if (title == null && mTitle != null || title != null && !title.equals(mTitle)) { + mTitleRes = 0; mTitle = title; notifyChanged(); } @@ -595,9 +598,21 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis */ public void setTitle(int titleResId) { setTitle(mContext.getString(titleResId)); + mTitleRes = titleResId; } /** + * Returns the title resource ID of this Preference. If the title did + * not come from a resource, 0 is returned. + * + * @return The title resource. + * @see #setTitle(int) + */ + public int getTitleRes() { + return mTitleRes; + } + + /** * Returns the title of this Preference. * * @return The title. diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java index db50bfc..15d5898 100644 --- a/core/java/android/preference/PreferenceActivity.java +++ b/core/java/android/preference/PreferenceActivity.java @@ -132,13 +132,28 @@ public abstract class PreferenceActivity extends ListActivity implements /** * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, - * this extra can also be specify to supply a Bundle of arguments to pass + * this extra can also be specified to supply a Bundle of arguments to pass * to that fragment when it is instantiated during the initial creation * of PreferenceActivity. */ public static final String EXTRA_SHOW_FRAGMENT_ARGUMENTS = ":android:show_fragment_args"; /** + * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, + * this extra can also be specify to supply the title to be shown for + * that fragment. + */ + public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title"; + + /** + * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, + * this extra can also be specify to supply the short title to be shown for + * that fragment. + */ + public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE + = ":android:show_fragment_short_title"; + + /** * When starting this activity, the invoking Intent can contain this extra * boolean that the header list should not be displayed. This is most often * used in conjunction with {@link #EXTRA_SHOW_FRAGMENT} to launch @@ -488,7 +503,12 @@ public abstract class PreferenceActivity extends ListActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(com.android.internal.R.layout.preference_list_content); + if (getResources().getConfiguration().isLayoutSizeAtLeast( + Configuration.SCREENLAYOUT_SIZE_LARGE)) { + setContentView(com.android.internal.R.layout.preference_list_content_large); + } else { + setContentView(com.android.internal.R.layout.preference_list_content); + } mListFooter = (FrameLayout)findViewById(com.android.internal.R.id.list_footer); mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs_frame); @@ -496,6 +516,8 @@ public abstract class PreferenceActivity extends ListActivity implements mSinglePane = hidingHeaders || !onIsMultiPane(); String initialFragment = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT); Bundle initialArguments = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS); + int initialTitle = getIntent().getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE, 0); + int initialShortTitle = getIntent().getIntExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE, 0); if (savedInstanceState != null) { // We are restarting from a previous saved state; used that to @@ -516,6 +538,12 @@ public abstract class PreferenceActivity extends ListActivity implements // new fragment mode, but don't need to compute and show // the headers. switchToHeader(initialFragment, initialArguments); + if (initialTitle != 0) { + CharSequence initialTitleStr = getText(initialTitle); + CharSequence initialShortTitleStr = initialShortTitle != 0 + ? getText(initialShortTitle) : null; + showBreadCrumbs(initialTitleStr, initialShortTitleStr); + } } else { // We need to try to build the headers. @@ -557,7 +585,12 @@ public abstract class PreferenceActivity extends ListActivity implements } else { // If there are no headers, we are in the old "just show a screen // of preferences" mode. - setContentView(com.android.internal.R.layout.preference_list_content_single); + if (getResources().getConfiguration().isLayoutSizeAtLeast( + Configuration.SCREENLAYOUT_SIZE_LARGE)) { + setContentView(com.android.internal.R.layout.preference_list_content_single_large); + } else { + setContentView(com.android.internal.R.layout.preference_list_content_single); + } mListFooter = (FrameLayout) findViewById(com.android.internal.R.id.list_footer); mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs); mPreferenceManager = new PreferenceManager(this, FIRST_REQUEST_CODE); @@ -942,7 +975,8 @@ public abstract class PreferenceActivity extends ListActivity implements /** * Called when the user selects an item in the header list. The default - * implementation will call either {@link #startWithFragment(String, Bundle, Fragment, int)} + * implementation will call either + * {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} * or {@link #switchToHeader(Header)} as appropriate. * * @param header The header that was selected. @@ -951,7 +985,14 @@ public abstract class PreferenceActivity extends ListActivity implements public void onHeaderClick(Header header, int position) { if (header.fragment != null) { if (mSinglePane) { - startWithFragment(header.fragment, header.fragmentArguments, null, 0); + int titleRes = header.breadCrumbTitleRes; + int shortTitleRes = header.breadCrumbShortTitleRes; + if (titleRes == 0) { + titleRes = header.titleRes; + shortTitleRes = 0; + } + startWithFragment(header.fragment, header.fragmentArguments, null, 0, + titleRes, shortTitleRes); } else { switchToHeader(header); } @@ -961,7 +1002,7 @@ public abstract class PreferenceActivity extends ListActivity implements } /** - * Called by {@link #startWithFragment(String, Bundle, Fragment, int)} when + * Called by {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} when * in single-pane mode, to build an Intent to launch a new activity showing * the selected fragment. The default implementation constructs an Intent * that re-launches the current activity with the appropriate arguments to @@ -969,19 +1010,33 @@ public abstract class PreferenceActivity extends ListActivity implements * * @param fragmentName The name of the fragment to display. * @param args Optional arguments to supply to the fragment. + * @param titleRes Optional resource ID of title to show for this item. + * @param titleRes Optional resource ID of short title to show for this item. * @return Returns an Intent that can be launched to display the given * fragment. */ - public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args) { + public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, + int titleRes, int shortTitleRes) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClass(this, getClass()); intent.putExtra(EXTRA_SHOW_FRAGMENT, fragmentName); intent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, args); + intent.putExtra(EXTRA_SHOW_FRAGMENT_TITLE, titleRes); + intent.putExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE, shortTitleRes); intent.putExtra(EXTRA_NO_HEADERS, true); return intent; } /** + * Like {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} + * but uses a 0 titleRes. + */ + public void startWithFragment(String fragmentName, Bundle args, + Fragment resultTo, int resultRequestCode) { + startWithFragment(fragmentName, args, resultTo, resultRequestCode, 0, 0); + } + + /** * Start a new instance of this activity, showing only the given * preference fragment. When launched in this mode, the header list * will be hidden and the given preference fragment will be instantiated @@ -993,10 +1048,14 @@ public abstract class PreferenceActivity extends ListActivity implements * the activity launch. * @param resultRequestCode If resultTo is non-null, this is the request * code in which to report the result. + * @param titleRes Resource ID of string to display for the title of + * this set of preferences. + * @param titleRes Resource ID of string to display for the short title of + * this set of preferences. */ public void startWithFragment(String fragmentName, Bundle args, - Fragment resultTo, int resultRequestCode) { - Intent intent = onBuildStartFragmentIntent(fragmentName, args); + Fragment resultTo, int resultRequestCode, int titleRes, int shortTitleRes) { + Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes); if (resultTo == null) { startActivity(intent); } else { @@ -1013,16 +1072,16 @@ public abstract class PreferenceActivity extends ListActivity implements if (mFragmentBreadCrumbs == null) { View crumbs = findViewById(android.R.id.title); // For screens with a different kind of title, don't create breadcrumbs. - if (!(crumbs instanceof FragmentBreadCrumbs)) return; - mFragmentBreadCrumbs = (FragmentBreadCrumbs) findViewById(android.R.id.title); + try { + mFragmentBreadCrumbs = (FragmentBreadCrumbs)crumbs; + } catch (ClassCastException e) { + return; + } if (mFragmentBreadCrumbs == null) { - mFragmentBreadCrumbs = new FragmentBreadCrumbs(this); - ActionBar actionBar = getActionBar(); - if (actionBar != null) { - actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, - ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); - actionBar.setCustomView(mFragmentBreadCrumbs); + if (title != null) { + setTitle(title); } + return; } mFragmentBreadCrumbs.setMaxVisible(2); mFragmentBreadCrumbs.setActivity(this); @@ -1190,7 +1249,7 @@ public abstract class PreferenceActivity extends ListActivity implements public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes, CharSequence titleText, Fragment resultTo, int resultRequestCode) { if (mSinglePane) { - startWithFragment(fragmentClass, args, resultTo, resultRequestCode); + startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, 0); } else { Fragment f = Fragment.instantiate(this, fragmentClass, args); if (resultTo != null) { @@ -1236,7 +1295,8 @@ public abstract class PreferenceActivity extends ListActivity implements @Override public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) { - startPreferencePanel(pref.getFragment(), pref.getExtras(), 0, pref.getTitle(), null, 0); + startPreferencePanel(pref.getFragment(), pref.getExtras(), pref.getTitleRes(), + pref.getTitle(), null, 0); return true; } diff --git a/core/java/android/preference/PreferenceFragment.java b/core/java/android/preference/PreferenceFragment.java index 4e22ba0..7511e14 100644 --- a/core/java/android/preference/PreferenceFragment.java +++ b/core/java/android/preference/PreferenceFragment.java @@ -20,6 +20,7 @@ import android.app.Activity; import android.app.Fragment; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -151,8 +152,14 @@ public abstract class PreferenceFragment extends Fragment implements @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - return inflater.inflate(com.android.internal.R.layout.preference_list_fragment, - container, false); + if (getResources().getConfiguration().isLayoutSizeAtLeast( + Configuration.SCREENLAYOUT_SIZE_LARGE)) { + return inflater.inflate(com.android.internal.R.layout.preference_list_fragment_large, + container, false); + } else { + return inflater.inflate(com.android.internal.R.layout.preference_list_fragment, + container, false); + } } @Override diff --git a/core/res/res/layout/preference_list_content.xml b/core/res/res/layout/preference_list_content.xml index 5d034a5..925b715 100644 --- a/core/res/res/layout/preference_list_content.xml +++ b/core/res/res/layout/preference_list_content.xml @@ -36,8 +36,6 @@ android:layout_height="match_parent" android:layout_marginRight="@dimen/preference_screen_side_margin_negative" android:layout_marginLeft="@dimen/preference_screen_side_margin" - android:layout_marginTop="32dp" - android:layout_marginBottom="32dp" android:layout_weight="10"> <ListView android:id="@android:id/list" @@ -61,33 +59,9 @@ android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="20" - android:layout_marginLeft="@dimen/preference_screen_side_margin" - android:layout_marginRight="@dimen/preference_screen_side_margin" - android:layout_marginTop="16dp" - android:layout_marginBottom="16dp" - android:background="?attr/detailsElementBackground" android:orientation="vertical" android:visibility="gone" > - <!-- Breadcrumb inserted here --> - <android.app.FragmentBreadCrumbs - android:id="@android:id/title" - android:layout_height="72dip" - android:layout_width="match_parent" - android:paddingTop="16dip" - android:paddingBottom="8dip" - android:gravity="center_vertical|left" - android:layout_marginLeft="48dip" - android:layout_marginRight="48dip" - /> - - <ImageView - android:layout_width="match_parent" - android:layout_height="1dip" - android:paddingLeft="32dip" - android:paddingRight="32dip" - android:src="#404040" - /> <android.preference.PreferenceFrameLayout android:id="@+id/prefs" android:layout_width="match_parent" android:layout_height="0dip" diff --git a/core/res/res/layout/preference_list_content_large.xml b/core/res/res/layout/preference_list_content_large.xml new file mode 100644 index 0000000..14d188e --- /dev/null +++ b/core/res/res/layout/preference_list_content_large.xml @@ -0,0 +1,140 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* //device/apps/common/assets/res/layout/list_content.xml +** +** Copyright 2011, 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. +*/ +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_height="match_parent" + android:layout_width="match_parent"> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="0px" + android:layout_weight="1"> + + <LinearLayout + android:id="@+id/headers" + android:orientation="vertical" + android:layout_width="0px" + android:layout_height="match_parent" + android:layout_marginRight="@dimen/preference_screen_side_margin_negative" + android:layout_marginLeft="@dimen/preference_screen_side_margin" + android:layout_marginTop="32dp" + android:layout_marginBottom="32dp" + android:layout_weight="10"> + + <ListView android:id="@android:id/list" + android:layout_width="match_parent" + android:layout_height="0px" + android:layout_weight="1" + android:drawSelectorOnTop="false" + android:cacheColorHint="@android:color/transparent" + android:listPreferredItemHeight="48dp" + android:scrollbarAlwaysDrawVerticalTrack="true" /> + + <FrameLayout android:id="@+id/list_footer" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="0" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/prefs_frame" + android:layout_width="0px" + android:layout_height="match_parent" + android:layout_weight="20" + android:layout_marginLeft="@dimen/preference_screen_side_margin" + android:layout_marginRight="@dimen/preference_screen_side_margin" + android:layout_marginTop="16dp" + android:layout_marginBottom="16dp" + android:background="?attr/detailsElementBackground" + android:orientation="vertical" + android:visibility="gone" > + + <!-- Breadcrumb inserted here --> + <android.app.FragmentBreadCrumbs + android:id="@android:id/title" + android:layout_height="72dip" + android:layout_width="match_parent" + android:paddingTop="16dip" + android:paddingBottom="8dip" + android:gravity="center_vertical|left" + android:layout_marginLeft="48dip" + android:layout_marginRight="48dip" + /> + + <ImageView + android:layout_width="match_parent" + android:layout_height="1dip" + android:paddingLeft="32dip" + android:paddingRight="32dip" + android:src="#404040" + /> + <android.preference.PreferenceFrameLayout android:id="@+id/prefs" + android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="1" + android:layout_marginTop="-1dip" + /> + </LinearLayout> + </LinearLayout> + + <RelativeLayout android:id="@+id/button_bar" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_weight="0" + android:background="@android:drawable/bottom_bar" + android:visibility="gone"> + + <Button android:id="@+id/back_button" + android:layout_width="150dip" + android:layout_height="wrap_content" + android:layout_margin="5dip" + android:layout_alignParentLeft="true" + android:drawableLeft="@drawable/ic_btn_back" + android:drawablePadding="3dip" + android:text="@string/back_button_label" + /> + <LinearLayout + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true"> + + <Button android:id="@+id/skip_button" + android:layout_width="150dip" + android:layout_height="wrap_content" + android:layout_margin="5dip" + android:text="@string/skip_button_label" + android:visibility="gone" + /> + + <Button android:id="@+id/next_button" + android:layout_width="150dip" + android:layout_height="wrap_content" + android:layout_margin="5dip" + android:drawableRight="@drawable/ic_btn_next" + android:drawablePadding="3dip" + android:text="@string/next_button_label" + /> + </LinearLayout> + </RelativeLayout> +</LinearLayout> diff --git a/core/res/res/layout-xlarge/preference_list_content_single.xml b/core/res/res/layout/preference_list_content_single_large.xml index 6725996..6725996 100644 --- a/core/res/res/layout-xlarge/preference_list_content_single.xml +++ b/core/res/res/layout/preference_list_content_single_large.xml diff --git a/core/res/res/layout/preference_list_fragment.xml b/core/res/res/layout/preference_list_fragment.xml index 393cecf..4044371 100644 --- a/core/res/res/layout/preference_list_fragment.xml +++ b/core/res/res/layout/preference_list_fragment.xml @@ -28,10 +28,6 @@ android:layout_width="match_parent" android:layout_height="0px" android:layout_weight="1" - android:paddingTop="0dip" - android:paddingBottom="48dip" - android:paddingLeft="32dip" - android:paddingRight="32dip" android:clipToPadding="false" android:drawSelectorOnTop="false" android:cacheColorHint="@android:color/transparent" diff --git a/core/res/res/layout/preference_list_fragment_large.xml b/core/res/res/layout/preference_list_fragment_large.xml new file mode 100644 index 0000000..cde84ff --- /dev/null +++ b/core/res/res/layout/preference_list_fragment_large.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2011, 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. +*/ +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_height="match_parent" + android:layout_width="match_parent" + android:background="@android:color/transparent" + android:layout_removeBorders="true"> + + <ListView android:id="@android:id/list" + android:layout_width="match_parent" + android:layout_height="0px" + android:layout_weight="1" + android:paddingTop="0dip" + android:paddingBottom="48dip" + android:paddingLeft="32dip" + android:paddingRight="32dip" + android:clipToPadding="false" + android:drawSelectorOnTop="false" + android:cacheColorHint="@android:color/transparent" + android:scrollbarAlwaysDrawVerticalTrack="true" /> + + <RelativeLayout android:id="@+id/button_bar" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_weight="0" + android:background="@android:drawable/bottom_bar" + android:visibility="gone"> + + <Button android:id="@+id/back_button" + android:layout_width="150dip" + android:layout_height="wrap_content" + android:layout_margin="5dip" + android:layout_alignParentLeft="true" + android:drawableLeft="@drawable/ic_btn_back" + android:drawablePadding="3dip" + android:text="@string/back_button_label" + /> + <LinearLayout + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true"> + + <Button android:id="@+id/skip_button" + android:layout_width="150dip" + android:layout_height="wrap_content" + android:layout_margin="5dip" + android:text="@string/skip_button_label" + android:visibility="gone" + /> + + <Button android:id="@+id/next_button" + android:layout_width="150dip" + android:layout_height="wrap_content" + android:layout_margin="5dip" + android:drawableRight="@drawable/ic_btn_next" + android:drawablePadding="3dip" + android:text="@string/next_button_label" + /> + </LinearLayout> + </RelativeLayout> +</LinearLayout> diff --git a/core/res/res/values-large/dimens.xml b/core/res/res/values-large/dimens.xml index 5691548..cd1847f 100644 --- a/core/res/res/values-large/dimens.xml +++ b/core/res/res/values-large/dimens.xml @@ -19,4 +19,7 @@ <resources> <item type="dimen" name="dialog_min_width_major">55%</item> <item type="dimen" name="dialog_min_width_minor">80%</item> + + <!-- Preference UI dimensions for larger screens. --> + <dimen name="preference_widget_width">56dp</dimen> </resources> diff --git a/core/res/res/values-large/styles.xml b/core/res/res/values-large/styles.xml new file mode 100644 index 0000000..96a8c84 --- /dev/null +++ b/core/res/res/values-large/styles.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 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="Widget.Holo.PreferenceFrameLayout"> + <item name="android:borderTop">0dip</item> + <item name="android:borderBottom">48dip</item> + <item name="android:borderLeft">32dip</item> + <item name="android:borderRight">32dip</item> + </style> +</resources> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 8a590cd..cca7d8b 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -52,12 +52,13 @@ <dimen name="password_keyboard_key_height_numeric">56dip</dimen> <!-- Default correction for the space key in the password keyboard --> <dimen name="password_keyboard_spacebar_vertical_correction">4dip</dimen> + <!-- Preference activity side margins --> <dimen name="preference_screen_side_margin">0dp</dimen> <!-- Preference activity side margins negative--> <dimen name="preference_screen_side_margin_negative">0dp</dimen> <!-- Preference widget area width (to the left of the text) --> - <dimen name="preference_widget_width">56dp</dimen> + <dimen name="preference_widget_width">8dp</dimen> <!-- The platform's desired minimum size for a dialog's width when it is along the major axis (that is the screen is landscape). This may diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 11c3916..08f5410 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -2179,8 +2179,8 @@ <style name="Widget.Holo.PreferenceFrameLayout"> <item name="android:borderTop">0dip</item> - <item name="android:borderBottom">48dip</item> - <item name="android:borderLeft">32dip</item> - <item name="android:borderRight">32dip</item> + <item name="android:borderBottom">0dip</item> + <item name="android:borderLeft">0dip</item> + <item name="android:borderRight">0dip</item> </style> </resources> |