Register most app info related controllers in xml

Bug: 77216595
Test: robotests
Change-Id: I79afa38820b7518d8b3112148802797ebcf6d184
This commit is contained in:
Fan Zhang
2018-03-29 15:45:49 -07:00
parent 65983f71d5
commit b5c651c939
40 changed files with 299 additions and 249 deletions

View File

@@ -32,16 +32,14 @@ import com.android.settings.core.BasePreferenceController;
public abstract class AppInfoPreferenceControllerBase extends BasePreferenceController
implements AppInfoDashboardFragment.Callback {
protected final AppInfoDashboardFragment mParent;
private final Class<? extends SettingsPreferenceFragment> mDetailFragmenClass;
protected AppInfoDashboardFragment mParent;
protected Preference mPreference;
public AppInfoPreferenceControllerBase(Context context, AppInfoDashboardFragment parent,
String preferenceKey) {
private final Class<? extends SettingsPreferenceFragment> mDetailFragmentClass;
public AppInfoPreferenceControllerBase(Context context, String preferenceKey) {
super(context, preferenceKey);
mParent = parent;
mDetailFragmenClass = getDetailFragmentClass();
mDetailFragmentClass = getDetailFragmentClass();
}
@Override
@@ -57,9 +55,9 @@ public abstract class AppInfoPreferenceControllerBase extends BasePreferenceCont
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (TextUtils.equals(preference.getKey(), mPreferenceKey) && mDetailFragmenClass != null) {
if (TextUtils.equals(preference.getKey(), mPreferenceKey) && mDetailFragmentClass != null) {
AppInfoDashboardFragment.startAppInfoFragment(
mDetailFragmenClass, -1, getArguments(), mParent, mParent.getAppEntry());
mDetailFragmentClass, -1, getArguments(), mParent, mParent.getAppEntry());
return true;
}
return false;
@@ -70,6 +68,11 @@ public abstract class AppInfoPreferenceControllerBase extends BasePreferenceCont
updateState(mPreference);
}
public void setParentFragment(AppInfoDashboardFragment parent) {
mParent = parent;
parent.addToCallbackList(this);
}
/**
* Gets the fragment class to be launched when the preference is clicked.
* @return the fragment to launch