mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-05-08 11:38:12 +03:00
some fixes to make NewPipe not crash when layouting
This commit is contained in:
parent
1474d8d3e1
commit
28cd0006bc
13 changed files with 171 additions and 29 deletions
|
@ -1201,4 +1201,31 @@ public class View extends Object {
|
|||
|
||||
protected boolean awakenScrollBars() {return false;}
|
||||
public Matrix getMatrix() {return new Matrix();}
|
||||
|
||||
protected static final int[] EMPTY_STATE_SET = new int[0];
|
||||
|
||||
/**
|
||||
* Utility to return a default size. Uses the supplied size if the
|
||||
* MeasureSpec imposed no constraints. Will get larger if allowed
|
||||
* by the MeasureSpec.
|
||||
*
|
||||
* @param size Default size for this view
|
||||
* @param measureSpec Constraints imposed by the parent
|
||||
* @return The size this view should be.
|
||||
*/
|
||||
public static int getDefaultSize(int size, int measureSpec) {
|
||||
int result = size;
|
||||
int specMode = MeasureSpec.getMode(measureSpec);
|
||||
int specSize = MeasureSpec.getSize(measureSpec);
|
||||
switch (specMode) {
|
||||
case MeasureSpec.UNSPECIFIED:
|
||||
result = size;
|
||||
break;
|
||||
case MeasureSpec.AT_MOST:
|
||||
case MeasureSpec.EXACTLY:
|
||||
result = specSize;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue