Refactor the layout for MasterSwitch to a 2 target pref

And move the layout to settingslib.

The new TwoTargetPreference is a preference object that has a vertical
divider between main panel and widget (if it exists).

Converted master switch, restricted preference, gear preference to use
the new style

Change-Id: Ia3848cebb06b8edc4e60abf9b0caf13cdb29c22c
Fix: 36511169
Test: make RunSettingsRoboTests
This commit is contained in:
Fan Zhang
2017-03-22 11:43:22 -07:00
parent 679ed4c30c
commit fe292515d8
10 changed files with 83 additions and 198 deletions

View File

@@ -21,7 +21,6 @@ import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.view.View;
@@ -46,7 +45,7 @@ class SpellCheckerPreference extends CustomListPreference {
public SpellCheckerPreference(final Context context, final SpellCheckerInfo[] scis) {
super(context, null);
mScis = scis;
setWidgetLayoutResource(R.layout.preference_widget_settings);
setWidgetLayoutResource(R.layout.preference_widget_gear);
CharSequence[] labels = new CharSequence[scis.length];
CharSequence[] values = new CharSequence[scis.length];
for (int i = 0 ; i < scis.length; i++) {