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 | |
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')
-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 | ||||
-rw-r--r-- | ui/src/main/res/values-de/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values-hi/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values-id/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values-it/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values-ja/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values-ru/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values-sl/strings.xml | 4 | ||||
-rw-r--r-- | ui/src/main/res/values-zh-rCN/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values/strings.xml | 18 |
13 files changed, 63 insertions, 45 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" diff --git a/ui/src/main/res/values-de/strings.xml b/ui/src/main/res/values-de/strings.xml index 6990f26e..61407b9a 100644 --- a/ui/src/main/res/values-de/strings.xml +++ b/ui/src/main/res/values-de/strings.xml @@ -76,7 +76,6 @@ <string name="error_root">Bitte root-Zugriff anfordern und erneut versuchen</string> <string name="error_up">Fehler beim Starten des Tunnels: %s</string> <string name="exclude_private_ips">Private IPs ausschließen</string> - <string name="excluded_applications">Ausgeschlossene Anwendungen</string> <string name="generate_new_private_key">Neuen privaten Schlüssel generieren</string> <string name="generic_error">Unbekannter „%s“ Fehler</string> <string name="hint_automatic">(auto)</string> @@ -142,7 +141,6 @@ <string name="restore_on_boot_title">Beim Neustart wiederherstellen</string> <string name="save">Speichern</string> <string name="select_all">Alle auswählen</string> - <string name="set_exclusions">Ausnahmen festlegen</string> <string name="settings">Einstellungen</string> <string name="shell_exit_status_read_error">Shell kann den Exit-Status nicht lesen</string> <string name="shell_marker_count_error">Die Shell erwartete 4 Marker, erhielt aber %d</string> diff --git a/ui/src/main/res/values-hi/strings.xml b/ui/src/main/res/values-hi/strings.xml index 69aff26b..19d970b8 100644 --- a/ui/src/main/res/values-hi/strings.xml +++ b/ui/src/main/res/values-hi/strings.xml @@ -72,7 +72,6 @@ <string name="error_root">कृपया रूट एक्सेस प्राप्त करें और पुनः प्रयास करें</string> <string name="error_up">टनल को लाने में त्रुटि: %s</string> <string name="exclude_private_ips">निजी आईपी को छोड़ दें</string> - <string name="excluded_applications">निकाले गए ऐप्स</string> <string name="generic_error">अज्ञात “%s” त्रुटि</string> <string name="hint_automatic">(ऑटो)</string> <string name="hint_generated">(उत्पन्न)</string> @@ -128,7 +127,6 @@ <string name="restore_on_boot_title">बूट पर पुनर्स्थापित करें</string> <string name="save">सहेजें</string> <string name="select_all">सभी का चयन करे</string> - <string name="set_exclusions">बहिष्करण सेट करें</string> <string name="settings">सेटिंग्स</string> <string name="shell_exit_status_read_error">शेल बाहर निकलने की स्थिति नहीं पढ़ सकता</string> <string name="shell_marker_count_error">शेल ने 4 मार्करों की अपेक्षा की, %d प्राप्त किया</string> diff --git a/ui/src/main/res/values-id/strings.xml b/ui/src/main/res/values-id/strings.xml index ba45ea22..ca3ba316 100644 --- a/ui/src/main/res/values-id/strings.xml +++ b/ui/src/main/res/values-id/strings.xml @@ -70,7 +70,6 @@ <string name="error_root">Izinkan akses root dan coba lagi</string> <string name="error_up">Kesalahan menambahkan tunel: %s</string> <string name="exclude_private_ips">Kecualikan IP pribadi</string> - <string name="excluded_applications">Kecualikan aplikasi</string> <string name="generate_new_private_key">Buat kunci privat baru</string> <string name="generic_error">Eror “%s” Tidak diketahui</string> <string name="hint_automatic">(otomatis)</string> @@ -136,7 +135,6 @@ <string name="restore_on_boot_title">Pulihkan saat boot</string> <string name="save">Simpan</string> <string name="select_all">Pilih semua</string> - <string name="set_exclusions">Tetapkan pengecualian</string> <string name="settings">Pengaturan</string> <string name="shell_exit_status_read_error">Shell tidak dapat membaca status keluar</string> <string name="shell_marker_count_error">Shell diharapkan 4 nilai, diterima %d</string> diff --git a/ui/src/main/res/values-it/strings.xml b/ui/src/main/res/values-it/strings.xml index eee91af1..0abd3c3a 100644 --- a/ui/src/main/res/values-it/strings.xml +++ b/ui/src/main/res/values-it/strings.xml @@ -76,7 +76,6 @@ <string name="error_root">Accedi come root e riprova</string> <string name="error_up">Errore di attivazione del tunnel: %s</string> <string name="exclude_private_ips">Escludi IP privati</string> - <string name="excluded_applications">Applicazioni escluse</string> <string name="generate_new_private_key">Genera nuova chiave privata</string> <string name="generic_error">Errore “%s” sconosciuto</string> <string name="hint_automatic">(auto)</string> @@ -142,7 +141,6 @@ <string name="restore_on_boot_title">Ripristina all\'avvio</string> <string name="save">Salva</string> <string name="select_all">Seleziona tutto</string> - <string name="set_exclusions">Imposta esclusioni</string> <string name="settings">Impostazioni</string> <string name="shell_exit_status_read_error">La shell non riesce a leggere lo stato di uscita</string> <string name="shell_marker_count_error">La shell si aspettava 4 marker, ne ha ricevuti %d</string> diff --git a/ui/src/main/res/values-ja/strings.xml b/ui/src/main/res/values-ja/strings.xml index f0ddc23d..f8054ab2 100644 --- a/ui/src/main/res/values-ja/strings.xml +++ b/ui/src/main/res/values-ja/strings.xml @@ -70,7 +70,6 @@ <string name="error_root">root 権限を取得して再試行してください</string> <string name="error_up">トンネル起動時エラー: %s</string> <string name="exclude_private_ips">プライベート IP アドレスを除外</string> - <string name="excluded_applications">対象外とするアプリケーション</string> <string name="generate_new_private_key">新しい秘密鍵を生成する</string> <string name="generic_error">未知の “%s” エラー</string> <string name="hint_automatic">(自動)</string> @@ -136,7 +135,6 @@ <string name="restore_on_boot_title">起動時に復元</string> <string name="save">保存</string> <string name="select_all">すべて選択</string> - <string name="set_exclusions">対象外アプリを設定</string> <string name="settings">設定</string> <string name="shell_exit_status_read_error">シェルは終了ステータスを取得できません</string> <string name="shell_marker_count_error">シェルは 4 マーカーを期待していますが、 %d マーカーを受け取りました</string> diff --git a/ui/src/main/res/values-ru/strings.xml b/ui/src/main/res/values-ru/strings.xml index 970176c2..5f9927a0 100644 --- a/ui/src/main/res/values-ru/strings.xml +++ b/ui/src/main/res/values-ru/strings.xml @@ -88,7 +88,6 @@ <string name="error_root">Пожалуйста, получите root-доступ и попробуйте снова</string> <string name="error_up">Ошибка при запуске туннеля: %s</string> <string name="exclude_private_ips">Исключить частные IP-адреса</string> - <string name="excluded_applications">Исключенные приложения</string> <string name="generate_new_private_key">Сгенерировать новый приватный ключ</string> <string name="generic_error">Неизвестная “%s” ошибка</string> <string name="hint_automatic">(авто)</string> @@ -154,7 +153,6 @@ <string name="restore_on_boot_title">Восстанавливать при загрузке</string> <string name="save">Сохранить</string> <string name="select_all">Выбрать все</string> - <string name="set_exclusions">ОК</string> <string name="settings">Настройки</string> <string name="shell_exit_status_read_error">Shell не может прочитать статус выхода</string> <string name="shell_marker_count_error">Shell ожидает 4 маркера, получено %d</string> diff --git a/ui/src/main/res/values-sl/strings.xml b/ui/src/main/res/values-sl/strings.xml index d0ad8316..4aa1dce6 100644 --- a/ui/src/main/res/values-sl/strings.xml +++ b/ui/src/main/res/values-sl/strings.xml @@ -65,7 +65,7 @@ <string name="config_file_exists_error">Konfiguracijska datoteka za „%s“ že obstaja</string> <string name="config_not_found_error">Konfiguracijske datoteke za „%s“ ni bilo mogoče najti</string> <string name="config_rename_error">Konfiguracijske datoteke za „%s“ ni bilo mogoče preimenovati</string> - <string name="config_save_error">Konfiguracijske datoteke za „%s“ ni bilo mogoče shraniti: %2$s</string> + <string name="config_save_error">Konfiguracijske datoteke za „%1$s“ ni bilo mogoče shraniti: %2$s</string> <string name="config_save_success">Konfiguracijska datoteka za „%s“ uspešno shranjena</string> <string name="create_activity_title">Ustvarite WireGuard tunel</string> <string name="create_bin_dir_error">Lokalnega imenika za aplikacijo ni bilo mogoče kreirati</string> @@ -88,7 +88,6 @@ <string name="error_root">Prosim omogočite root dostop in poskusite ponovno</string> <string name="error_up">Napaka pri vzpostavitvi tunela: %s</string> <string name="exclude_private_ips">Izključitev privatnih IP naslovov</string> - <string name="excluded_applications">Izključitev aplikacije</string> <string name="generate_new_private_key">Generiraj nov privatni ključ</string> <string name="generic_error">Neznana napaka „%s“</string> <string name="hint_automatic">(samodejno)</string> @@ -154,7 +153,6 @@ <string name="restore_on_boot_title">Ponovna vzpostavitev pri ponovnem zagonu</string> <string name="save">Shrani</string> <string name="select_all">Izbor vseh</string> - <string name="set_exclusions">Določite izključitve</string> <string name="settings">Nastavitve</string> <string name="shell_exit_status_read_error">Lupina ne more prebrati izhodnega statusa</string> <string name="shell_marker_count_error">Lupina je pričakovala 4 markerje, dobila pa je %d</string> diff --git a/ui/src/main/res/values-zh-rCN/strings.xml b/ui/src/main/res/values-zh-rCN/strings.xml index 45d20603..ca4e8fcd 100644 --- a/ui/src/main/res/values-zh-rCN/strings.xml +++ b/ui/src/main/res/values-zh-rCN/strings.xml @@ -70,7 +70,6 @@ <string name="error_root">请获取 root 权限并重试</string> <string name="error_up">建立连接时出错:%s</string> <string name="exclude_private_ips">排除局域网</string> - <string name="excluded_applications">排除的应用</string> <string name="generate_new_private_key">生成新的私钥</string> <string name="generic_error">未知的 “%s” 错误</string> <string name="hint_automatic">(自动)</string> @@ -136,7 +135,6 @@ <string name="restore_on_boot_title">启动时恢复</string> <string name="save">保存</string> <string name="select_all">全选</string> - <string name="set_exclusions">确定</string> <string name="settings">设置</string> <string name="shell_exit_status_read_error">Shell 无法读取退出状态</string> <string name="shell_marker_count_error">Shell 应获取 4 个标记,获取到 %d 个</string> diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index 50bc40b8..da0f0be7 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -24,6 +24,22 @@ <item quantity="one">%d Excluded Application</item> <item quantity="other">%d Excluded Applications</item> </plurals> + <plurals name="set_included_applications"> + <item quantity="one">%d Included Application</item> + <item quantity="other">%d Included Applications</item> + </plurals> + <string name="all_applications">All Applications</string> + <string name="exclude_from_tunnel">Exclude:</string> + <string name="include_in_tunnel">Include only:</string> + <plurals name="include_n_applications"> + <item quantity="one">Include %d apps</item> + <item quantity="other">Include %d apps</item> + </plurals> + <plurals name="exclude_n_applications"> + <item quantity="one">Exclude %d apps</item> + <item quantity="other">Exclude %d apps</item> + </plurals> + <string name="use_all_applications">Use all apps</string> <string name="add_peer">Add peer</string> <string name="addresses">Addresses</string> <string name="allow_remote_control_intents_summary_off">External apps may not toggle tunnels (recommended)</string> @@ -76,7 +92,6 @@ <string name="error_root">Please obtain root access and try again</string> <string name="error_up">Error bringing up tunnel: %s</string> <string name="exclude_private_ips">Exclude private IPs</string> - <string name="excluded_applications">Excluded Applications</string> <string name="generate_new_private_key">Generate new private key</string> <string name="generic_error">Unknown “%s” error</string> <string name="hint_automatic">(auto)</string> @@ -142,7 +157,6 @@ <string name="restore_on_boot_title">Restore on boot</string> <string name="save">Save</string> <string name="select_all">Select all</string> - <string name="set_exclusions">Set Exclusions</string> <string name="settings">Settings</string> <string name="shell_exit_status_read_error">Shell cannot read exit status</string> <string name="shell_marker_count_error">Shell expected 4 markers, received %d</string> |