diff options
author | cyberta <cyberta@riseup.net> | 2021-05-18 16:13:44 +0000 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2021-05-18 16:13:44 +0000 |
commit | 15490dae1ac8670d1288367cb2ac8fd43c48a045 (patch) | |
tree | 7ee5ae99b504c5a737471f6d1d9ee331008dfc20 /app/src/main/java/se/leap/bitmaskclient/base/views | |
parent | 48bd56b48c96cc62557675a82ac0ca1865f9aa8e (diff) | |
parent | 4b8ea1252cddfd54278676a8b2f64eb937f92c2d (diff) |
Merge branch 'gateway_selector' into 'master'
Gateway selector
See merge request leap/bitmask_android!132
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/views')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java index 1160986e..b6d72ab6 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java @@ -1,3 +1,19 @@ +/** + * Copyright (c) 2021 LEAP Encryption Access Project and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package se.leap.bitmaskclient.base.views; import android.annotation.TargetApi; @@ -51,7 +67,7 @@ public class IconSwitchEntry extends LinearLayout { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rootview = inflater.inflate(R.layout.v_switch_list_item, this, true); - textView = rootview.findViewById(android.R.id.text1); + textView = rootview.findViewById(R.id.title); subtitleView = rootview.findViewById(R.id.subtitle); iconView = rootview.findViewById(R.id.material_icon); switchView = rootview.findViewById(R.id.option_switch); @@ -88,6 +104,15 @@ public class IconSwitchEntry extends LinearLayout { textView.setText(id); } + public void setSubtitle(CharSequence text) { + subtitleView.setText(text); + } + + public void setSingleLine(boolean singleLine) { + textView.setSingleLine(singleLine); + subtitleView.setSingleLine(singleLine); + } + public void showSubtitle(boolean show) { subtitleView.setVisibility(show ? VISIBLE : GONE); } @@ -106,6 +131,10 @@ public class IconSwitchEntry extends LinearLayout { switchView.setOnCheckedChangeListener(checkedChangeListener); } + public boolean isChecked() { + return switchView.isChecked(); + } + @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); |