Add Settings keywords for Styles & Wallpaper.

Reusing existing strings since this is coming in after string freeze.
TODO: create a new keyword string for this preference.

Fixes: 130759285
Test: m RunSettingsRoboTests and searching keywords on device
Change-Id: Ice1bc34b381302745cb55056377cc94ea74e8d50
This commit is contained in:
Amin Shaikh
2019-04-18 11:13:01 -04:00
parent 3683a688f7
commit 87ef55ea90
3 changed files with 58 additions and 17 deletions

View File

@@ -53,8 +53,27 @@ public class WallpaperPreferenceController extends BasePreferenceController {
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
Preference preference = screen.findPreference(getPreferenceKey());
preference.setTitle(mContext.getString(areStylesAvailable()
? R.string.style_and_wallpaper_settings_title : R.string.wallpaper_settings_title));
preference.setTitle(getTitle());
}
public String getTitle() {
return mContext.getString(areStylesAvailable()
? R.string.style_and_wallpaper_settings_title : R.string.wallpaper_settings_title);
}
public ComponentName getComponentName() {
return new ComponentName(mWallpaperPackage,
areStylesAvailable() ? mStylesAndWallpaperClass : mWallpaperClass);
}
public String getKeywords() {
StringBuilder sb = new StringBuilder(mContext.getString(R.string.keywords_wallpaper));
if (areStylesAvailable()) {
// TODO(b/130759285): Create a new string keywords_styles_and_wallpaper
sb.append(", ").append(mContext.getString(R.string.theme_customization_category))
.append(", ").append(mContext.getString(R.string.keywords_dark_ui_mode));
}
return sb.toString();
}
@Override
@@ -75,9 +94,7 @@ public class WallpaperPreferenceController extends BasePreferenceController {
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (getPreferenceKey().equals(preference.getKey())) {
final ComponentName componentName = new ComponentName(mWallpaperPackage,
areStylesAvailable() ? mStylesAndWallpaperClass : mWallpaperClass);
preference.getContext().startActivity(new Intent().setComponent(componentName));
preference.getContext().startActivity(new Intent().setComponent(getComponentName()));
return true;
}
return super.handlePreferenceTreeClick(preference);