| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.Manifest; | 7 import android.Manifest; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.content.BroadcastReceiver; | 9 import android.content.BroadcastReceiver; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 Profile profile = Profile.getLastUsedProfile(); | 117 Profile profile = Profile.getLastUsedProfile(); |
| 118 SpannableString origin = new SpannableString(mOrigin); | 118 SpannableString origin = new SpannableString(mOrigin); |
| 119 OmniboxUrlEmphasizer.emphasizeUrl( | 119 OmniboxUrlEmphasizer.emphasizeUrl( |
| 120 origin, mActivity.getResources(), profile, mSecurityLevel, false
, true, true); | 120 origin, mActivity.getResources(), profile, mSecurityLevel, false
, true, true); |
| 121 // Construct a full string and replace the origin text with emphasized v
ersion. | 121 // Construct a full string and replace the origin text with emphasized v
ersion. |
| 122 SpannableString title = | 122 SpannableString title = |
| 123 new SpannableString(mActivity.getString(R.string.bluetooth_dialo
g_title, mOrigin)); | 123 new SpannableString(mActivity.getString(R.string.bluetooth_dialo
g_title, mOrigin)); |
| 124 int start = title.toString().indexOf(mOrigin); | 124 int start = title.toString().indexOf(mOrigin); |
| 125 TextUtils.copySpansFrom(origin, 0, origin.length(), Object.class, title,
start); | 125 TextUtils.copySpansFrom(origin, 0, origin.length(), Object.class, title,
start); |
| 126 | 126 |
| 127 String message = mActivity.getString(R.string.bluetooth_not_found); | 127 String noneFound = mActivity.getString(R.string.bluetooth_not_found); |
| 128 SpannableString noneFound = SpanApplier.applySpans( | |
| 129 message, new SpanInfo("<link>", "</link>", | |
| 130 new BluetoothClickableSpan(LinkType.RESTART_SEA
RCH, mActivity))); | |
| 131 | 128 |
| 132 SpannableString searching = SpanApplier.applySpans( | 129 SpannableString searching = SpanApplier.applySpans( |
| 133 mActivity.getString(R.string.bluetooth_searching), | 130 mActivity.getString(R.string.bluetooth_searching), |
| 134 new SpanInfo("<link>", "</link>", | 131 new SpanInfo("<link>", "</link>", |
| 135 new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, m
Activity))); | 132 new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, m
Activity))); |
| 136 | 133 |
| 137 String positiveButton = mActivity.getString(R.string.bluetooth_confirm_b
utton); | 134 String positiveButton = mActivity.getString(R.string.bluetooth_confirm_b
utton); |
| 138 | 135 |
| 139 SpannableString statusIdleNoneFound = SpanApplier.applySpans( | 136 SpannableString statusIdleNoneFound = SpanApplier.applySpans( |
| 140 mActivity.getString(R.string.bluetooth_not_seeing_it_idle_none_f
ound), | 137 mActivity.getString(R.string.bluetooth_not_seeing_it_idle_none_f
ound), |
| 141 new SpanInfo("<link>", "</link>", | 138 new SpanInfo("<link1>", "</link1>", |
| 142 new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, m
Activity))); | 139 new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, m
Activity)), |
| 140 new SpanInfo("<link2>", "</link2>", |
| 141 new BluetoothClickableSpan(LinkType.RESTART_SEARCH, mAct
ivity))); |
| 143 | 142 |
| 144 SpannableString statusActive = SpanApplier.applySpans( | 143 SpannableString statusActive = SpanApplier.applySpans( |
| 145 mActivity.getString(R.string.bluetooth_not_seeing_it), | 144 mActivity.getString(R.string.bluetooth_not_seeing_it), |
| 146 new SpanInfo("<link>", "</link>", | 145 new SpanInfo("<link>", "</link>", |
| 147 new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, m
Activity))); | 146 new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, m
Activity))); |
| 148 | 147 |
| 149 SpannableString statusIdleSomeFound = SpanApplier.applySpans( | 148 SpannableString statusIdleSomeFound = SpanApplier.applySpans( |
| 150 mActivity.getString(R.string.bluetooth_not_seeing_it_idle_some_f
ound), | 149 mActivity.getString(R.string.bluetooth_not_seeing_it_idle_some_f
ound), |
| 151 new SpanInfo("<link1>", "</link1>", | 150 new SpanInfo("<link1>", "</link1>", |
| 152 new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, m
Activity)), | 151 new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, m
Activity)), |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 @VisibleForTesting | 401 @VisibleForTesting |
| 403 native void nativeRestartSearch(long nativeBluetoothChooserAndroid); | 402 native void nativeRestartSearch(long nativeBluetoothChooserAndroid); |
| 404 // Help links. | 403 // Help links. |
| 405 @VisibleForTesting | 404 @VisibleForTesting |
| 406 native void nativeShowBluetoothOverviewLink(long nativeBluetoothChooserAndro
id); | 405 native void nativeShowBluetoothOverviewLink(long nativeBluetoothChooserAndro
id); |
| 407 @VisibleForTesting | 406 @VisibleForTesting |
| 408 native void nativeShowBluetoothAdapterOffLink(long nativeBluetoothChooserAnd
roid); | 407 native void nativeShowBluetoothAdapterOffLink(long nativeBluetoothChooserAnd
roid); |
| 409 @VisibleForTesting | 408 @VisibleForTesting |
| 410 native void nativeShowNeedLocationPermissionLink(long nativeBluetoothChooser
Android); | 409 native void nativeShowNeedLocationPermissionLink(long nativeBluetoothChooser
Android); |
| 411 } | 410 } |
| OLD | NEW |