Merge "Recursively find preference in progressive disclosure."

This commit is contained in:
Doris Ling
2017-02-21 18:26:27 +00:00
committed by Android (Google) Code Review
2 changed files with 26 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import android.os.Bundle;
import android.support.annotation.VisibleForTesting;
import android.support.v14.preference.PreferenceFragment;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.Log;
@@ -219,6 +220,12 @@ public class ProgressiveDisclosureMixin implements Preference.OnPreferenceClickL
if (TextUtils.equals(key, pref.getKey())) {
return pref;
}
if (pref instanceof PreferenceGroup) {
final Preference returnedPreference = ((PreferenceGroup)pref).findPreference(key);
if (returnedPreference != null) {
return returnedPreference;
}
}
}
Log.d(TAG, "Cannot find preference with key " + key);
return null;