Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f665025d authored by Fan Zhang's avatar Fan Zhang Committed by Android (Google) Code Review
Browse files

Merge changes Ib59efe76,I316e3649

* changes:
  Move RadioButtonPreference to generic widget package
  Another attempt fix for account preference screen.
parents cb63d7b6 64c83afa
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -17,15 +17,15 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/location_mode_screen_title">

        <com.android.settings.location.RadioButtonPreference
        <com.android.settings.widget.RadioButtonPreference
            android:key="high_accuracy"
            android:title="@string/location_mode_high_accuracy_title"
            android:summary="@string/location_mode_high_accuracy_description" />
        <com.android.settings.location.RadioButtonPreference
        <com.android.settings.widget.RadioButtonPreference
            android:key="battery_saving"
            android:title="@string/location_mode_battery_saving_title"
            android:summary="@string/location_mode_battery_saving_description" />
        <com.android.settings.location.RadioButtonPreference
        <com.android.settings.widget.RadioButtonPreference
            android:key="sensors_only"
            android:title="@string/location_mode_sensors_only_title"
            android:summary="@string/location_mode_sensors_only_description" />
+2 −2
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ import java.util.List;
import static android.content.Intent.EXTRA_USER;
import static android.os.UserManager.DISALLOW_MODIFY_ACCOUNTS;
import static android.os.UserManager.DISALLOW_REMOVE_MANAGED_PROFILE;
import static android.os.UserManager.DISALLOW_REMOVE_USER;
import static android.provider.Settings.EXTRA_AUTHORITIES;

public class AccountPreferenceController extends PreferenceController
@@ -405,7 +404,8 @@ public class AccountPreferenceController extends PreferenceController
    }

    private void updateAccountTypes(ProfileData profileData) {
        if (mParent.getPreferenceManager() == null) {
        if (mParent.getPreferenceManager() == null
                || profileData.preferenceGroup.getPreferenceManager() == null) {
            // This could happen if activity is finishing
            return;
        }
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.support.v7.preference.PreferenceScreen;

import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.widget.RadioButtonPreference;

/**
 * A page with 3 radio buttons to choose the location mode.
+8 −5
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 The Android Open Source Project
 * Copyright (C) 2017 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.
@@ -14,9 +14,10 @@
 * limitations under the License.
 */

package com.android.settings.location;
package com.android.settings.widget;

import android.content.Context;
import android.support.v4.content.res.TypedArrayUtils;
import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
@@ -36,7 +37,7 @@ import com.android.settings.R;
 */
public class RadioButtonPreference extends CheckBoxPreference {
    public interface OnClickListener {
        public abstract void onRadioButtonClicked(RadioButtonPreference emiter);
       void onRadioButtonClicked(RadioButtonPreference emiter);
    }

    private OnClickListener mListener = null;
@@ -47,14 +48,16 @@ public class RadioButtonPreference extends CheckBoxPreference {
    }

    public RadioButtonPreference(Context context, AttributeSet attrs) {
        this(context, attrs, com.android.internal.R.attr.checkBoxPreferenceStyle);
        this(context, attrs, TypedArrayUtils.getAttr(context,
                android.support.v7.preference.R.attr.preferenceStyle,
                android.R.attr.preferenceStyle));
    }

    public RadioButtonPreference(Context context) {
        this(context, null);
    }

    void setOnClickListener(OnClickListener listener) {
    public void setOnClickListener(OnClickListener listener) {
        mListener = listener;
    }

+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.UserManager;
import android.support.v14.preference.PreferenceFragment;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.preference.PreferenceScreen;

import com.android.settings.AccessiblePreferenceCategory;
@@ -324,6 +325,7 @@ public class AccountPreferenceControllerTest {
        when(mAccountManager.getAuthenticatorTypesAsUser(anyInt())).thenReturn(authDescs);

        AccessiblePreferenceCategory preferenceGroup = mock(AccessiblePreferenceCategory.class);
        when(preferenceGroup.getPreferenceManager()).thenReturn(mock(PreferenceManager.class));
        when(mAccountHelper.createAccessiblePreferenceCategory(any(Context.class))).thenReturn(
            preferenceGroup);