From 9044c3fdc13f02b7c21bb181d769fadb71924b75 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 19 Sep 2019 22:41:30 +0200 Subject: add subtitles to navigation drawer items - better explanation for PT --- .../se/leap/bitmaskclient/views/IconSwitchEntry.java | 8 ++++++++ .../se/leap/bitmaskclient/views/IconTextEntry.java | 8 ++++++++ .../main/res/layout-xlarge/v_icon_text_list_item.xml | 19 +++++++++++++++++++ app/src/main/res/layout-xlarge/v_switch_list_item.xml | 19 +++++++++++++++++++ app/src/main/res/layout/f_drawer_main.xml | 2 ++ app/src/main/res/layout/v_icon_text_list_item.xml | 19 +++++++++++++++++++ app/src/main/res/layout/v_switch_list_item.xml | 19 +++++++++++++++++++ app/src/main/res/values/attrs.xml | 3 +++ app/src/main/res/values/strings.xml | 2 ++ 9 files changed, 99 insertions(+) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java b/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java index 82e02a6e..02347b05 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java +++ b/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java @@ -21,6 +21,7 @@ import se.leap.bitmaskclient.R; public class IconSwitchEntry extends LinearLayout { private TextView textView; + private TextView subtitleView; private ImageView iconView; private SwitchCompat switchView; private CompoundButton.OnCheckedChangeListener checkedChangeListener; @@ -51,6 +52,7 @@ public class IconSwitchEntry extends LinearLayout { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rootview = inflater.inflate(R.layout.v_switch_list_item, this, true); textView = rootview.findViewById(android.R.id.text1); + subtitleView = rootview.findViewById(R.id.subtitle); iconView = rootview.findViewById(R.id.material_icon); switchView = rootview.findViewById(R.id.option_switch); @@ -62,6 +64,12 @@ public class IconSwitchEntry extends LinearLayout { textView.setText(entryText); } + String subtitle = typedArray.getString(R.styleable.IconTextEntry_subtitle); + if (subtitle != null) { + subtitleView.setText(subtitle); + subtitleView.setVisibility(VISIBLE); + } + Drawable drawable = typedArray.getDrawable(R.styleable.IconTextEntry_icon); if (drawable != null) { iconView.setImageDrawable(drawable); diff --git a/app/src/main/java/se/leap/bitmaskclient/views/IconTextEntry.java b/app/src/main/java/se/leap/bitmaskclient/views/IconTextEntry.java index 5689f429..0e86f506 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/IconTextEntry.java +++ b/app/src/main/java/se/leap/bitmaskclient/views/IconTextEntry.java @@ -21,6 +21,7 @@ public class IconTextEntry extends LinearLayout { private TextView textView; private ImageView iconView; + private TextView subtitleView; public IconTextEntry(Context context) { super(context); @@ -48,6 +49,7 @@ public class IconTextEntry extends LinearLayout { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rootview = inflater.inflate(R.layout.v_icon_text_list_item, this, true); textView = rootview.findViewById(android.R.id.text1); + subtitleView = rootview.findViewById(R.id.subtitle); iconView = rootview.findViewById(R.id.material_icon); if (attrs != null) { @@ -58,6 +60,12 @@ public class IconTextEntry extends LinearLayout { textView.setText(entryText); } + String subtitle = typedArray.getString(R.styleable.IconTextEntry_subtitle); + if (subtitle != null) { + subtitleView.setText(subtitle); + subtitleView.setVisibility(VISIBLE); + } + Drawable drawable = typedArray.getDrawable(R.styleable.IconTextEntry_icon); if (drawable != null) { iconView.setImageDrawable(drawable); diff --git a/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml b/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml index 7ecd32a9..798b47e3 100644 --- a/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml +++ b/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml @@ -29,6 +29,25 @@ tools:text="TEST" android:layout_toEndOf="@id/material_icon" android:layout_toRightOf="@+id/material_icon" + android:layout_above="@+id/subtitle" + /> + + + + @@ -81,6 +82,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" app:text="@string/always_on_vpn" + app:subtitle="@string/subtitle_always_on_vpn" app:icon="@drawable/ic_always_on_36" android:visibility="gone" /> diff --git a/app/src/main/res/layout/v_icon_text_list_item.xml b/app/src/main/res/layout/v_icon_text_list_item.xml index d34baeb6..64cc474a 100644 --- a/app/src/main/res/layout/v_icon_text_list_item.xml +++ b/app/src/main/res/layout/v_icon_text_list_item.xml @@ -28,6 +28,25 @@ tools:text="TEST" android:layout_toEndOf="@id/material_icon" android:layout_toRightOf="@+id/material_icon" + android:layout_above="@+id/subtitle" + /> + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 472a8549..5ae52ea9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -102,6 +102,7 @@ Save battery Background data connections will hibernate when your phone is inactive. Always-on VPN + Open Android System Settings Do not show again To enable always-on VPN in Android VPN Settings click on the configure icon [img src] and turn the switch on. To protect your privacy optimally, you should also activate the option \"Block connections without VPN\". @@ -113,4 +114,5 @@ Using an obfuscated connection. Trying an obfuscated connection. Using Bridges + Circumvent VPN filtering -- cgit v1.2.3