Format contact names in MUC properly
This commit is contained in:
parent
1f5908b1d1
commit
dd426ca6de
|
@ -69,7 +69,7 @@ public class ConversationActivity extends XmppActivity implements
|
||||||
|
|
||||||
private View mContentView;
|
private View mContentView;
|
||||||
|
|
||||||
private List<Conversation> conversationList = new ArrayList<Conversation>();
|
private List<Conversation> conversationList = new ArrayList<>();
|
||||||
private Conversation selectedConversation = null;
|
private Conversation selectedConversation = null;
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
private ConversationFragment mConversationFragment;
|
private ConversationFragment mConversationFragment;
|
||||||
|
@ -160,8 +160,10 @@ public class ConversationActivity extends XmppActivity implements
|
||||||
this.listAdapter = new ConversationAdapter(this, conversationList);
|
this.listAdapter = new ConversationAdapter(this, conversationList);
|
||||||
listView.setAdapter(this.listAdapter);
|
listView.setAdapter(this.listAdapter);
|
||||||
|
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(false);
|
if (getActionBar() != null) {
|
||||||
getActionBar().setHomeButtonEnabled(false);
|
getActionBar().setDisplayHomeAsUpEnabled(false);
|
||||||
|
getActionBar().setHomeButtonEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
listView.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
|
||||||
|
@ -599,7 +601,7 @@ public class ConversationActivity extends XmppActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
if (!isConversationsOverviewVisable()) {
|
if (!isConversationsOverviewVisable()) {
|
||||||
showConversationsOverview();
|
showConversationsOverview();
|
||||||
|
@ -610,7 +612,7 @@ public class ConversationActivity extends XmppActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(final Intent intent) {
|
||||||
if (xmppConnectionServiceBound) {
|
if (xmppConnectionServiceBound) {
|
||||||
if (intent != null && VIEW_CONVERSATION.equals(intent.getType())) {
|
if (intent != null && VIEW_CONVERSATION.equals(intent.getType())) {
|
||||||
handleViewConversationIntent(intent);
|
handleViewConversationIntent(intent);
|
||||||
|
@ -644,7 +646,7 @@ public class ConversationActivity extends XmppActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle savedInstanceState) {
|
public void onSaveInstanceState(final Bundle savedInstanceState) {
|
||||||
Conversation conversation = getSelectedConversation();
|
Conversation conversation = getSelectedConversation();
|
||||||
if (conversation != null) {
|
if (conversation != null) {
|
||||||
savedInstanceState.putString(STATE_OPEN_CONVERSATION,
|
savedInstanceState.putString(STATE_OPEN_CONVERSATION,
|
||||||
|
@ -713,11 +715,11 @@ public class ConversationActivity extends XmppActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectConversationByUuid(String uuid) {
|
private void selectConversationByUuid(String uuid) {
|
||||||
for (int i = 0; i < conversationList.size(); ++i) {
|
for (Conversation aConversationList : conversationList) {
|
||||||
if (conversationList.get(i).getUuid().equals(uuid)) {
|
if (aConversationList.getUuid().equals(uuid)) {
|
||||||
setSelectedConversation(conversationList.get(i));
|
setSelectedConversation(aConversationList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerListener() {
|
public void registerListener() {
|
||||||
|
@ -831,7 +833,7 @@ public class ConversationActivity extends XmppActivity implements
|
||||||
try {
|
try {
|
||||||
this.startIntentSenderForResult(pi.getIntentSender(), requestCode,
|
this.startIntentSenderForResult(pi.getIntentSender(), requestCode,
|
||||||
null, 0, 0, 0);
|
null, 0, 0, 0);
|
||||||
} catch (SendIntentException e1) {
|
} catch (final SendIntentException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
info = contact.getDisplayName();
|
info = contact.getDisplayName();
|
||||||
} else {
|
} else {
|
||||||
if (message.getPresence() != null) {
|
if (message.getPresence() != null) {
|
||||||
info = message.getPresence().toString();
|
info = message.getPresence().getResourcepart();
|
||||||
} else {
|
} else {
|
||||||
info = message.getCounterpart().toString();
|
info = message.getCounterpart().toString();
|
||||||
}
|
}
|
||||||
|
@ -246,8 +246,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
} else {
|
} else {
|
||||||
to = message.getCounterpart();
|
to = message.getCounterpart();
|
||||||
}
|
}
|
||||||
privateMarker = activity.getString(
|
privateMarker = activity.getString(R.string.private_message_to, to);
|
||||||
R.string.private_message_to, to);
|
|
||||||
}
|
}
|
||||||
SpannableString span = new SpannableString(privateMarker + " "
|
SpannableString span = new SpannableString(privateMarker + " "
|
||||||
+ message.getBody());
|
+ 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)));
|
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
|
viewHolder.contact_picture
|
||||||
.setOnClickListener(new OnClickListener() {
|
.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
|
@ -501,14 +500,16 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
} else {
|
} else {
|
||||||
displayInfoMessage(viewHolder,
|
displayInfoMessage(viewHolder,
|
||||||
R.string.install_openkeychain);
|
R.string.install_openkeychain);
|
||||||
viewHolder.message_box
|
if (viewHolder != null) {
|
||||||
.setOnClickListener(new OnClickListener() {
|
viewHolder.message_box
|
||||||
|
.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
activity.showInstallPgpDialog();
|
activity.showInstallPgpDialog();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (item.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
|
} else if (item.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
|
||||||
displayDecryptionFailed(viewHolder);
|
displayDecryptionFailed(viewHolder);
|
||||||
|
|
Loading…
Reference in New Issue