mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
dm media layout finalization
This commit is contained in:
parent
a3c0b496aa
commit
99a8e03578
@ -53,41 +53,12 @@ public class DirectMessageMediaShareViewHolder extends DirectMessageItemViewHold
|
|||||||
maxWidth
|
maxWidth
|
||||||
);
|
);
|
||||||
final ViewGroup.LayoutParams layoutParams = binding.ivMediaPreview.getLayoutParams();
|
final ViewGroup.LayoutParams layoutParams = binding.ivMediaPreview.getLayoutParams();
|
||||||
layoutParams.width = widthHeight.first != null ? widthHeight.first : 0;
|
|
||||||
layoutParams.height = widthHeight.second != null ? widthHeight.second : 0;
|
layoutParams.height = widthHeight.second != null ? widthHeight.second : 0;
|
||||||
|
layoutParams.width = widthHeight.first != null ? widthHeight.first : 0;
|
||||||
binding.ivMediaPreview.requestLayout();
|
binding.ivMediaPreview.requestLayout();
|
||||||
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
|
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
|
||||||
final MediaItemType modelMediaType = mediaModel.getMediaType();
|
final MediaItemType modelMediaType = mediaModel.getMediaType();
|
||||||
binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
|
binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
|
||||||
|| modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
|
|| 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -841,7 +841,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fetchPosts() {
|
private void fetchPosts() {
|
||||||
Log.d("austin_debug", "fp");
|
|
||||||
stopCurrentExecutor();
|
stopCurrentExecutor();
|
||||||
binding.swipeRefreshLayout.setRefreshing(true);
|
binding.swipeRefreshLayout.setRefreshing(true);
|
||||||
currentlyExecuting = new PostsFetcher(profileModel.getId(), PostItemType.MAIN, endCursor, postsFetchListener)
|
currentlyExecuting = new PostsFetcher(profileModel.getId(), PostItemType.MAIN, endCursor, postsFetchListener)
|
||||||
|
@ -57,8 +57,8 @@ public final class NumberUtils {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static Pair<Integer, Integer> calculateWidthHeight(final int height, final int width, final int maxHeight, final int maxWidth) {
|
public static Pair<Integer, Integer> calculateWidthHeight(final int height, final int width, final int maxHeight, final int maxWidth) {
|
||||||
int tempWidth = NumberUtils.getResultingWidth(maxHeight, height, width);
|
int tempWidth = width;
|
||||||
int tempHeight = maxHeight;
|
int tempHeight = height > maxHeight ? maxHeight : height;
|
||||||
if (tempWidth > maxWidth) {
|
if (tempWidth > maxWidth) {
|
||||||
tempHeight = NumberUtils.getResultingHeight(maxWidth, height, width);
|
tempHeight = NumberUtils.getResultingHeight(maxWidth, height, width);
|
||||||
tempWidth = maxWidth;
|
tempWidth = maxWidth;
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
android:id="@+id/swipeRefreshLayout"
|
android:id="@+id/swipeRefreshLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<com.facebook.drawee.view.SimpleDraweeView
|
<com.facebook.drawee.view.SimpleDraweeView
|
||||||
android:id="@+id/ivMediaPreview"
|
android:id="@+id/ivMediaPreview"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
android:id="@+id/ivMediaPreview"
|
android:id="@+id/ivMediaPreview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:maxHeight="@dimen/dm_media_img_max_height"
|
android:maxHeight="@dimen/dm_media_img_max_height"
|
||||||
app:actualImageScaleType="fitCenter" />
|
app:actualImageScaleType="fitCenter" />
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
android:id="@+id/ivMediaPreview"
|
android:id="@+id/ivMediaPreview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:maxHeight="@dimen/dm_media_img_max_height" />
|
android:maxHeight="@dimen/dm_media_img_max_height" />
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
android:id="@+id/ivMediaPreview"
|
android:id="@+id/ivMediaPreview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:maxHeight="@dimen/dm_media_img_max_height" />
|
android:maxHeight="@dimen/dm_media_img_max_height" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user