More crash fixes
This commit is contained in:
parent
283b56be5b
commit
2cd98a6620
@ -76,7 +76,7 @@ dependencies {
|
|||||||
implementation 'me.grishka.litex:viewpager:1.0.0'
|
implementation 'me.grishka.litex:viewpager:1.0.0'
|
||||||
implementation 'me.grishka.litex:viewpager2:1.0.0'
|
implementation 'me.grishka.litex:viewpager2:1.0.0'
|
||||||
implementation 'me.grishka.litex:palette:1.0.0'
|
implementation 'me.grishka.litex:palette:1.0.0'
|
||||||
implementation 'me.grishka.appkit:appkit:1.2.12'
|
implementation 'me.grishka.appkit:appkit:1.2.13'
|
||||||
implementation 'com.google.code.gson:gson:2.8.9'
|
implementation 'com.google.code.gson:gson:2.8.9'
|
||||||
implementation 'org.jsoup:jsoup:1.14.3'
|
implementation 'org.jsoup:jsoup:1.14.3'
|
||||||
implementation 'com.squareup:otto:1.3.8'
|
implementation 'com.squareup:otto:1.3.8'
|
||||||
|
@ -119,6 +119,9 @@ public class ZoomPanView extends FrameLayout implements ScaleGestureDetector.OnS
|
|||||||
|
|
||||||
int width=right-left;
|
int width=right-left;
|
||||||
int height=bottom-top;
|
int height=bottom-top;
|
||||||
|
if(width==0 || height==0)
|
||||||
|
return;
|
||||||
|
|
||||||
float scale=Math.min(width/(float)child.getWidth(), height/(float)child.getHeight());
|
float scale=Math.min(width/(float)child.getWidth(), height/(float)child.getHeight());
|
||||||
minScale=scale;
|
minScale=scale;
|
||||||
maxScale=Math.max(3f, height/(float)child.getHeight());
|
maxScale=Math.max(3f, height/(float)child.getHeight());
|
||||||
@ -306,8 +309,6 @@ public class ZoomPanView extends FrameLayout implements ScaleGestureDetector.OnS
|
|||||||
}, 1f).setMinimumVisibleChange(DynamicAnimation.MIN_VISIBLE_CHANGE_ALPHA));
|
}, 1f).setMinimumVisibleChange(DynamicAnimation.MIN_VISIBLE_CHANGE_ALPHA));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(animatingTransition)
|
|
||||||
Log.w(TAG, "updateViewTransform: ", new Throwable().fillInStackTrace());
|
|
||||||
child.setScaleX(matrixValues[Matrix.MSCALE_X]);
|
child.setScaleX(matrixValues[Matrix.MSCALE_X]);
|
||||||
child.setScaleY(matrixValues[Matrix.MSCALE_Y]);
|
child.setScaleY(matrixValues[Matrix.MSCALE_Y]);
|
||||||
child.setTranslationX(matrixValues[Matrix.MTRANS_X]);
|
child.setTranslationX(matrixValues[Matrix.MTRANS_X]);
|
||||||
|
@ -18,7 +18,7 @@ public class MediaGridLayout extends ViewGroup{
|
|||||||
public static final int MAX_WIDTH=400; // dp
|
public static final int MAX_WIDTH=400; // dp
|
||||||
private static final int GAP=2; // dp
|
private static final int GAP=2; // dp
|
||||||
private PhotoLayoutHelper.TiledLayoutResult tiledLayout;
|
private PhotoLayoutHelper.TiledLayoutResult tiledLayout;
|
||||||
private int[] columnStarts=new int[10], columnEnds=new int[10], rowStarts=new int[10], rowEnds=new int[10];
|
private int[] columnStarts, columnEnds, rowStarts, rowEnds;
|
||||||
|
|
||||||
public MediaGridLayout(Context context){
|
public MediaGridLayout(Context context){
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@ -45,6 +45,14 @@ public class MediaGridLayout extends ViewGroup{
|
|||||||
width=Math.round(width*(tiledLayout.width/(float)PhotoLayoutHelper.MAX_WIDTH));
|
width=Math.round(width*(tiledLayout.width/(float)PhotoLayoutHelper.MAX_WIDTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rowStarts==null || rowStarts.length<tiledLayout.rowSizes.length){
|
||||||
|
rowStarts=new int[tiledLayout.rowSizes.length];
|
||||||
|
rowEnds=new int[tiledLayout.rowSizes.length];
|
||||||
|
}
|
||||||
|
if(columnStarts==null || columnStarts.length<tiledLayout.columnSizes.length){
|
||||||
|
columnStarts=new int[tiledLayout.columnSizes.length];
|
||||||
|
columnEnds=new int[tiledLayout.columnSizes.length];
|
||||||
|
}
|
||||||
int offset=0;
|
int offset=0;
|
||||||
for(int i=0;i<tiledLayout.columnSizes.length;i++){
|
for(int i=0;i<tiledLayout.columnSizes.length;i++){
|
||||||
columnStarts[i]=offset;
|
columnStarts[i]=offset;
|
||||||
@ -77,7 +85,7 @@ public class MediaGridLayout extends ViewGroup{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int l, int t, int r, int b){
|
protected void onLayout(boolean changed, int l, int t, int r, int b){
|
||||||
if(tiledLayout==null)
|
if(tiledLayout==null || rowStarts==null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int maxWidth=V.dp(MAX_WIDTH);
|
int maxWidth=V.dp(MAX_WIDTH);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user