Merge "Modify the TTS engine preference UI so that the radio button and the TTS engine name are a single focusable element." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1cb87b2af5
@@ -17,83 +17,34 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:layout_gravity="center_vertical">
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
<RadioButton
|
||||||
android:id="@+id/tts_engine_pref"
|
android:id="@+id/tts_engine_radiobutton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
android:background="?android:attr/selectableItemBackground">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/tts_engine_radiobutton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:clickable="true" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/tts_engine_pref_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="15dip"
|
|
||||||
android:layout_marginEnd="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_alignStart="@android:id/title"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:textSize="13sp"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:maxLines="4" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="2dip"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="5dip"
|
android:layout_weight="1"
|
||||||
android:layout_marginBottom="5dip"
|
|
||||||
android:background="@android:drawable/divider_horizontal_dark" />
|
android:background="@android:drawable/divider_horizontal_dark" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/tts_engine_settings"
|
android:id="@+id/tts_engine_settings"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingStart="15dip"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:paddingEnd="?android:attr/scrollbarSize"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:src="@drawable/ic_sysbar_quicksettings"
|
android:src="@drawable/ic_sysbar_quicksettings"
|
||||||
android:contentDescription="@string/tts_engine_settings_button"
|
android:contentDescription="@string/tts_engine_settings_button"
|
||||||
android:layout_gravity="center"
|
android:layout_centerVertical="true"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:background="?android:attr/selectableItemBackground" />
|
android:background="?android:attr/selectableItemBackground" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -118,6 +118,7 @@ public class TtsEnginePreference extends Preference {
|
|||||||
|
|
||||||
final RadioButton rb = (RadioButton) view.findViewById(R.id.tts_engine_radiobutton);
|
final RadioButton rb = (RadioButton) view.findViewById(R.id.tts_engine_radiobutton);
|
||||||
rb.setOnCheckedChangeListener(mRadioChangeListener);
|
rb.setOnCheckedChangeListener(mRadioChangeListener);
|
||||||
|
rb.setText(mEngineInfo.label);
|
||||||
|
|
||||||
boolean isChecked = getKey().equals(mSharedState.getCurrentKey());
|
boolean isChecked = getKey().equals(mSharedState.getCurrentKey());
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
@@ -130,14 +131,6 @@ public class TtsEnginePreference extends Preference {
|
|||||||
|
|
||||||
mRadioButton = rb;
|
mRadioButton = rb;
|
||||||
|
|
||||||
View textLayout = view.findViewById(R.id.tts_engine_pref_text);
|
|
||||||
textLayout.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
onRadioButtonClicked(rb, !rb.isChecked());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mSettingsIcon = view.findViewById(R.id.tts_engine_settings);
|
mSettingsIcon = view.findViewById(R.id.tts_engine_settings);
|
||||||
// Will be enabled only the engine has passed the voice check, and
|
// Will be enabled only the engine has passed the voice check, and
|
||||||
// is currently enabled.
|
// is currently enabled.
|
||||||
|
Reference in New Issue
Block a user