Material theme updates for Bluetooth Device picker.

Bug: 17303554
Change-Id: I6eba8654ffb95ff6a9e31c43f8e2ba93df79280d
This commit is contained in:
PauloftheWest
2014-09-04 10:14:19 -07:00
parent ebe496ea7b
commit e32220eedc
4 changed files with 32 additions and 34 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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. */);
@@ -55,6 +58,29 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
mLaunchClass = intent.getStringExtra(BluetoothDevicePicker.EXTRA_LAUNCH_CLASS);
}
@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);
@@ -62,6 +88,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
mStartScanOnResume = !um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)
&& (savedInstanceState == null); // don't start scan after rotation
setHasOptionsMenu(true);
}
@Override