mirror of
https://github.com/overte-org/overte.git
synced 2025-04-12 09:22:10 +02:00
Fix NullPointerException introduced with the workaround
This commit is contained in:
parent
b2fe5a6d63
commit
459991988c
1 changed files with 22 additions and 18 deletions
|
@ -170,25 +170,29 @@ public class InterfaceActivity extends QtActivity {
|
||||||
|
|
||||||
private void surfacesWorkaround() {
|
private void surfacesWorkaround() {
|
||||||
FrameLayout fl = findViewById(android.R.id.content);
|
FrameLayout fl = findViewById(android.R.id.content);
|
||||||
QtLayout qtLayout = (QtLayout) fl.getChildAt(0);
|
if (fl.getChildCount() > 0) {
|
||||||
QtSurface s1 = (QtSurface) qtLayout.getChildAt(0);
|
QtLayout qtLayout = (QtLayout) fl.getChildAt(0);
|
||||||
QtSurface s2 = (QtSurface) qtLayout.getChildAt(1);
|
if (qtLayout.getChildCount() > 1) {
|
||||||
Integer subLayer1 = 0;
|
QtSurface s1 = (QtSurface) qtLayout.getChildAt(0);
|
||||||
Integer subLayer2 = 0;
|
QtSurface s2 = (QtSurface) qtLayout.getChildAt(1);
|
||||||
try {
|
Integer subLayer1 = 0;
|
||||||
Field f = s1.getClass().getSuperclass().getDeclaredField("mSubLayer");
|
Integer subLayer2 = 0;
|
||||||
f.setAccessible(true);
|
try {
|
||||||
subLayer1 = (Integer) f.get(s1);
|
Field f = s1.getClass().getSuperclass().getDeclaredField("mSubLayer");
|
||||||
subLayer2 = (Integer) f.get(s2);
|
f.setAccessible(true);
|
||||||
if (subLayer1 < subLayer2) {
|
subLayer1 = (Integer) f.get(s1);
|
||||||
s1.setVisibility(View.VISIBLE);
|
subLayer2 = (Integer) f.get(s2);
|
||||||
s2.setVisibility(View.INVISIBLE);
|
if (subLayer1 < subLayer2) {
|
||||||
} else {
|
s1.setVisibility(View.VISIBLE);
|
||||||
s1.setVisibility(View.INVISIBLE);
|
s2.setVisibility(View.INVISIBLE);
|
||||||
s2.setVisibility(View.VISIBLE);
|
} else {
|
||||||
|
s1.setVisibility(View.INVISIBLE);
|
||||||
|
s2.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
Log.e(TAG, "Workaround failed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (ReflectiveOperationException e) {
|
|
||||||
Log.e(TAG, "Workaround failed");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue