summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java
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 /app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java
parent2b22e4ad47ae7df24b15ea28b08e60a4999a96cf (diff)
improve visual disabled state for switch entries in navigation drawer
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java11
1 files changed, 10 insertions, 1 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);
+ }
}