[Povider Model] Fix string in SIMs

Bug: 192058192
Test: make
Change-Id: I4314802840a4952acf7f090d81ca19ec28b793b2
(cherry picked from commit 84073b9851)
Merged-In: I4314802840a4952acf7f090d81ca19ec28b793b2
This commit is contained in:
Zoey Chen
2021-07-06 14:28:52 +08:00
parent c97269a900
commit f982f286a2
2 changed files with 18 additions and 3 deletions

View File

@@ -3,9 +3,11 @@ package com.android.settings.network;
import android.content.Context;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -15,6 +17,7 @@ public class NetworkProviderDownloadedSimsCategoryController extends
private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
"provider_model_downloaded_sim_category";
private PreferenceCategory mPreferenceCategory;
private NetworkProviderDownloadedSimListController mNetworkProviderDownloadedSimListController;
public NetworkProviderDownloadedSimsCategoryController(Context context, String key) {
@@ -44,9 +47,19 @@ public class NetworkProviderDownloadedSimsCategoryController extends
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
PreferenceCategory preferenceCategory = screen.findPreference(
mPreferenceCategory = screen.findPreference(
KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
preferenceCategory.setVisible(isAvailable());
mPreferenceCategory.setVisible(isAvailable());
mNetworkProviderDownloadedSimListController.displayPreference(screen);
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
int count = mPreferenceCategory.getPreferenceCount();
String title = mContext.getString(count > 1
? R.string.downloaded_sims_category_title
: R.string.downloaded_sim_category_title);
mPreferenceCategory.setTitle(title);
}
}