Define a helper link for 5G limitation in DSDS footer.

Bug: 152786064
Test: manual
Change-Id: I5a02f847531988217cc6ab47e3b35ed319c1027c
This commit is contained in:
Malcolm Chen
2020-04-17 21:54:53 -07:00
committed by Xiangyu/Malcolm Chen
parent c67a0d853b
commit 80be9de6d0
2 changed files with 36 additions and 4 deletions

View File

@@ -17,10 +17,17 @@
package com.android.settings.network.telephony;
import android.content.Context;
import android.content.Intent;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.utils.AnnotationSpan;
import com.android.settingslib.HelpUtils;
/**
* Class to show the footer that can't connect to 5G when device is in DSDS mode.
@@ -43,6 +50,29 @@ public class NrDisabledInDsdsFooterPreferenceController extends BasePreferenceCo
mSubId = subId;
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (preference != null) {
preference.setTitle(getFooterText());
}
}
private CharSequence getFooterText() {
final Intent helpIntent = HelpUtils.getHelpIntent(mContext,
mContext.getString(R.string.help_uri_5g_dsds),
mContext.getClass().getName());
final AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo(mContext,
"url", helpIntent);
if (linkInfo.isActionable()) {
return AnnotationSpan.linkify(mContext.getText(R.string.no_5g_in_dsds_text), linkInfo);
} else {
return mContext.getText(R.string.no_5g_in_dsds_text);
}
}
@Override
public int getAvailabilityStatus() {
if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {