aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java26
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java25
2 files changed, 27 insertions, 24 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 443a73db..c1306210 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -69,7 +69,7 @@ public class ConversationActivity extends XmppActivity implements
private View mContentView;
- private List<Conversation> conversationList = new ArrayList<Conversation>();
+ private List<Conversation> conversationList = new ArrayList<>();
private Conversation selectedConversation = null;
private ListView listView;
private ConversationFragment mConversationFragment;
@@ -160,8 +160,10 @@ public class ConversationActivity extends XmppActivity implements
this.listAdapter = new ConversationAdapter(this, conversationList);
listView.setAdapter(this.listAdapter);
- getActionBar().setDisplayHomeAsUpEnabled(false);
- getActionBar().setHomeButtonEnabled(false);
+ if (getActionBar() != null) {
+ getActionBar().setDisplayHomeAsUpEnabled(false);
+ getActionBar().setHomeButtonEnabled(false);
+ }
listView.setOnItemClickListener(new OnItemClickListener() {
@@ -599,7 +601,7 @@ public class ConversationActivity extends XmppActivity implements
}
@Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
+ public boolean onKeyDown(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (!isConversationsOverviewVisable()) {
showConversationsOverview();
@@ -610,7 +612,7 @@ public class ConversationActivity extends XmppActivity implements
}
@Override
- protected void onNewIntent(Intent intent) {
+ protected void onNewIntent(final Intent intent) {
if (xmppConnectionServiceBound) {
if (intent != null && VIEW_CONVERSATION.equals(intent.getType())) {
handleViewConversationIntent(intent);
@@ -644,7 +646,7 @@ public class ConversationActivity extends XmppActivity implements
}
@Override
- public void onSaveInstanceState(Bundle savedInstanceState) {
+ public void onSaveInstanceState(final Bundle savedInstanceState) {
Conversation conversation = getSelectedConversation();
if (conversation != null) {
savedInstanceState.putString(STATE_OPEN_CONVERSATION,
@@ -713,11 +715,11 @@ public class ConversationActivity extends XmppActivity implements
}
private void selectConversationByUuid(String uuid) {
- for (int i = 0; i < conversationList.size(); ++i) {
- if (conversationList.get(i).getUuid().equals(uuid)) {
- setSelectedConversation(conversationList.get(i));
- }
- }
+ for (Conversation aConversationList : conversationList) {
+ if (aConversationList.getUuid().equals(uuid)) {
+ setSelectedConversation(aConversationList);
+ }
+ }
}
public void registerListener() {
@@ -831,7 +833,7 @@ public class ConversationActivity extends XmppActivity implements
try {
this.startIntentSenderForResult(pi.getIntentSender(), requestCode,
null, 0, 0, 0);
- } catch (SendIntentException e1) {
+ } catch (final SendIntentException ignored) {
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index ffd0b4e9..17253cff 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -149,7 +149,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
info = contact.getDisplayName();
} else {
if (message.getPresence() != null) {
- info = message.getPresence().toString();
+ info = message.getPresence().getResourcepart();
} else {
info = message.getCounterpart().toString();
}
@@ -246,8 +246,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
} else {
to = message.getCounterpart();
}
- privateMarker = activity.getString(
- R.string.private_message_to, to);
+ privateMarker = activity.getString(R.string.private_message_to, to);
}
SpannableString span = new SpannableString(privateMarker + " "
+ message.getBody());
@@ -436,7 +435,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.contact_picture.setImageBitmap(activity.avatarService().get(item.getConversation().getAccount(), activity.getPixel(48)));
}
- if (viewHolder.contact_picture != null) {
+ if (viewHolder != null && viewHolder.contact_picture != null) {
viewHolder.contact_picture
.setOnClickListener(new OnClickListener() {
@@ -501,14 +500,16 @@ public class MessageAdapter extends ArrayAdapter<Message> {
} else {
displayInfoMessage(viewHolder,
R.string.install_openkeychain);
- viewHolder.message_box
- .setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- activity.showInstallPgpDialog();
- }
- });
+ if (viewHolder != null) {
+ viewHolder.message_box
+ .setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ activity.showInstallPgpDialog();
+ }
+ });
+ }
}
} else if (item.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
displayDecryptionFailed(viewHolder);