Skip to content

Commit b8fc929

Browse files
committed
Updating SDK and demo app to use API 30
also testing fullscreen windowManager flags in the demo app
1 parent 3015c9a commit b8fc929

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

Examples/OneSignalDemo/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
22
apply plugin: 'com.android.application'
33

44
android {
5-
compileSdkVersion 28
5+
compileSdkVersion 30
66
defaultConfig {
77
minSdkVersion 16
8-
targetSdkVersion 28
8+
targetSdkVersion 30
99
versionCode 1
1010
versionName "1.0"
1111
multiDexEnabled true

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/activity/MainActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.onesignal.sdktest.activity;
22

3+
import android.os.Build;
34
import android.os.Bundle;
5+
import android.view.WindowManager;
46

57
import androidx.appcompat.app.AppCompatActivity;
68

@@ -16,6 +18,10 @@ public class MainActivity extends AppCompatActivity {
1618
protected void onCreate(Bundle savedInstanceState) {
1719
super.onCreate(savedInstanceState);
1820
setContentView(R.layout.main_activity_layout);
21+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
22+
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
23+
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
24+
}
1925

2026
viewModel = new MainActivityViewModel();
2127
OneSignal.addPermissionObserver(viewModel);

OneSignalSDK/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ buildscript {
44

55
ext {
66
buildVersions = [
7-
compileSdkVersion: 29,
8-
targetSdkVersion: 28
7+
compileSdkVersion: 30,
8+
targetSdkVersion: 30
99
]
1010
androidGradlePluginVersion = '3.6.2'
1111
androidConcurrentFutures = '1.1.0'

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSViewUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ void available(@NonNull Activity currentActivity) {
7676
}
7777

7878
static int[] getWindowInsets(@NonNull Activity activity) {
79+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
80+
81+
}
7982
Rect frame = getWindowVisibleDisplayFrame(activity);
8083
View contentView = activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT);
8184
int topInset = frame.top - contentView.getTop();
@@ -88,11 +91,12 @@ static int[] getWindowInsets(@NonNull Activity activity) {
8891
Not using this method for now because the bottom value is not correct (we don't cover the bottom buttons)
8992
*/
9093
// Requirement: Ensure DecorView is ready by using OSViewUtils.decorViewReady
91-
@TargetApi(Build.VERSION_CODES.M)
92-
private static int[] getWindowInsetsAPI23Plus(@NonNull Activity activity) {
94+
@TargetApi(Build.VERSION_CODES.P)
95+
private static int[] getWindowInsetsAPI28Plus(@NonNull Activity activity) {
9396
View decorView = activity.getWindow().getDecorView();
9497
// Use use stable heights as SystemWindowInset subtracts the keyboard
9598
WindowInsets windowInsets = decorView.getRootWindowInsets();
99+
//if windowInsets.getDisplayCutout().
96100
return new int[] {windowInsets.getStableInsetTop(), windowInsets.getStableInsetBottom(),
97101
windowInsets.getStableInsetRight(), windowInsets.getStableInsetLeft()};
98102
}

OneSignalSDK/onesignal/src/main/java/com/onesignal/WebViewManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import android.util.Base64;
1313
import android.view.View;
1414
import android.view.Window;
15+
import android.view.WindowInsets;
16+
import android.view.WindowManager;
1517
import android.webkit.JavascriptInterface;
1618
import android.webkit.ValueCallback;
1719
import android.webkit.WebView;

0 commit comments

Comments
 (0)