1
1
package com .dergoogler .mmrl ;
2
2
3
3
import android .annotation .SuppressLint ;
4
- import android .content .Context ;
5
- import android .content .Intent ;
6
- import android .database .Cursor ;
7
4
import android .graphics .Rect ;
8
- import android .net .Uri ;
9
5
import android .os .Build ;
10
6
import android .os .Bundle ;
11
7
import android .os .StrictMode ;
12
- import android .provider .DocumentsContract ;
13
- import android .provider .MediaStore ;
14
- import android .provider .OpenableColumns ;
15
8
import android .util .Log ;
16
9
import android .view .View ;
17
- import android .view .ViewTreeObserver ;
18
10
import android .webkit .ConsoleMessage ;
19
11
import android .webkit .WebSettings ;
20
12
import android .webkit .WebView ;
32
24
import com .dergoogler .core .NativeBuildConfig ;
33
25
import com .dergoogler .core .NativeView ;
34
26
import com .dergoogler .core .NativeSuZip ;
35
- import com .topjohnwu .superuser .io .SuFile ;
36
27
37
28
import org .apache .cordova .*;
38
29
import org .apache .cordova .engine .SystemWebChromeClient ;
39
30
import org .apache .cordova .engine .SystemWebViewEngine ;
40
31
41
- import java .io .File ;
42
32
43
33
public class MainActivity extends CordovaActivity {
44
34
@@ -65,24 +55,21 @@ public void onCreate(Bundle savedInstanceState) {
65
55
CordovaWebViewEngine wve = appView .getEngine ();
66
56
67
57
68
- rootView .getViewTreeObserver ().addOnGlobalLayoutListener (new ViewTreeObserver .OnGlobalLayoutListener () {
69
- @ Override
70
- public void onGlobalLayout () {
71
- Rect r = new Rect ();
72
- rootView .getWindowVisibleDisplayFrame (r );
73
- int screenHeight = rootView .getRootView ().getHeight ();
74
- int keypadHeight = screenHeight - r .bottom ;
75
-
76
- if (keypadHeight > screenHeight * 0.15 ) { // 0.15 ratio is perhaps enough to determine keypad height.
77
- if (!isKeyboardShowing ) {
78
- isKeyboardShowing = true ;
79
- adjustWebViewHeight (keypadHeight );
80
- }
81
- } else {
82
- if (isKeyboardShowing ) {
83
- isKeyboardShowing = false ;
84
- resetWebViewHeight ();
85
- }
58
+ rootView .getViewTreeObserver ().addOnGlobalLayoutListener (() -> {
59
+ Rect r = new Rect ();
60
+ rootView .getWindowVisibleDisplayFrame (r );
61
+ int screenHeight = rootView .getRootView ().getHeight ();
62
+ int keypadHeight = screenHeight - r .bottom ;
63
+
64
+ if (keypadHeight > screenHeight * 0.15 ) { // 0.15 ratio is perhaps enough to determine keypad height.
65
+ if (!isKeyboardShowing ) {
66
+ isKeyboardShowing = true ;
67
+ adjustWebViewHeight (keypadHeight );
68
+ }
69
+ } else {
70
+ if (isKeyboardShowing ) {
71
+ isKeyboardShowing = false ;
72
+ resetWebViewHeight ();
86
73
}
87
74
}
88
75
});
0 commit comments