Revision fd0b901a
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
27 | 27 |
import androidx.appcompat.app.AppCompatActivity; |
28 | 28 |
|
29 | 29 |
import android.util.DisplayMetrics; |
30 |
import android.view.DisplayCutout; |
|
30 | 31 |
import android.view.View; |
31 | 32 |
import android.view.ViewGroup; |
32 | 33 |
import android.view.WindowManager; |
... | ... | |
106 | 107 |
mIsLocked = false; |
107 | 108 |
|
108 | 109 |
hideNavigationBar(); |
109 |
huaweiHack(); |
|
110 | 110 |
|
111 |
// huaweiHack(); |
|
111 | 112 |
// askForPermissions(); |
112 | 113 |
} |
113 | 114 |
|
... | ... | |
142 | 143 |
@Override |
143 | 144 |
public void onAttachedToWindow() |
144 | 145 |
{ |
146 |
super.onAttachedToWindow(); |
|
147 |
|
|
145 | 148 |
final float RATIO = 0.10f; |
146 | 149 |
float height = getScreenHeightInPixels(); |
147 | 150 |
|
... | ... | |
154 | 157 |
ViewGroup.LayoutParams paramsBot = layoutBot.getLayoutParams(); |
155 | 158 |
paramsBot.height = (int)(height*RATIO); |
156 | 159 |
layoutBot.setLayoutParams(paramsBot); |
160 |
|
|
161 |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) |
|
162 |
{ |
|
163 |
DisplayCutout cutout = getWindow().getDecorView().getRootWindowInsets().getDisplayCutout(); |
|
164 |
int inset = cutout!=null ? cutout.getSafeInsetTop() : 0; |
|
165 |
RubikStatePlay.setSafeInsetTop(inset); |
|
166 |
} |
|
157 | 167 |
} |
158 | 168 |
|
159 | 169 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Avoid the possible cutouts at the top of the screen.