Skip to content

Commit 1fe3dc7

Browse files
jkasten2emawby
authored andcommitted
snapshot of working IAM under notch
Just a snapshot of it working, don't desinged to be merged. Will create another branch to follow up with a commit of only then changes needed.
1 parent 2728bb8 commit 1fe3dc7

File tree

6 files changed

+293
-234
lines changed

6 files changed

+293
-234
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.os.Build;
44
import android.os.Bundle;
5+
import android.view.View;
56
import android.view.WindowManager;
67

78
import androidx.appcompat.app.AppCompatActivity;
@@ -19,10 +20,21 @@ protected void onCreate(Bundle savedInstanceState) {
1920
super.onCreate(savedInstanceState);
2021
setContentView(R.layout.main_activity_layout);
2122
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
22-
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
23+
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
2324
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
2425
}
2526

27+
getWindow().getDecorView().setSystemUiVisibility(
28+
View.SYSTEM_UI_FLAG_IMMERSIVE
29+
// Set the content to appear under the system bars so that the
30+
// content doesn't resize when the system bars hide and show.
31+
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
32+
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
33+
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
34+
// Hide the nav bar and status bar
35+
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
36+
| View.SYSTEM_UI_FLAG_FULLSCREEN);
37+
2638
viewModel = new MainActivityViewModel();
2739
OneSignal.addPermissionObserver(viewModel);
2840
OneSignal.addSubscriptionObserver(viewModel);

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ public ActivityViewModel onActivityCreated(Context context) {
177177
recyclerViewBuilder = new RecyclerViewBuilder(context);
178178
toaster = new Toaster(context);
179179

180-
appBarLayout = getActivity().findViewById(R.id.main_activity_app_bar_layout);
181-
toolbar = getActivity().findViewById(R.id.main_activity_toolbar);
180+
// appBarLayout = getActivity().findViewById(R.id.main_activity_app_bar_layout);
181+
// toolbar = getActivity().findViewById(R.id.main_activity_toolbar);
182182
privacyConsentLinearLayout = getActivity().findViewById(R.id.main_activity_privacy_consent_linear_layout);
183183
nestedScrollView = getActivity().findViewById(R.id.main_activity_nested_scroll_view);
184184

@@ -301,8 +301,8 @@ public ActivityViewModel setupInterfaceElements() {
301301

302302
@Override
303303
public void setupToolbar() {
304-
toolbar.setTitle(Text.EMPTY);
305-
getAppCompatActivity().setSupportActionBar(toolbar);
304+
// toolbar.setTitle(Text.EMPTY);
305+
// getAppCompatActivity().setSupportActionBar(toolbar);
306306
}
307307

308308
@Override
@@ -342,7 +342,7 @@ private void setupConsentLayout(boolean hasConsent) {
342342
int scrollVisibility = hasConsent ? View.VISIBLE : View.GONE;
343343
privacyConsentLinearLayout.setVisibility(consentVisibility);
344344
nestedScrollView.setVisibility(scrollVisibility);
345-
appBarLayout.setExpanded(true);
345+
// appBarLayout.setExpanded(true);
346346

347347
privacyConsentAllowButton.setOnClickListener(v -> {
348348
togglePrivacyConsent(true);
@@ -738,7 +738,7 @@ public boolean scrollToTopIfAvailable() {
738738
if (shouldScrollTop) {
739739
if (nestedScrollView != null) {
740740
nestedScrollView.smoothScrollTo(0, 0);
741-
appBarLayout.setExpanded(true);
741+
// appBarLayout.setExpanded(true);
742742
}
743743
}
744744
return shouldScrollTop;
@@ -759,7 +759,7 @@ private void togglePrivacyConsent(boolean hasConsent) {
759759
privacyConsentLinearLayout.setVisibility(consentVisibility);
760760
nestedScrollView.setVisibility(scrollVisibility);
761761

762-
appBarLayout.setExpanded(true);
762+
// appBarLayout.setExpanded(true);
763763
}
764764

765765
}

0 commit comments

Comments
 (0)