summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-09-19 22:41:30 +0200
committercyBerta <cyberta@riseup.net>2019-09-19 22:42:16 +0200
commit9044c3fdc13f02b7c21bb181d769fadb71924b75 (patch)
tree07006ecd2b4a8a3628678ad934901d5b53e3594b
parenta49be8cf197af87e68aae263d31b3448f8ce379a (diff)
add subtitles to navigation drawer items - better explanation for PT
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/views/IconTextEntry.java8
-rw-r--r--app/src/main/res/layout-xlarge/v_icon_text_list_item.xml19
-rw-r--r--app/src/main/res/layout-xlarge/v_switch_list_item.xml19
-rw-r--r--app/src/main/res/layout/f_drawer_main.xml2
-rw-r--r--app/src/main/res/layout/v_icon_text_list_item.xml19
-rw-r--r--app/src/main/res/layout/v_switch_list_item.xml19
-rw-r--r--app/src/main/res/values/attrs.xml3
-rw-r--r--app/src/main/res/values/strings.xml2
9 files changed, 99 insertions, 0 deletions
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"
+ />
+
+ <TextView
+ android:id="@+id/subtitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:layout_alignParentBottom="true"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:paddingBottom="8dp"
+ tools:text="TEST"
+ android:visibility="gone"
+ android:layout_toEndOf="@id/material_icon"
+ android:layout_toRightOf="@+id/material_icon"
/>
<View
diff --git a/app/src/main/res/layout-xlarge/v_switch_list_item.xml b/app/src/main/res/layout-xlarge/v_switch_list_item.xml
index 68f63dc1..3d81af11 100644
--- a/app/src/main/res/layout-xlarge/v_switch_list_item.xml
+++ b/app/src/main/res/layout-xlarge/v_switch_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"
+ />
+
+ <TextView
+ android:id="@+id/subtitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:layout_alignParentBottom="true"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:paddingBottom="4dp"
+ tools:text="TEST"
+ android:visibility="gone"
+ android:layout_toEndOf="@id/material_icon"
+ android:layout_toRightOf="@+id/material_icon"
/>
<android.support.v7.widget.SwitchCompat
diff --git a/app/src/main/res/layout/f_drawer_main.xml b/app/src/main/res/layout/f_drawer_main.xml
index e4862ca8..8ca6f177 100644
--- a/app/src/main/res/layout/f_drawer_main.xml
+++ b/app/src/main/res/layout/f_drawer_main.xml
@@ -64,6 +64,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:text="@string/nav_drawer_obfuscated_connection"
+ app:subtitle="@string/nav_drawer_subtitle_obfuscated_connection"
app:icon="@drawable/ic_bridge_36"
android:visibility="gone"
/>
@@ -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"
+ />
+
+ <TextView
+ android:id="@+id/subtitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:layout_alignParentBottom="true"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:paddingBottom="4dp"
+ tools:text="TEST"
+ android:visibility="gone"
+ android:layout_toEndOf="@id/material_icon"
+ android:layout_toRightOf="@+id/material_icon"
/>
<View
diff --git a/app/src/main/res/layout/v_switch_list_item.xml b/app/src/main/res/layout/v_switch_list_item.xml
index de0e4f36..967d7a97 100644
--- a/app/src/main/res/layout/v_switch_list_item.xml
+++ b/app/src/main/res/layout/v_switch_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"
+ />
+
+ <TextView
+ android:id="@+id/subtitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:layout_alignParentBottom="true"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:paddingBottom="4dp"
+ tools:text="TEST"
+ android:visibility="gone"
+ android:layout_toEndOf="@id/material_icon"
+ android:layout_toRightOf="@+id/material_icon"
/>
<android.support.v7.widget.SwitchCompat
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index 66a351ae..d3a88b81 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -7,13 +7,16 @@
<attr name="text" format="string|reference"/>
<attr name="icon" format="reference"/>
+ <attr name="subtitle" format="string|reference"/>
<declare-styleable name="IconSwitchEntry">
<attr name="text"/>
+ <attr name="subtitle" />
<attr name="icon"/>
</declare-styleable>
<declare-styleable name="IconTextEntry">
<attr name="text"/>
+ <attr name="subtitle" />
<attr name="icon"/>
</declare-styleable>
</resources> \ 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 @@
<string name="save_battery">Save battery</string>
<string name="save_battery_message">Background data connections will hibernate when your phone is inactive.</string>
<string name="always_on_vpn">Always-on VPN</string>
+ <string name="subtitle_always_on_vpn">Open Android System Settings</string>
<string name="do_not_show_again">Do not show again</string>
<string name="always_on_vpn_user_message">To enable always-on VPN in Android VPN Settings click on the configure icon [img src] and turn the switch on.</string>
<string name="always_on_blocking_vpn_user_message">To protect your privacy optimally, you should also activate the option \"Block connections without VPN\".</string>
@@ -113,4 +114,5 @@
<string name="obfuscated_connection">Using an obfuscated connection.</string>
<string name="obfuscated_connection_try">Trying an obfuscated connection.</string>
<string name="nav_drawer_obfuscated_connection">Using Bridges</string>
+ <string name="nav_drawer_subtitle_obfuscated_connection">Circumvent VPN filtering</string>
</resources>