Commit be01902c authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Download location: hide the radio button if there is no SD card option.

This CL hides the radio button when there is only default download
directory option.

Also tweaks the layout a little bit, so the radio button and the text
can align with the "Download location" title in the preference UI.


Bug: 850586
Change-Id: Id686ee8e8d06bd477606f62741386095fa11c31c
Reviewed-on: https://chromium-review.googlesource.com/1098296Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567050}
parent 5b66ed28
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
android:id="@+id/radio_button" android:id="@+id/radio_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="6dp" android:layout_marginStart="10dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="6dp"
android:importantForAccessibility="no" /> android:importantForAccessibility="no" />
<LinearLayout <LinearLayout
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginStart="10dp"
android:layout_gravity="center_vertical" > android:layout_gravity="center_vertical" >
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
......
...@@ -57,6 +57,9 @@ public class DownloadLocationPreferenceAdapter ...@@ -57,6 +57,9 @@ public class DownloadLocationPreferenceAdapter
radioButton.setTag(position); radioButton.setTag(position);
radioButton.setOnClickListener(this); radioButton.setOnClickListener(this);
// Only show the radio button when there are multiple items.
if (getCount() <= 1) radioButton.setVisibility(View.GONE);
view.setEnabled(isEnabled(position)); view.setEnabled(isEnabled(position));
DirectoryOption directoryOption = (DirectoryOption) getItem(position); DirectoryOption directoryOption = (DirectoryOption) getItem(position);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment