Added assets for preference panel and adjusted layout margins for new spec.

This commit is contained in:
Amith Yamasani
2010-11-05 09:15:51 -07:00
parent 08caf9e84f
commit 8da3529069
20 changed files with 348 additions and 39 deletions

View File

@@ -473,6 +473,9 @@ 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);
mListFooter = (FrameLayout) findViewById(com.android.internal.R.id.list_footer);
mPrefsContainer = findViewById(com.android.internal.R.id.prefs);
mPreferenceManager = new PreferenceManager(this, FIRST_REQUEST_CODE);
mPreferenceManager.setOnPreferenceTreeClickListener(this);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -0,0 +1,104 @@
<?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.
*/
-->
<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="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/preference_screen_side_margin"
android:layout_marginLeft="@dimen/preference_screen_side_margin"
android:layout_marginTop="48dp"
android:layout_marginBottom="48dp"
android:paddingLeft="32dip"
android:paddingRight="32dip"
android:paddingTop="32dip"
android:paddingBottom="32dip"
android:background="?attr/preferencePanelBackground">
<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>
<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>

View File

@@ -4,9 +4,9 @@
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.
@@ -23,11 +23,14 @@
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize">
<View
android:layout_width="@dimen/preference_widget_width"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
@@ -37,7 +40,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
@@ -47,6 +50,7 @@
android:layout_below="@android:id/title"
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="4" />
</RelativeLayout>

View File

@@ -18,4 +18,5 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
style="?android:attr/listSeparatorTextViewStyle"
android:id="@+android:id/title"
android:paddingLeft="32dp"
/>

View File

@@ -14,13 +14,53 @@
limitations under the License.
-->
<!-- Layout used by DialogPreference widgets. This is inflated inside
android.R.layout.preference. -->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
<!-- Layout used by DialogPreference in a PreferenceActivity. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="4dip"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_circle"
android:src="@drawable/ic_btn_round_more" />
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize">
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@+android:id/widget_frame"
android:layout_width="@dimen/preference_widget_width"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal" >
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/btn_circle"
android:src="@drawable/ic_btn_round_more" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="4" />
</RelativeLayout>
</LinearLayout>

View File

@@ -17,7 +17,9 @@
<!-- Layout used as the dialog's content View for EditTextPreference. -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_marginTop="48dp"
android:layout_marginBottom="48dp">
<LinearLayout
android:id="@+android:id/edittext_container"
@@ -28,10 +30,11 @@
<TextView android:id="@+android:id/message"
style="?android:attr/textAppearanceSmall"
android:layout_marginBottom="48dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
</ScrollView>

View File

@@ -44,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />

View File

@@ -23,21 +23,24 @@
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize">
<View
android:layout_width="@dimen/preference_widget_width"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16sp"
android:layout_marginRight="6sp"
android:layout_marginTop="6sp"
android:layout_marginBottom="6sp"
android:layout_weight="1">
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondary" />
<TextView android:id="@+android:id/summary"

View File

@@ -21,8 +21,7 @@
<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_width="match_parent">
<LinearLayout
android:orientation="horizontal"
@@ -35,9 +34,9 @@
android:orientation="vertical"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_marginLeft="32dp"
android:layout_marginRight="0dp"
android:layout_marginLeft="@dimen/preference_screen_side_margin"
android:layout_marginTop="32dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="32dp"
android:layout_weight="10">
@@ -46,7 +45,6 @@
android:layout_height="0px"
android:layout_weight="1"
android:drawSelectorOnTop="false"
android:background="#40404040"
android:cacheColorHint="@android:color/transparent"
android:listPreferredItemHeight="48dp"
android:scrollbarAlwaysDrawVerticalTrack="true" />
@@ -61,12 +59,16 @@
<FrameLayout android:id="@+id/prefs"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="25"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_weight="20"
android:layout_marginLeft="-4dp"
android:layout_marginRight="@dimen/preference_screen_side_margin"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:background="#60202040"
android:paddingLeft="32dip"
android:paddingRight="32dip"
android:paddingTop="48dip"
android:paddingBottom="48dip"
android:background="?attr/preferencePanelBackground"
android:visibility="gone" />
</LinearLayout>

View File

@@ -0,0 +1,95 @@
<?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.
*/
-->
<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="match_parent"
android:layout_height="match_parent">
<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>
<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>

View File

@@ -16,11 +16,54 @@
<!-- Layout used by CheckBoxPreference for the checkbox style. This is inflated
inside android.R.layout.preference. -->
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+android:id/checkbox"
android:layout_width="wrap_content"
<!-- Layout used by DialogPreference in a PreferenceActivity. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="4dip"
android:layout_gravity="center_vertical"
android:focusable="false"
android:clickable="false" />
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize">
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@+android:id/widget_frame"
android:layout_width="@dimen/preference_widget_width"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal" >
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+android:id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:focusable="false"
android:clickable="false" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="4" />
</RelativeLayout>
</LinearLayout>

View File

@@ -21,4 +21,6 @@
<resources>
<dimen name="password_keyboard_key_height">47dip</dimen>
<dimen name="password_keyboard_spacebar_vertical_correction">2dip</dimen>
<dimen name="preference_screen_side_margin">32dp</dimen>
<dimen name="preference_widget_width">64dp</dimen>
</resources>

View File

@@ -545,6 +545,8 @@
<attr name="ringtonePreferenceStyle" format="reference" />
<!-- The preference layout that has the child/tabbed effect. -->
<attr name="preferenceLayoutChild" format="reference" />
<!-- Preference panel background -->
<attr name="preferencePanelBackground" format="reference" />
<!-- ============================ -->
<!-- Text selection handle styles -->

View File

@@ -52,4 +52,8 @@
<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 widget area width (to the left of the text) -->
<dimen name="preference_widget_width">56dp</dimen>
</resources>

View File

@@ -820,7 +820,7 @@
</style>
<style name="Preference.CheckBoxPreference">
<item name="android:widgetLayout">@android:layout/preference_widget_checkbox</item>
<item name="android:layout">@android:layout/preference_widget_checkbox</item>
</style>
<style name="Preference.PreferenceScreen">
@@ -829,7 +829,7 @@
<style name="Preference.DialogPreference">
<item name="android:positiveButtonText">@android:string/ok</item>
<item name="android:negativeButtonText">@android:string/cancel</item>
<item name="android:widgetLayout">@android:layout/preference_dialog</item>
<item name="android:layout">@android:layout/preference_dialog</item>
</style>
<style name="Preference.DialogPreference.YesNoPreference">
@@ -845,7 +845,7 @@
<item name="android:ringtoneType">ringtone</item>
<item name="android:showSilent">true</item>
<item name="android:showDefault">true</item>
<item name="android:widgetLayout">@android:layout/preference_dialog</item>
<item name="android:layout">@android:layout/preference_dialog</item>
</style>
<!-- Other Misc Styles -->

View File

@@ -233,6 +233,7 @@
<item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item>
<item name="ringtonePreferenceStyle">@android:style/Preference.RingtonePreference</item>
<item name="preferenceLayoutChild">@android:layout/preference_child</item>
<item name="preferencePanelBackground">@android:drawable/panel_bg_holo_dark</item>
<!-- Search widget styles -->
<item name="searchWidgetCorpusItemBackground">@android:color/search_widget_corpus_item_background</item>
@@ -843,6 +844,7 @@
<item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item>
<item name="ringtonePreferenceStyle">@android:style/Preference.RingtonePreference</item>
<item name="preferenceLayoutChild">@android:layout/preference_child</item>
<item name="preferencePanelBackground">@android:drawable/panel_bg_holo_dark</item>
<!-- Search widget styles -->
<item name="searchWidgetCorpusItemBackground">@android:color/search_widget_corpus_item_background</item>
@@ -1077,6 +1079,7 @@
<item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item>
<item name="ringtonePreferenceStyle">@android:style/Preference.RingtonePreference</item>
<item name="preferenceLayoutChild">@android:layout/preference_child</item>
<item name="preferencePanelBackground">@android:drawable/panel_bg_holo_light</item>
<!-- Search widget styles -->
<item name="searchWidgetCorpusItemBackground">@android:color/search_widget_corpus_item_background</item>