Support getDynamicSummary in BasePreferenceController
Adds dynamic summary getter in relevant BasePreferenceControllers. Preferece controllers that don't have dynamic summaries or which are not yet BasePreferenceControllers are not changed right now. Change-Id: I435ccab7758d90515583fd8ca10a9b1ef0c858b9 Fixes: 71514936 Test: robotests
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.android.settings.applications.appinfo;
|
||||
|
||||
import android.app.slice.Slice;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
@@ -52,7 +51,13 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
preference.setSummary(isDefaultApp() ? R.string.yes : R.string.no);
|
||||
preference.setSummary(getSummary());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSummary() {
|
||||
int summaryResId = isDefaultApp() ? R.string.yes : R.string.no;
|
||||
return mContext.getString(summaryResId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,12 +74,14 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
|
||||
/**
|
||||
* Check whether the app has the default app capability
|
||||
*
|
||||
* @return true if the app has the default app capability
|
||||
*/
|
||||
protected abstract boolean hasAppCapability();
|
||||
|
||||
/**
|
||||
* Check whether the app is the default app
|
||||
*
|
||||
* @return true if the app is the default app
|
||||
*/
|
||||
protected abstract boolean isDefaultApp();
|
||||
|
||||
Reference in New Issue
Block a user