diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-05 21:37:45 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-06 02:40:49 -0600 |
commit | 7db0fa915ef909ad33b9b29754e1fd1e7ed260a9 (patch) | |
tree | 77742b284864e2d875fc8b4be56842282e0e2746 /ui/src/main/res/layout | |
parent | e424765a615f95fd98d90b0e54282fa1f0a86392 (diff) |
AppListDialogFragment: support both inclusion and exclusion
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/res/layout')
-rw-r--r-- | ui/src/main/res/layout/app_list_dialog_fragment.xml | 60 | ||||
-rw-r--r-- | ui/src/main/res/layout/app_list_item.xml | 6 | ||||
-rw-r--r-- | ui/src/main/res/layout/tunnel_editor_fragment.xml | 4 | ||||
-rw-r--r-- | ui/src/main/res/layout/tunnel_editor_peer.xml | 2 |
4 files changed, 46 insertions, 26 deletions
diff --git a/ui/src/main/res/layout/app_list_dialog_fragment.xml b/ui/src/main/res/layout/app_list_dialog_fragment.xml index 7a9b1eb1..4503de15 100644 --- a/ui/src/main/res/layout/app_list_dialog_fragment.xml +++ b/ui/src/main/res/layout/app_list_dialog_fragment.xml @@ -18,30 +18,50 @@ type="com.wireguard.android.databinding.ObservableKeyedArrayList<String, ApplicationData>" /> </data> - <FrameLayout + <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:minHeight="200dp"> - - <ProgressBar - android:id="@+id/progress_bar" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:indeterminate="true" - android:visibility="@{appData.isEmpty() ? View.VISIBLE : View.GONE}" - tools:visibility="gone" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/app_list" + android:orientation="vertical"> + + <com.google.android.material.tabs.TabLayout + android:id="@+id/tabs" + style="@style/Widget.MaterialComponents.TabLayout.Colored" android:layout_width="match_parent" - android:layout_height="match_parent" - app:items="@{appData}" - app:layout="@{@layout/app_list_item}" - tools:itemCount="10" - tools:listitem="@layout/app_list_item" /> + android:layout_height="wrap_content"> + + <com.google.android.material.tabs.TabItem + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/exclude_from_tunnel" /> - </FrameLayout> + <com.google.android.material.tabs.TabItem + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/include_in_tunnel" /> + </com.google.android.material.tabs.TabLayout> + + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:minHeight="200dp"> + <ProgressBar + android:id="@+id/progress_bar" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:indeterminate="true" + android:visibility="@{appData.isEmpty() ? View.VISIBLE : View.GONE}" + tools:visibility="gone" /> + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/app_list" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:items="@{appData}" + app:layout="@{@layout/app_list_item}" + tools:itemCount="10" + tools:listitem="@layout/app_list_item" /> + </FrameLayout> + </LinearLayout> </layout> diff --git a/ui/src/main/res/layout/app_list_item.xml b/ui/src/main/res/layout/app_list_item.xml index 5ce7a8a5..e4e4483c 100644 --- a/ui/src/main/res/layout/app_list_item.xml +++ b/ui/src/main/res/layout/app_list_item.xml @@ -24,7 +24,7 @@ android:layout_height="wrap_content" android:background="@drawable/list_item_background" android:gravity="center_vertical" - android:onClick="@{(view) -> item.setExcludedFromTunnel(!item.excludedFromTunnel)}" + android:onClick="@{(view) -> item.setSelected(!item.selected)}" android:orientation="horizontal" android:paddingTop="8dp" android:paddingBottom="8dp"> @@ -51,10 +51,10 @@ tools:text="@tools:sample/full_names" /> <CheckBox - android:id="@+id/excluded_checkbox" + android:id="@+id/selected_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:checked="@={item.excludedFromTunnel}" + android:checked="@={item.selected}" tools:checked="true" /> </LinearLayout> diff --git a/ui/src/main/res/layout/tunnel_editor_fragment.xml b/ui/src/main/res/layout/tunnel_editor_fragment.xml index d5724c11..5f84e5f7 100644 --- a/ui/src/main/res/layout/tunnel_editor_fragment.xml +++ b/ui/src/main/res/layout/tunnel_editor_fragment.xml @@ -220,8 +220,8 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="4dp" - android:onClick="@{fragment::onRequestSetExcludedApplications}" - android:text="@{@plurals/set_excluded_applications(config.interface.excludedApplications.size, config.interface.excludedApplications.size)}" + android:onClick="@{fragment::onRequestSetExcludedIncludedApplications}" + android:text="@{config.interface.includedApplications.size > 0 ? @plurals/set_included_applications(config.interface.includedApplications.size, config.interface.includedApplications.size) : config.interface.excludedApplications.size > 0 ? @plurals/set_excluded_applications(config.interface.excludedApplications.size, config.interface.excludedApplications.size) : @string/all_applications}" android:textColor="?attr/colorSecondary" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/ui/src/main/res/layout/tunnel_editor_peer.xml b/ui/src/main/res/layout/tunnel_editor_peer.xml index f00a6d26..d17378f2 100644 --- a/ui/src/main/res/layout/tunnel_editor_peer.xml +++ b/ui/src/main/res/layout/tunnel_editor_peer.xml @@ -159,7 +159,7 @@ </com.google.android.material.textfield.TextInputLayout> <CheckBox - android:id="@+id/excluded_checkbox" + android:id="@+id/selected_checkbox" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginStart="4dp" |