aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/ui/adapter
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-03-11 23:44:59 +0100
committersteckbrief <steckbrief@chefmail.de>2016-03-11 23:44:59 +0100
commita4444026444c75678db1663e01de05df225cd9ed (patch)
tree3bee0b26345feee9eeb477e45e4d443c52d832ca /src/main/java/de/thedevstack/conversationsplus/ui/adapter
parentbfc5000b6aa3d401ad80e04c43a6671aa9c2c619 (diff)
Fixes FS#51: Change toggle in Account Management back to standard
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/adapter')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java
index eb0344bc..b6caa019 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java
@@ -7,6 +7,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.ImageView;
+import android.widget.Switch;
import android.widget.TextView;
import java.util.List;
@@ -17,7 +18,6 @@ import de.thedevstack.conversationsplus.entities.Account;
import de.thedevstack.conversationsplus.services.AvatarService;
import de.thedevstack.conversationsplus.ui.ManageAccountActivity;
import de.thedevstack.conversationsplus.ui.XmppActivity;
-import de.thedevstack.conversationsplus.ui.widget.Switch;
public class AccountAdapter extends ArrayAdapter<Account> {
@@ -60,12 +60,13 @@ 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);
+ tglAccountState.setChecked(!isDisabled);
tglAccountState.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
- if (b == isDisabled && activity instanceof ManageAccountActivity) {
- ((ManageAccountActivity) activity).onClickTglAccountState(account,b);
+ // Condition compoundButton.isPressed() added because of http://stackoverflow.com/a/28219410
+ if (compoundButton.isPressed() && b == isDisabled && activity instanceof ManageAccountActivity) {
+ ((ManageAccountActivity) activity).onClickTglAccountState(account, b);
}
}
});