You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
android_layout_measure: reuse old MeasureSpec for missing dimension
This should fix the SurfaceView in NewPipe not resizing automatically
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../util.h"
|
||||
#include "../defines.h"
|
||||
#include "AndroidLayout.h"
|
||||
|
||||
static int make_measure_spec(int layout_size, int for_size)
|
||||
@@ -26,6 +27,11 @@ static void android_layout_measure(GtkLayoutManager *layout_manager, GtkWidget *
|
||||
int widthMeasureSpec = make_measure_spec(layout->width, orientation == GTK_ORIENTATION_VERTICAL ? for_size : -1);
|
||||
int heightMeasureSpec = make_measure_spec(layout->height, orientation == GTK_ORIENTATION_HORIZONTAL ? for_size : -1);
|
||||
|
||||
// if layout params say match_parent, but GTK doesnt specify the dimension, fallback to old specification if available
|
||||
if (widthMeasureSpec == -1)
|
||||
widthMeasureSpec = _GET_INT_FIELD(layout->view, "oldWidthMeasureSpec");
|
||||
if (heightMeasureSpec == -1)
|
||||
heightMeasureSpec = _GET_INT_FIELD(layout->view, "oldHeightMeasureSpec");
|
||||
if (widthMeasureSpec != -1 && heightMeasureSpec != -1) {
|
||||
(*env)->CallVoidMethod(env, layout->view, handle_cache.view.measure, widthMeasureSpec, heightMeasureSpec);
|
||||
if((*env)->ExceptionCheck(env))
|
||||
|
||||
@@ -807,8 +807,8 @@ public class View extends Object {
|
||||
|
||||
public static HashMap<Integer, View> view_by_id = new HashMap<Integer, View>();
|
||||
|
||||
private int oldWidthMeasureSpec;
|
||||
private int oldHeightMeasureSpec;
|
||||
private int oldWidthMeasureSpec = -1;
|
||||
private int oldHeightMeasureSpec = -1;
|
||||
private boolean layoutRequested = true;
|
||||
private int oldWidth;
|
||||
private int oldHeight;
|
||||
@@ -1237,6 +1237,9 @@ public class View extends Object {
|
||||
|
||||
public void requestLayout() {
|
||||
layoutRequested = true;
|
||||
if (parent != null && !parent.isLayoutRequested()) {
|
||||
parent.requestLayout();
|
||||
}
|
||||
native_requestLayout(widget);
|
||||
};
|
||||
|
||||
@@ -1302,7 +1305,7 @@ public class View extends Object {
|
||||
|
||||
public boolean isEnabled() {return true;}
|
||||
public boolean hasFocus() {return false;}
|
||||
public boolean isLayoutRequested() {return true;}
|
||||
public boolean isLayoutRequested() {return layoutRequested;}
|
||||
public int getBaseline() {return -1;}
|
||||
public boolean hasFocusable() {return false;}
|
||||
public boolean isFocused() {return false;}
|
||||
|
||||
Reference in New Issue
Block a user