Skip to content

Commit a269069

Browse files
authored
Merge pull request #529 from Countly/content-hidden-load-fix
Behind loading content fix
2 parents 5745850 + 0f7f6dd commit a269069

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

sdk/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
android:theme="@android:style/Theme.Translucent.NoTitleBar"
1111
android:exported="false"/>
1212
<activity android:name=".TransparentActivity"
13+
android:launchMode="singleTask"
1314
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
1415
android:theme="@android:style/Theme.Translucent.NoTitleBar">
1516
</activity>

sdk/src/main/java/ly/count/android/sdk/ModuleContent.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ void onActivityStarted(Activity activity, int updatedActivityCount) {
6767
if (UtilsDevice.cutout == null && activity != null) {
6868
UtilsDevice.getCutout(activity);
6969
}
70+
if (isCurrentlyInContentZone
71+
&& activity != null
72+
&& !(activity instanceof TransparentActivity)) {
73+
try {
74+
Intent bringToFront = new Intent(activity, TransparentActivity.class);
75+
bringToFront.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
76+
activity.startActivity(bringToFront);
77+
} catch (Exception ex) {
78+
L.w("[ModuleContent] onActivityStarted, failed to reorder TransparentActivity to front", ex);
79+
}
80+
}
7081
}
7182

7283
void fetchContentsInternal(@NonNull String[] categories, @Nullable Runnable callbackOnFailure) {

0 commit comments

Comments
 (0)