diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-06 15:34:08 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-06 15:34:08 +0200 |
commit | c30bf75a5d77fab21480e04ce18b46d6b2826295 (patch) | |
tree | b0eed8c7cf56483c90047eb92f53e18d9a1a6f51 /src/eu/siacs/conversations/ui | |
parent | 9fc7a1b980863955a139193ded0fef5edfbad296 (diff) |
gui for images
Diffstat (limited to 'src/eu/siacs/conversations/ui')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationActivity.java | 5 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 61 |
2 files changed, 36 insertions, 30 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index 82b33499..85186e9b 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -494,10 +494,7 @@ public class ConversationActivity extends XmppActivity { selectedFragment.hidePgpPassphraseBox(); } } else if (requestCode == ATTACH_FILE) { - FileBackend backend = xmppConnectionService.getFileBackend(); - File file = backend.copyImageToPrivateStorage(getSelectedConversation(), data.getData()); - Log.d(LOGTAG,"new file"+file.getAbsolutePath()); - + xmppConnectionService.attachImageToConversation(getSelectedConversation(), data.getData()); } } } diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 51caafbd..a9bde53d 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -89,7 +89,6 @@ public class ConversationFragment extends Fragment { @Override public void onClick(View v) { - Log.d("gultsch", "clicked to decrypt"); if (askForPassphraseIntent != null) { try { getActivity().startIntentSenderForResult( @@ -97,7 +96,7 @@ public class ConversationFragment extends Fragment { ConversationActivity.REQUEST_DECRYPT_PGP, null, 0, 0, 0); } catch (SendIntentException e) { - Log.d("gultsch", "couldnt fire intent"); + Log.d("xmppService", "couldnt fire intent"); } } } @@ -210,6 +209,7 @@ public class ConversationFragment extends Fragment { .findViewById(R.id.message_photo); viewHolder.imageView.setImageBitmap(selfBitmap); viewHolder.indicator = (ImageView) view.findViewById(R.id.security_indicator); + viewHolder.image = (ImageView) view.findViewById(R.id.message_image); break; case RECIEVED: view = (View) inflater.inflate( @@ -262,32 +262,40 @@ public class ConversationFragment extends Fragment { } } } - String body = item.getBody(); - if (body != null) { - if (item.getEncryption() == Message.ENCRYPTION_PGP) { - viewHolder.messageBody - .setText(getString(R.string.encrypted_message)); - viewHolder.messageBody.setTextColor(0xff33B5E5); - viewHolder.messageBody.setTypeface(null, - Typeface.ITALIC); - viewHolder.indicator.setVisibility(View.VISIBLE); - } else if ((item.getEncryption() == Message.ENCRYPTION_OTR)||(item.getEncryption() == Message.ENCRYPTION_DECRYPTED)) { - viewHolder.messageBody.setText(body.trim()); - viewHolder.messageBody.setTextColor(0xff000000); - viewHolder.messageBody.setTypeface(null, - Typeface.NORMAL); - viewHolder.indicator.setVisibility(View.VISIBLE); - } else { - viewHolder.messageBody.setText(body.trim()); - viewHolder.messageBody.setTextColor(0xff000000); - viewHolder.messageBody.setTypeface(null, - Typeface.NORMAL); - if (item.getStatus() != Message.STATUS_ERROR) { - viewHolder.indicator.setVisibility(View.GONE); + if (item.getType() == Message.TYPE_IMAGE) { + viewHolder.image.setVisibility(View.VISIBLE); + viewHolder.image.setImageBitmap(activity.xmppConnectionService.getFileBackend().getImageFromMessage(item)); + viewHolder.messageBody.setVisibility(View.GONE); + } else { + if (viewHolder.image != null) viewHolder.image.setVisibility(View.GONE); + viewHolder.messageBody.setVisibility(View.VISIBLE); + String body = item.getBody(); + if (body != null) { + if (item.getEncryption() == Message.ENCRYPTION_PGP) { + viewHolder.messageBody + .setText(getString(R.string.encrypted_message)); + viewHolder.messageBody.setTextColor(0xff33B5E5); + viewHolder.messageBody.setTypeface(null, + Typeface.ITALIC); + viewHolder.indicator.setVisibility(View.VISIBLE); + } else if ((item.getEncryption() == Message.ENCRYPTION_OTR)||(item.getEncryption() == Message.ENCRYPTION_DECRYPTED)) { + viewHolder.messageBody.setText(body.trim()); + viewHolder.messageBody.setTextColor(0xff000000); + viewHolder.messageBody.setTypeface(null, + Typeface.NORMAL); + viewHolder.indicator.setVisibility(View.VISIBLE); + } else { + viewHolder.messageBody.setText(body.trim()); + viewHolder.messageBody.setTextColor(0xff000000); + viewHolder.messageBody.setTypeface(null, + Typeface.NORMAL); + if (item.getStatus() != Message.STATUS_ERROR) { + viewHolder.indicator.setVisibility(View.GONE); + } } + } else { + viewHolder.indicator.setVisibility(View.GONE); } - } else { - viewHolder.indicator.setVisibility(View.GONE); } if (item.getStatus() == Message.STATUS_UNSEND) { viewHolder.time.setTypeface(null, Typeface.ITALIC); @@ -585,6 +593,7 @@ public class ConversationFragment extends Fragment { private static class ViewHolder { + protected ImageView image; protected ImageView indicator; protected TextView time; protected TextView messageBody; |