From e4b2f9101d2ecf16fa016f2f78492fe1c4a16b69 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sun, 19 Dec 2021 02:33:12 +0100 Subject: ui,tunnel: add HTTP proxy setting to Go backend Only make the HTTP proxy settings visible on supported Android versions, i.e. Android 10 (AKA Android Q) and later. Signed-off-by: Mikael Magnusson --- ui/src/main/res/layout/http_proxy_menu_item.xml | 8 ++ ui/src/main/res/layout/tunnel_detail_fragment.xml | 35 +++++++- ui/src/main/res/layout/tunnel_editor_fragment.xml | 105 ++++++++++++++++++++-- ui/src/main/res/values/strings.xml | 5 ++ ui/src/main/res/values/styles.xml | 4 + 5 files changed, 149 insertions(+), 8 deletions(-) create mode 100644 ui/src/main/res/layout/http_proxy_menu_item.xml (limited to 'ui/src/main/res') diff --git a/ui/src/main/res/layout/http_proxy_menu_item.xml b/ui/src/main/res/layout/http_proxy_menu_item.xml new file mode 100644 index 00000000..8ad5c026 --- /dev/null +++ b/ui/src/main/res/layout/http_proxy_menu_item.xml @@ -0,0 +1,8 @@ + + diff --git a/ui/src/main/res/layout/tunnel_detail_fragment.xml b/ui/src/main/res/layout/tunnel_detail_fragment.xml index 164fabf0..b4f88308 100644 --- a/ui/src/main/res/layout/tunnel_detail_fragment.xml +++ b/ui/src/main/res/layout/tunnel_detail_fragment.xml @@ -5,6 +5,8 @@ + + @@ -224,7 +226,7 @@ android:contentDescription="@string/listen_port" android:nextFocusRight="@id/mtu_text" android:nextFocusUp="@id/dns_search_domains_text" - android:nextFocusDown="@id/applications_text" + android:nextFocusDown="@id/http_proxy_text" android:nextFocusForward="@id/mtu_text" android:onClick="@{ClipboardUtils::copyTextView}" android:text="@{config.interface.listenPort}" @@ -257,7 +259,7 @@ android:contentDescription="@string/mtu" android:nextFocusLeft="@id/listen_port_text" android:nextFocusUp="@id/dns_servers_text" - android:nextFocusForward="@id/applications_text" + android:nextFocusForward="@id/http_proxy_text" android:onClick="@{ClipboardUtils::copyTextView}" android:text="@{config.interface.mtu}" android:visibility="@{!config.interface.mtu.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}" @@ -275,6 +277,33 @@ app:barrierDirection="bottom" app:constraint_referenced_ids="listen_port_text,mtu_text" /> + + + + - \ No newline at end of file + diff --git a/ui/src/main/res/layout/tunnel_editor_fragment.xml b/ui/src/main/res/layout/tunnel_editor_fragment.xml index 59572b32..789c839b 100644 --- a/ui/src/main/res/layout/tunnel_editor_fragment.xml +++ b/ui/src/main/res/layout/tunnel_editor_fragment.xml @@ -5,6 +5,8 @@ + + @@ -210,7 +212,7 @@ android:imeOptions="actionNext" android:inputType="textNoSuggestions|textVisiblePassword" android:nextFocusUp="@id/addresses_label_text" - android:nextFocusDown="@id/set_excluded_applications" + android:nextFocusDown="@id/http_proxy_hostname_text" android:nextFocusForward="@id/mtu_text" android:text="@={config.interface.dnsServers}" /> @@ -235,19 +237,112 @@ android:imeOptions="actionDone" android:inputType="number" android:nextFocusUp="@id/listen_port_text" - android:nextFocusDown="@id/set_excluded_applications" - android:nextFocusForward="@id/set_excluded_applications" + android:nextFocusDown="@id/http_proxy_hostname_text" + android:nextFocusForward="@id/http_proxy_hostname_text" android:text="@={config.interface.mtu}" android:textAlignment="center" /> + + + + + + + + + + + + + + + + + + + + diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index 6c090199..c10c4ea7 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -70,6 +70,7 @@ : Must be positive and no more than 65535 : Must be positive : Must be a valid UDP port number + : Must be valid proxy hostname and port Invalid key Invalid number Invalid value @@ -126,6 +127,10 @@ (optional) (optional, not recommended) (random) + Proxy + Proxy hostname + Proxy Auto-Config URL + Proxy port Illegal file name ā€œ%sā€ Unable to import tunnel: %s Import Tunnel from QR Code diff --git a/ui/src/main/res/values/styles.xml b/ui/src/main/res/values/styles.xml index 396f156c..da3c2cb7 100644 --- a/ui/src/main/res/values/styles.xml +++ b/ui/src/main/res/values/styles.xml @@ -61,4 +61,8 @@ + + -- cgit v1.2.3