aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/adapter
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-02-22 21:19:33 +0100
committerChristian Schneppe <christian@pix-art.de>2017-02-22 21:19:33 +0100
commit8ad2e790e6cec22ce6c816d51f692593ec4517db (patch)
tree50d9d786072f349c85a6573f014f6dd3c905db38 /src/main/java/de/pixart/messenger/ui/adapter
parent0ce13fa8613e7df1215ef4582a14bcf8a3a77e96 (diff)
set location preview size
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/adapter')
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index b71e98032..909ef38ea 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -634,6 +634,22 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.messageBody.setVisibility(View.GONE);
String url = GeoHelper.MapPreviewUri(message);
viewHolder.image.setVisibility(View.VISIBLE);
+ double target = metrics.density * 200;
+ int scaledW;
+ int scaledH;
+ if (Math.max(500, 500) * metrics.density <= target) {
+ scaledW = (int) (500 * metrics.density);
+ scaledH = (int) (500 * metrics.density);
+ } else if (Math.max(500, 500) <= target) {
+ scaledW = 500;
+ scaledH = 500;
+ } else {
+ scaledW = (int) target;
+ scaledH = (int) (500 / ((double) 500 / target));
+ }
+ LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(scaledW, scaledH);
+ layoutParams.setMargins(0, (int) (metrics.density * 4), 0, (int) (metrics.density * 4));
+ viewHolder.image.setLayoutParams(layoutParams);
viewHolder.image.setOnClickListener(new OnClickListener() {
@Override