From: Tobias Brunner Date: Sat, 30 Apr 2016 08:42:00 +0000 (+0200) Subject: android: Use TextInputLayoutHelper in profile editor X-Git-Tag: 5.4.1dr2~16^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea15f20a56479314e65899869ae6ca03ccca2b3f;p=thirdparty%2Fstrongswan.git android: Use TextInputLayoutHelper in profile editor This adds floating labels and helper texts to the form fields. It also changed/added lots of strings in the editor. --- diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileDetailActivity.java b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileDetailActivity.java index 927119188e..fe523e1587 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileDetailActivity.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileDetailActivity.java @@ -1,8 +1,8 @@ /* - * Copyright (C) 2012-2014 Tobias Brunner + * Copyright (C) 2012-2016 Tobias Brunner * Copyright (C) 2012 Giuliano Grassi * Copyright (C) 2012 Ralf Sager - * Hochschule fuer Technik Rapperswil + * HSR Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -57,6 +57,7 @@ import org.strongswan.android.data.VpnType; import org.strongswan.android.data.VpnType.VpnTypeFeature; import org.strongswan.android.logic.TrustedCertificateManager; import org.strongswan.android.security.TrustedCertificateEntry; +import org.strongswan.android.ui.widget.TextInputLayoutHelper; import java.security.cert.X509Certificate; @@ -74,10 +75,13 @@ public class VpnProfileDetailActivity extends AppCompatActivity private VpnType mVpnType = VpnType.IKEV2_EAP; private VpnProfile mProfile; private EditText mName; + private TextInputLayoutHelper mNameWrap; private EditText mGateway; + private TextInputLayoutHelper mGatewayWrap; private Spinner mSelectVpnType; private ViewGroup mUsernamePassword; private EditText mUsername; + private TextInputLayoutHelper mUsernameWrap; private EditText mPassword; private ViewGroup mUserCertificate; private RelativeLayout mSelectUserCert; @@ -87,7 +91,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity private CheckBox mShowAdvanced; private ViewGroup mAdvancedSettings; private EditText mMTU; + private TextInputLayoutHelper mMTUWrap; private EditText mPort; + private TextInputLayoutHelper mPortWrap; private CheckBox mBlockIPv4; private CheckBox mBlockIPv6; @@ -105,12 +111,15 @@ public class VpnProfileDetailActivity extends AppCompatActivity setContentView(R.layout.profile_detail_view); mName = (EditText)findViewById(R.id.name); + mNameWrap = (TextInputLayoutHelper)findViewById(R.id.name_wrap); mGateway = (EditText)findViewById(R.id.gateway); + mGatewayWrap = (TextInputLayoutHelper) findViewById(R.id.gateway_wrap); mSelectVpnType = (Spinner)findViewById(R.id.vpn_type); mTncNotice = (RelativeLayout)findViewById(R.id.tnc_notice); mUsernamePassword = (ViewGroup)findViewById(R.id.username_password_group); mUsername = (EditText)findViewById(R.id.username); + mUsernameWrap = (TextInputLayoutHelper) findViewById(R.id.username_wrap); mPassword = (EditText)findViewById(R.id.password); mUserCertificate = (ViewGroup)findViewById(R.id.user_certificate_group); @@ -123,7 +132,9 @@ public class VpnProfileDetailActivity extends AppCompatActivity mAdvancedSettings = (ViewGroup)findViewById(R.id.advanced_settings); mMTU = (EditText)findViewById(R.id.mtu); + mMTUWrap = (TextInputLayoutHelper) findViewById(R.id.mtu_wrap); mPort = (EditText)findViewById(R.id.port); + mPortWrap = (TextInputLayoutHelper) findViewById(R.id.port_wrap); mBlockIPv4 = (CheckBox)findViewById(R.id.split_tunneling_v4); mBlockIPv6 = (CheckBox)findViewById(R.id.split_tunneling_v6); @@ -135,14 +146,15 @@ public class VpnProfileDetailActivity extends AppCompatActivity public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override - public void afterTextChanged(Editable s) { + public void afterTextChanged(Editable s) + { if (TextUtils.isEmpty(mGateway.getText())) { - mName.setHint(R.string.profile_name_hint); + mNameWrap.setHelperText(getString(R.string.profile_name_hint)); } else { - mName.setHint("(" + mGateway.getText() + ")"); + mNameWrap.setHelperText(String.format(getString(R.string.profile_name_hint_gateway), mGateway.getText())); } } }); @@ -411,14 +423,14 @@ public class VpnProfileDetailActivity extends AppCompatActivity boolean valid = true; if (mGateway.getText().toString().trim().isEmpty()) { - mGateway.setError(getString(R.string.alert_text_no_input_gateway)); + mGatewayWrap.setError(getString(R.string.alert_text_no_input_gateway)); valid = false; } if (mVpnType.has(VpnTypeFeature.USER_PASS)) { if (mUsername.getText().toString().trim().isEmpty()) { - mUsername.setError(getString(R.string.alert_text_no_input_username)); + mUsernameWrap.setError(getString(R.string.alert_text_no_input_username)); valid = false; } } @@ -435,13 +447,13 @@ public class VpnProfileDetailActivity extends AppCompatActivity Integer mtu = getInteger(mMTU); if (mtu != null && (mtu < MTU_MIN || mtu > MTU_MAX)) { - mMTU.setError(String.format(getString(R.string.alert_text_out_of_range), MTU_MIN, MTU_MAX)); + mMTUWrap.setError(String.format(getString(R.string.alert_text_out_of_range), MTU_MIN, MTU_MAX)); valid = false; } Integer port = getInteger(mPort); if (port != null && (port < 1 || port > 65535)) { - mPort.setError(String.format(getString(R.string.alert_text_out_of_range), 1, 65535)); + mPortWrap.setError(String.format(getString(R.string.alert_text_out_of_range), 1, 65535)); valid = false; } return valid; diff --git a/src/frontends/android/app/src/main/res/layout/profile_detail_view.xml b/src/frontends/android/app/src/main/res/layout/profile_detail_view.xml index ee4f2562b6..4a1cc61758 100644 --- a/src/frontends/android/app/src/main/res/layout/profile_detail_view.xml +++ b/src/frontends/android/app/src/main/res/layout/profile_detail_view.xml @@ -16,32 +16,39 @@ for more details. --> + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" > + android:padding="10dp" + android:animateLayoutChanges="true" > - + android:layout_marginTop="6dp" + app:helper_text="@string/profile_gateway_hint" > - + + + - + android:layout_height="wrap_content" > - + - + - + android:layout_marginTop="4dp" + app:helper_text="@string/profile_password_hint" > + + + + @@ -95,12 +107,15 @@ android:id="@+id/user_certificate_group" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="4dp" android:orientation="vertical" > - + android:layout_marginTop="8dp" + app:helper_text="@string/profile_name_hint" > - + + + + android:layout_marginLeft="4dp" + android:textSize="20sp" + android:text="@string/profile_advanced_label" /> - - - + app:helper_text="@string/profile_mtu_hint" > + + - + + + app:helper_text="@string/profile_port_hint" > + + + + - \ No newline at end of file + diff --git a/src/frontends/android/app/src/main/res/values-de/strings.xml b/src/frontends/android/app/src/main/res/values-de/strings.xml index 076bea3d33..c2357eb5c3 100644 --- a/src/frontends/android/app/src/main/res/values-de/strings.xml +++ b/src/frontends/android/app/src/main/res/values-de/strings.xml @@ -49,30 +49,34 @@ Speichern Abbrechen - Profilname: - (Server-Adresse verwenden) - Server: - Typ: - Benutzername: - Passwort: - (anfordern wenn benötigt) - Benutzer-Zertifikat: + Profilname (optional) + Standardwert ist der konfigurierte Server + Standardwert ist \"%1$s\" + Server + IP-Adresse oder Hostname des VPN Servers + VPN-Typ + Benutzername + Passwort (optional) + Leer lassen, um bei Bedarf danach gefragt zu werden + Benutzer-Zertifikat Benutzer-Zertifikat auswählen Wählen Sie ein bestimmtes Benutzer-Zertifikat - CA-Zertifikat: + CA-Zertifikat Automatisch wählen CA-Zertifikat auswählen Wählen Sie ein bestimmtes CA-Zertifikat + Erweiterte Einstellungen Erweiterte Einstellungen anzeigen - MTU: - Server Port: - (Standardwert verwenden) - Split-Tunneling: + MTU des VPN Tunnel-Device + Falls der Standardwert in einem bestimmten Netzwerk nicht geeignet ist + Server Port + UDP-Port zu dem verbunden wird, falls dieser vom Standard-Port abweicht + Split-Tunneling Blockiere IPv4 Verkehr der nicht für das VPN bestimmt ist Blockiere IPv6 Verkehr der nicht für das VPN bestimmt ist - Bitte geben Sie hier die Server-Adresse ein - Bitte geben Sie hier Ihren Benutzernamen ein + Ein Wert wird benötigt, um die Verbindung aufbauen zu können + Bitte geben Sie Ihren Benutzernamen ein Kein CA-Zertifikat ausgewählt Bitte wählen Sie eines aus oder aktivieren Sie Automatisch wählen Bitte geben Sie eine Nummer von %1$d - %2$d ein diff --git a/src/frontends/android/app/src/main/res/values-pl/strings.xml b/src/frontends/android/app/src/main/res/values-pl/strings.xml index 6a1e3460f3..c8c1595379 100644 --- a/src/frontends/android/app/src/main/res/values-pl/strings.xml +++ b/src/frontends/android/app/src/main/res/values-pl/strings.xml @@ -49,36 +49,40 @@ Zapisz Anuluj - Nazwa profilu: - (użyj adresu serwer) - Serwer: - Typ: - Użytkownik: - Hasło: - (w razie potrzeby zapromptuj) - Certyfikat użytkownika: + Nazwa profilu (opcjonalny) + Defaults to the configured server + Defaults to \"%1$s\" + Serwer + IP address or hostname of the VPN server + Typ VPN + Użytkownik + Hasło (opcjonalny) + Leave blank to get prompted on demand + Certyfikat użytkownika Wybierz certyfikat użytkownika >Wybierz określony certyfikat użytkownika - Certyfikat CA: + Certyfikat CA Wybierz automatycznie Wybierz certyfikat CA Wybierz określony certyfikat CA + Advanced settings Show advanced settings - MTU: - Server port: - (use default) - Split tunneling: + MTU of the VPN tunnel device + In case the default value is unsuitable for a particular network + Server port + UDP port to connect to, if different from the default + Split tunneling Block IPv4 traffic not destined for the VPN Block IPv6 traffic not destined for the VPN - Wprowadź adres serwer + A value is required to initiate the connection Wprowadź swoją nazwę użytkownika Nie wybrano żadnego certyfikatu CA Wybierz lub uaktywnij jeden Wybierz automatycznie Please enter a number in the range from %1$d - %2$d EAP-TNC may affect your privacy Device data is sent to the server operator - <p>Trusted Network Connect (TNC) allows server operators to assess the health of a client device.</p><p>For that purpose the server operator may request data such as a unique identifier, a list of installed packages, system settings, or cryptographic checksums of files.</p><b>Any data will be sent only after verifying the server\'s identity.</b> + Trusted Network Connect (TNC) allows server operators to assess the health of a client device.

For that purpose the server operator may request data such as a unique identifier, a list of installed packages, system settings, or cryptographic checksums of files.

Any data will be sent only after verifying the server\'s identity.]]>
Certyfikaty CA diff --git a/src/frontends/android/app/src/main/res/values-ru/strings.xml b/src/frontends/android/app/src/main/res/values-ru/strings.xml index 098bdf9232..0550fb2926 100644 --- a/src/frontends/android/app/src/main/res/values-ru/strings.xml +++ b/src/frontends/android/app/src/main/res/values-ru/strings.xml @@ -46,29 +46,33 @@ Сохранить Отмена - Название профиля: - (адрес cервер) - Сервер: - Тип: - Логин: - Пароль: - (спросить если нужно) - Сертификат пользователя: + Название профиля (необязательный) + Defaults to the configured server + Defaults to \"%1$s\" + Сервер + IP address or hostname of the VPN server + VPN Тип + Логин + Пароль (необязательный) + Leave blank to get prompted on demand + Сертификат пользователя Выбрать сертификат пользователя Выбрать сертификат пользователя - Сертификат CA: + Сертификат CA Выбрать автоматически Выбрать сертификат CA Выбрать CA сертификат + Advanced settings Show advanced settings - MTU: - Server port: - (use default) - Split tunneling: + MTU of the VPN tunnel device + In case the default value is unsuitable for a particular network + Server port + UDP port to connect to, if different from the default + Split tunneling Block IPv4 traffic not destined for the VPN Block IPv6 traffic not destined for the VPN - Пожалуйста введите адрес cервер + A value is required to initiate the connection Пожалуйста введите имя пользователя Не выбран сертификат CA Пожалуйста выберите один Выбрать автоматически @@ -127,4 +131,3 @@ Соединить - diff --git a/src/frontends/android/app/src/main/res/values-ua/strings.xml b/src/frontends/android/app/src/main/res/values-ua/strings.xml index d6b9772a2a..a520748767 100644 --- a/src/frontends/android/app/src/main/res/values-ua/strings.xml +++ b/src/frontends/android/app/src/main/res/values-ua/strings.xml @@ -47,30 +47,34 @@ Зберегти Відміна - Назва профілю: - (використовувати адресу cервер) - Сервер: - Тип: - Логін: - Пароль: - (запитати якщо потрібно) - Сертифікат користувача: + Назва профілю (необов\'язковий) + Defaults to the configured server + Defaults to \"%1$s\" + Сервер + IP address or hostname of the VPN server + VPN Тип + Логін + Пароль (необов\'язковий) + Leave blank to get prompted on demand + Сертифікат користувача Виберіть сертифікат користувача Вибрати спеціальний сертифікат користувача - Сертифікат CA: + Сертифікат CA Вибрати автоматично Вибрати сертифікат CA Вибрати спеціальний сертифікат CA + Advanced settings Show advanced settings - MTU: - Server port: - (use default) - Split tunneling: + MTU of the VPN tunnel device + In case the default value is unsuitable for a particular network + Server port + UDP port to connect to, if different from the default + Split tunneling Block IPv4 traffic not destined for the VPN Block IPv6 traffic not destined for the VPN - Введіть адресу cервер тут - Введіть ім\'я користувача тут + A value is required to initiate the connection + Введіть ім\'я користувача Не вибрано сертифікат CA Будь ласка виберіть один Вибрати автоматично Please enter a number in the range from %1$d - %2$d @@ -128,4 +132,3 @@ Підключити - diff --git a/src/frontends/android/app/src/main/res/values/strings.xml b/src/frontends/android/app/src/main/res/values/strings.xml index be90dc98d0..76886cd6d5 100644 --- a/src/frontends/android/app/src/main/res/values/strings.xml +++ b/src/frontends/android/app/src/main/res/values/strings.xml @@ -49,30 +49,34 @@ Save Cancel - Profile Name: - (use server address) - Server: - Type: - Username: - Password: - (prompt when needed) - User certificate: + Profile name (optional) + Defaults to the configured server + Defaults to \"%1$s\" + Server + IP address or hostname of the VPN server + VPN Type + Username + Password (optional) + Leave blank to get prompted on demand + User certificate Select user certificate Select a specific user certificate - CA certificate: + CA certificate Select automatically Select CA certificate Select a specific CA certificate + Advanced settings Show advanced settings - MTU: - Server port: - (use default) - Split tunneling: + MTU of the VPN tunnel device + In case the default value is unsuitable for a particular network + Server port + UDP port to connect to, if different from the default + Split tunneling Block IPv4 traffic not destined for the VPN Block IPv6 traffic not destined for the VPN - Please enter the server address here - Please enter your username here + A value is required to initiate the connection + Please enter your username No CA certificate selected Please select one or activate Select automatically Please enter a number in the range from %1$d - %2$d