summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2020-03-01 23:50:06 +0100
committercyBerta <cyberta@riseup.net>2020-03-01 23:50:06 +0100
commitb370e063453edb5caeaf11cdb85d1ca1c1ac15e9 (patch)
tree566191d887163fdba44e6cf9aab9162f255b232c
parent2b22e4ad47ae7df24b15ea28b08e60a4999a96cf (diff)
improve visual disabled state for switch entries in navigation drawer
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java11
-rw-r--r--app/src/main/res/layout-xlarge/v_switch_list_item.xml2
-rw-r--r--app/src/main/res/layout/v_switch_list_item.xml2
3 files changed, 12 insertions, 3 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 8bb809fd..b41f3a50 100644
--- a/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java
+++ b/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java
@@ -7,6 +7,7 @@ import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
+import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.SwitchCompat;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -22,7 +23,7 @@ public class IconSwitchEntry extends LinearLayout {
private TextView textView;
private TextView subtitleView;
- private ImageView iconView;
+ private AppCompatImageView iconView;
private SwitchCompat switchView;
private CompoundButton.OnCheckedChangeListener checkedChangeListener;
@@ -105,4 +106,12 @@ public class IconSwitchEntry extends LinearLayout {
switchView.setChecked(isChecked);
switchView.setOnCheckedChangeListener(checkedChangeListener);
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ switchView.setVisibility(enabled ? VISIBLE : GONE);
+ textView.setTextColor(getResources().getColor(enabled ? android.R.color.black : R.color.colorDisabled));
+ iconView.setImageAlpha(enabled ? 255 : 128);
+ }
}
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 c393a0f8..8ad83650 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
@@ -5,7 +5,7 @@
android:layout_width="match_parent"
>
- <ImageView
+ <android.support.v7.widget.AppCompatImageView
android:id="@+id/material_icon"
android:layout_width="?android:attr/listPreferredItemHeight"
android:layout_height="?android:attr/listPreferredItemHeight"
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 a92e78b1..6a2e4a8d 100644
--- a/app/src/main/res/layout/v_switch_list_item.xml
+++ b/app/src/main/res/layout/v_switch_list_item.xml
@@ -5,7 +5,7 @@
android:layout_width="match_parent"
>
- <ImageView
+ <android.support.v7.widget.AppCompatImageView
android:id="@+id/material_icon"
android:layout_width="?android:attr/listPreferredItemHeightSmall"
android:layout_height="?android:attr/listPreferredItemHeightSmall"