|
32 | 32 | import android.content.Intent; |
33 | 33 | import android.graphics.PixelFormat; |
34 | 34 | import android.graphics.Rect; |
| 35 | +import android.os.Build; |
35 | 36 | import android.os.Bundle; |
36 | 37 | import android.os.Handler; |
37 | 38 | import android.os.SystemClock; |
|
41 | 42 | import android.util.DisplayMetrics; |
42 | 43 | import android.util.Log; |
43 | 44 |
|
44 | | -import android.view.inputmethod.InputConnection; |
45 | | - |
46 | 45 | import android.view.KeyEvent; |
47 | 46 | import android.view.KeyCharacterMap; |
48 | 47 | import android.view.MotionEvent; |
49 | 48 | import android.view.Surface; |
50 | 49 | import android.view.SurfaceHolder; |
51 | 50 | import android.view.SurfaceView; |
| 51 | +import android.view.View; |
52 | 52 | import android.view.ViewConfiguration; |
53 | 53 | import android.view.ViewGroup; |
54 | 54 | import android.view.Window; |
55 | 55 | import android.view.WindowManager; |
56 | 56 | import android.view.inputmethod.BaseInputConnection; |
57 | 57 | import android.view.inputmethod.EditorInfo; |
| 58 | +import android.view.inputmethod.InputConnection; |
58 | 59 | import android.view.inputmethod.InputMethodManager; |
59 | 60 | import android.widget.FrameLayout; |
60 | 61 |
|
@@ -100,12 +101,17 @@ protected void onCreate(Bundle savedInstanceState) { |
100 | 101 | setContentView(mViewGroup); |
101 | 102 | instance = this; |
102 | 103 |
|
103 | | - // Apply edge-to-edge display |
104 | | - ViewCompat.setOnApplyWindowInsetsListener(mView, (v, insets) -> { |
105 | | - Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); |
106 | | - v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); |
107 | | - return insets; |
108 | | - }); |
| 104 | + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { // > 34 |
| 105 | + // Prevent edge-to-edge display, keeping the view outside the systemBars |
| 106 | + // Warning: this doesn't set the color of the SystemBars, which can be done |
| 107 | + // by the StatusBarService in Attach |
| 108 | + View decorView = getWindow().getDecorView(); |
| 109 | + ViewCompat.setOnApplyWindowInsetsListener(decorView, (v, insets) -> { |
| 110 | + Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); |
| 111 | + decorView.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); |
| 112 | + return insets; |
| 113 | + }); |
| 114 | + } |
109 | 115 |
|
110 | 116 | imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
111 | 117 | Log.v(TAG, "onCreate done"); |
|
0 commit comments