Merge "Align seek bar type preferences to reserve icon space"
This commit is contained in:
committed by
Android (Google) Code Review
commit
44f2ad1c9a
@@ -1,55 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 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.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="8dip"
|
||||
android:layout_marginBottom="8dip">
|
||||
|
||||
<TextView android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dip">
|
||||
|
||||
<SeekBar android:id="@*android:id/seekbar"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
@@ -18,22 +18,19 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingStart="@dimen/preference_no_icon_padding_start"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:layout_gravity="center_vertical">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/tts_engine_radiobutton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:drawable/divider_horizontal_dark" />
|
||||
android:maxLines="2"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:ellipsize="marquee"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tts_engine_settings"
|
||||
|
95
res/layout/preference_widget_seekbar_settings.xml
Normal file
95
res/layout/preference_widget_seekbar_settings.xml
Normal file
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<!-- Layout used by SeekBarPreference for the seekbar widget style. -->
|
||||
<!-- Same as frameworks/base/core/res/res/layout/preference_widget_seekbar_material.xml with
|
||||
reserved icon space -->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/icon_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="60dp"
|
||||
android:gravity="start|center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp">
|
||||
<com.android.internal.widget.PreferenceImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="48dp"
|
||||
android:maxHeight="48dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dip"
|
||||
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:style/TextAppearance.Material.Subhead"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
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_alignStart="@android:id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:maxLines="4"/>
|
||||
|
||||
<!-- Preference should place its actual preference widget here. -->
|
||||
<LinearLayout
|
||||
android:id="@android:id/widget_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@android:id/summary"
|
||||
android:layout_alignStart="@android:id/title"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
<SeekBar
|
||||
android:id="@*android:id/seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/summary"
|
||||
android:layout_toEndOf="@android:id/widget_frame"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -49,6 +49,10 @@
|
||||
<item name="android:layout">@layout/preference_category_material_settings</item>
|
||||
</style>
|
||||
|
||||
<style name="SettingsSeekBarPreference">
|
||||
<item name="android:layout">@layout/preference_widget_seekbar_settings</item>
|
||||
</style>
|
||||
|
||||
<style name="SettingsSwitchPreference" parent="SettingsPreference">
|
||||
<item name="widgetLayout">@*android:layout/preference_widget_switch</item>
|
||||
<item name="switchTextOn">@*android:string/capital_on</item>
|
||||
|
@@ -90,6 +90,7 @@
|
||||
<item name="preferenceCategoryStyle">@style/SettingsPreferenceCategory</item>
|
||||
<item name="preferenceFragmentStyle">@style/PreferenceFragmentStyle</item>
|
||||
<item name="preferenceStyle">@style/SettingsPreference</item>
|
||||
<item name="seekBarPreferenceStyle">@style/SettingsSeekBarPreference</item>
|
||||
<item name="switchPreferenceStyle">@style/SettingsSwitchPreference</item>
|
||||
</style>
|
||||
|
||||
|
@@ -20,7 +20,6 @@
|
||||
|
||||
<com.android.settings.SeekBarPreference
|
||||
android:key="autoclick_delay"
|
||||
android:title="@string/accessibility_autoclick_delay_preference_title"
|
||||
android:layout="@layout/preference_iconless_slider" />
|
||||
android:title="@string/accessibility_autoclick_delay_preference_title"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@@ -31,16 +31,14 @@
|
||||
android:title="@string/tts_default_rate_title"
|
||||
android:summary="@string/tts_default_rate_summary"
|
||||
android:defaultValue="50"
|
||||
android:max="600"
|
||||
android:layout="@layout/preference_iconless_slider" />
|
||||
android:max="600"/>
|
||||
|
||||
<com.android.settings.SeekBarPreference
|
||||
android:key="tts_default_pitch"
|
||||
android:title="@string/tts_default_pitch_title"
|
||||
android:summary="@string/tts_default_pitch_summary"
|
||||
android:defaultValue="100"
|
||||
android:max="400"
|
||||
android:layout="@layout/preference_iconless_slider" />
|
||||
android:max="400"/>
|
||||
|
||||
<Preference android:key="reset_speech_rate"
|
||||
android:persistent="false"
|
||||
|
@@ -20,6 +20,7 @@ import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.content.res.TypedArrayUtils;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
@@ -64,7 +65,9 @@ public class SeekBarPreference extends RestrictedPreference
|
||||
}
|
||||
|
||||
public SeekBarPreference(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, com.android.internal.R.attr.seekBarPreferenceStyle);
|
||||
this(context, attrs, TypedArrayUtils.getAttr(context,
|
||||
android.support.v7.preference.R.attr.seekBarPreferenceStyle,
|
||||
com.android.internal.R.attr.seekBarPreferenceStyle));
|
||||
}
|
||||
|
||||
public SeekBarPreference(Context context) {
|
||||
|
Reference in New Issue
Block a user