OSDN Git Service

am 1675c786: Merge "Made Bluetooth device dialog fully scrollable." into lmp-dev
authorPauloftheWest <paulofthewest@google.com>
Wed, 10 Sep 2014 22:20:37 +0000 (22:20 +0000)
committerAndroid Git Automerger <android-git-automerger@android.com>
Wed, 10 Sep 2014 22:20:37 +0000 (22:20 +0000)
* commit '1675c786bfe213cce0d454d9eaf5fb51b4b4520c':
  Made Bluetooth device dialog fully scrollable.

res/layout/bluetooth_device_settings.xml
res/layout/bluetooth_preference_category.xml
res/layout/preference_progress_category.xml
src/com/android/settings/bluetooth/BluetoothSettings.java

index b87551a..b65ca0f 100644 (file)
         android:orientation="vertical"
         android:gravity="center">
 
-    <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/bt_item" >
-
-            <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/bluetooth_preference_paired_dialog_name_label"
-                    android:textAppearance="@android:style/TextAppearance.Material.Body1"
-                    android:textColor="?android:attr/textColorSecondary"
-                    android:textDirection="locale"
-                    style="@style/bt_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/bt_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.DeviceProfilesSettings" />
 
-    </LinearLayout>
-
 </LinearLayout>
index 59a3e87..2b9a29a 100644 (file)
@@ -22,4 +22,5 @@
     android:textAppearance="@android:style/TextAppearance.Material.Body1"
     android:textColor="?android:attr/textColorSecondary"
     android:paddingTop="16dip"
+    android:paddingStart="16dip"
     android:paddingBottom="16dip" />
index 5859fbf..1776fec 100644 (file)
@@ -31,6 +31,7 @@
         android:background="@null"
         android:id="@+android:id/title"
         android:paddingStart="0dp"
+        android:paddingTop="6dp"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"
@@ -40,6 +41,7 @@
     <ProgressBar
         android:id="@+id/scanning_progress"
         android:text="@string/progress_scanning"
+        android:paddingTop="6dp"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
index a084137..1282409 100755 (executable)
@@ -44,6 +44,7 @@ import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.EditText;
 import android.widget.TextView;
 
@@ -322,7 +323,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
                 mMyDevicePreference.setSummary(getResources().getString(
                             R.string.bluetooth_is_visible_message, mLocalAdapter.getName()));
                 mMyDevicePreference.setSelectable(false);
-                mMyDevicePreference.setEnabled(false);
                 preferenceScreen.addPreference(mMyDevicePreference);
 
                 getActivity().invalidateOptionsMenu();
@@ -401,11 +401,17 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
                     parent.removeView(mSettingsDialogView);
                 }
             }
+
             if (profileFrag == null) {
                 LayoutInflater inflater = getActivity().getLayoutInflater();
                 mSettingsDialogView = inflater.inflate(R.layout.bluetooth_device_settings, null);
                 profileFrag = (DeviceProfilesSettings)activity.getFragmentManager()
                     .findFragmentById(R.id.bluetooth_fragment_settings);
+
+                // To enable scrolling we store the name field in a seperate header and add to
+                // the ListView of the profileFrag.
+                View header = inflater.inflate(R.layout.bluetooth_device_settings_header, null);
+                profileFrag.getListView().addHeaderView(header);
             }
 
             final View dialogLayout = mSettingsDialogView;
@@ -439,6 +445,10 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
             AlertDialog dialog = settingsDialog.create();
             dialog.create();
             dialog.show();
+
+            // We must ensure that clicking on the EditText will bring up the keyboard.
+            dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+                    | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
         }
     };