diff options
author | pacien | 2023-07-30 03:06:35 +0200 |
---|---|---|
committer | pacien | 2023-07-30 03:53:20 +0200 |
commit | 550a6b1f622868f23413f08a766bee00723923bb (patch) | |
tree | 5d21eb06d0b7fdfe1c70f0595ebf178f5c87cbb5 /app/src/main/res | |
parent | 6077eae9077edc5b7bde4b58071a302edbb4667e (diff) | |
download | tincapp-550a6b1f622868f23413f08a766bee00723923bb.tar.gz |
errors: handle notifications internally
Diffstat (limited to 'app/src/main/res')
-rw-r--r-- | app/src/main/res/layout/start_activity.xml | 6 | ||||
-rw-r--r-- | app/src/main/res/layout/start_error_notification.xml | 69 | ||||
-rw-r--r-- | app/src/main/res/values/colors.xml | 3 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 6 |
4 files changed, 82 insertions, 2 deletions
diff --git a/app/src/main/res/layout/start_activity.xml b/app/src/main/res/layout/start_activity.xml index 2960711..f2069d5 100644 --- a/app/src/main/res/layout/start_activity.xml +++ b/app/src/main/res/layout/start_activity.xml | |||
@@ -31,6 +31,12 @@ | |||
31 | android:text="@string/start_network_list_warning_text"/> | 31 | android:text="@string/start_network_list_warning_text"/> |
32 | 32 | ||
33 | <fragment | 33 | <fragment |
34 | android:id="@+id/start_activity_error_notification_fragment" | ||
35 | android:name="org.pacien.tincapp.activities.start.ErrorNotificationFragment" | ||
36 | android:layout_width="match_parent" | ||
37 | android:layout_height="wrap_content"/> | ||
38 | |||
39 | <fragment | ||
34 | android:id="@+id/start_activity_network_list_fragment" | 40 | android:id="@+id/start_activity_network_list_fragment" |
35 | android:name="org.pacien.tincapp.activities.start.NetworkListFragment" | 41 | android:name="org.pacien.tincapp.activities.start.NetworkListFragment" |
36 | android:layout_width="match_parent" | 42 | android:layout_width="match_parent" |
diff --git a/app/src/main/res/layout/start_error_notification.xml b/app/src/main/res/layout/start_error_notification.xml new file mode 100644 index 0000000..3d2169d --- /dev/null +++ b/app/src/main/res/layout/start_error_notification.xml | |||
@@ -0,0 +1,69 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | |||
3 | <!-- | ||
4 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon | ||
5 | * Copyright (C) 2017-2023 Pacien TRAN-GIRARD | ||
6 | * | ||
7 | * This program is free software: you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation, either version 3 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
19 | --> | ||
20 | |||
21 | <layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||
22 | |||
23 | <data> | ||
24 | |||
25 | <import type="android.view.View"/> | ||
26 | |||
27 | <variable | ||
28 | name="errorNotification" | ||
29 | type="org.pacien.tincapp.context.AppNotificationManager.ErrorNotification"/> | ||
30 | |||
31 | <!-- '<' escaping: https://stackoverflow.com/q/40970686 --> | ||
32 | <variable | ||
33 | name="openManualAction" | ||
34 | type="kotlin.jvm.functions.Function0<kotlin.Unit>"/> | ||
35 | |||
36 | </data> | ||
37 | |||
38 | <LinearLayout | ||
39 | android:layout_width="match_parent" | ||
40 | android:layout_height="wrap_content" | ||
41 | android:orientation="vertical" | ||
42 | android:visibility="@{errorNotification == null ? View.GONE : View.VISIBLE}"> | ||
43 | |||
44 | <TextView | ||
45 | android:text="@{errorNotification.title}" | ||
46 | style="@style/AppTheme.SectionTitle.Error" /> | ||
47 | |||
48 | <LinearLayout style="@style/AppTheme.ListBlock"> | ||
49 | |||
50 | <TextView | ||
51 | style="@style/AppTheme.BlockTitle" | ||
52 | android:text="@{errorNotification.message}" /> | ||
53 | |||
54 | <LinearLayout | ||
55 | style="@style/AppTheme.ListBlock.Clickable" | ||
56 | android:visibility="@{errorNotification.manualLink == null ? View.GONE : View.VISIBLE}" | ||
57 | android:onClick="@{() -> openManualAction.invoke()}"> | ||
58 | |||
59 | <TextView | ||
60 | style="@style/AppTheme.BlockTitle" | ||
61 | android:text="@string/notification_error_action_open_manual" /> | ||
62 | |||
63 | </LinearLayout> | ||
64 | |||
65 | </LinearLayout> | ||
66 | |||
67 | </LinearLayout> | ||
68 | |||
69 | </layout> \ No newline at end of file | ||
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 7520cd8..3d05b1c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | <!-- | 3 | <!-- |
4 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon | 4 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon |
5 | * Copyright (C) 2017-2018 Pacien TRAN-GIRARD | 5 | * Copyright (C) 2017-2023 Pacien TRAN-GIRARD |
6 | * | 6 | * |
7 | * This program is free software: you can redistribute it and/or modify | 7 | * This program is free software: you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -25,6 +25,7 @@ | |||
25 | <color name="textTitle">#FFFFFFFF</color> | 25 | <color name="textTitle">#FFFFFFFF</color> |
26 | <color name="textAccent">#007f68</color> | 26 | <color name="textAccent">#007f68</color> |
27 | <color name="textSecondary">#212121</color> | 27 | <color name="textSecondary">#212121</color> |
28 | <color name="textError">#F44336</color> | ||
28 | 29 | ||
29 | <color name="separator">#d9d9d9</color> | 30 | <color name="separator">#d9d9d9</color> |
30 | 31 | ||
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index fc4a6c3..171a1da 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | <!-- | 3 | <!-- |
4 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon | 4 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon |
5 | * Copyright (C) 2017-2018 Pacien TRAN-GIRARD | 5 | * Copyright (C) 2017-2023 Pacien TRAN-GIRARD |
6 | * | 6 | * |
7 | * This program is free software: you can redistribute it and/or modify | 7 | * This program is free software: you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -44,6 +44,10 @@ | |||
44 | <item name="android:paddingTop">@dimen/activity_vertical_margin</item> | 44 | <item name="android:paddingTop">@dimen/activity_vertical_margin</item> |
45 | </style> | 45 | </style> |
46 | 46 | ||
47 | <style name="AppTheme.SectionTitle.Error"> | ||
48 | <item name="android:textColor">@color/textError</item> | ||
49 | </style> | ||
50 | |||
47 | <style name="AppTheme.List"> | 51 | <style name="AppTheme.List"> |
48 | <item name="android:layout_width">match_parent</item> | 52 | <item name="android:layout_width">match_parent</item> |
49 | <item name="android:layout_height">wrap_content</item> | 53 | <item name="android:layout_height">wrap_content</item> |