Make all the Settings Switches appear again
- use the ActionBar Theme context when creating the Switch for getting the correct Theming Change-Id: Ic3701c53662b0f245c7149b119de8bb5cbaae232
This commit is contained in:
@@ -368,7 +368,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
final Activity activity = getActivity();
|
||||
mEnabledSwitch = new Switch(activity);
|
||||
mEnabledSwitch = new Switch(activity.getActionBar().getThemedContext());
|
||||
|
||||
final int padding = activity.getResources().getDimensionPixelSize(
|
||||
R.dimen.action_bar_switch_padding);
|
||||
|
@@ -86,7 +86,7 @@ public class DreamSettings extends SettingsPreferenceFragment {
|
||||
final Activity activity = getActivity();
|
||||
|
||||
mBackend = new DreamBackend(activity);
|
||||
mSwitch = new Switch(activity);
|
||||
mSwitch = new Switch(activity.getActionBar().getThemedContext());
|
||||
mSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
|
@@ -67,7 +67,7 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
mActivity = getActivity();
|
||||
mSwitch = new Switch(mActivity);
|
||||
mSwitch = new Switch(mActivity.getActionBar().getThemedContext());
|
||||
final int p = getResources().getDimensionPixelSize(R.dimen.content_margin_left);
|
||||
mSwitch.setPadding(0, 0, p, 0);
|
||||
setHasOptionsMenu(true);
|
||||
|
@@ -117,7 +117,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
|
||||
final Activity activity = getActivity();
|
||||
final int padding = activity.getResources().getDimensionPixelSize(
|
||||
R.dimen.action_bar_switch_padding);
|
||||
mSwitch = new Switch(activity);
|
||||
mSwitch = new Switch(activity.getActionBar().getThemedContext());
|
||||
mSwitch.setPaddingRelative(0, 0, padding, 0);
|
||||
|
||||
mBluetoothEnabler = new BluetoothEnabler(activity, mSwitch);
|
||||
|
@@ -73,7 +73,7 @@ public class LocationSettings extends LocationSettingsBase
|
||||
|
||||
final Activity activity = getActivity();
|
||||
|
||||
mSwitch = new Switch(activity);
|
||||
mSwitch = new Switch(activity.getActionBar().getThemedContext());
|
||||
final int padding = activity.getResources().getDimensionPixelSize(
|
||||
R.dimen.action_bar_switch_padding);
|
||||
mSwitch.setPaddingRelative(0, 0, padding, 0);
|
||||
|
@@ -42,7 +42,7 @@ public class AndroidBeam extends Fragment
|
||||
super.onCreate(savedInstanceState);
|
||||
Activity activity = getActivity();
|
||||
|
||||
mActionBarSwitch = new Switch(activity);
|
||||
mActionBarSwitch = new Switch(activity.getActionBar().getThemedContext());
|
||||
|
||||
if (activity instanceof SettingsActivity) {
|
||||
final int padding = activity.getResources().getDimensionPixelSize(
|
||||
|
@@ -294,7 +294,7 @@ public class PrintServiceSettingsFragment extends SettingsPreferenceFragment
|
||||
mPrintersAdapter = new PrintersAdapter();
|
||||
mPrintersAdapter.registerDataSetObserver(mDataObserver);
|
||||
|
||||
mToggleSwitch = createActionBarToggleSwitch(getActivity());
|
||||
mToggleSwitch = createActionBarToggleSwitch(getActivity().getActionBar().getThemedContext());
|
||||
mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
|
||||
@Override
|
||||
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
|
||||
@@ -445,9 +445,9 @@ public class PrintServiceSettingsFragment extends SettingsPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
private ToggleSwitch createActionBarToggleSwitch(Activity activity) {
|
||||
ToggleSwitch toggleSwitch = new ToggleSwitch(activity);
|
||||
final int padding = activity.getResources().getDimensionPixelSize(
|
||||
private ToggleSwitch createActionBarToggleSwitch(Context context) {
|
||||
ToggleSwitch toggleSwitch = new ToggleSwitch(context);
|
||||
final int padding = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.action_bar_switch_padding);
|
||||
toggleSwitch.setPaddingRelative(0, 0, padding, 0);
|
||||
return toggleSwitch;
|
||||
|
@@ -50,7 +50,6 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -72,8 +71,6 @@ import java.util.List;
|
||||
public class PrintSettingsFragment extends SettingsPreferenceFragment
|
||||
implements DialogCreatable, Indexable {
|
||||
|
||||
static final char ENABLED_PRINT_SERVICES_SEPARATOR = ':';
|
||||
|
||||
private static final int LOADER_ID_PRINT_JOBS_LOADER = 1;
|
||||
|
||||
private static final String PRINT_JOBS_CATEGORY = "print_jobs_category";
|
||||
|
Reference in New Issue
Block a user