aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-05-09 20:46:43 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-05-09 20:46:43 +0200
commita14a28973ada020234c60680a51cdff2f9129de9 (patch)
tree0023194f9d53d0db6f7844829e210e15d9b88663 /src/eu/siacs/conversations/ui
parentb0a0863ba2c23023b0b04d813b1dc30bd638735e (diff)
nicer descriptions in notificaton for images and encrypted messages
Diffstat (limited to 'src/eu/siacs/conversations/ui')
-rw-r--r--src/eu/siacs/conversations/ui/ConversationActivity.java11
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java
index 646eb3c0..d3e3737f 100644
--- a/src/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/eu/siacs/conversations/ui/ConversationActivity.java
@@ -55,6 +55,7 @@ import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import android.widget.TextView;
import android.widget.ImageView;
+import android.widget.Toast;
public class ConversationActivity extends XmppActivity {
@@ -112,6 +113,7 @@ public class ConversationActivity extends XmppActivity {
protected ConversationActivity activity = this;
private DisplayMetrics metrics;
+ private Toast prepareImageToast;
public List<Conversation> getConversationList() {
return this.conversationList;
@@ -178,7 +180,11 @@ public class ConversationActivity extends XmppActivity {
Message latestMessage = conv.getLatestMessage();
if (latestMessage.getType() == Message.TYPE_TEXT) {
- convLastMsg.setText(conv.getLatestMessage().getBody());
+ if ((latestMessage.getEncryption() != Message.ENCRYPTION_PGP)&&(latestMessage.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED)) {
+ convLastMsg.setText(conv.getLatestMessage().getBody());
+ } else {
+ convLastMsg.setText(getText(R.string.encrypted_message_received));
+ }
convLastMsg.setVisibility(View.VISIBLE);
imagePreview.setVisibility(View.GONE);
} else if (latestMessage.getType() == Message.TYPE_IMAGE) {
@@ -639,11 +645,14 @@ public class ConversationActivity extends XmppActivity {
selectedFragment.hidePgpPassphraseBox();
}
} else if (requestCode == REQUEST_ATTACH_FILE_DIALOG) {
+ prepareImageToast = Toast.makeText(getApplicationContext(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
final Conversation conversation = getSelectedConversation();
String presence = conversation.getNextPresence();
if (conversation.getNextEncryption() == Message.ENCRYPTION_NONE) {
+ prepareImageToast.show();
xmppConnectionService.attachImageToConversation(conversation, presence, data.getData());
} else if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) {
+ prepareImageToast.show();
attachPgpFile(conversation,data.getData());
} else {
Log.d(LOGTAG,"unknown next message encryption: "+conversation.getNextEncryption());
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index e06c9eeb..6850ac54 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -492,7 +492,9 @@ public class ConversationFragment extends Fragment {
@Override
public void onStop() {
super.onStop();
- this.conversation.setNextMessage(chatMsg.getText().toString());
+ if (this.conversation!=null) {
+ this.conversation.setNextMessage(chatMsg.getText().toString());
+ }
}
public void onBackendConnected() {