Set a title for personal dictionary

After the collapsing toolbar layout is applied to subsetting pages, the
title of the personal dictionary page won't be shown. This CL is to set
a title for the personal dictionary page.

Bug: 176897229
Test: manual test and visual verified
1) Navigate to Settings -> System -> Languages & input -> Personal
dictionary
2) Enable collapsing toolbar feature
3) Observe and check if the title is shown as normal

Change-Id: I0b6488bc2c8040b275ba0d5348d09aa4bad905d1
This commit is contained in:
Mill Chen
2021-01-07 00:14:50 +08:00
parent 90c976b8c0
commit 124f01999c

View File

@@ -26,6 +26,7 @@ import android.database.Cursor;
import android.os.Bundle; import android.os.Bundle;
import android.provider.UserDictionary; import android.provider.UserDictionary;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@@ -44,6 +45,7 @@ import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader; import androidx.loader.content.Loader;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.SubSettingLauncher; import com.android.settings.core.SubSettingLauncher;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.Instrumentable; import com.android.settingslib.core.instrumentation.Instrumentable;
@@ -104,6 +106,10 @@ public class UserDictionarySettings extends ListFragment implements Instrumentab
@Override @Override
public View onCreateView( public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// TODO(b/176883483): Remove the title after material component updated
if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
getActivity().setTitle(R.string.user_dict_settings_title);
}
// Show the language as a subtitle of the action bar // Show the language as a subtitle of the action bar
final ActionBar actionBar = getActivity().getActionBar(); final ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null) { if (actionBar != null) {