aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <xmpp-dev@marcschink.de>2017-12-06 11:18:05 +0100
committerAndroid Development <you@example.com>2017-12-07 17:33:09 +0100
commite42f6f1d9022f80b598246e6106f277d1552f162 (patch)
treefce451ef577dde94c6534aca6a567d2d48b9ddbd
parent9ca0c6372618402383dccbe1297306c7a75ba471 (diff)
AccountAdapter: Allow hiding of state button
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
index d7e2417..6a8ba6c 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
@@ -29,10 +29,18 @@ import eu.siacs.conversations.utils.UIHelper;
public class AccountAdapter extends ArrayAdapter<Account> {
private XmppActivity activity;
+ private boolean showStateButton;
+
+ public AccountAdapter(XmppActivity activity, List<Account> objects, boolean showStateButton) {
+ super(activity, 0, objects);
+ this.activity = activity;
+ this.showStateButton = showStateButton;
+ }
public AccountAdapter(XmppActivity activity, List<Account> objects) {
super(activity, 0, objects);
this.activity = activity;
+ this.showStateButton = true;
}
@Override
@@ -68,6 +76,10 @@ public class AccountAdapter extends ArrayAdapter<Account> {
final Switch tglAccountState = (Switch) view.findViewById(R.id.tgl_account_status);
final boolean isDisabled = (account.getStatus() == Account.State.DISABLED);
tglAccountState.setChecked(!isDisabled,false);
+ if (this.showStateButton)
+ tglAccountState.setVisibility(View.VISIBLE);
+ else
+ tglAccountState.setVisibility(View.GONE);
tglAccountState.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {