summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauloftheWest <paulofthewest@google.com>2014-09-04 10:14:19 -0700
committerPauloftheWest <paulofthewest@google.com>2014-09-04 10:16:09 -0700
commite32220eedc7b369b439bb899fd9509966a68a223 (patch)
treea0410dcce06ba57512ce1076997d19913936a584
parentebe496ea7b18c5d702db4beee270046e43e491ad (diff)
downloadpackages_apps_Settings-e32220eedc7b369b439bb899fd9509966a68a223.zip
packages_apps_Settings-e32220eedc7b369b439bb899fd9509966a68a223.tar.gz
packages_apps_Settings-e32220eedc7b369b439bb899fd9509966a68a223.tar.bz2
Material theme updates for Bluetooth Device picker.
Bug: 17303554 Change-Id: I6eba8654ffb95ff6a9e31c43f8e2ba93df79280d
-rwxr-xr-xres/layout/bluetooth_device_picker.xml28
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/xml/device_picker.xml5
-rw-r--r--src/com/android/settings/bluetooth/DevicePickerFragment.java29
4 files changed, 32 insertions, 34 deletions
diff --git a/res/layout/bluetooth_device_picker.xml b/res/layout/bluetooth_device_picker.xml
index 833a7b3..16e421f 100755
--- a/res/layout/bluetooth_device_picker.xml
+++ b/res/layout/bluetooth_device_picker.xml
@@ -20,33 +20,9 @@
android:layout_height="wrap_content"
android:orientation="vertical">
- <LinearLayout android:id="@+id/dialog_layout"
+ <fragment android:id="@+id/bluetooth_fragment_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingBottom="@dimen/bluetooth_dialog_padding"
- style="@style/wifi_item" >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/bluetooth_preference_paired_dialog_name_label"
- android:textDirection="locale"
- style="@style/wifi_item_label" />
-
- <EditText android:id="@+id/name"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:inputType="textNoSuggestions"
- android:maxLength="@integer/bluetooth_name_length"
- android:singleLine="true"
- style="@style/wifi_item_edit_content" />
-
- <fragment android:id="@+id/bluetooth_fragment_settings"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- class="com.android.settings.bluetooth.DevicePickerFragment" />
-
- </LinearLayout>
+ class="com.android.settings.bluetooth.DevicePickerFragment" />
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 96f57cb..50ad8e3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -315,8 +315,8 @@
<!-- Bluetooth settings screen, menu to show the list of received files [CHAR LIMIT=30] -->
<string name="bluetooth_show_received_files">Show received files</string>
- <!-- Strings for BluetoothDevicePicker -->
- <string name="device_picker">Bluetooth device chooser</string>
+ <!-- Strings for BluetoothDevicePicker [CHAR LIMIT=40]-->
+ <string name="device_picker">Choose Bluetooth device</string>
<!-- Strings for dialog title when asking to the user whether to allow an app to enable discovery mode -->
<string name="bluetooth_permission_request">"Bluetooth permission request"</string>
diff --git a/res/xml/device_picker.xml b/res/xml/device_picker.xml
index 9fef34d..fd043a2 100644
--- a/res/xml/device_picker.xml
+++ b/res/xml/device_picker.xml
@@ -17,13 +17,8 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
- <Preference
- android:key="bt_scan"
- android:title="@string/bluetooth_preference_scan_title" />
-
<com.android.settings.bluetooth.BluetoothProgressCategory
android:key="bt_device_list"
- android:title="@string/bluetooth_preference_found_devices"
android:orderingFromXml="false" />
</PreferenceScreen>
diff --git a/src/com/android/settings/bluetooth/DevicePickerFragment.java b/src/com/android/settings/bluetooth/DevicePickerFragment.java
index 4b6a6b0..354d03c 100644
--- a/src/com/android/settings/bluetooth/DevicePickerFragment.java
+++ b/src/com/android/settings/bluetooth/DevicePickerFragment.java
@@ -17,7 +17,6 @@
package com.android.settings.bluetooth;
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
-
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevicePicker;
@@ -25,6 +24,9 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserManager;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import com.android.settings.R;
@@ -33,6 +35,7 @@ import com.android.settings.R;
* connection management.
*/
public final class DevicePickerFragment extends DeviceListPreferenceFragment {
+ private static final int MENU_ID_REFRESH = Menu.FIRST;
public DevicePickerFragment() {
super(null /* Not tied to any user restrictions. */);
@@ -56,12 +59,36 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
}
@Override
+ void initDevicePreference(BluetoothDevicePreference preference) {
+ preference.setWidgetLayoutResource(R.layout.preference_empty_list);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ menu.add(Menu.NONE, MENU_ID_REFRESH, 0, R.string.bluetooth_search_for_devices)
+ .setEnabled(true)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ super.onCreateOptionsMenu(menu, inflater);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case MENU_ID_REFRESH:
+ mLocalAdapter.startScanning(true);
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivity().setTitle(getString(R.string.device_picker));
UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
mStartScanOnResume = !um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)
&& (savedInstanceState == null); // don't start scan after rotation
+ setHasOptionsMenu(true);
}
@Override