Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e73c521 authored by PauloftheWest's avatar PauloftheWest Committed by Android (Google) Code Review
Browse files

Merge "Material theme updates for Bluetooth Device picker." into lmp-dev

parents 92de681e e32220ee
Loading
Loading
Loading
Loading
+2 −26
Original line number Original line Diff line number Diff line
@@ -20,33 +20,9 @@
        android:layout_height="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        android:orientation="vertical">


    <LinearLayout android:id="@+id/dialog_layout"
            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"
        <fragment android:id="@+id/bluetooth_fragment_settings"
            android:layout_width="wrap_content"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_height="wrap_content"
            class="com.android.settings.bluetooth.DevicePickerFragment" />
            class="com.android.settings.bluetooth.DevicePickerFragment" />


</LinearLayout>
</LinearLayout>

</LinearLayout>
+2 −2
Original line number Original line Diff line number Diff line
@@ -315,8 +315,8 @@
    <!-- Bluetooth settings screen, menu to show the list of received files [CHAR LIMIT=30] -->
    <!-- Bluetooth settings screen, menu to show the list of received files [CHAR LIMIT=30] -->
    <string name="bluetooth_show_received_files">Show received files</string>
    <string name="bluetooth_show_received_files">Show received files</string>


    <!-- Strings for BluetoothDevicePicker -->
    <!-- Strings for BluetoothDevicePicker [CHAR LIMIT=40]-->
    <string name="device_picker">Bluetooth device chooser</string>
    <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 -->
    <!-- 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>
    <string name="bluetooth_permission_request">"Bluetooth permission request"</string>
+0 −5
Original line number Original line Diff line number Diff line
@@ -17,13 +17,8 @@
<PreferenceScreen
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android">
    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
    <com.android.settings.bluetooth.BluetoothProgressCategory
        android:key="bt_device_list"
        android:key="bt_device_list"
        android:title="@string/bluetooth_preference_found_devices"
        android:orderingFromXml="false" />
        android:orderingFromXml="false" />


</PreferenceScreen>
</PreferenceScreen>
+28 −1
Original line number Original line Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.settings.bluetooth;
package com.android.settings.bluetooth;


import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevicePicker;
import android.bluetooth.BluetoothDevicePicker;
@@ -25,6 +24,9 @@ import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.os.Bundle;
import android.os.Bundle;
import android.os.UserManager;
import android.os.UserManager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;


import com.android.settings.R;
import com.android.settings.R;


@@ -33,6 +35,7 @@ import com.android.settings.R;
 * connection management.
 * connection management.
 */
 */
public final class DevicePickerFragment extends DeviceListPreferenceFragment {
public final class DevicePickerFragment extends DeviceListPreferenceFragment {
    private static final int MENU_ID_REFRESH = Menu.FIRST;


    public DevicePickerFragment() {
    public DevicePickerFragment() {
        super(null /* Not tied to any user restrictions. */);
        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);
        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
    @Override
    public void onCreate(Bundle savedInstanceState) {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.onCreate(savedInstanceState);
@@ -62,6 +88,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
        UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
        UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
        mStartScanOnResume = !um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)
        mStartScanOnResume = !um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)
                && (savedInstanceState == null);  // don't start scan after rotation
                && (savedInstanceState == null);  // don't start scan after rotation
        setHasOptionsMenu(true);
    }
    }


    @Override
    @Override