Fix issue that the wifi calling text cannot be customized based on sim
Some carriers have requirements that the wifi calling text should be customizable. However, the resources for the wifi calling text are not obtained based on sim. So it cannot be customized per sim for multi sim device. To solve this issue, obtain the resources with specified sim. Test: manual - Checked that the wifi calling text could be customized based on sim. Bug: 117257109 Change-Id: I6b3f6b06c9cc984ee6a68a19ae317b5d1d4e48e2 Merged-In: I6b3f6b06c9cc984ee6a68a19ae317b5d1d4e48e2
This commit is contained in:
committed by
Youming Ye
parent
3ddcb6a90a
commit
82aa55bcda
@@ -2337,7 +2337,7 @@
|
||||
<item>"1"</item>
|
||||
</string-array>
|
||||
<!-- Wi-Fi Calling settings. Text displayed when Wi-Fi Calling is off -->
|
||||
<string name="wifi_calling_off_explanation">When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\u2019s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details.</string>
|
||||
<string name="wifi_calling_off_explanation">When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\u2019s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details.<xliff:g id="additional_text" example="Learn More">%1$s</xliff:g></string>
|
||||
<!-- Wi-Fi Calling settings. Additional text displayed when Wi-Fi Calling is off. Default empty. [CHAR LIMIT=NONE] -->
|
||||
<string name="wifi_calling_off_explanation_2"></string>
|
||||
<!-- Title of a preference for updating emergency address [CHAR LIMIT=40] -->
|
||||
|
@@ -29,6 +29,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.android.ims.ImsManager;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.util.CollectionUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.InstrumentedFragment;
|
||||
import com.android.settings.search.actionbar.SearchMenuController;
|
||||
@@ -52,6 +53,24 @@ public class WifiCallingSettings extends InstrumentedFragment implements HelpRes
|
||||
private WifiCallingViewPagerAdapter mPagerAdapter;
|
||||
private SlidingTabLayout mTabLayout;
|
||||
|
||||
private final class InternalViewPagerListener implements
|
||||
RtlCompatibleViewPager.OnPageChangeListener {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
updateTitleForCurrentSub();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.WIFI_CALLING;
|
||||
@@ -67,6 +86,7 @@ public class WifiCallingSettings extends InstrumentedFragment implements HelpRes
|
||||
|
||||
mPagerAdapter = new WifiCallingViewPagerAdapter(getChildFragmentManager(), mViewPager);
|
||||
mViewPager.setAdapter(mPagerAdapter);
|
||||
mViewPager.addOnPageChangeListener(new InternalViewPagerListener());
|
||||
|
||||
return view;
|
||||
}
|
||||
@@ -92,6 +112,8 @@ public class WifiCallingSettings extends InstrumentedFragment implements HelpRes
|
||||
} else {
|
||||
mTabLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
updateTitleForCurrentSub();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,4 +184,13 @@ public class WifiCallingSettings extends InstrumentedFragment implements HelpRes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTitleForCurrentSub() {
|
||||
if (CollectionUtils.size(mSil) > 1) {
|
||||
final int subId = mSil.get(mViewPager.getCurrentItem()).getSubscriptionId();
|
||||
final String title = SubscriptionManager.getResourcesForSubId(getContext(), subId)
|
||||
.getString(R.string.wifi_calling_settings_title);
|
||||
getActivity().getActionBar().setTitle(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
import androidx.preference.ListPreference;
|
||||
@@ -158,8 +159,9 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
||||
|
||||
mEmptyView = getView().findViewById(android.R.id.empty);
|
||||
setEmptyView(mEmptyView);
|
||||
String emptyViewText = activity.getString(R.string.wifi_calling_off_explanation)
|
||||
+ activity.getString(R.string.wifi_calling_off_explanation_2);
|
||||
final Resources res = SubscriptionManager.getResourcesForSubId(getActivity(), mSubId);
|
||||
String emptyViewText = res.getString(R.string.wifi_calling_off_explanation,
|
||||
res.getString(R.string.wifi_calling_off_explanation_2));
|
||||
mEmptyView.setText(emptyViewText);
|
||||
|
||||
mSwitchBar = getView().findViewById(R.id.switch_bar);
|
||||
|
Reference in New Issue
Block a user