Fixed NullPointerException in ConfigureGroupActivity. Bug #63.

This commit is contained in:
akwizgran
2014-03-22 12:25:04 +00:00
parent fc66f6ed8a
commit 86ebae04b4

View File

@@ -50,6 +50,7 @@ SelectContactsDialog.Listener {
private RadioButton visibleToAll = null, visibleToSome = null; private RadioButton visibleToAll = null, visibleToSome = null;
private Button doneButton = null; private Button doneButton = null;
private ProgressBar progress = null; private ProgressBar progress = null;
private boolean changed = false;
// Fields that are accessed from background threads must be volatile // Fields that are accessed from background threads must be volatile
@Inject private volatile DatabaseComponent db; @Inject private volatile DatabaseComponent db;
@@ -128,20 +129,28 @@ SelectContactsDialog.Listener {
public void onClick(View view) { public void onClick(View view) {
if(view == subscribeCheckBox) { if(view == subscribeCheckBox) {
changed = true;
boolean subscribe = subscribeCheckBox.isChecked(); boolean subscribe = subscribeCheckBox.isChecked();
visibleToAll.setEnabled(subscribe); visibleToAll.setEnabled(subscribe);
visibleToSome.setEnabled(subscribe); visibleToSome.setEnabled(subscribe);
} else if(view == visibleToAll) {
changed = true;
} else if(view == visibleToSome) { } else if(view == visibleToSome) {
changed = true;
if(contacts == null) loadContacts(); if(contacts == null) loadContacts();
else displayContacts(); else displayContacts();
} else if(view == doneButton) { } else if(view == doneButton) {
boolean subscribe = subscribeCheckBox.isChecked(); if(changed) {
boolean all = visibleToAll.isChecked(); boolean subscribe = subscribeCheckBox.isChecked();
// Replace the button with a progress bar boolean all = visibleToAll.isChecked();
doneButton.setVisibility(GONE); // Replace the button with a progress bar
progress.setVisibility(VISIBLE); doneButton.setVisibility(GONE);
// Update the blog in a background thread progress.setVisibility(VISIBLE);
if(subscribe || subscribed) updateGroup(subscribe, all); // Update the blog in a background thread
if(subscribe || subscribed) updateGroup(subscribe, all);
} else {
finish();
}
} }
} }