Java Code Examples for org.chromium.ui.text.SpanApplier#applySpans()
The following examples show how to use
org.chromium.ui.text.SpanApplier#applySpans() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PassphraseTypeDialogFragment.java From AndroidChromium with Apache License 2.0 | 6 votes |
private SpannableString getResetText() { final Context context = getActivity(); return SpanApplier.applySpans( context.getString(R.string.sync_passphrase_encryption_reset_instructions), new SpanInfo("<resetlink>", "</resetlink>", new ClickableSpan() { @Override public void onClick(View view) { Uri syncDashboardUrl = Uri.parse( context.getText(R.string.sync_dashboard_url).toString()); Intent intent = new Intent(Intent.ACTION_VIEW, syncDashboardUrl); intent.setPackage(BuildInfo.getPackageName(context)); IntentUtils.safePutBinderExtra( intent, CustomTabsIntent.EXTRA_SESSION, null); context.startActivity(intent); } })); }
Example 2
Source File: PassphraseTypeDialogFragment.java From 365browser with Apache License 2.0 | 6 votes |
private SpannableString getResetText() { final Context context = getActivity(); return SpanApplier.applySpans( context.getString(R.string.sync_passphrase_encryption_reset_instructions), new SpanInfo("<resetlink>", "</resetlink>", new ClickableSpan() { @Override public void onClick(View view) { Uri syncDashboardUrl = Uri.parse( context.getText(R.string.sync_dashboard_url).toString()); Intent intent = new Intent(Intent.ACTION_VIEW, syncDashboardUrl); intent.setPackage(BuildInfo.getPackageName()); IntentUtils.safePutBinderExtra( intent, CustomTabsIntent.EXTRA_SESSION, null); context.startActivity(intent); } })); }
Example 3
Source File: PassphraseDialogFragment.java From AndroidChromium with Apache License 2.0 | 6 votes |
private SpannableString getResetText() { final Context context = getActivity(); return SpanApplier.applySpans( context.getString(R.string.sync_passphrase_reset_instructions), new SpanInfo("<resetlink>", "</resetlink>", new ClickableSpan() { @Override public void onClick(View view) { recordPassphraseDialogDismissal(PASSPHRASE_DIALOG_RESET_LINK); Uri syncDashboardUrl = Uri.parse( context.getText(R.string.sync_dashboard_url).toString()); Intent intent = new Intent(Intent.ACTION_VIEW, syncDashboardUrl); intent.setPackage(BuildInfo.getPackageName(context)); IntentUtils.safePutBinderExtra( intent, CustomTabsIntent.EXTRA_SESSION, null); context.startActivity(intent); } })); }
Example 4
Source File: SogouPromoDialog.java From 365browser with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Do not allow this dialog to be reconstructed because it requires native side loaded. if (savedInstanceState != null) { dismiss(); return; } StyleSpan boldSpan = new StyleSpan(android.graphics.Typeface.BOLD); TextView textView = (TextView) findViewById(R.id.subheader); SpannableString description = SpanApplier.applySpans( getContext().getString(R.string.sogou_explanation), new SpanInfo("<link>", "</link>", mSpan), new SpanInfo("<b>", "</b>", boldSpan)); textView.setText(description); textView.setMovementMethod(LinkMovementMethod.getInstance()); }
Example 5
Source File: PhysicalWebOptInActivity.java From AndroidChromium with Apache License 2.0 | 6 votes |
private SpannableString getDescriptionText() { return SpanApplier.applySpans( getString(R.string.physical_web_optin_description), new SpanInfo("<learnmore>", "</learnmore>", new ClickableSpan() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PHYSICAL_WEB_LEARN_MORE_URL)); // Add the SESSION extra to indicate we want a Chrome custom tab. This // allows the help page to open in the same task as the opt-in activity so // they can share a back stack. String session = null; intent.putExtra(EXTRA_CUSTOM_TABS_SESSION, session); PhysicalWebOptInActivity.this.startActivity(intent); } @Override public void updateDrawState(TextPaint ds) { // Color links but do not underline them. ds.setColor(ds.linkColor); } })); }
Example 6
Source File: PhysicalWebOptInActivity.java From delion with Apache License 2.0 | 6 votes |
private SpannableString getDescriptionText() { return SpanApplier.applySpans( getString(R.string.physical_web_optin_description), new SpanInfo("<learnmore>", "</learnmore>", new ClickableSpan() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PHYSICAL_WEB_LEARN_MORE_URL)); // Add the SESSION extra to indicate we want a Chrome custom tab. This // allows the help page to open in the same task as the opt-in activity so // they can share a back stack. String session = null; intent.putExtra(EXTRA_CUSTOM_TABS_SESSION, session); PhysicalWebOptInActivity.this.startActivity(intent); } @Override public void updateDrawState(TextPaint ds) { // Color links but do not underline them. ds.setColor(ds.linkColor); } })); }
Example 7
Source File: PassphraseTypeDialogFragment.java From delion with Apache License 2.0 | 6 votes |
private SpannableString getResetText() { final Context context = getActivity(); return SpanApplier.applySpans( context.getString(R.string.sync_passphrase_encryption_reset_instructions), new SpanInfo("<resetlink>", "</resetlink>", new ClickableSpan() { @Override public void onClick(View view) { Uri syncDashboardUrl = Uri.parse( context.getText(R.string.sync_dashboard_url).toString()); Intent intent = new Intent(Intent.ACTION_VIEW, syncDashboardUrl); intent.setPackage(BuildInfo.getPackageName(context)); IntentUtils.safePutBinderExtra( intent, CustomTabsIntent.EXTRA_SESSION, null); context.startActivity(intent); } })); }
Example 8
Source File: TextMessageWithLinkAndIconPreference.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void setSummary(CharSequence summary) { // If there is no link in the summary, invoke the default behavior. String summaryString = summary.toString(); if (!summaryString.contains("<link>") || !summaryString.contains("</link>")) { super.setSummary(summary); return; } // Linkify <link></link> span. final SpannableString summaryWithLink = SpanApplier.applySpans(summaryString, new SpanApplier.SpanInfo("<link>", "</link>", new NoUnderlineClickableSpan() { @Override public void onClick(View widget) { if (mLinkClickDelegate != null) mLinkClickDelegate.run(); } })); super.setSummary(summaryWithLink); }
Example 9
Source File: ClearBrowsingDataTabCheckBoxPreference.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void setSummary(CharSequence summary) { // If there is no link in the summary, invoke the default behavior. String summaryString = summary.toString(); if (!summaryString.contains("<link>") || !summaryString.contains("</link>")) { super.setSummary(summary); return; } // Linkify <link></link> span. final SpannableString summaryWithLink = SpanApplier.applySpans(summaryString, new SpanApplier.SpanInfo("<link>", "</link>", new NoUnderlineClickableSpan() { @Override public void onClick(View widget) { if (mLinkClickDelegate != null) mLinkClickDelegate.run(); } })); mHasClickableSpans = true; super.setSummary(summaryWithLink); }
Example 10
Source File: OtherFormsOfHistoryDialogFragment.java From delion with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.other_forms_of_history_dialog, null); // Linkify the <link></link> span in the dialog text. TextView textView = (TextView) view.findViewById(R.id.text); final SpannableString textWithLink = SpanApplier.applySpans( textView.getText().toString(), new SpanApplier.SpanInfo("<link>", "</link>", new NoUnderlineClickableSpan() { @Override public void onClick(View widget) { new TabDelegate(false /* incognito */).launchUrl( WEB_HISTORY_URL, TabLaunchType.FROM_CHROME_UI); } })); textView.setText(textWithLink); textView.setMovementMethod(LinkMovementMethod.getInstance()); // Construct the dialog. AlertDialog dialog = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) .setView(view) .setTitle(R.string.clear_browsing_data_history_dialog_title) .setPositiveButton( R.string.ok_got_it, this) .create(); dialog.setCanceledOnTouchOutside(false); return dialog; }
Example 11
Source File: SadTabViewFactory.java From delion with Apache License 2.0 | 5 votes |
/** * Construct and return help message to be displayed on R.id.sad_tab_message. * @param context Context of the resulting Sad Tab view. This is needed to load the strings. * @param suggestionAction Action to be executed when user clicks "try these suggestions". * @return Help message to be displayed on R.id.sad_tab_message. */ private static CharSequence getHelpMessage( Context context, final OnClickListener suggestionAction) { String helpMessage = context.getString(R.string.sad_tab_message) + "\n\n" + context.getString(R.string.sad_tab_suggestions); NoUnderlineClickableSpan span = new NoUnderlineClickableSpan() { @Override public void onClick(View view) { suggestionAction.onClick(view); } }; return SpanApplier.applySpans(helpMessage, new SpanInfo("<link>", "</link>", span)); }
Example 12
Source File: GeolocationSnackbarController.java From delion with Apache License 2.0 | 5 votes |
/** * Shows the geolocation snackbar if it hasn't already been shown and the geolocation snackbar * is currently relevant: i.e. the default search engine is Google, location is enabled * for Chrome, the tab is not incognito, etc. * * @param snackbarManager The SnackbarManager used to show the snackbar. * @param view Any view that's attached to the view hierarchy. * @param isIncognito Whether the currently visible tab is incognito. * @param delayMs The delay in ms before the snackbar should be shown. This is intended to * give the keyboard time to animate in. */ public static void maybeShowSnackbar(final SnackbarManager snackbarManager, View view, boolean isIncognito, int delayMs) { final Context context = view.getContext(); if (getGeolocationSnackbarShown(context)) return; // If in incognito mode, don't show the snackbar now, but maybe show it later. if (isIncognito) return; if (neverShowSnackbar(context)) { setGeolocationSnackbarShown(context); return; } Uri searchUri = Uri.parse(TemplateUrlService.getInstance().getUrlForSearchQuery("foo")); TypefaceSpan robotoMediumSpan = new TypefaceSpan("sans-serif-medium"); String messageWithoutSpans = context.getResources().getString( R.string.omnibox_geolocation_disclosure, "<b>" + searchUri.getHost() + "</b>"); SpannableString message = SpanApplier.applySpans(messageWithoutSpans, new SpanInfo("<b>", "</b>", robotoMediumSpan)); String settings = context.getResources().getString(R.string.preferences); int durationMs = DeviceClassManager.isAccessibilityModeEnabled(view.getContext()) ? ACCESSIBILITY_SNACKBAR_DURATION_MS : SNACKBAR_DURATION_MS; final GeolocationSnackbarController controller = new GeolocationSnackbarController(); final Snackbar snackbar = Snackbar .make(message, controller, Snackbar.TYPE_ACTION, Snackbar.UMA_OMNIBOX_GEOLOCATION) .setAction(settings, view) .setSingleLine(false) .setDuration(durationMs); view.postDelayed(new Runnable() { @Override public void run() { snackbarManager.dismissSnackbars(controller); snackbarManager.showSnackbar(snackbar); setGeolocationSnackbarShown(context); } }, delayMs); }
Example 13
Source File: PassphraseCreationDialogFragment.java From AndroidChromium with Apache License 2.0 | 5 votes |
private SpannableString getInstructionsText() { final Activity activity = getActivity(); return SpanApplier.applySpans( activity.getString(R.string.sync_custom_passphrase), new SpanInfo("<learnmore>", "</learnmore>", new ClickableSpan() { @Override public void onClick(View view) { HelpAndFeedback.getInstance(activity).show(activity, activity.getString(R.string.help_context_change_sync_passphrase), Profile.getLastUsedProfile(), null); } })); }
Example 14
Source File: BluetoothChooserDialog.java From delion with Apache License 2.0 | 5 votes |
@VisibleForTesting @CalledByNative void notifyAdapterTurnedOff() { SpannableString adapterOffMessage = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_adapter_off), new SpanInfo("<link>", "</link>", new BluetoothClickableSpan(LinkType.ADAPTER_OFF, mActivity))); SpannableString adapterOffStatus = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_adapter_off_help), new SpanInfo("<link>", "</link>", new BluetoothClickableSpan(LinkType.ADAPTER_OFF_HELP, mActivity))); mItemChooserDialog.setErrorState(adapterOffMessage, adapterOffStatus); }
Example 15
Source File: GeolocationSnackbarController.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Shows the geolocation snackbar if it hasn't already been shown and the geolocation snackbar * is currently relevant: i.e. the default search engine is Google, location is enabled * for Chrome, the tab is not incognito, etc. * * @param snackbarManager The SnackbarManager used to show the snackbar. * @param view Any view that's attached to the view hierarchy. * @param isIncognito Whether the currently visible tab is incognito. * @param delayMs The delay in ms before the snackbar should be shown. This is intended to * give the keyboard time to animate in. */ public static void maybeShowSnackbar(final SnackbarManager snackbarManager, View view, boolean isIncognito, int delayMs) { final Context context = view.getContext(); if (ChromeFeatureList.isEnabled(ChromeFeatureList.CONSISTENT_OMNIBOX_GEOLOCATION)) return; if (getGeolocationSnackbarShown(context)) return; // If in incognito mode, don't show the snackbar now, but maybe show it later. if (isIncognito) return; if (neverShowSnackbar(context)) { setGeolocationSnackbarShown(context); return; } Uri searchUri = Uri.parse(TemplateUrlService.getInstance().getUrlForSearchQuery("foo")); TypefaceSpan robotoMediumSpan = new TypefaceSpan("sans-serif-medium"); String messageWithoutSpans = context.getResources().getString( R.string.omnibox_geolocation_disclosure, "<b>" + searchUri.getHost() + "</b>"); SpannableString message = SpanApplier.applySpans(messageWithoutSpans, new SpanInfo("<b>", "</b>", robotoMediumSpan)); String settings = context.getResources().getString(R.string.preferences); int durationMs = DeviceClassManager.isAccessibilityModeEnabled(view.getContext()) ? ACCESSIBILITY_SNACKBAR_DURATION_MS : SNACKBAR_DURATION_MS; final GeolocationSnackbarController controller = new GeolocationSnackbarController(); final Snackbar snackbar = Snackbar .make(message, controller, Snackbar.TYPE_ACTION, Snackbar.UMA_OMNIBOX_GEOLOCATION) .setAction(settings, view) .setSingleLine(false) .setDuration(durationMs); view.postDelayed(new Runnable() { @Override public void run() { snackbarManager.dismissSnackbars(controller); snackbarManager.showSnackbar(snackbar); setGeolocationSnackbarShown(context); } }, delayMs); }
Example 16
Source File: OtherFormsOfHistoryDialogFragment.java From 365browser with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.other_forms_of_history_dialog, null); // Linkify the <link></link> span in the dialog text. TextView textView = (TextView) view.findViewById(R.id.text); final SpannableString textWithLink = SpanApplier.applySpans( textView.getText().toString(), new SpanApplier.SpanInfo("<link>", "</link>", new NoUnderlineClickableSpan() { @Override public void onClick(View widget) { new TabDelegate(false /* incognito */).launchUrl( WEB_HISTORY_URL, TabLaunchType.FROM_CHROME_UI); } })); textView.setText(textWithLink); textView.setMovementMethod(LinkMovementMethod.getInstance()); // Construct the dialog. AlertDialog dialog = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) .setView(view) .setTitle(R.string.clear_browsing_data_history_dialog_title) .setPositiveButton( R.string.ok_got_it, this) .create(); dialog.setCanceledOnTouchOutside(false); return dialog; }
Example 17
Source File: BluetoothChooserDialog.java From 365browser with Apache License 2.0 | 4 votes |
/** * Show the BluetoothChooserDialog. */ @VisibleForTesting void show() { // Emphasize the origin. Profile profile = Profile.getLastUsedProfile(); SpannableString origin = new SpannableString(mOrigin); OmniboxUrlEmphasizer.emphasizeUrl( origin, mActivity.getResources(), profile, mSecurityLevel, false, true, true); // Construct a full string and replace the origin text with emphasized version. SpannableString title = new SpannableString(mActivity.getString(R.string.bluetooth_dialog_title, mOrigin)); int start = title.toString().indexOf(mOrigin); TextUtils.copySpansFrom(origin, 0, origin.length(), Object.class, title, start); String noneFound = mActivity.getString(R.string.bluetooth_not_found); SpannableString searching = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_searching), new SpanInfo("<link>", "</link>", new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity))); String positiveButton = mActivity.getString(R.string.bluetooth_confirm_button); SpannableString statusIdleNoneFound = SpanApplier.applySpans(mActivity.getString(R.string.bluetooth_not_seeing_it_idle), new SpanInfo("<link1>", "</link1>", new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity)), new SpanInfo("<link2>", "</link2>", new BluetoothClickableSpan(LinkType.RESTART_SEARCH, mActivity))); SpannableString statusActive = searching; SpannableString statusIdleSomeFound = statusIdleNoneFound; ItemChooserDialog.ItemChooserLabels labels = new ItemChooserDialog.ItemChooserLabels(title, searching, noneFound, statusActive, statusIdleNoneFound, statusIdleSomeFound, positiveButton); mItemChooserDialog = new ItemChooserDialog(mActivity, this, labels); mActivity.registerReceiver(mLocationModeBroadcastReceiver, new IntentFilter(LocationManager.MODE_CHANGED_ACTION)); mIsLocationModeChangedReceiverRegistered = true; }
Example 18
Source File: UsbChooserDialog.java From 365browser with Apache License 2.0 | 4 votes |
/** * Shows the UsbChooserDialog. * * @param activity Activity which is used for launching a dialog. * @param origin The origin for the site wanting to connect to the USB device. * @param securityLevel The security level of the connection to the site wanting to connect to * the USB device. For valid values see SecurityStateModel::SecurityLevel. */ @VisibleForTesting void show(Activity activity, String origin, int securityLevel) { // Emphasize the origin. Profile profile = Profile.getLastUsedProfile(); SpannableString originSpannableString = new SpannableString(origin); OmniboxUrlEmphasizer.emphasizeUrl(originSpannableString, activity.getResources(), profile, securityLevel, false /* isInternalPage */, true /* useDarkColors */, true /* emphasizeHttpsScheme */); // Construct a full string and replace the origin text with emphasized version. SpannableString title = new SpannableString(activity.getString(R.string.usb_chooser_dialog_prompt, origin)); int start = title.toString().indexOf(origin); TextUtils.copySpansFrom(originSpannableString, 0, originSpannableString.length(), Object.class, title, start); String searching = ""; String noneFound = activity.getString(R.string.usb_chooser_dialog_no_devices_found_prompt); SpannableString statusActive = SpanApplier.applySpans( activity.getString(R.string.usb_chooser_dialog_footnote_text), new SpanInfo("<link>", "</link>", new NoUnderlineClickableSpan() { @Override public void onClick(View view) { if (mNativeUsbChooserDialogPtr == 0) { return; } nativeLoadUsbHelpPage(mNativeUsbChooserDialogPtr); // Get rid of the highlight background on selection. view.invalidate(); } })); SpannableString statusIdleNoneFound = statusActive; SpannableString statusIdleSomeFound = statusActive; String positiveButton = activity.getString(R.string.usb_chooser_dialog_connect_button_text); ItemChooserDialog.ItemChooserLabels labels = new ItemChooserDialog.ItemChooserLabels(title, searching, noneFound, statusActive, statusIdleNoneFound, statusIdleSomeFound, positiveButton); mItemChooserDialog = new ItemChooserDialog(activity, this, labels); }
Example 19
Source File: BluetoothChooserDialog.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Show the BluetoothChooserDialog. */ @VisibleForTesting void show() { // Emphasize the origin. Profile profile = Profile.getLastUsedProfile(); SpannableString origin = new SpannableString(mOrigin); OmniboxUrlEmphasizer.emphasizeUrl( origin, mActivity.getResources(), profile, mSecurityLevel, false, true, true); // Construct a full string and replace the origin text with emphasized version. SpannableString title = new SpannableString(mActivity.getString(R.string.bluetooth_dialog_title, mOrigin)); int start = title.toString().indexOf(mOrigin); TextUtils.copySpansFrom(origin, 0, origin.length(), Object.class, title, start); String noneFound = mActivity.getString(R.string.bluetooth_not_found); SpannableString searching = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_searching), new SpanInfo("<link>", "</link>", new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity))); String positiveButton = mActivity.getString(R.string.bluetooth_confirm_button); SpannableString statusIdleNoneFound = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_not_seeing_it_idle_none_found), new SpanInfo("<link1>", "</link1>", new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity)), new SpanInfo("<link2>", "</link2>", new BluetoothClickableSpan(LinkType.RESTART_SEARCH, mActivity))); SpannableString statusActive = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_not_seeing_it), new SpanInfo("<link>", "</link>", new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity))); SpannableString statusIdleSomeFound = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_not_seeing_it_idle_some_found), new SpanInfo("<link1>", "</link1>", new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity)), new SpanInfo("<link2>", "</link2>", new BluetoothClickableSpan(LinkType.RESTART_SEARCH, mActivity))); ItemChooserDialog.ItemChooserLabels labels = new ItemChooserDialog.ItemChooserLabels(title, searching, noneFound, statusActive, statusIdleNoneFound, statusIdleSomeFound, positiveButton); mItemChooserDialog = new ItemChooserDialog(mActivity, this, labels); mActivity.registerReceiver(mLocationModeBroadcastReceiver, new IntentFilter(LocationManager.MODE_CHANGED_ACTION)); mIsLocationModeChangedReceiverRegistered = true; }
Example 20
Source File: BluetoothChooserDialog.java From delion with Apache License 2.0 | 4 votes |
private boolean checkLocationServicesAndPermission() { final boolean havePermission = LocationUtils.getInstance().hasAndroidLocationPermission(mActivity); final boolean locationServicesOn = LocationUtils.getInstance().isSystemLocationSettingEnabled(mActivity); if (!havePermission && !mWindowAndroid.canRequestPermission( Manifest.permission.ACCESS_COARSE_LOCATION)) { // Immediately close the dialog because the user has asked Chrome not to request the // location permission. finishDialog(DIALOG_FINISHED_DENIED_PERMISSION, ""); return false; } // Compute the message to show the user. final SpanInfo permissionSpan = new SpanInfo("<permission_link>", "</permission_link>", new BluetoothClickableSpan(LinkType.REQUEST_LOCATION_PERMISSION, mActivity)); final SpanInfo servicesSpan = new SpanInfo("<services_link>", "</services_link>", new BluetoothClickableSpan(LinkType.REQUEST_LOCATION_SERVICES, mActivity)); final SpannableString needLocationMessage; if (havePermission) { if (locationServicesOn) { // We don't need to request anything. return true; } else { needLocationMessage = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_need_location_services_on), servicesSpan); } } else { if (locationServicesOn) { needLocationMessage = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_need_location_permission), permissionSpan); } else { needLocationMessage = SpanApplier.applySpans( mActivity.getString( R.string.bluetooth_need_location_permission_and_services_on), permissionSpan, servicesSpan); } } SpannableString needLocationStatus = SpanApplier.applySpans( mActivity.getString(R.string.bluetooth_need_location_permission_help), new SpanInfo("<link>", "</link>", new BluetoothClickableSpan( LinkType.NEED_LOCATION_PERMISSION_HELP, mActivity))); mItemChooserDialog.setErrorState(needLocationMessage, needLocationStatus); return false; }