Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1179)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java

Issue 2018213002: Set the Bluetooth chooser list height to cut through the middle of a list item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Remove an unnecessary cast. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java
index e5144655389507f77126e99a407ff09c838bcc1a..3483a645626c69f58936686326bf4dde328c5443 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser;
import android.Manifest;
+import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -45,7 +46,7 @@ public class BluetoothChooserDialog
// Always equal to mWindowAndroid.getActivity().get(), but stored separately to make sure it's
// not GC'ed.
- final Context mContext;
+ final Activity mActivity;
// The dialog to show to let the user pick a device.
ItemChooserDialog mItemChooserDialog;
@@ -77,8 +78,8 @@ public class BluetoothChooserDialog
BluetoothChooserDialog(WindowAndroid windowAndroid, String origin, int securityLevel,
long nativeBluetoothChooserDialogPtr) {
mWindowAndroid = windowAndroid;
- mContext = windowAndroid.getActivity().get();
- assert mContext != null;
+ mActivity = windowAndroid.getActivity().get();
+ assert mActivity != null;
mOrigin = origin;
mSecurityLevel = securityLevel;
mNativeBluetoothChooserDialogPtr = nativeBluetoothChooserDialogPtr;
@@ -93,41 +94,41 @@ public class BluetoothChooserDialog
Profile profile = Profile.getLastUsedProfile();
SpannableString origin = new SpannableString(mOrigin);
OmniboxUrlEmphasizer.emphasizeUrl(
- origin, mContext.getResources(), profile, mSecurityLevel, false, true, true);
+ origin, mActivity.getResources(), profile, mSecurityLevel, false, true, true);
// Construct a full string and replace the origin text with emphasized version.
SpannableString title =
- new SpannableString(mContext.getString(R.string.bluetooth_dialog_title, mOrigin));
+ 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 message = mContext.getString(R.string.bluetooth_not_found);
+ String message = mActivity.getString(R.string.bluetooth_not_found);
SpannableString noneFound = SpanApplier.applySpans(
message, new SpanInfo("<link>", "</link>",
- new BluetoothClickableSpan(LinkType.RESTART_SEARCH, mContext)));
+ new BluetoothClickableSpan(LinkType.RESTART_SEARCH, mActivity)));
SpannableString searching = SpanApplier.applySpans(
- mContext.getString(R.string.bluetooth_searching),
+ mActivity.getString(R.string.bluetooth_searching),
new SpanInfo("<link>", "</link>",
- new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mContext)));
+ new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity)));
- String positiveButton = mContext.getString(R.string.bluetooth_confirm_button);
+ String positiveButton = mActivity.getString(R.string.bluetooth_confirm_button);
SpannableString statusIdleNoneFound = SpanApplier.applySpans(
- mContext.getString(R.string.bluetooth_not_seeing_it_idle_none_found),
+ mActivity.getString(R.string.bluetooth_not_seeing_it_idle_none_found),
new SpanInfo("<link>", "</link>",
- new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mContext)));
+ new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity)));
SpannableString statusIdleSomeFound = SpanApplier.applySpans(
- mContext.getString(R.string.bluetooth_not_seeing_it_idle_some_found),
+ mActivity.getString(R.string.bluetooth_not_seeing_it_idle_some_found),
new SpanInfo("<link1>", "</link1>",
- new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mContext)),
+ new BluetoothClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mActivity)),
new SpanInfo("<link2>", "</link2>",
- new BluetoothClickableSpan(LinkType.RESTART_SEARCH, mContext)));
+ new BluetoothClickableSpan(LinkType.RESTART_SEARCH, mActivity)));
ItemChooserDialog.ItemChooserLabels labels =
new ItemChooserDialog.ItemChooserLabels(title, searching, noneFound,
statusIdleNoneFound, statusIdleSomeFound, positiveButton);
- mItemChooserDialog = new ItemChooserDialog(mContext, this, labels);
+ mItemChooserDialog = new ItemChooserDialog(mActivity, this, labels);
}
@Override
@@ -174,16 +175,16 @@ public class BluetoothChooserDialog
}
SpannableString needLocationMessage = SpanApplier.applySpans(
- mContext.getString(R.string.bluetooth_need_location_permission),
+ mActivity.getString(R.string.bluetooth_need_location_permission),
new SpanInfo("<link>", "</link>",
new BluetoothClickableSpan(
- LinkType.REQUEST_LOCATION_PERMISSION, mContext)));
+ LinkType.REQUEST_LOCATION_PERMISSION, mActivity)));
SpannableString needLocationStatus = SpanApplier.applySpans(
- mContext.getString(R.string.bluetooth_need_location_permission_help),
+ mActivity.getString(R.string.bluetooth_need_location_permission_help),
new SpanInfo("<link>", "</link>",
new BluetoothClickableSpan(
- LinkType.NEED_LOCATION_PERMISSION_HELP, mContext)));
+ LinkType.NEED_LOCATION_PERMISSION_HELP, mActivity)));
mItemChooserDialog.setErrorState(needLocationMessage, needLocationStatus);
}
@@ -292,13 +293,13 @@ public class BluetoothChooserDialog
@CalledByNative
void notifyAdapterTurnedOff() {
SpannableString adapterOffMessage = SpanApplier.applySpans(
- mContext.getString(R.string.bluetooth_adapter_off),
+ mActivity.getString(R.string.bluetooth_adapter_off),
new SpanInfo("<link>", "</link>",
- new BluetoothClickableSpan(LinkType.ADAPTER_OFF, mContext)));
+ new BluetoothClickableSpan(LinkType.ADAPTER_OFF, mActivity)));
SpannableString adapterOffStatus = SpanApplier.applySpans(
- mContext.getString(R.string.bluetooth_adapter_off_help),
+ mActivity.getString(R.string.bluetooth_adapter_off_help),
new SpanInfo("<link>", "</link>",
- new BluetoothClickableSpan(LinkType.ADAPTER_OFF_HELP, mContext)));
+ new BluetoothClickableSpan(LinkType.ADAPTER_OFF_HELP, mActivity)));
mItemChooserDialog.setErrorState(adapterOffMessage, adapterOffStatus);
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698