diff options
author | pacien | 2020-12-08 18:03:20 +0100 |
---|---|---|
committer | pacien | 2020-12-08 18:03:20 +0100 |
commit | 355251694d63640f028f3e2c17235d12a8573df6 (patch) | |
tree | 966ffd45ec29797afb440ead00586f4fcdf15589 /app/src/main/res/layout/configure_tools_configuration_access_fragment.xml | |
parent | 2760703484f9b12f8c21c395915f9780b1ae7e9e (diff) | |
download | tincapp-355251694d63640f028f3e2c17235d12a8573df6.tar.gz |
ConfigurationAccessService: prevent service from being stopped when app loses focus
This makes the ConfigurationAccessService (formerly ConfigurationFtpService) start in foreground
through the use of a persistent notification so that it isn't stopped by the system after the app
loses the focus on the user's screen, which happens when the user switches to an FTP client
application on the same device.
Diffstat (limited to 'app/src/main/res/layout/configure_tools_configuration_access_fragment.xml')
-rw-r--r-- | app/src/main/res/layout/configure_tools_configuration_access_fragment.xml | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/app/src/main/res/layout/configure_tools_configuration_access_fragment.xml b/app/src/main/res/layout/configure_tools_configuration_access_fragment.xml new file mode 100644 index 0000000..24f3c36 --- /dev/null +++ b/app/src/main/res/layout/configure_tools_configuration_access_fragment.xml | |||
@@ -0,0 +1,86 @@ | |||
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-2020 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 | <variable | ||
26 | name="ftpEnabled" | ||
27 | type="boolean" /> | ||
28 | |||
29 | <variable | ||
30 | name="ftpUsername" | ||
31 | type="String" /> | ||
32 | |||
33 | <variable | ||
34 | name="ftpPassword" | ||
35 | type="String" /> | ||
36 | |||
37 | <variable | ||
38 | name="ftpPort" | ||
39 | type="int" /> | ||
40 | |||
41 | <variable | ||
42 | name="toggleFtpState" | ||
43 | type="kotlin.jvm.functions.Function0<kotlin.Unit>" /> | ||
44 | |||
45 | </data> | ||
46 | |||
47 | <LinearLayout style="@style/AppTheme.List"> | ||
48 | |||
49 | <LinearLayout | ||
50 | style="@style/AppTheme.ListBlock.Clickable" | ||
51 | android:onClick="@{() -> toggleFtpState.invoke()}" | ||
52 | android:orientation="horizontal"> | ||
53 | |||
54 | <LinearLayout | ||
55 | android:layout_width="wrap_content" | ||
56 | android:layout_height="wrap_content" | ||
57 | android:layout_weight="1" | ||
58 | android:orientation="vertical"> | ||
59 | |||
60 | <TextView | ||
61 | style="@style/AppTheme.BlockTitle" | ||
62 | android:layout_width="wrap_content" | ||
63 | android:layout_height="wrap_content" | ||
64 | android:text="@string/configure_configuration_server_ftp_access" /> | ||
65 | |||
66 | <TextView | ||
67 | style="@style/AppTheme.BlockContent" | ||
68 | android:layout_width="wrap_content" | ||
69 | android:layout_height="wrap_content" | ||
70 | android:text="@{ftpEnabled ? @string/configure_configuration_server_ftp_access_endpoint_format(ftpUsername, ftpPassword, ftpPort) : @string/configure_configuration_server_ftp_access_not_active}" | ||
71 | android:textIsSelectable="@{ftpEnabled}" /> | ||
72 | |||
73 | </LinearLayout> | ||
74 | |||
75 | <androidx.appcompat.widget.SwitchCompat | ||
76 | android:layout_width="wrap_content" | ||
77 | android:layout_height="match_parent" | ||
78 | android:layout_weight="0" | ||
79 | android:checked="@{ftpEnabled}" | ||
80 | android:onClick="@{() -> toggleFtpState.invoke()}" /> | ||
81 | |||
82 | </LinearLayout> | ||
83 | |||
84 | </LinearLayout> | ||
85 | |||
86 | </layout> | ||