diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2020-03-24 12:12:25 +0530 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-03-26 00:49:01 -0600 |
commit | 63a395125aa40ab9f30f3479d8e005306a16bd78 (patch) | |
tree | 81c21b7d379fb7894998c82a2de576f48ef79ff1 /ui/src/main/res | |
parent | 6f973afa36b01698509440c85ec943e75ffed871 (diff) |
Introduce realtime log viewer
This contains a share button and a save button, the former using a
custom content provider.
Co-authored-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/res')
-rw-r--r-- | ui/src/main/res/drawable/ic_action_share_white.xml | 9 | ||||
-rw-r--r-- | ui/src/main/res/layout/log_viewer_activity.xml | 30 | ||||
-rw-r--r-- | ui/src/main/res/layout/log_viewer_entry.xml | 34 | ||||
-rw-r--r-- | ui/src/main/res/menu/log_viewer.xml | 9 | ||||
-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-night/colors.xml | 6 | ||||
-rw-r--r-- | ui/src/main/res/values-ru/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values-zh-rCN/strings.xml | 2 | ||||
-rw-r--r-- | ui/src/main/res/values/colors.xml | 5 | ||||
-rw-r--r-- | ui/src/main/res/values/strings.xml | 6 | ||||
-rw-r--r-- | ui/src/main/res/xml/preferences.xml | 5 |
14 files changed, 101 insertions, 15 deletions
diff --git a/ui/src/main/res/drawable/ic_action_share_white.xml b/ui/src/main/res/drawable/ic_action_share_white.xml new file mode 100644 index 00000000..4ada554b --- /dev/null +++ b/ui/src/main/res/drawable/ic_action_share_white.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/> +</vector> diff --git a/ui/src/main/res/layout/log_viewer_activity.xml b/ui/src/main/res/layout/log_viewer_activity.xml new file mode 100644 index 00000000..7a08bc88 --- /dev/null +++ b/ui/src/main/res/layout/log_viewer_activity.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright © 2020 WireGuard LLC. All Rights Reserved. + ~ SPDX-License-Identifier: Apache-2.0 + --> + +<androidx.coordinatorlayout.widget.CoordinatorLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:listitem="@layout/log_viewer_entry" + tools:itemCount="20" /> + + <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton + style="@style/Widget.MaterialComponents.ExtendedFloatingActionButton.Icon" + android:id="@+id/share_fab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom|end" + android:layout_margin="@dimen/fab_margin" + app:icon="@drawable/ic_action_share_white" /> + +</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/ui/src/main/res/layout/log_viewer_entry.xml b/ui/src/main/res/layout/log_viewer_entry.xml new file mode 100644 index 00000000..37f8941d --- /dev/null +++ b/ui/src/main/res/layout/log_viewer_entry.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright © 2020 WireGuard LLC. All Rights Reserved. + ~ SPDX-License-Identifier: Apache-2.0 + --> + +<androidx.constraintlayout.widget.ConstraintLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="6dp"> + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.MaterialComponents.Caption" + android:id="@+id/log_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="?android:attr/textColorPrimary" + android:textSize="10sp" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent" + tools:text="Fri Mar 13 10:17:37 GMT+05:30 2020" /> + + <com.google.android.material.textview.MaterialTextView + style="@style/TextAppearance.MaterialComponents.Caption" + android:id="@+id/log_msg" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="?android:attr/textColorPrimary" + app:layout_constraintTop_toBottomOf="@id/log_date" + tools:text="FATAL EXCEPTION: Thread-2" /> + +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/ui/src/main/res/menu/log_viewer.xml b/ui/src/main/res/menu/log_viewer.xml new file mode 100644 index 00000000..3a9da698 --- /dev/null +++ b/ui/src/main/res/menu/log_viewer.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/save_log" + android:icon="@drawable/ic_action_save" + android:title="@string/log_export_title" + app:showAsAction="ifRoom"/> +</menu> diff --git a/ui/src/main/res/values-hi/strings.xml b/ui/src/main/res/values-hi/strings.xml index c79341d7..bda0cbb2 100644 --- a/ui/src/main/res/values-hi/strings.xml +++ b/ui/src/main/res/values-hi/strings.xml @@ -88,9 +88,7 @@ <string name="key_length_explanation_binary">: वायरगार्ड कीज 32 बाइट होनी चाहिए</string> <string name="key_length_explanation_hex">: वायरगार्ड हेक्स कीज़ 64 अक्षरों की होनी चाहिए (32 बाइट्स)</string> <string name="listen_port">पोर्ट सूने</string> - <string name="log_export_error">लॉग निर्यात करने में असमर्थ: %s</string> <string name="log_export_success">“%s” में सहेजा गया</string> - <string name="log_export_summary">लॉग फ़ाइल को डाउनलोड फ़ोल्डर में सहेजा जाएगा</string> <string name="log_export_title">लॉग फ़ाइल निर्यात करें</string> <string name="logcat_error">लॉगकैट चलाने में असमर्थ: </string> <string name="module_version_error">कर्नेल मॉड्यूल संस्करण निर्धारित करने में असमर्थ</string> diff --git a/ui/src/main/res/values-id/strings.xml b/ui/src/main/res/values-id/strings.xml index 7c6c6a0b..3f0af404 100644 --- a/ui/src/main/res/values-id/strings.xml +++ b/ui/src/main/res/values-id/strings.xml @@ -88,9 +88,7 @@ <string name="key_length_explanation_binary">: Kunci WireGuard harus terdiri dari 32 bit</string> <string name="key_length_explanation_hex">: Kunci hex WireGuard Harus terdiri dari 64 karakter (32 bit)</string> <string name="listen_port">Isi port</string> - <string name="log_export_error">Log %s tidak bisa diekspor</string> <string name="log_export_success">Simpan ke “%s”</string> - <string name="log_export_summary">File log akan disimpan di folder download</string> <string name="log_export_title">Ekspor file log</string> <string name="logcat_error">Tidak bisa menjalankan logcat: </string> <string name="module_version_error">Tidak dapat menentukan versi modul kernel</string> diff --git a/ui/src/main/res/values-it/strings.xml b/ui/src/main/res/values-it/strings.xml index 48f36a2b..2ab211e9 100644 --- a/ui/src/main/res/values-it/strings.xml +++ b/ui/src/main/res/values-it/strings.xml @@ -88,9 +88,7 @@ <string name="key_length_explanation_binary">: le chiavi di WireGuard devono essere di 32 byte</string> <string name="key_length_explanation_hex">: le chiavi hex di WireGuard devono essere di 64 caratteri (32 byte)</string> <string name="listen_port">Porta in ascolto</string> - <string name="log_export_error">Impossibile esportare il registro: %s</string> <string name="log_export_success">Salvato in “%s”</string> - <string name="log_export_summary">Il file del registro verrà salvato nella cartella di download</string> <string name="log_export_title">Esporta file registro</string> <string name="logcat_error">Impossibile eseguire logcat: </string> <string name="module_version_error">Impossibile determinare la versione modulo del kernel</string> diff --git a/ui/src/main/res/values-ja/strings.xml b/ui/src/main/res/values-ja/strings.xml index c753a5d5..5d342d2d 100644 --- a/ui/src/main/res/values-ja/strings.xml +++ b/ui/src/main/res/values-ja/strings.xml @@ -84,9 +84,7 @@ <string name="key_length_explanation_binary">: WireGuard 鍵は32バイトでなければなりません</string> <string name="key_length_explanation_hex">: WireGuard hex 鍵は64文字(32バイト)でなければなりません</string> <string name="listen_port">Listen ポート</string> - <string name="log_export_error">ログをエクスポートできません: %s</string> <string name="log_export_success">“%s” に保存しました</string> - <string name="log_export_summary">ログはダウンロードフォルダに保存されます</string> <string name="log_export_title">ログのエクスポート</string> <string name="logcat_error">logcat を実行できません: </string> <string name="module_version_error">カーネルモジュールバージョンを特定できません</string> diff --git a/ui/src/main/res/values-night/colors.xml b/ui/src/main/res/values-night/colors.xml index 314142d9..e1015da8 100644 --- a/ui/src/main/res/values-night/colors.xml +++ b/ui/src/main/res/values-night/colors.xml @@ -14,4 +14,10 @@ <color name="list_multiselect_background">#1aeeeeee</color> <color name="status_bar_color">#21242424</color> <color name="navigation_bar_color">#aa242424</color> + + <!-- Log viewer tag colors --> + <color name="debug_tag_color">#aaaaaa</color> + <color name="error_tag_color">#ff0000</color> + <color name="info_tag_color">#00ff00</color> + <color name="warning_tag_color">#ffff00</color> </resources> diff --git a/ui/src/main/res/values-ru/strings.xml b/ui/src/main/res/values-ru/strings.xml index 557ce196..519ec24e 100644 --- a/ui/src/main/res/values-ru/strings.xml +++ b/ui/src/main/res/values-ru/strings.xml @@ -93,9 +93,7 @@ <string name="key_length_explanation_binary">: Ключи WireGuard должны быть 32 байта</string> <string name="key_length_explanation_hex">: HEX ключи WireGuard должны содержать 64 символа (32 байта)</string> <string name="listen_port">Порт</string> - <string name="log_export_error">Не удалось экспортировать логи: %s</string> <string name="log_export_success">Сохранено в “%s”</string> - <string name="log_export_summary">Файл логов будет сохранен в папке загрузок</string> <string name="log_export_title">Экспорт логов в файл</string> <string name="logcat_error">Не удалось запустить logcat: </string> <string name="module_version_error">Не удалось определить версию модуля ядра</string> diff --git a/ui/src/main/res/values-zh-rCN/strings.xml b/ui/src/main/res/values-zh-rCN/strings.xml index 613abf46..4e3730f1 100644 --- a/ui/src/main/res/values-zh-rCN/strings.xml +++ b/ui/src/main/res/values-zh-rCN/strings.xml @@ -82,9 +82,7 @@ <string name="key_length_explanation_binary">:WireGuard 密钥大小必须为 32 字节</string> <string name="key_length_explanation_hex">:WireGuard 的十六进制密钥长度必须为 64 个字符(32 字节)</string> <string name="listen_port">监听端口</string> - <string name="log_export_error">无法导出日志:%s</string> <string name="log_export_success">已保存至 “%s”</string> - <string name="log_export_summary">日志文件将保存至下载文件夹</string> <string name="log_export_title">导出日志文件</string> <string name="logcat_error">无法运行 logcat:</string> <string name="module_version_error">无法确定内核模块版本</string> diff --git a/ui/src/main/res/values/colors.xml b/ui/src/main/res/values/colors.xml index 06bcd143..bd304726 100644 --- a/ui/src/main/res/values/colors.xml +++ b/ui/src/main/res/values/colors.xml @@ -18,4 +18,9 @@ <color name="mtrl_textinput_default_box_stroke_color" tools:override="true">@color/secondary_color</color> <color name="white">#ffffffff</color> + <!-- Log viewer tag colors --> + <color name="debug_tag_color">#444444</color> + <color name="error_tag_color">#aa0000</color> + <color name="info_tag_color">#00aa00</color> + <color name="warning_tag_color">#aaaa00</color> </resources> diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index 74c5be69..972b6244 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -93,10 +93,9 @@ <string name="key_length_explanation_binary">: WireGuard keys must be 32 bytes</string> <string name="key_length_explanation_hex">: WireGuard hex keys must be 64 characters (32 bytes)</string> <string name="listen_port">Listen port</string> - <string name="log_export_error">Unable to export log: %s</string> <string name="log_export_success">Saved to “%s”</string> - <string name="log_export_summary">Log file will be saved to downloads folder</string> <string name="log_export_title">Export log file</string> + <string name="log_export_subject">WireGuard Android Log File</string> <string name="logcat_error">Unable to run logcat: </string> <string name="module_version_error">Unable to determine kernel module version</string> <string name="module_installer_not_found">No modules are available for your device</string> @@ -186,4 +185,7 @@ <string name="zip_export_title">Export tunnels to zip file</string> <string name="key_length_error">Incorrect key length</string> <string name="key_contents_error">Bad characters in key</string> + <string name="log_viewer_title">View application log</string> + <string name="log_viewer_pref_summary">Logs may assist with debugging</string> + <string name="log_saver_activity_label">Save log</string> </resources> diff --git a/ui/src/main/res/xml/preferences.xml b/ui/src/main/res/xml/preferences.xml index 4668fab4..06d7ac7c 100644 --- a/ui/src/main/res/xml/preferences.xml +++ b/ui/src/main/res/xml/preferences.xml @@ -8,7 +8,10 @@ android:summaryOff="@string/restore_on_boot_summary_off" android:title="@string/restore_on_boot_title" /> <com.wireguard.android.preference.ZipExporterPreference /> - <com.wireguard.android.preference.LogExporterPreference /> + <Preference + android:key="log_viewer" + android:title="@string/log_viewer_title" + android:summary="@string/log_viewer_pref_summary" /> <CheckBoxPreference android:defaultValue="false" android:key="dark_theme" |