diff --git a/app/src/main/java/com/simon/harmonichackernews/CommentsActivity.java b/app/src/main/java/com/simon/harmonichackernews/CommentsActivity.java index 5889e0c7..8c4fb3c2 100644 --- a/app/src/main/java/com/simon/harmonichackernews/CommentsActivity.java +++ b/app/src/main/java/com/simon/harmonichackernews/CommentsActivity.java @@ -1,6 +1,8 @@ package com.simon.harmonichackernews; +import android.os.Build; import android.os.Bundle; +import android.os.Handler; import android.view.View; import androidx.activity.OnBackPressedCallback; @@ -66,6 +68,29 @@ public void onSwitchView(boolean isAtWebView) { } } + @Override + protected void onResume() { + super.onResume(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + + final Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + setTranslucent(true); + } + }, 400); + } + } + + @Override + protected void onPause() { + super.onPause(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + setTranslucent(false); + } + } + @Override protected void onDestroy() { super.onDestroy(); diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index e3d93af0..de5da860 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -149,7 +149,7 @@