Fix media layout for inset posts
This commit is contained in:
@@ -27,6 +27,7 @@ public abstract class ImageStatusDisplayItem extends StatusDisplayItem{
|
||||
public final Status status;
|
||||
public final PhotoLayoutHelper.TiledLayoutResult tiledLayout;
|
||||
public final PhotoLayoutHelper.TiledLayoutResult.Tile thisTile;
|
||||
public int horizontalInset;
|
||||
|
||||
public ImageStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, Attachment photo, Status status, int index, int totalPhotos, PhotoLayoutHelper.TiledLayoutResult tiledLayout, PhotoLayoutHelper.TiledLayoutResult.Tile thisTile){
|
||||
super(parentID, parentFragment);
|
||||
@@ -63,7 +64,7 @@ public abstract class ImageStatusDisplayItem extends StatusDisplayItem{
|
||||
|
||||
@Override
|
||||
public void onBind(ImageStatusDisplayItem item){
|
||||
layout.setLayout(item.tiledLayout, item.thisTile);
|
||||
layout.setLayout(item.tiledLayout, item.thisTile, item.horizontalInset);
|
||||
crossfadeDrawable.setSize(item.attachment.getWidth(), item.attachment.getHeight());
|
||||
crossfadeDrawable.setBlurhashDrawable(item.attachment.blurhashPlaceholder);
|
||||
crossfadeDrawable.setCrossfadeAlpha(item.status.spoilerRevealed ? 0f : 1f);
|
||||
|
||||
@@ -16,6 +16,7 @@ public class ImageAttachmentFrameLayout extends FrameLayout{
|
||||
|
||||
private PhotoLayoutHelper.TiledLayoutResult tileLayout;
|
||||
private PhotoLayoutHelper.TiledLayoutResult.Tile tile;
|
||||
private int horizontalInset;
|
||||
|
||||
public ImageAttachmentFrameLayout(@NonNull Context context){
|
||||
super(context);
|
||||
@@ -35,7 +36,7 @@ public class ImageAttachmentFrameLayout extends FrameLayout{
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
return;
|
||||
}
|
||||
int w=Math.min(((View)getParent()).getMeasuredWidth(), V.dp(MAX_WIDTH));
|
||||
int w=Math.min(((View)getParent()).getMeasuredWidth()-horizontalInset, V.dp(MAX_WIDTH));
|
||||
int actualHeight=Math.round(tile.height/1000f*w)+V.dp(1)*(tile.rowSpan-1);
|
||||
int actualWidth=Math.round(tile.width/1000f*w);
|
||||
if(tile.startCol+tile.colSpan<tileLayout.columnSizes.length)
|
||||
@@ -45,8 +46,9 @@ public class ImageAttachmentFrameLayout extends FrameLayout{
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
public void setLayout(PhotoLayoutHelper.TiledLayoutResult layout, PhotoLayoutHelper.TiledLayoutResult.Tile tile){
|
||||
public void setLayout(PhotoLayoutHelper.TiledLayoutResult layout, PhotoLayoutHelper.TiledLayoutResult.Tile tile, int horizontalInset){
|
||||
tileLayout=layout;
|
||||
this.tile=tile;
|
||||
this.horizontalInset=horizontalInset;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user