diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaShareViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaShareViewHolder.java
index d788074d..9648b82d 100644
--- a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaShareViewHolder.java
+++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaShareViewHolder.java
@@ -2,9 +2,11 @@ package awais.instagrabber.adapters.viewholder.directmessages;
import android.content.Context;
import android.view.View;
+import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.core.text.HtmlCompat;
+import androidx.core.util.Pair;
import awais.instagrabber.R;
import awais.instagrabber.databinding.LayoutDmBaseBinding;
@@ -13,18 +15,24 @@ import awais.instagrabber.models.ProfileModel;
import awais.instagrabber.models.direct_messages.DirectItemModel;
import awais.instagrabber.models.direct_messages.DirectItemModel.DirectItemMediaModel;
import awais.instagrabber.models.enums.MediaItemType;
+import awais.instagrabber.utils.NumberUtils;
+import awais.instagrabber.utils.Utils;
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_COMPACT;
public class DirectMessageMediaShareViewHolder extends DirectMessageItemViewHolder {
private final LayoutDmMediaShareBinding binding;
+ private final int maxHeight;
+ private final int maxWidth;
public DirectMessageMediaShareViewHolder(@NonNull final LayoutDmBaseBinding baseBinding,
@NonNull final LayoutDmMediaShareBinding binding,
final View.OnClickListener onClickListener) {
super(baseBinding, onClickListener);
this.binding = binding;
+ maxHeight = itemView.getResources().getDimensionPixelSize(R.dimen.dm_media_img_max_height);
+ maxWidth = (int) (Utils.displayMetrics.widthPixels * 0.8);
setItemView(binding.getRoot());
}
@@ -38,9 +46,48 @@ public class DirectMessageMediaShareViewHolder extends DirectMessageItemViewHold
"" + context.getString(R.string.dms_inbox_media_shared_from, modelUser.getUsername()) + "",
FROM_HTML_MODE_COMPACT));
}
+ final Pair widthHeight = NumberUtils.calculateWidthHeight(
+ mediaModel.getHeight(),
+ mediaModel.getWidth(),
+ maxHeight,
+ maxWidth
+ );
+ final ViewGroup.LayoutParams layoutParams = binding.ivMediaPreview.getLayoutParams();
+ layoutParams.width = widthHeight.first != null ? widthHeight.first : 0;
+ layoutParams.height = widthHeight.second != null ? widthHeight.second : 0;
+ binding.ivMediaPreview.requestLayout();
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
final MediaItemType modelMediaType = mediaModel.getMediaType();
binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
|| modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
}
+
+ private class WidthHeight {
+ private final DirectItemMediaModel mediaModel;
+ private int height;
+ private int width;
+
+ public WidthHeight(final DirectItemMediaModel mediaModel) {this.mediaModel = mediaModel;}
+
+ public int getHeight() {
+ return height;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public WidthHeight invoke() {
+ height = mediaModel.getHeight();
+ width = mediaModel.getWidth();
+ // make height 500dp regardless
+ width = NumberUtils.getResultingWidth(maxHeight, height, width);
+ height = maxHeight;
+ if (width > maxWidth) {
+ height = NumberUtils.getResultingHeight(maxWidth, height, width);
+ width = maxWidth;
+ }
+ return this;
+ }
+ }
}
diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaViewHolder.java
index 8c6e0da6..2dd96e9e 100644
--- a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaViewHolder.java
+++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaViewHolder.java
@@ -1,32 +1,53 @@
package awais.instagrabber.adapters.viewholder.directmessages;
import android.view.View;
+import android.view.ViewGroup;
import androidx.annotation.NonNull;
+import androidx.core.util.Pair;
+import awais.instagrabber.R;
import awais.instagrabber.databinding.LayoutDmBaseBinding;
import awais.instagrabber.databinding.LayoutDmMediaBinding;
import awais.instagrabber.models.direct_messages.DirectItemModel;
import awais.instagrabber.models.enums.MediaItemType;
+import awais.instagrabber.utils.NumberUtils;
+import awais.instagrabber.utils.Utils;
public class DirectMessageMediaViewHolder extends DirectMessageItemViewHolder {
private final LayoutDmMediaBinding binding;
+ private final int maxHeight;
+ private final int maxWidth;
public DirectMessageMediaViewHolder(@NonNull final LayoutDmBaseBinding baseBinding,
@NonNull final LayoutDmMediaBinding binding,
final View.OnClickListener onClickListener) {
super(baseBinding, onClickListener);
this.binding = binding;
+ maxHeight = itemView.getResources().getDimensionPixelSize(R.dimen.dm_media_img_max_height);
+ maxWidth = (int) (Utils.displayMetrics.widthPixels * 0.8);
setItemView(binding.getRoot());
}
@Override
public void bindItem(final DirectItemModel directItemModel) {
final DirectItemModel.DirectItemMediaModel mediaModel = directItemModel.getMediaModel();
+ final Pair widthHeight = NumberUtils.calculateWidthHeight(
+ mediaModel.getHeight(),
+ mediaModel.getWidth(),
+ maxHeight,
+ maxWidth
+ );
+ final ViewGroup.LayoutParams layoutParams = binding.ivMediaPreview.getLayoutParams();
+ layoutParams.width = widthHeight.first != null ? widthHeight.first : 0;
+ layoutParams.height = widthHeight.second != null ? widthHeight.second : 0;
+ binding.ivMediaPreview.requestLayout();
+ binding.ivMediaPreview.requestLayout();
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
final MediaItemType modelMediaType = mediaModel.getMediaType();
- binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
- || modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
+ binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO || modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER
+ ? View.VISIBLE
+ : View.GONE);
}
}
diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageRavenMediaViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageRavenMediaViewHolder.java
index fc7e404f..4e1c9120 100644
--- a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageRavenMediaViewHolder.java
+++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageRavenMediaViewHolder.java
@@ -2,8 +2,10 @@ package awais.instagrabber.adapters.viewholder.directmessages;
import android.content.Context;
import android.view.View;
+import android.view.ViewGroup;
import androidx.annotation.NonNull;
+import androidx.core.util.Pair;
import awais.instagrabber.R;
import awais.instagrabber.databinding.LayoutDmBaseBinding;
@@ -12,17 +14,23 @@ import awais.instagrabber.models.direct_messages.DirectItemModel;
import awais.instagrabber.models.enums.MediaItemType;
import awais.instagrabber.models.enums.RavenExpiringMediaType;
import awais.instagrabber.models.enums.RavenMediaViewType;
+import awais.instagrabber.utils.NumberUtils;
import awais.instagrabber.utils.TextUtils;
+import awais.instagrabber.utils.Utils;
public class DirectMessageRavenMediaViewHolder extends DirectMessageItemViewHolder {
private final LayoutDmRavenMediaBinding binding;
+ private final int maxHeight;
+ private final int maxWidth;
public DirectMessageRavenMediaViewHolder(@NonNull final LayoutDmBaseBinding baseBinding,
@NonNull final LayoutDmRavenMediaBinding binding,
final View.OnClickListener onClickListener) {
super(baseBinding, onClickListener);
this.binding = binding;
+ maxHeight = itemView.getResources().getDimensionPixelSize(R.dimen.dm_media_img_max_height);
+ maxWidth = (int) (Utils.displayMetrics.widthPixels * 0.8);
binding.tvMessage.setVisibility(View.GONE);
setItemView(binding.getRoot());
}
@@ -72,8 +80,19 @@ public class DirectMessageRavenMediaViewHolder extends DirectMessageItemViewHold
if (ravenMediaViewType == RavenMediaViewType.PERMANENT || ravenMediaViewType == RavenMediaViewType.REPLAYABLE) {
final MediaItemType mediaType = mediaModel.getMediaType();
textRes = -1;
- binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
- mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
+ binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO || mediaType == MediaItemType.MEDIA_TYPE_SLIDER
+ ? View.VISIBLE
+ : View.GONE);
+ final Pair widthHeight = NumberUtils.calculateWidthHeight(
+ mediaModel.getHeight(),
+ mediaModel.getWidth(),
+ maxHeight,
+ maxWidth
+ );
+ final ViewGroup.LayoutParams layoutParams = binding.ivMediaPreview.getLayoutParams();
+ layoutParams.width = widthHeight.first != null ? widthHeight.first : 0;
+ layoutParams.height = widthHeight.second != null ? widthHeight.second : 0;
+ binding.ivMediaPreview.requestLayout();
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
}
}
diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageReelShareViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageReelShareViewHolder.java
index ce027fc3..88c60121 100644
--- a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageReelShareViewHolder.java
+++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageReelShareViewHolder.java
@@ -1,19 +1,26 @@
package awais.instagrabber.adapters.viewholder.directmessages;
import android.view.View;
+import android.view.ViewGroup;
import androidx.annotation.NonNull;
+import androidx.core.util.Pair;
+import awais.instagrabber.R;
import awais.instagrabber.databinding.LayoutDmBaseBinding;
import awais.instagrabber.databinding.LayoutDmRavenMediaBinding;
import awais.instagrabber.interfaces.MentionClickListener;
import awais.instagrabber.models.direct_messages.DirectItemModel;
import awais.instagrabber.models.enums.MediaItemType;
+import awais.instagrabber.utils.NumberUtils;
import awais.instagrabber.utils.TextUtils;
+import awais.instagrabber.utils.Utils;
public class DirectMessageReelShareViewHolder extends DirectMessageItemViewHolder {
private final LayoutDmRavenMediaBinding binding;
+ private final int maxHeight;
+ private final int maxWidth;
public DirectMessageReelShareViewHolder(@NonNull final LayoutDmBaseBinding baseBinding,
@NonNull final LayoutDmRavenMediaBinding binding,
@@ -21,6 +28,8 @@ public class DirectMessageReelShareViewHolder extends DirectMessageItemViewHolde
final MentionClickListener mentionClickListener) {
super(baseBinding, onClickListener);
this.binding = binding;
+ maxHeight = itemView.getResources().getDimensionPixelSize(R.dimen.dm_media_img_max_height);
+ maxWidth = (int) (Utils.displayMetrics.widthPixels * 0.8);
binding.tvMessage.setMentionClickListener(mentionClickListener);
setItemView(binding.getRoot());
}
@@ -42,6 +51,16 @@ public class DirectMessageReelShareViewHolder extends DirectMessageItemViewHolde
} else {
binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
+ final Pair widthHeight = NumberUtils.calculateWidthHeight(
+ reelShareMedia.getHeight(),
+ reelShareMedia.getWidth(),
+ maxHeight,
+ maxWidth
+ );
+ final ViewGroup.LayoutParams layoutParams = binding.ivMediaPreview.getLayoutParams();
+ layoutParams.width = widthHeight.first != null ? widthHeight.first : 0;
+ layoutParams.height = widthHeight.second != null ? widthHeight.second : 0;
+ binding.ivMediaPreview.requestLayout();
binding.ivMediaPreview.setImageURI(reelShareMedia.getThumbUrl());
}
}
diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageStoryShareViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageStoryShareViewHolder.java
index e588bc3c..cb19c71d 100644
--- a/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageStoryShareViewHolder.java
+++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageStoryShareViewHolder.java
@@ -1,27 +1,36 @@
package awais.instagrabber.adapters.viewholder.directmessages;
import android.view.View;
+import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.core.text.HtmlCompat;
+import androidx.core.util.Pair;
+import awais.instagrabber.R;
import awais.instagrabber.databinding.LayoutDmBaseBinding;
import awais.instagrabber.databinding.LayoutDmStoryShareBinding;
import awais.instagrabber.models.direct_messages.DirectItemModel;
import awais.instagrabber.models.enums.MediaItemType;
+import awais.instagrabber.utils.NumberUtils;
import awais.instagrabber.utils.TextUtils;
+import awais.instagrabber.utils.Utils;
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_COMPACT;
public class DirectMessageStoryShareViewHolder extends DirectMessageItemViewHolder {
private final LayoutDmStoryShareBinding binding;
+ private final int maxHeight;
+ private final int maxWidth;
public DirectMessageStoryShareViewHolder(@NonNull final LayoutDmBaseBinding baseBinding,
@NonNull final LayoutDmStoryShareBinding binding,
final View.OnClickListener onClickListener) {
super(baseBinding, onClickListener);
this.binding = binding;
+ maxHeight = itemView.getResources().getDimensionPixelSize(R.dimen.dm_media_img_max_height);
+ maxWidth = (int) (Utils.displayMetrics.widthPixels * 0.8);
binding.tvMessage.setVisibility(View.GONE);
setItemView(binding.getRoot());
}
@@ -41,6 +50,16 @@ public class DirectMessageStoryShareViewHolder extends DirectMessageItemViewHold
final DirectItemModel.DirectItemMediaModel reelShareMedia = reelShare.getMedia();
final MediaItemType mediaType = reelShareMedia.getMediaType();
binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ? View.VISIBLE : View.GONE);
+ final Pair widthHeight = NumberUtils.calculateWidthHeight(
+ reelShareMedia.getHeight(),
+ reelShareMedia.getWidth(),
+ maxHeight,
+ maxWidth
+ );
+ final ViewGroup.LayoutParams layoutParams = binding.ivMediaPreview.getLayoutParams();
+ layoutParams.width = widthHeight.first != null ? widthHeight.first : 0;
+ layoutParams.height = widthHeight.second != null ? widthHeight.second : 0;
+ binding.ivMediaPreview.requestLayout();
binding.ivMediaPreview.setImageURI(reelShareMedia.getThumbUrl());
}
}
diff --git a/app/src/main/java/awais/instagrabber/asyncs/DiscoverFetcher.java b/app/src/main/java/awais/instagrabber/asyncs/DiscoverFetcher.java
index c83f2cb0..f86958aa 100755
--- a/app/src/main/java/awais/instagrabber/asyncs/DiscoverFetcher.java
+++ b/app/src/main/java/awais/instagrabber/asyncs/DiscoverFetcher.java
@@ -166,10 +166,11 @@ public final class DiscoverFetcher extends AsyncTask calculateWidthHeight(final int height, final int width, final int maxHeight, final int maxWidth) {
+ int tempWidth = NumberUtils.getResultingWidth(maxHeight, height, width);
+ int tempHeight = maxHeight;
+ if (width > maxWidth) {
+ tempHeight = NumberUtils.getResultingHeight(maxWidth, height, width);
+ tempWidth = maxWidth;
+ }
+ return new Pair<>(tempWidth, tempHeight);
+ }
}
diff --git a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
index 658177d3..f5879d76 100644
--- a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
+++ b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
@@ -10,7 +10,6 @@ import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
-import java.util.Locale;
import awais.instagrabber.BuildConfig;
import awais.instagrabber.models.ProfileModel;
@@ -24,6 +23,8 @@ import awais.instagrabber.models.enums.RavenMediaViewType;
import awaisomereport.LogCollector;
public final class ResponseBodyUtils {
+ private static final String TAG = "ResponseBodyUtils";
+
// isI: true if the content was requested from i.instagram.com instead of graphql
@Nullable
public static String getHighQualityPost(final JSONArray resources, final boolean isVideo, final boolean isI, final boolean low) {
@@ -103,37 +104,38 @@ public final class ResponseBodyUtils {
return src;
}
- public static String getItemThumbnail(@NonNull final JSONArray jsonArray) {
- String thumbnail = null;
+ public static ThumbnailDetails getItemThumbnail(@NonNull final JSONArray jsonArray) {
+ final ThumbnailDetails thumbnailDetails = new ThumbnailDetails();
final int imageResLen = jsonArray.length();
-
for (int i = 0; i < imageResLen; ++i) {
final JSONObject imageResource = jsonArray.optJSONObject(i);
try {
- final int width = imageResource.getInt("width");
- final int height = imageResource.getInt("height");
- final float ratio = Float.parseFloat(String.format(Locale.ENGLISH, "%.2f", (float) height / width));
- if (ratio >= 0.95f && ratio <= 1.0f) {
- thumbnail = imageResource.getString("url");
- break;
- }
+ // final float ratio = (float) height / width;
+ // if (ratio >= 0.95f && ratio <= 1.0f) {
+ thumbnailDetails.height = imageResource.getInt("height");
+ thumbnailDetails.width = imageResource.getInt("width");
+ thumbnailDetails.url = imageResource.getString("url");
+ break;
+ // }
} catch (final Exception e) {
if (Utils.logCollector != null)
Utils.logCollector.appendException(e, LogCollector.LogFile.UTILS, "getItemThumbnail");
- if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
- thumbnail = null;
+ if (BuildConfig.DEBUG) Log.e(TAG, "", e);
}
}
+ // if (TextUtils.isEmpty(thumbnail)) thumbnail = jsonArray.optJSONObject(0).optString("url");
+ return thumbnailDetails;
+ }
- if (TextUtils.isEmpty(thumbnail)) thumbnail = jsonArray.optJSONObject(0).optString("url");
-
- return thumbnail;
+ public static class ThumbnailDetails {
+ int width;
+ int height;
+ public String url;
}
@Nullable
- public static String getThumbnailUrl(@NonNull final JSONObject mediaObj, final MediaItemType mediaType) throws Exception {
- String thumbnail = null;
-
+ public static ThumbnailDetails getThumbnailUrl(@NonNull final JSONObject mediaObj, final MediaItemType mediaType) throws Exception {
+ ThumbnailDetails thumbnail = null;
if (mediaType == MediaItemType.MEDIA_TYPE_IMAGE || mediaType == MediaItemType.MEDIA_TYPE_VIDEO) {
final JSONObject imageVersions = mediaObj.optJSONObject("image_versions2");
if (imageVersions != null)
@@ -143,19 +145,18 @@ public final class ResponseBodyUtils {
final JSONArray carouselMedia = mediaObj.optJSONArray("carousel_media");
if (carouselMedia != null)
thumbnail = getItemThumbnail(carouselMedia.getJSONObject(0)
- .getJSONObject("image_versions2").getJSONArray("candidates"));
+ .getJSONObject("image_versions2")
+ .getJSONArray("candidates"));
}
-
return thumbnail;
}
- public static String getVideoUrl(@NonNull final JSONObject mediaObj) throws Exception {
+ public static String getVideoUrl(@NonNull final JSONObject mediaObj) {
String thumbnail = null;
-
final JSONArray imageVersions = mediaObj.optJSONArray("video_versions");
- if (imageVersions != null)
- thumbnail = getItemThumbnail(imageVersions);
-
+ if (imageVersions != null) {
+ thumbnail = getItemThumbnail(imageVersions).url;
+ }
return thumbnail;
}
@@ -193,14 +194,18 @@ public final class ResponseBodyUtils {
String id = mediaObj.optString("id");
if (TextUtils.isEmpty(id)) id = null;
- mediaModel = new DirectItemModel.DirectItemMediaModel(mediaType,
- mediaObj.optLong("expiring_at"),
- mediaObj.optLong("pk"),
- id,
- getThumbnailUrl(mediaObj, mediaType),
- mediaType == MediaItemType.MEDIA_TYPE_VIDEO ? getVideoUrl(mediaObj) : null,
- user,
- mediaObj.optString("code"));
+ final ThumbnailDetails thumbnailDetails = getThumbnailUrl(mediaObj, mediaType);
+ mediaModel = new DirectItemModel.DirectItemMediaModel(
+ mediaType,
+ mediaObj.optLong("expiring_at"),
+ mediaObj.optLong("pk"),
+ id,
+ thumbnailDetails != null ? thumbnailDetails.url : null,
+ mediaType == MediaItemType.MEDIA_TYPE_VIDEO ? getVideoUrl(mediaObj) : null,
+ user,
+ mediaObj.optString("code"),
+ thumbnailDetails != null ? thumbnailDetails.height : 0,
+ thumbnailDetails != null ? thumbnailDetails.width : 0);
}
return mediaModel;
}
@@ -314,14 +319,15 @@ public final class ResponseBodyUtils {
final JSONObject animatedMedia = itemObject.getJSONObject("animated_media");
final JSONObject stickerImage = animatedMedia.getJSONObject("images").getJSONObject("fixed_height");
- animatedMediaModel = new DirectItemModel.DirectItemAnimatedMediaModel(animatedMedia.getBoolean("is_random"),
- animatedMedia.getBoolean("is_sticker"),
- animatedMedia.getString("id"),
- stickerImage.getString("url"),
- stickerImage.optString("webp"),
- stickerImage.optString("mp4"),
- stickerImage.getInt("height"),
- stickerImage.getInt("width"));
+ animatedMediaModel = new DirectItemModel.DirectItemAnimatedMediaModel(
+ animatedMedia.getBoolean("is_random"),
+ animatedMedia.getBoolean("is_sticker"),
+ animatedMedia.getString("id"),
+ stickerImage.getString("url"),
+ stickerImage.optString("webp"),
+ stickerImage.optString("mp4"),
+ stickerImage.getInt("height"),
+ stickerImage.getInt("width"));
}
break;
@@ -340,9 +346,11 @@ public final class ResponseBodyUtils {
}
}
- voiceMediaModel = new DirectItemModel.DirectItemVoiceMediaModel(voiceMedia.getString("id"),
- audio.getString("audio_src"), audio.getLong("duration"),
- waveformData);
+ voiceMediaModel = new DirectItemModel.DirectItemVoiceMediaModel(
+ voiceMedia.getString("id"),
+ audio.getString("audio_src"),
+ audio.getLong("duration"),
+ waveformData);
}
break;
@@ -360,10 +368,11 @@ public final class ResponseBodyUtils {
);
}
- linkModel = new DirectItemModel.DirectItemLinkModel(linkObj.getString("text"),
- linkObj.getString("client_context"),
- linkObj.optString("mutation_token"),
- itemLinkContext);
+ linkModel = new DirectItemModel.DirectItemLinkModel(
+ linkObj.getString("text"),
+ linkObj.getString("client_context"),
+ linkObj.optString("mutation_token"),
+ itemLinkContext);
}
break;
diff --git a/app/src/main/res/layout/fragment_direct_messages_thread.xml b/app/src/main/res/layout/fragment_direct_messages_thread.xml
index b4a72897..3ea8bd66 100644
--- a/app/src/main/res/layout/fragment_direct_messages_thread.xml
+++ b/app/src/main/res/layout/fragment_direct_messages_thread.xml
@@ -1,22 +1,24 @@
+ tools:listitem="@layout/layout_dm_base" />
\ No newline at end of file
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dm_media_img_max_height" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_dm_media.xml b/app/src/main/res/layout/layout_dm_media.xml
index a53b59cb..3cdb9ff3 100644
--- a/app/src/main/res/layout/layout_dm_media.xml
+++ b/app/src/main/res/layout/layout_dm_media.xml
@@ -7,9 +7,7 @@
+ android:layout_height="wrap_content" />
+ app:nullable="true" />