refactor(PreviewlessMediaItems): remove unused class
This commit is contained in:
parent
91211b7720
commit
91c7fc64bd
|
@ -1,53 +1,24 @@
|
|||
package org.joinmastodon.android.ui.displayitems;
|
||||
|
||||
import static org.joinmastodon.android.GlobalUserPreferences.*;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Activity;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.text.Layout;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.fragments.BaseStatusListFragment;
|
||||
import org.joinmastodon.android.model.Attachment;
|
||||
import org.joinmastodon.android.model.Status;
|
||||
import org.joinmastodon.android.ui.OutlineProviders;
|
||||
import org.joinmastodon.android.ui.PhotoLayoutHelper;
|
||||
import org.joinmastodon.android.ui.drawables.SpoilerStripesDrawable;
|
||||
import org.joinmastodon.android.ui.photoviewer.PhotoViewerHost;
|
||||
import org.joinmastodon.android.ui.utils.MediaAttachmentViewController;
|
||||
import org.joinmastodon.android.ui.utils.PreviewlessMediaAttachmentViewController;
|
||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||
import org.joinmastodon.android.ui.views.FrameLayoutThatOnlyMeasuresFirstChild;
|
||||
import org.joinmastodon.android.ui.views.MaxWidthFrameLayout;
|
||||
import org.joinmastodon.android.ui.views.MediaGridLayout;
|
||||
import org.joinmastodon.android.ui.views.PreviewlessMediaGridLayout;
|
||||
import org.joinmastodon.android.utils.TypedObjectPool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import me.grishka.appkit.imageloader.ImageLoaderViewHolder;
|
||||
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
|
||||
import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest;
|
||||
import me.grishka.appkit.utils.CubicBezierInterpolator;
|
||||
import me.grishka.appkit.utils.V;
|
||||
|
||||
public class PreviewlessMediaGridStatusDisplayItem extends StatusDisplayItem{
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
package org.joinmastodon.android.ui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import org.joinmastodon.android.ui.PhotoLayoutHelper;
|
||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||
|
||||
import me.grishka.appkit.utils.V;
|
||||
|
||||
public class PreviewlessMediaGridLayout extends LinearLayout{
|
||||
private static final String TAG="PreviewlessMediaGridLayout";
|
||||
|
||||
private static final int GAP=2; // dp
|
||||
private PhotoLayoutHelper.TiledLayoutResult tiledLayout;
|
||||
|
||||
public PreviewlessMediaGridLayout(Context context){
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public PreviewlessMediaGridLayout(Context context, AttributeSet attrs){
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public PreviewlessMediaGridLayout(Context context, AttributeSet attrs, int defStyle){
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
|
||||
// if(tiledLayout==null){
|
||||
// setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 0);
|
||||
// return;
|
||||
// }
|
||||
// int width=Math.min(UiUtils.MAX_WIDTH, MeasureSpec.getSize(widthMeasureSpec));
|
||||
// int height=Math.round(width*(tiledLayout.height/(float)PhotoLayoutHelper.MAX_WIDTH));
|
||||
// if(tiledLayout.width<PhotoLayoutHelper.MAX_WIDTH){
|
||||
// width=Math.round(width*(tiledLayout.width/(float)PhotoLayoutHelper.MAX_WIDTH));
|
||||
// }
|
||||
//
|
||||
// for(int i=0;i<tiledLayout.rowSizes.length;i++){
|
||||
// rowStarts[i]=offset;
|
||||
// offset+=Math.round(tiledLayout.rowSizes[i]/(float)tiledLayout.height*height);
|
||||
// rowEnds[i]=offset;
|
||||
// offset+=V.dp(GAP);
|
||||
// }
|
||||
// rowEnds[tiledLayout.rowSizes.length-1]=height;
|
||||
//
|
||||
// for(int i=0;i<getChildCount();i++){
|
||||
// View child=getChildAt(i);
|
||||
// LayoutParams lp=(LayoutParams) child.getLayoutParams();
|
||||
// int colSpan=Math.max(1, lp.tile.colSpan)-1;
|
||||
// int rowSpan=Math.max(1, lp.tile.rowSpan)-1;
|
||||
// int w=columnEnds[lp.tile.startCol+colSpan]-columnStarts[lp.tile.startCol];
|
||||
// int h=rowEnds[lp.tile.startRow+rowSpan]-rowStarts[lp.tile.startRow];
|
||||
// child.measure(w | MeasureSpec.EXACTLY, h | MeasureSpec.EXACTLY);
|
||||
// }
|
||||
//
|
||||
// setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b){
|
||||
if(tiledLayout==null)
|
||||
return;
|
||||
|
||||
int maxWidth=UiUtils.MAX_WIDTH;
|
||||
if(tiledLayout.width<PhotoLayoutHelper.MAX_WIDTH){
|
||||
maxWidth=Math.round((r-l)*(tiledLayout.width/(float)PhotoLayoutHelper.MAX_WIDTH));
|
||||
}
|
||||
int xOffset=0;
|
||||
if(r-l>maxWidth){
|
||||
xOffset=(r-l)/2-maxWidth/2;
|
||||
}
|
||||
|
||||
for(int i=0;i<getChildCount();i++){
|
||||
View child=getChildAt(i);
|
||||
LayoutParams lp=(LayoutParams) child.getLayoutParams();
|
||||
int colSpan=Math.max(1, lp.tile.colSpan)-1;
|
||||
int rowSpan=Math.max(1, lp.tile.rowSpan)-1;
|
||||
// child.layout(columnStarts[lp.tile.startCol]+xOffset, rowStarts[lp.tile.startRow], columnEnds[lp.tile.startCol+colSpan]+xOffset, rowEnds[lp.tile.startRow+rowSpan]);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTiledLayout(PhotoLayoutHelper.TiledLayoutResult tiledLayout){
|
||||
this.tiledLayout=tiledLayout;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public static class LayoutParams extends ViewGroup.LayoutParams{
|
||||
public PhotoLayoutHelper.TiledLayoutResult.Tile tile;
|
||||
|
||||
public LayoutParams(PhotoLayoutHelper.TiledLayoutResult.Tile tile){
|
||||
super(WRAP_CONTENT, WRAP_CONTENT);
|
||||
this.tile=tile;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue