1142 lines
40 KiB
Java
1142 lines
40 KiB
Java
|
package androidx.preference;
|
||
|
|
||
|
import android.content.ClipData;
|
||
|
import android.content.ClipboardManager;
|
||
|
import android.content.Context;
|
||
|
import android.content.Intent;
|
||
|
import android.content.SharedPreferences;
|
||
|
import android.content.res.TypedArray;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.os.Bundle;
|
||
|
import android.os.Parcel;
|
||
|
import android.os.Parcelable;
|
||
|
import android.text.TextUtils;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.view.AbsSavedState;
|
||
|
import android.view.ContextMenu;
|
||
|
import android.view.MenuItem;
|
||
|
import android.view.View;
|
||
|
import android.view.ViewGroup;
|
||
|
import android.widget.ImageView;
|
||
|
import android.widget.TextView;
|
||
|
import android.widget.Toast;
|
||
|
import androidx.annotation.CallSuper;
|
||
|
import androidx.annotation.NonNull;
|
||
|
import androidx.annotation.Nullable;
|
||
|
import androidx.annotation.RestrictTo;
|
||
|
import androidx.appcompat.content.res.AppCompatResources;
|
||
|
import androidx.core.content.res.TypedArrayUtils;
|
||
|
import androidx.core.view.ViewCompat;
|
||
|
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||
|
import androidx.preference.PreferenceManager;
|
||
|
import c.d.b.a.a;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
import java.util.Set;
|
||
|
public class Preference implements Comparable<Preference> {
|
||
|
private static final String CLIPBOARD_ID = "Preference";
|
||
|
public static final int DEFAULT_ORDER = Integer.MAX_VALUE;
|
||
|
private boolean mAllowDividerAbove;
|
||
|
private boolean mAllowDividerBelow;
|
||
|
private boolean mBaseMethodCalled;
|
||
|
private final View.OnClickListener mClickListener;
|
||
|
private Context mContext;
|
||
|
private boolean mCopyingEnabled;
|
||
|
private Object mDefaultValue;
|
||
|
private String mDependencyKey;
|
||
|
private boolean mDependencyMet;
|
||
|
private List<Preference> mDependents;
|
||
|
private boolean mEnabled;
|
||
|
private Bundle mExtras;
|
||
|
private String mFragment;
|
||
|
private boolean mHasId;
|
||
|
private boolean mHasSingleLineTitleAttr;
|
||
|
private Drawable mIcon;
|
||
|
private int mIconResId;
|
||
|
private boolean mIconSpaceReserved;
|
||
|
private long mId;
|
||
|
private Intent mIntent;
|
||
|
private String mKey;
|
||
|
private int mLayoutResId;
|
||
|
private OnPreferenceChangeInternalListener mListener;
|
||
|
private OnPreferenceChangeListener mOnChangeListener;
|
||
|
private OnPreferenceClickListener mOnClickListener;
|
||
|
private OnPreferenceCopyListener mOnCopyListener;
|
||
|
private int mOrder;
|
||
|
private boolean mParentDependencyMet;
|
||
|
private PreferenceGroup mParentGroup;
|
||
|
private boolean mPersistent;
|
||
|
@Nullable
|
||
|
private PreferenceDataStore mPreferenceDataStore;
|
||
|
@Nullable
|
||
|
private PreferenceManager mPreferenceManager;
|
||
|
private boolean mRequiresKey;
|
||
|
private boolean mSelectable;
|
||
|
private boolean mShouldDisableView;
|
||
|
private boolean mSingleLineTitle;
|
||
|
private CharSequence mSummary;
|
||
|
private SummaryProvider mSummaryProvider;
|
||
|
private CharSequence mTitle;
|
||
|
private int mViewId;
|
||
|
private boolean mVisible;
|
||
|
private boolean mWasDetached;
|
||
|
private int mWidgetLayoutResId;
|
||
|
|
||
|
/* renamed from: androidx.preference.Preference$1 reason: invalid class name */
|
||
|
public class AnonymousClass1 implements View.OnClickListener {
|
||
|
public AnonymousClass1() {
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View.OnClickListener
|
||
|
public void onClick(View view) {
|
||
|
Preference.this.performClick(view);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static class BaseSavedState extends AbsSavedState {
|
||
|
public static final Parcelable.Creator<BaseSavedState> CREATOR = new AnonymousClass1();
|
||
|
|
||
|
/* renamed from: androidx.preference.Preference$BaseSavedState$1 reason: invalid class name */
|
||
|
public static class AnonymousClass1 implements Parcelable.Creator<BaseSavedState> {
|
||
|
@Override // android.os.Parcelable.Creator
|
||
|
public BaseSavedState createFromParcel(Parcel parcel) {
|
||
|
return new BaseSavedState(parcel);
|
||
|
}
|
||
|
|
||
|
@Override // android.os.Parcelable.Creator
|
||
|
public BaseSavedState[] newArray(int i) {
|
||
|
return new BaseSavedState[i];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public BaseSavedState(Parcel parcel) {
|
||
|
super(parcel);
|
||
|
}
|
||
|
|
||
|
public BaseSavedState(Parcelable parcelable) {
|
||
|
super(parcelable);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public interface OnPreferenceChangeInternalListener {
|
||
|
void onPreferenceChange(Preference preference);
|
||
|
|
||
|
void onPreferenceHierarchyChange(Preference preference);
|
||
|
|
||
|
void onPreferenceVisibilityChange(Preference preference);
|
||
|
}
|
||
|
|
||
|
public interface OnPreferenceChangeListener {
|
||
|
boolean onPreferenceChange(Preference preference, Object obj);
|
||
|
}
|
||
|
|
||
|
public interface OnPreferenceClickListener {
|
||
|
boolean onPreferenceClick(Preference preference);
|
||
|
}
|
||
|
|
||
|
public static class OnPreferenceCopyListener implements View.OnCreateContextMenuListener, MenuItem.OnMenuItemClickListener {
|
||
|
private final Preference mPreference;
|
||
|
|
||
|
public OnPreferenceCopyListener(Preference preference) {
|
||
|
this.mPreference = preference;
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View.OnCreateContextMenuListener
|
||
|
public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
|
||
|
CharSequence summary = this.mPreference.getSummary();
|
||
|
if (this.mPreference.isCopyingEnabled() && !TextUtils.isEmpty(summary)) {
|
||
|
contextMenu.setHeaderTitle(summary);
|
||
|
contextMenu.add(0, 0, 0, R.string.copy).setOnMenuItemClickListener(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.MenuItem.OnMenuItemClickListener
|
||
|
public boolean onMenuItemClick(MenuItem menuItem) {
|
||
|
CharSequence summary = this.mPreference.getSummary();
|
||
|
((ClipboardManager) this.mPreference.getContext().getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("Preference", summary));
|
||
|
Toast.makeText(this.mPreference.getContext(), this.mPreference.getContext().getString(R.string.preference_copied, summary), 0).show();
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public interface SummaryProvider<T extends Preference> {
|
||
|
CharSequence provideSummary(T t);
|
||
|
}
|
||
|
|
||
|
public Preference(Context context) {
|
||
|
this(context, null);
|
||
|
}
|
||
|
|
||
|
public Preference(Context context, AttributeSet attributeSet) {
|
||
|
this(context, attributeSet, TypedArrayUtils.getAttr(context, R.attr.preferenceStyle, 16842894));
|
||
|
}
|
||
|
|
||
|
public Preference(Context context, AttributeSet attributeSet, int i) {
|
||
|
this(context, attributeSet, i, 0);
|
||
|
}
|
||
|
|
||
|
public Preference(Context context, AttributeSet attributeSet, int i, int i2) {
|
||
|
this.mOrder = Integer.MAX_VALUE;
|
||
|
this.mViewId = 0;
|
||
|
this.mEnabled = true;
|
||
|
this.mSelectable = true;
|
||
|
this.mPersistent = true;
|
||
|
this.mDependencyMet = true;
|
||
|
this.mParentDependencyMet = true;
|
||
|
this.mVisible = true;
|
||
|
this.mAllowDividerAbove = true;
|
||
|
this.mAllowDividerBelow = true;
|
||
|
this.mSingleLineTitle = true;
|
||
|
this.mShouldDisableView = true;
|
||
|
int i3 = R.layout.preference;
|
||
|
this.mLayoutResId = i3;
|
||
|
this.mClickListener = new AnonymousClass1();
|
||
|
this.mContext = context;
|
||
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.Preference, i, i2);
|
||
|
this.mIconResId = TypedArrayUtils.getResourceId(obtainStyledAttributes, R.styleable.Preference_icon, R.styleable.Preference_android_icon, 0);
|
||
|
this.mKey = TypedArrayUtils.getString(obtainStyledAttributes, R.styleable.Preference_key, R.styleable.Preference_android_key);
|
||
|
this.mTitle = TypedArrayUtils.getText(obtainStyledAttributes, R.styleable.Preference_title, R.styleable.Preference_android_title);
|
||
|
this.mSummary = TypedArrayUtils.getText(obtainStyledAttributes, R.styleable.Preference_summary, R.styleable.Preference_android_summary);
|
||
|
this.mOrder = TypedArrayUtils.getInt(obtainStyledAttributes, R.styleable.Preference_order, R.styleable.Preference_android_order, Integer.MAX_VALUE);
|
||
|
this.mFragment = TypedArrayUtils.getString(obtainStyledAttributes, R.styleable.Preference_fragment, R.styleable.Preference_android_fragment);
|
||
|
this.mLayoutResId = TypedArrayUtils.getResourceId(obtainStyledAttributes, R.styleable.Preference_layout, R.styleable.Preference_android_layout, i3);
|
||
|
this.mWidgetLayoutResId = TypedArrayUtils.getResourceId(obtainStyledAttributes, R.styleable.Preference_widgetLayout, R.styleable.Preference_android_widgetLayout, 0);
|
||
|
this.mEnabled = TypedArrayUtils.getBoolean(obtainStyledAttributes, R.styleable.Preference_enabled, R.styleable.Preference_android_enabled, true);
|
||
|
this.mSelectable = TypedArrayUtils.getBoolean(obtainStyledAttributes, R.styleable.Preference_selectable, R.styleable.Preference_android_selectable, true);
|
||
|
this.mPersistent = TypedArrayUtils.getBoolean(obtainStyledAttributes, R.styleable.Preference_persistent, R.styleable.Preference_android_persistent, true);
|
||
|
this.mDependencyKey = TypedArrayUtils.getString(obtainStyledAttributes, R.styleable.Preference_dependency, R.styleable.Preference_android_dependency);
|
||
|
int i4 = R.styleable.Preference_allowDividerAbove;
|
||
|
this.mAllowDividerAbove = TypedArrayUtils.getBoolean(obtainStyledAttributes, i4, i4, this.mSelectable);
|
||
|
int i5 = R.styleable.Preference_allowDividerBelow;
|
||
|
this.mAllowDividerBelow = TypedArrayUtils.getBoolean(obtainStyledAttributes, i5, i5, this.mSelectable);
|
||
|
int i6 = R.styleable.Preference_defaultValue;
|
||
|
if (obtainStyledAttributes.hasValue(i6)) {
|
||
|
this.mDefaultValue = onGetDefaultValue(obtainStyledAttributes, i6);
|
||
|
} else {
|
||
|
int i7 = R.styleable.Preference_android_defaultValue;
|
||
|
if (obtainStyledAttributes.hasValue(i7)) {
|
||
|
this.mDefaultValue = onGetDefaultValue(obtainStyledAttributes, i7);
|
||
|
}
|
||
|
}
|
||
|
this.mShouldDisableView = TypedArrayUtils.getBoolean(obtainStyledAttributes, R.styleable.Preference_shouldDisableView, R.styleable.Preference_android_shouldDisableView, true);
|
||
|
int i8 = R.styleable.Preference_singleLineTitle;
|
||
|
boolean hasValue = obtainStyledAttributes.hasValue(i8);
|
||
|
this.mHasSingleLineTitleAttr = hasValue;
|
||
|
if (hasValue) {
|
||
|
this.mSingleLineTitle = TypedArrayUtils.getBoolean(obtainStyledAttributes, i8, R.styleable.Preference_android_singleLineTitle, true);
|
||
|
}
|
||
|
this.mIconSpaceReserved = TypedArrayUtils.getBoolean(obtainStyledAttributes, R.styleable.Preference_iconSpaceReserved, R.styleable.Preference_android_iconSpaceReserved, false);
|
||
|
int i9 = R.styleable.Preference_isPreferenceVisible;
|
||
|
this.mVisible = TypedArrayUtils.getBoolean(obtainStyledAttributes, i9, i9, true);
|
||
|
int i10 = R.styleable.Preference_enableCopying;
|
||
|
this.mCopyingEnabled = TypedArrayUtils.getBoolean(obtainStyledAttributes, i10, i10, false);
|
||
|
obtainStyledAttributes.recycle();
|
||
|
}
|
||
|
|
||
|
private void dispatchSetInitialValue() {
|
||
|
if (getPreferenceDataStore() != null) {
|
||
|
onSetInitialValue(true, this.mDefaultValue);
|
||
|
} else if (!shouldPersist() || !getSharedPreferences().contains(this.mKey)) {
|
||
|
Object obj = this.mDefaultValue;
|
||
|
if (obj != null) {
|
||
|
onSetInitialValue(false, obj);
|
||
|
}
|
||
|
} else {
|
||
|
onSetInitialValue(true, null);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void registerDependency() {
|
||
|
if (!TextUtils.isEmpty(this.mDependencyKey)) {
|
||
|
Preference findPreferenceInHierarchy = findPreferenceInHierarchy(this.mDependencyKey);
|
||
|
if (findPreferenceInHierarchy != null) {
|
||
|
findPreferenceInHierarchy.registerDependent(this);
|
||
|
return;
|
||
|
}
|
||
|
StringBuilder K = a.K("Dependency \"");
|
||
|
K.append(this.mDependencyKey);
|
||
|
K.append("\" not found for preference \"");
|
||
|
K.append(this.mKey);
|
||
|
K.append("\" (title: \"");
|
||
|
K.append((Object) this.mTitle);
|
||
|
K.append("\"");
|
||
|
throw new IllegalStateException(K.toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void registerDependent(Preference preference) {
|
||
|
if (this.mDependents == null) {
|
||
|
this.mDependents = new ArrayList();
|
||
|
}
|
||
|
this.mDependents.add(preference);
|
||
|
preference.onDependencyChanged(this, shouldDisableDependents());
|
||
|
}
|
||
|
|
||
|
private void setEnabledStateOnViews(View view, boolean z2) {
|
||
|
view.setEnabled(z2);
|
||
|
if (view instanceof ViewGroup) {
|
||
|
ViewGroup viewGroup = (ViewGroup) view;
|
||
|
for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
|
||
|
setEnabledStateOnViews(viewGroup.getChildAt(childCount), z2);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void tryCommit(@NonNull SharedPreferences.Editor editor) {
|
||
|
if (this.mPreferenceManager.shouldCommit()) {
|
||
|
editor.apply();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void unregisterDependency() {
|
||
|
Preference findPreferenceInHierarchy;
|
||
|
String str = this.mDependencyKey;
|
||
|
if (str != null && (findPreferenceInHierarchy = findPreferenceInHierarchy(str)) != null) {
|
||
|
findPreferenceInHierarchy.unregisterDependent(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void unregisterDependent(Preference preference) {
|
||
|
List<Preference> list = this.mDependents;
|
||
|
if (list != null) {
|
||
|
list.remove(preference);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void assignParent(@Nullable PreferenceGroup preferenceGroup) {
|
||
|
if (preferenceGroup == null || this.mParentGroup == null) {
|
||
|
this.mParentGroup = preferenceGroup;
|
||
|
return;
|
||
|
}
|
||
|
throw new IllegalStateException("This preference already has a parent. You must remove the existing parent before assigning a new one.");
|
||
|
}
|
||
|
|
||
|
public boolean callChangeListener(Object obj) {
|
||
|
OnPreferenceChangeListener onPreferenceChangeListener = this.mOnChangeListener;
|
||
|
return onPreferenceChangeListener == null || onPreferenceChangeListener.onPreferenceChange(this, obj);
|
||
|
}
|
||
|
|
||
|
public final void clearWasDetached() {
|
||
|
this.mWasDetached = false;
|
||
|
}
|
||
|
|
||
|
public int compareTo(@NonNull Preference preference) {
|
||
|
int i = this.mOrder;
|
||
|
int i2 = preference.mOrder;
|
||
|
if (i != i2) {
|
||
|
return i - i2;
|
||
|
}
|
||
|
CharSequence charSequence = this.mTitle;
|
||
|
CharSequence charSequence2 = preference.mTitle;
|
||
|
if (charSequence == charSequence2) {
|
||
|
return 0;
|
||
|
}
|
||
|
if (charSequence == null) {
|
||
|
return 1;
|
||
|
}
|
||
|
if (charSequence2 == null) {
|
||
|
return -1;
|
||
|
}
|
||
|
return charSequence.toString().compareToIgnoreCase(preference.mTitle.toString());
|
||
|
}
|
||
|
|
||
|
public void dispatchRestoreInstanceState(Bundle bundle) {
|
||
|
Parcelable parcelable;
|
||
|
if (hasKey() && (parcelable = bundle.getParcelable(this.mKey)) != null) {
|
||
|
this.mBaseMethodCalled = false;
|
||
|
onRestoreInstanceState(parcelable);
|
||
|
if (!this.mBaseMethodCalled) {
|
||
|
throw new IllegalStateException("Derived class did not call super.onRestoreInstanceState()");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void dispatchSaveInstanceState(Bundle bundle) {
|
||
|
if (hasKey()) {
|
||
|
this.mBaseMethodCalled = false;
|
||
|
Parcelable onSaveInstanceState = onSaveInstanceState();
|
||
|
if (!this.mBaseMethodCalled) {
|
||
|
throw new IllegalStateException("Derived class did not call super.onSaveInstanceState()");
|
||
|
} else if (onSaveInstanceState != null) {
|
||
|
bundle.putParcelable(this.mKey, onSaveInstanceState);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Nullable
|
||
|
public <T extends Preference> T findPreferenceInHierarchy(@NonNull String str) {
|
||
|
PreferenceManager preferenceManager = this.mPreferenceManager;
|
||
|
if (preferenceManager == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return (T) preferenceManager.findPreference(str);
|
||
|
}
|
||
|
|
||
|
public Context getContext() {
|
||
|
return this.mContext;
|
||
|
}
|
||
|
|
||
|
public String getDependency() {
|
||
|
return this.mDependencyKey;
|
||
|
}
|
||
|
|
||
|
public Bundle getExtras() {
|
||
|
if (this.mExtras == null) {
|
||
|
this.mExtras = new Bundle();
|
||
|
}
|
||
|
return this.mExtras;
|
||
|
}
|
||
|
|
||
|
public StringBuilder getFilterableStringBuilder() {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
CharSequence title = getTitle();
|
||
|
if (!TextUtils.isEmpty(title)) {
|
||
|
sb.append(title);
|
||
|
sb.append(' ');
|
||
|
}
|
||
|
CharSequence summary = getSummary();
|
||
|
if (!TextUtils.isEmpty(summary)) {
|
||
|
sb.append(summary);
|
||
|
sb.append(' ');
|
||
|
}
|
||
|
if (sb.length() > 0) {
|
||
|
sb.setLength(sb.length() - 1);
|
||
|
}
|
||
|
return sb;
|
||
|
}
|
||
|
|
||
|
public String getFragment() {
|
||
|
return this.mFragment;
|
||
|
}
|
||
|
|
||
|
public Drawable getIcon() {
|
||
|
int i;
|
||
|
if (this.mIcon == null && (i = this.mIconResId) != 0) {
|
||
|
this.mIcon = AppCompatResources.getDrawable(this.mContext, i);
|
||
|
}
|
||
|
return this.mIcon;
|
||
|
}
|
||
|
|
||
|
public long getId() {
|
||
|
return this.mId;
|
||
|
}
|
||
|
|
||
|
public Intent getIntent() {
|
||
|
return this.mIntent;
|
||
|
}
|
||
|
|
||
|
public String getKey() {
|
||
|
return this.mKey;
|
||
|
}
|
||
|
|
||
|
public final int getLayoutResource() {
|
||
|
return this.mLayoutResId;
|
||
|
}
|
||
|
|
||
|
public OnPreferenceChangeListener getOnPreferenceChangeListener() {
|
||
|
return this.mOnChangeListener;
|
||
|
}
|
||
|
|
||
|
public OnPreferenceClickListener getOnPreferenceClickListener() {
|
||
|
return this.mOnClickListener;
|
||
|
}
|
||
|
|
||
|
public int getOrder() {
|
||
|
return this.mOrder;
|
||
|
}
|
||
|
|
||
|
@Nullable
|
||
|
public PreferenceGroup getParent() {
|
||
|
return this.mParentGroup;
|
||
|
}
|
||
|
|
||
|
public boolean getPersistedBoolean(boolean z2) {
|
||
|
if (!shouldPersist()) {
|
||
|
return z2;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
return preferenceDataStore != null ? preferenceDataStore.getBoolean(this.mKey, z2) : this.mPreferenceManager.getSharedPreferences().getBoolean(this.mKey, z2);
|
||
|
}
|
||
|
|
||
|
public float getPersistedFloat(float f) {
|
||
|
if (!shouldPersist()) {
|
||
|
return f;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
return preferenceDataStore != null ? preferenceDataStore.getFloat(this.mKey, f) : this.mPreferenceManager.getSharedPreferences().getFloat(this.mKey, f);
|
||
|
}
|
||
|
|
||
|
public int getPersistedInt(int i) {
|
||
|
if (!shouldPersist()) {
|
||
|
return i;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
return preferenceDataStore != null ? preferenceDataStore.getInt(this.mKey, i) : this.mPreferenceManager.getSharedPreferences().getInt(this.mKey, i);
|
||
|
}
|
||
|
|
||
|
public long getPersistedLong(long j) {
|
||
|
if (!shouldPersist()) {
|
||
|
return j;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
return preferenceDataStore != null ? preferenceDataStore.getLong(this.mKey, j) : this.mPreferenceManager.getSharedPreferences().getLong(this.mKey, j);
|
||
|
}
|
||
|
|
||
|
public String getPersistedString(String str) {
|
||
|
if (!shouldPersist()) {
|
||
|
return str;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
return preferenceDataStore != null ? preferenceDataStore.getString(this.mKey, str) : this.mPreferenceManager.getSharedPreferences().getString(this.mKey, str);
|
||
|
}
|
||
|
|
||
|
public Set<String> getPersistedStringSet(Set<String> set) {
|
||
|
if (!shouldPersist()) {
|
||
|
return set;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
return preferenceDataStore != null ? preferenceDataStore.getStringSet(this.mKey, set) : this.mPreferenceManager.getSharedPreferences().getStringSet(this.mKey, set);
|
||
|
}
|
||
|
|
||
|
@Nullable
|
||
|
public PreferenceDataStore getPreferenceDataStore() {
|
||
|
PreferenceDataStore preferenceDataStore = this.mPreferenceDataStore;
|
||
|
if (preferenceDataStore != null) {
|
||
|
return preferenceDataStore;
|
||
|
}
|
||
|
PreferenceManager preferenceManager = this.mPreferenceManager;
|
||
|
if (preferenceManager != null) {
|
||
|
return preferenceManager.getPreferenceDataStore();
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public PreferenceManager getPreferenceManager() {
|
||
|
return this.mPreferenceManager;
|
||
|
}
|
||
|
|
||
|
public SharedPreferences getSharedPreferences() {
|
||
|
if (this.mPreferenceManager == null || getPreferenceDataStore() != null) {
|
||
|
return null;
|
||
|
}
|
||
|
return this.mPreferenceManager.getSharedPreferences();
|
||
|
}
|
||
|
|
||
|
public boolean getShouldDisableView() {
|
||
|
return this.mShouldDisableView;
|
||
|
}
|
||
|
|
||
|
public CharSequence getSummary() {
|
||
|
return getSummaryProvider() != null ? getSummaryProvider().provideSummary(this) : this.mSummary;
|
||
|
}
|
||
|
|
||
|
@Nullable
|
||
|
public final SummaryProvider getSummaryProvider() {
|
||
|
return this.mSummaryProvider;
|
||
|
}
|
||
|
|
||
|
public CharSequence getTitle() {
|
||
|
return this.mTitle;
|
||
|
}
|
||
|
|
||
|
public final int getWidgetLayoutResource() {
|
||
|
return this.mWidgetLayoutResId;
|
||
|
}
|
||
|
|
||
|
public boolean hasKey() {
|
||
|
return !TextUtils.isEmpty(this.mKey);
|
||
|
}
|
||
|
|
||
|
public boolean isCopyingEnabled() {
|
||
|
return this.mCopyingEnabled;
|
||
|
}
|
||
|
|
||
|
public boolean isEnabled() {
|
||
|
return this.mEnabled && this.mDependencyMet && this.mParentDependencyMet;
|
||
|
}
|
||
|
|
||
|
public boolean isIconSpaceReserved() {
|
||
|
return this.mIconSpaceReserved;
|
||
|
}
|
||
|
|
||
|
public boolean isPersistent() {
|
||
|
return this.mPersistent;
|
||
|
}
|
||
|
|
||
|
public boolean isSelectable() {
|
||
|
return this.mSelectable;
|
||
|
}
|
||
|
|
||
|
public final boolean isShown() {
|
||
|
if (!isVisible() || getPreferenceManager() == null) {
|
||
|
return false;
|
||
|
}
|
||
|
if (this == getPreferenceManager().getPreferenceScreen()) {
|
||
|
return true;
|
||
|
}
|
||
|
PreferenceGroup parent = getParent();
|
||
|
if (parent == null) {
|
||
|
return false;
|
||
|
}
|
||
|
return parent.isShown();
|
||
|
}
|
||
|
|
||
|
public boolean isSingleLineTitle() {
|
||
|
return this.mSingleLineTitle;
|
||
|
}
|
||
|
|
||
|
public final boolean isVisible() {
|
||
|
return this.mVisible;
|
||
|
}
|
||
|
|
||
|
public void notifyChanged() {
|
||
|
OnPreferenceChangeInternalListener onPreferenceChangeInternalListener = this.mListener;
|
||
|
if (onPreferenceChangeInternalListener != null) {
|
||
|
onPreferenceChangeInternalListener.onPreferenceChange(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void notifyDependencyChange(boolean z2) {
|
||
|
List<Preference> list = this.mDependents;
|
||
|
if (list != null) {
|
||
|
int size = list.size();
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
list.get(i).onDependencyChanged(this, z2);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void notifyHierarchyChanged() {
|
||
|
OnPreferenceChangeInternalListener onPreferenceChangeInternalListener = this.mListener;
|
||
|
if (onPreferenceChangeInternalListener != null) {
|
||
|
onPreferenceChangeInternalListener.onPreferenceHierarchyChange(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void onAttached() {
|
||
|
registerDependency();
|
||
|
}
|
||
|
|
||
|
public void onAttachedToHierarchy(PreferenceManager preferenceManager) {
|
||
|
this.mPreferenceManager = preferenceManager;
|
||
|
if (!this.mHasId) {
|
||
|
this.mId = preferenceManager.getNextId();
|
||
|
}
|
||
|
dispatchSetInitialValue();
|
||
|
}
|
||
|
|
||
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
||
|
public void onAttachedToHierarchy(PreferenceManager preferenceManager, long j) {
|
||
|
this.mId = j;
|
||
|
this.mHasId = true;
|
||
|
boolean z2 = false;
|
||
|
try {
|
||
|
onAttachedToHierarchy(preferenceManager);
|
||
|
} finally {
|
||
|
this.mHasId = z2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX WARNING: Removed duplicated region for block: B:23:0x0081 */
|
||
|
/* JADX WARNING: Removed duplicated region for block: B:43:0x00b7 */
|
||
|
/* JADX WARNING: Removed duplicated region for block: B:45:0x00c0 */
|
||
|
/* JADX WARNING: Removed duplicated region for block: B:54:0x00d4 */
|
||
|
/* JADX WARNING: Removed duplicated region for block: B:55:0x00dc */
|
||
|
/* JADX WARNING: Removed duplicated region for block: B:62:0x0107 */
|
||
|
/* JADX WARNING: Removed duplicated region for block: B:63:0x010a */
|
||
|
/* JADX WARNING: Removed duplicated region for block: B:9:0x0043 */
|
||
|
public void onBindViewHolder(PreferenceViewHolder preferenceViewHolder) {
|
||
|
Integer num;
|
||
|
TextView textView;
|
||
|
ImageView imageView;
|
||
|
View findViewById;
|
||
|
boolean isCopyingEnabled;
|
||
|
View view = preferenceViewHolder.itemView;
|
||
|
view.setOnClickListener(this.mClickListener);
|
||
|
view.setId(this.mViewId);
|
||
|
TextView textView2 = (TextView) preferenceViewHolder.findViewById(16908304);
|
||
|
int i = 8;
|
||
|
if (textView2 != null) {
|
||
|
CharSequence summary = getSummary();
|
||
|
if (!TextUtils.isEmpty(summary)) {
|
||
|
textView2.setText(summary);
|
||
|
textView2.setVisibility(0);
|
||
|
num = Integer.valueOf(textView2.getCurrentTextColor());
|
||
|
textView = (TextView) preferenceViewHolder.findViewById(16908310);
|
||
|
if (textView != null) {
|
||
|
CharSequence title = getTitle();
|
||
|
if (!TextUtils.isEmpty(title)) {
|
||
|
textView.setText(title);
|
||
|
textView.setVisibility(0);
|
||
|
if (this.mHasSingleLineTitleAttr) {
|
||
|
textView.setSingleLine(this.mSingleLineTitle);
|
||
|
}
|
||
|
if (!isSelectable() && isEnabled() && num != null) {
|
||
|
textView.setTextColor(num.intValue());
|
||
|
}
|
||
|
} else {
|
||
|
textView.setVisibility(8);
|
||
|
}
|
||
|
}
|
||
|
imageView = (ImageView) preferenceViewHolder.findViewById(16908294);
|
||
|
if (imageView != null) {
|
||
|
int i2 = this.mIconResId;
|
||
|
if (!(i2 == 0 && this.mIcon == null)) {
|
||
|
if (this.mIcon == null) {
|
||
|
this.mIcon = AppCompatResources.getDrawable(this.mContext, i2);
|
||
|
}
|
||
|
Drawable drawable = this.mIcon;
|
||
|
if (drawable != null) {
|
||
|
imageView.setImageDrawable(drawable);
|
||
|
}
|
||
|
}
|
||
|
if (this.mIcon != null) {
|
||
|
imageView.setVisibility(0);
|
||
|
} else {
|
||
|
imageView.setVisibility(this.mIconSpaceReserved ? 4 : 8);
|
||
|
}
|
||
|
}
|
||
|
findViewById = preferenceViewHolder.findViewById(R.id.icon_frame);
|
||
|
if (findViewById == null) {
|
||
|
findViewById = preferenceViewHolder.findViewById(16908350);
|
||
|
}
|
||
|
if (findViewById != null) {
|
||
|
if (this.mIcon != null) {
|
||
|
findViewById.setVisibility(0);
|
||
|
} else {
|
||
|
if (this.mIconSpaceReserved) {
|
||
|
i = 4;
|
||
|
}
|
||
|
findViewById.setVisibility(i);
|
||
|
}
|
||
|
}
|
||
|
if (!this.mShouldDisableView) {
|
||
|
setEnabledStateOnViews(view, isEnabled());
|
||
|
} else {
|
||
|
setEnabledStateOnViews(view, true);
|
||
|
}
|
||
|
boolean isSelectable = isSelectable();
|
||
|
view.setFocusable(isSelectable);
|
||
|
view.setClickable(isSelectable);
|
||
|
preferenceViewHolder.setDividerAllowedAbove(this.mAllowDividerAbove);
|
||
|
preferenceViewHolder.setDividerAllowedBelow(this.mAllowDividerBelow);
|
||
|
isCopyingEnabled = isCopyingEnabled();
|
||
|
if (isCopyingEnabled && this.mOnCopyListener == null) {
|
||
|
this.mOnCopyListener = new OnPreferenceCopyListener(this);
|
||
|
}
|
||
|
view.setOnCreateContextMenuListener(!isCopyingEnabled ? this.mOnCopyListener : null);
|
||
|
view.setLongClickable(isCopyingEnabled);
|
||
|
if (isCopyingEnabled && !isSelectable) {
|
||
|
ViewCompat.setBackground(view, null);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
textView2.setVisibility(8);
|
||
|
}
|
||
|
num = null;
|
||
|
textView = (TextView) preferenceViewHolder.findViewById(16908310);
|
||
|
if (textView != null) {
|
||
|
}
|
||
|
imageView = (ImageView) preferenceViewHolder.findViewById(16908294);
|
||
|
if (imageView != null) {
|
||
|
}
|
||
|
findViewById = preferenceViewHolder.findViewById(R.id.icon_frame);
|
||
|
if (findViewById == null) {
|
||
|
}
|
||
|
if (findViewById != null) {
|
||
|
}
|
||
|
if (!this.mShouldDisableView) {
|
||
|
}
|
||
|
boolean isSelectable = isSelectable();
|
||
|
view.setFocusable(isSelectable);
|
||
|
view.setClickable(isSelectable);
|
||
|
preferenceViewHolder.setDividerAllowedAbove(this.mAllowDividerAbove);
|
||
|
preferenceViewHolder.setDividerAllowedBelow(this.mAllowDividerBelow);
|
||
|
isCopyingEnabled = isCopyingEnabled();
|
||
|
this.mOnCopyListener = new OnPreferenceCopyListener(this);
|
||
|
view.setOnCreateContextMenuListener(!isCopyingEnabled ? this.mOnCopyListener : null);
|
||
|
view.setLongClickable(isCopyingEnabled);
|
||
|
if (isCopyingEnabled) {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void onClick() {
|
||
|
}
|
||
|
|
||
|
public void onDependencyChanged(Preference preference, boolean z2) {
|
||
|
if (this.mDependencyMet == z2) {
|
||
|
this.mDependencyMet = !z2;
|
||
|
notifyDependencyChange(shouldDisableDependents());
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void onDetached() {
|
||
|
unregisterDependency();
|
||
|
this.mWasDetached = true;
|
||
|
}
|
||
|
|
||
|
public Object onGetDefaultValue(TypedArray typedArray, int i) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
@CallSuper
|
||
|
@Deprecated
|
||
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
||
|
}
|
||
|
|
||
|
public void onParentChanged(Preference preference, boolean z2) {
|
||
|
if (this.mParentDependencyMet == z2) {
|
||
|
this.mParentDependencyMet = !z2;
|
||
|
notifyDependencyChange(shouldDisableDependents());
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void onPrepareForRemoval() {
|
||
|
unregisterDependency();
|
||
|
}
|
||
|
|
||
|
public void onRestoreInstanceState(Parcelable parcelable) {
|
||
|
this.mBaseMethodCalled = true;
|
||
|
if (parcelable != AbsSavedState.EMPTY_STATE && parcelable != null) {
|
||
|
throw new IllegalArgumentException("Wrong state class -- expecting Preference State");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Parcelable onSaveInstanceState() {
|
||
|
this.mBaseMethodCalled = true;
|
||
|
return AbsSavedState.EMPTY_STATE;
|
||
|
}
|
||
|
|
||
|
public void onSetInitialValue(@Nullable Object obj) {
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public void onSetInitialValue(boolean z2, Object obj) {
|
||
|
onSetInitialValue(obj);
|
||
|
}
|
||
|
|
||
|
public Bundle peekExtras() {
|
||
|
return this.mExtras;
|
||
|
}
|
||
|
|
||
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
||
|
public void performClick() {
|
||
|
PreferenceManager.OnPreferenceTreeClickListener onPreferenceTreeClickListener;
|
||
|
if (isEnabled() && isSelectable()) {
|
||
|
onClick();
|
||
|
OnPreferenceClickListener onPreferenceClickListener = this.mOnClickListener;
|
||
|
if (onPreferenceClickListener == null || !onPreferenceClickListener.onPreferenceClick(this)) {
|
||
|
PreferenceManager preferenceManager = getPreferenceManager();
|
||
|
if ((preferenceManager == null || (onPreferenceTreeClickListener = preferenceManager.getOnPreferenceTreeClickListener()) == null || !onPreferenceTreeClickListener.onPreferenceTreeClick(this)) && this.mIntent != null) {
|
||
|
getContext().startActivity(this.mIntent);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
||
|
public void performClick(View view) {
|
||
|
performClick();
|
||
|
}
|
||
|
|
||
|
public boolean persistBoolean(boolean z2) {
|
||
|
if (!shouldPersist()) {
|
||
|
return false;
|
||
|
}
|
||
|
if (z2 == getPersistedBoolean(!z2)) {
|
||
|
return true;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
if (preferenceDataStore != null) {
|
||
|
preferenceDataStore.putBoolean(this.mKey, z2);
|
||
|
} else {
|
||
|
SharedPreferences.Editor editor = this.mPreferenceManager.getEditor();
|
||
|
editor.putBoolean(this.mKey, z2);
|
||
|
tryCommit(editor);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public boolean persistFloat(float f) {
|
||
|
if (!shouldPersist()) {
|
||
|
return false;
|
||
|
}
|
||
|
if (f == getPersistedFloat(Float.NaN)) {
|
||
|
return true;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
if (preferenceDataStore != null) {
|
||
|
preferenceDataStore.putFloat(this.mKey, f);
|
||
|
} else {
|
||
|
SharedPreferences.Editor editor = this.mPreferenceManager.getEditor();
|
||
|
editor.putFloat(this.mKey, f);
|
||
|
tryCommit(editor);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public boolean persistInt(int i) {
|
||
|
if (!shouldPersist()) {
|
||
|
return false;
|
||
|
}
|
||
|
if (i == getPersistedInt(~i)) {
|
||
|
return true;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
if (preferenceDataStore != null) {
|
||
|
preferenceDataStore.putInt(this.mKey, i);
|
||
|
} else {
|
||
|
SharedPreferences.Editor editor = this.mPreferenceManager.getEditor();
|
||
|
editor.putInt(this.mKey, i);
|
||
|
tryCommit(editor);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public boolean persistLong(long j) {
|
||
|
if (!shouldPersist()) {
|
||
|
return false;
|
||
|
}
|
||
|
if (j == getPersistedLong(~j)) {
|
||
|
return true;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
if (preferenceDataStore != null) {
|
||
|
preferenceDataStore.putLong(this.mKey, j);
|
||
|
} else {
|
||
|
SharedPreferences.Editor editor = this.mPreferenceManager.getEditor();
|
||
|
editor.putLong(this.mKey, j);
|
||
|
tryCommit(editor);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public boolean persistString(String str) {
|
||
|
if (!shouldPersist()) {
|
||
|
return false;
|
||
|
}
|
||
|
if (TextUtils.equals(str, getPersistedString(null))) {
|
||
|
return true;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
if (preferenceDataStore != null) {
|
||
|
preferenceDataStore.putString(this.mKey, str);
|
||
|
} else {
|
||
|
SharedPreferences.Editor editor = this.mPreferenceManager.getEditor();
|
||
|
editor.putString(this.mKey, str);
|
||
|
tryCommit(editor);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public boolean persistStringSet(Set<String> set) {
|
||
|
if (!shouldPersist()) {
|
||
|
return false;
|
||
|
}
|
||
|
if (set.equals(getPersistedStringSet(null))) {
|
||
|
return true;
|
||
|
}
|
||
|
PreferenceDataStore preferenceDataStore = getPreferenceDataStore();
|
||
|
if (preferenceDataStore != null) {
|
||
|
preferenceDataStore.putStringSet(this.mKey, set);
|
||
|
} else {
|
||
|
SharedPreferences.Editor editor = this.mPreferenceManager.getEditor();
|
||
|
editor.putStringSet(this.mKey, set);
|
||
|
tryCommit(editor);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public void requireKey() {
|
||
|
if (!TextUtils.isEmpty(this.mKey)) {
|
||
|
this.mRequiresKey = true;
|
||
|
return;
|
||
|
}
|
||
|
throw new IllegalStateException("Preference does not have a key assigned.");
|
||
|
}
|
||
|
|
||
|
public void restoreHierarchyState(Bundle bundle) {
|
||
|
dispatchRestoreInstanceState(bundle);
|
||
|
}
|
||
|
|
||
|
public void saveHierarchyState(Bundle bundle) {
|
||
|
dispatchSaveInstanceState(bundle);
|
||
|
}
|
||
|
|
||
|
public void setCopyingEnabled(boolean z2) {
|
||
|
if (this.mCopyingEnabled != z2) {
|
||
|
this.mCopyingEnabled = z2;
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setDefaultValue(Object obj) {
|
||
|
this.mDefaultValue = obj;
|
||
|
}
|
||
|
|
||
|
public void setDependency(String str) {
|
||
|
unregisterDependency();
|
||
|
this.mDependencyKey = str;
|
||
|
registerDependency();
|
||
|
}
|
||
|
|
||
|
public void setEnabled(boolean z2) {
|
||
|
if (this.mEnabled != z2) {
|
||
|
this.mEnabled = z2;
|
||
|
notifyDependencyChange(shouldDisableDependents());
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setFragment(String str) {
|
||
|
this.mFragment = str;
|
||
|
}
|
||
|
|
||
|
public void setIcon(int i) {
|
||
|
setIcon(AppCompatResources.getDrawable(this.mContext, i));
|
||
|
this.mIconResId = i;
|
||
|
}
|
||
|
|
||
|
public void setIcon(Drawable drawable) {
|
||
|
if (this.mIcon != drawable) {
|
||
|
this.mIcon = drawable;
|
||
|
this.mIconResId = 0;
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setIconSpaceReserved(boolean z2) {
|
||
|
if (this.mIconSpaceReserved != z2) {
|
||
|
this.mIconSpaceReserved = z2;
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setIntent(Intent intent) {
|
||
|
this.mIntent = intent;
|
||
|
}
|
||
|
|
||
|
public void setKey(String str) {
|
||
|
this.mKey = str;
|
||
|
if (this.mRequiresKey && !hasKey()) {
|
||
|
requireKey();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setLayoutResource(int i) {
|
||
|
this.mLayoutResId = i;
|
||
|
}
|
||
|
|
||
|
public final void setOnPreferenceChangeInternalListener(OnPreferenceChangeInternalListener onPreferenceChangeInternalListener) {
|
||
|
this.mListener = onPreferenceChangeInternalListener;
|
||
|
}
|
||
|
|
||
|
public void setOnPreferenceChangeListener(OnPreferenceChangeListener onPreferenceChangeListener) {
|
||
|
this.mOnChangeListener = onPreferenceChangeListener;
|
||
|
}
|
||
|
|
||
|
public void setOnPreferenceClickListener(OnPreferenceClickListener onPreferenceClickListener) {
|
||
|
this.mOnClickListener = onPreferenceClickListener;
|
||
|
}
|
||
|
|
||
|
public void setOrder(int i) {
|
||
|
if (i != this.mOrder) {
|
||
|
this.mOrder = i;
|
||
|
notifyHierarchyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setPersistent(boolean z2) {
|
||
|
this.mPersistent = z2;
|
||
|
}
|
||
|
|
||
|
public void setPreferenceDataStore(PreferenceDataStore preferenceDataStore) {
|
||
|
this.mPreferenceDataStore = preferenceDataStore;
|
||
|
}
|
||
|
|
||
|
public void setSelectable(boolean z2) {
|
||
|
if (this.mSelectable != z2) {
|
||
|
this.mSelectable = z2;
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setShouldDisableView(boolean z2) {
|
||
|
if (this.mShouldDisableView != z2) {
|
||
|
this.mShouldDisableView = z2;
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setSingleLineTitle(boolean z2) {
|
||
|
this.mHasSingleLineTitleAttr = true;
|
||
|
this.mSingleLineTitle = z2;
|
||
|
}
|
||
|
|
||
|
public void setSummary(int i) {
|
||
|
setSummary(this.mContext.getString(i));
|
||
|
}
|
||
|
|
||
|
public void setSummary(CharSequence charSequence) {
|
||
|
if (getSummaryProvider() != null) {
|
||
|
throw new IllegalStateException("Preference already has a SummaryProvider set.");
|
||
|
} else if (!TextUtils.equals(this.mSummary, charSequence)) {
|
||
|
this.mSummary = charSequence;
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void setSummaryProvider(@Nullable SummaryProvider summaryProvider) {
|
||
|
this.mSummaryProvider = summaryProvider;
|
||
|
notifyChanged();
|
||
|
}
|
||
|
|
||
|
public void setTitle(int i) {
|
||
|
setTitle(this.mContext.getString(i));
|
||
|
}
|
||
|
|
||
|
public void setTitle(CharSequence charSequence) {
|
||
|
if ((charSequence == null && this.mTitle != null) || (charSequence != null && !charSequence.equals(this.mTitle))) {
|
||
|
this.mTitle = charSequence;
|
||
|
notifyChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setViewId(int i) {
|
||
|
this.mViewId = i;
|
||
|
}
|
||
|
|
||
|
public final void setVisible(boolean z2) {
|
||
|
if (this.mVisible != z2) {
|
||
|
this.mVisible = z2;
|
||
|
OnPreferenceChangeInternalListener onPreferenceChangeInternalListener = this.mListener;
|
||
|
if (onPreferenceChangeInternalListener != null) {
|
||
|
onPreferenceChangeInternalListener.onPreferenceVisibilityChange(this);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setWidgetLayoutResource(int i) {
|
||
|
this.mWidgetLayoutResId = i;
|
||
|
}
|
||
|
|
||
|
public boolean shouldDisableDependents() {
|
||
|
return !isEnabled();
|
||
|
}
|
||
|
|
||
|
public boolean shouldPersist() {
|
||
|
return this.mPreferenceManager != null && isPersistent() && hasKey();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Object
|
||
|
public String toString() {
|
||
|
return getFilterableStringBuilder().toString();
|
||
|
}
|
||
|
|
||
|
public final boolean wasDetached() {
|
||
|
return this.mWasDetached;
|
||
|
}
|
||
|
}
|