diff options
author | steckbrief <steckbrief@chefmail.de> | 2015-11-03 21:09:36 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2015-11-03 21:09:36 +0100 |
commit | b22d863c362bb6492240700c0f69f1a5d926f46b (patch) | |
tree | acf185af5312a97f18819efd3927c46b12a797d1 /src/main/java/de/thedevstack/conversationsplus/ui/adapter | |
parent | 11659eadb02b382804845d4e01a8536e02698468 (diff) |
Implements FS#26: Introduction of dialog to choose whether to resize a picture or not
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/adapter')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java | 2 | ||||
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java | 40 |
2 files changed, 22 insertions, 20 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java index 1fc6e066..56e1baa4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java @@ -106,7 +106,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { || message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) { mLastMessage.setVisibility(View.GONE); imagePreview.setVisibility(View.VISIBLE); - activity.loadBitmap(message, imagePreview); + activity.loadBitmap(message, imagePreview, false); } else { Pair<String,Boolean> preview = UIHelper.getMessagePreview(activity,message); mLastMessage.setVisibility(View.VISIBLE); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java index 550e3c4e..bbe0d362 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java @@ -206,7 +206,7 @@ public class MessageAdapter extends ArrayAdapter<Message> { viewHolder.image.setVisibility(View.GONE); viewHolder.messageBody.setVisibility(View.VISIBLE); viewHolder.messageBody.setText(getContext().getString( - R.string.decryption_failed)); + R.string.decryption_failed)); viewHolder.messageBody.setTextColor(activity.getWarningTextColor()); viewHolder.messageBody.setTypeface(null, Typeface.NORMAL); viewHolder.messageBody.setTextIsSelectable(false); @@ -297,11 +297,11 @@ public class MessageAdapter extends ArrayAdapter<Message> { viewHolder.download_button.setText(text); viewHolder.download_button.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - startDownloadable(message); - } - }); + @Override + public void onClick(View v) { + startDownloadable(message); + } + }); viewHolder.download_button.setOnLongClickListener(openContextMenu); } @@ -343,7 +343,8 @@ public class MessageAdapter extends ArrayAdapter<Message> { viewHolder.messageBody.setVisibility(View.GONE); viewHolder.image.setVisibility(View.VISIBLE); FileParams params = message.getFileParams(); - double target = metrics.density * 288; + //TODO: Check what value add the following lines have (compared with setting height/width in XmppActivity.loadBitmap from thumbnail after thumbnail is created) + /*double target = metrics.density * 288; int scalledW; int scalledH; if (params.width <= params.height) { @@ -354,18 +355,19 @@ public class MessageAdapter extends ArrayAdapter<Message> { scalledH = (int) (params.height / ((double) params.width / target)); } viewHolder.image.setLayoutParams(new LinearLayout.LayoutParams( - scalledW, scalledH)); - activity.loadBitmap(message, viewHolder.image); - viewHolder.image.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(activity.xmppConnectionService - .getFileBackend().getJingleFileUri(message), "image/*"); - getContext().startActivity(intent); - } - }); + scalledW, scalledH));*/ + //TODO Why should this be calculated by hand??? + activity.loadBitmap(message, viewHolder.image, true); + viewHolder.image.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(activity.xmppConnectionService + .getFileBackend().getJingleFileUri(message), "image/*"); + getContext().startActivity(intent); + } + }); viewHolder.image.setOnLongClickListener(openContextMenu); } |