code cleanup

This commit is contained in:
Daniel Gultsch 2014-05-13 17:11:27 +02:00
parent 84e79040df
commit 71545f4f66
1 changed files with 12 additions and 10 deletions

View File

@ -6,8 +6,6 @@ import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
import org.openintents.openpgp.OpenPgpError;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;
@ -121,6 +119,10 @@ public class ConversationActivity extends XmppActivity {
return this.selectedConversation; return this.selectedConversation;
} }
public void setSelectedConversation(Conversation conversation) {
this.selectedConversation = conversation;
}
public ListView getConversationListView() { public ListView getConversationListView() {
return this.listView; return this.listView;
} }
@ -235,8 +237,8 @@ public class ConversationActivity extends XmppActivity {
public void onItemClick(AdapterView<?> arg0, View clickedView, public void onItemClick(AdapterView<?> arg0, View clickedView,
int position, long arg3) { int position, long arg3) {
paneShouldBeOpen = false; paneShouldBeOpen = false;
if (selectedConversation != conversationList.get(position)) { if (getSelectedConversation() != conversationList.get(position)) {
selectedConversation = conversationList.get(position); setSelectedConversation(conversationList.get(position));
swapConversationFragment(); // .onBackendConnected(conversationList.get(position)); swapConversationFragment(); // .onBackendConnected(conversationList.get(position));
} else { } else {
spl.closePane(); spl.closePane();
@ -367,7 +369,7 @@ public class ConversationActivity extends XmppActivity {
@Override @Override
public void error(int error) { public void error(int error) {
// TODO Auto-generated method stub displayErrorDialog(error);
} }
}); });
@ -452,7 +454,7 @@ public class ConversationActivity extends XmppActivity {
Intent inviteIntent = new Intent(getApplicationContext(), Intent inviteIntent = new Intent(getApplicationContext(),
ContactsActivity.class); ContactsActivity.class);
inviteIntent.setAction("invite"); inviteIntent.setAction("invite");
inviteIntent.putExtra("uuid", selectedConversation.getUuid()); inviteIntent.putExtra("uuid", getSelectedConversation().getUuid());
startActivity(inviteIntent); startActivity(inviteIntent);
break; break;
case R.id.action_security: case R.id.action_security:
@ -531,9 +533,9 @@ public class ConversationActivity extends XmppActivity {
spl.openPane(); spl.openPane();
xmppConnectionService.archiveConversation(conversation); xmppConnectionService.archiveConversation(conversation);
if (conversationList.size() > 0) { if (conversationList.size() > 0) {
selectedConversation = conversationList.get(0); setSelectedConversation(conversationList.get(0));
} else { } else {
selectedConversation = null; setSelectedConversation(null);
} }
} }
@ -619,7 +621,7 @@ public class ConversationActivity extends XmppActivity {
for (int i = 0; i < conversationList.size(); ++i) { for (int i = 0; i < conversationList.size(); ++i) {
if (conversationList.get(i).getUuid().equals(convToView)) { if (conversationList.get(i).getUuid().equals(convToView)) {
selectedConversation = conversationList.get(i); setSelectedConversation(conversationList.get(i));
} }
} }
paneShouldBeOpen = false; paneShouldBeOpen = false;
@ -642,7 +644,7 @@ public class ConversationActivity extends XmppActivity {
if (selectedFragment != null) { if (selectedFragment != null) {
selectedFragment.onBackendConnected(); selectedFragment.onBackendConnected();
} else { } else {
selectedConversation = conversationList.get(0); setSelectedConversation(conversationList.get(0));
swapConversationFragment(); swapConversationFragment();
} }
ExceptionHelper.checkForCrash(this, this.xmppConnectionService); ExceptionHelper.checkForCrash(this, this.xmppConnectionService);