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 --- .../main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java | 8 ++++++++ app/src/main/java/se/leap/bitmaskclient/views/IconTextEntry.java | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'app/src/main/java/se/leap') 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); -- cgit v1.2.3