Skip to content

Commit

Permalink
Fixed CommentsActivity weird transparency during predictive back
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHalvdansson committed Sep 17, 2023
1 parent 0e975be commit bd3839f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@


<style name="Theme.Swipe.Back.NoActionBar" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item>
<!--<item name="android:windowIsTranslucent">true</item>-->
<item name="android:windowBackground">@android:color/transparent</item>
</style>

Expand Down

0 comments on commit bd3839f

Please sign in to comment.