From: Markus Pfeiffer Date: Tue, 21 Nov 2023 14:37:22 +0000 (+0100) Subject: android: Add label to read-only profiles in list X-Git-Tag: android-2.5.0^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9c65a94c974ad8d64666c81e8d50057936a356b;p=thirdparty%2Fstrongswan.git android: Add label to read-only profiles in list Show "Managed profile" in the list of VPN profiles, to make it immediately obvious that a profile is managed/read-only. --- diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/adapter/VpnProfileAdapter.java b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/adapter/VpnProfileAdapter.java index 05a15464d9..c2942b8a18 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/adapter/VpnProfileAdapter.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/adapter/VpnProfileAdapter.java @@ -61,11 +61,13 @@ public class VpnProfileAdapter extends ArrayAdapter vpnProfileView = inflater.inflate(resource, null); } VpnProfile profile = getItem(position); - TextView tv = (TextView)vpnProfileView.findViewById(R.id.profile_item_name); + TextView tv = vpnProfileView.findViewById(R.id.profile_item_name); tv.setText(profile.getName()); - tv = (TextView)vpnProfileView.findViewById(R.id.profile_item_gateway); + tv = vpnProfileView.findViewById(R.id.profile_item_managed); + tv.setVisibility(profile.isReadOnly() ? View.VISIBLE : View.GONE); + tv = vpnProfileView.findViewById(R.id.profile_item_gateway); tv.setText(getContext().getString(R.string.profile_gateway_label) + ": " + profile.getGateway()); - tv = (TextView)vpnProfileView.findViewById(R.id.profile_item_username); + tv = vpnProfileView.findViewById(R.id.profile_item_username); if (profile.getVpnType().has(VpnTypeFeature.USER_PASS)) { /* if the view is reused we make sure it is visible */ tv.setVisibility(View.VISIBLE); @@ -81,7 +83,7 @@ public class VpnProfileAdapter extends ArrayAdapter { tv.setVisibility(View.GONE); } - tv = (TextView)vpnProfileView.findViewById(R.id.profile_item_certificate); + tv = vpnProfileView.findViewById(R.id.profile_item_certificate); if (profile.getVpnType().has(VpnTypeFeature.CERTIFICATE)) { tv.setText(getContext().getString(R.string.profile_user_certificate_label) + ": " + profile.getUserCertificateAlias()); @@ -103,7 +105,8 @@ public class VpnProfileAdapter extends ArrayAdapter private void sortItems() { - Collections.sort(this.items, new Comparator() { + Collections.sort(this.items, new Comparator() + { @Override public int compare(VpnProfile lhs, VpnProfile rhs) { diff --git a/src/frontends/android/app/src/main/res/layout/profile_list_item.xml b/src/frontends/android/app/src/main/res/layout/profile_list_item.xml index caf5488584..d4d9b651e3 100644 --- a/src/frontends/android/app/src/main/res/layout/profile_list_item.xml +++ b/src/frontends/android/app/src/main/res/layout/profile_list_item.xml @@ -17,44 +17,60 @@ for more details. --> + android:paddingTop="4dip"> + android:layout_marginStart="15dp" + android:textAppearance="?android:attr/textAppearanceMedium" + tools:text="Profile name" /> + + + android:textColor="?android:textColorSecondary" + tools:text="Server: vpn.example.com" /> + android:textColor="?android:textColorSecondary" + tools:text="Username" /> + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?android:textColorSecondary" + tools:text="Certificate" /> 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 0b21fc747f..19d5a1a541 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 @@ -139,6 +139,7 @@ Zertifikat aus VPN Profil importieren Zertifikat für \"%1$s\" Profil-ID + Verwaltetes Profil Ein Wert wird benötigt, um die Verbindung aufbauen zu können Bitte geben Sie Ihren Benutzernamen 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 ec6ba216b8..737eddf868 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 @@ -141,6 +141,7 @@ Import certificate from VPN profile Certificate for \"%1$s\" Profile ID + Managed profile A value is required to initiate the connection Wprowadź swoją nazwę użytkownika 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 0150016b73..2bbe2b4dc1 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 @@ -135,6 +135,7 @@ Import certificate from VPN profile Certificate for \"%1$s\" Profile ID + Managed profile A value is required to initiate the connection Пожалуйста введите имя пользователя diff --git a/src/frontends/android/app/src/main/res/values-uk/strings.xml b/src/frontends/android/app/src/main/res/values-uk/strings.xml index e02a640a3f..3868fc4756 100644 --- a/src/frontends/android/app/src/main/res/values-uk/strings.xml +++ b/src/frontends/android/app/src/main/res/values-uk/strings.xml @@ -136,6 +136,7 @@ Import certificate from VPN profile Certificate for \"%1$s\" Profile ID + Managed profile A value is required to initiate the connection Введіть ім\'я користувача diff --git a/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml b/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml index 99693c5092..69b9f4d268 100644 --- a/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml +++ b/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml @@ -135,6 +135,7 @@ 从VPN配置导入证书 \"%1$s\" 所对应的证书 配置文件ID + Managed profile 必填信息以初始化连接 请输入您的用户名 diff --git a/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml b/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml index 79d3e41ba3..33473b63e6 100644 --- a/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml +++ b/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml @@ -135,6 +135,7 @@ 從VPN設定檔匯入憑證 \"%1$s\" 對應的憑證 Profile ID + Managed profile 請填寫必要訊息才能初始化連線 請輸入您的用戶名稱 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 59f24e7e25..d6d2ce8546 100644 --- a/src/frontends/android/app/src/main/res/values/strings.xml +++ b/src/frontends/android/app/src/main/res/values/strings.xml @@ -139,6 +139,7 @@ Import certificate from VPN profile Certificate for \"%1$s\" Profile ID + Managed profile A value is required to initiate the connection Please enter your username