@@ -41,6 +41,8 @@ public class IterableInAppFragmentHTMLNotification extends DialogFragment implem
41
41
private static final String MESSAGE_ID = "MessageId" ;
42
42
private static final String INAPP_OPEN_TRACKED = "InAppOpenTracked" ;
43
43
44
+ private static final int DELAY_THRESHOLD_MS = 500 ;
45
+
44
46
static IterableInAppFragmentHTMLNotification notification ;
45
47
static IterableHelper .IterableUrlCallback clickCallback ;
46
48
static IterableInAppLocation location ;
@@ -125,6 +127,7 @@ public void onDestroy() {
125
127
*/
126
128
public void setLoaded (boolean loaded ) {
127
129
this .loaded = loaded ;
130
+ showDialogView ();
128
131
}
129
132
130
133
@ NonNull
@@ -148,7 +151,6 @@ public void onBackPressed() {
148
151
if (insetPadding .bottom == 0 && insetPadding .top == 0 ) {
149
152
dialog .getWindow ().setFlags (WindowManager .LayoutParams .FLAG_FULLSCREEN , WindowManager .LayoutParams .FLAG_FULLSCREEN );
150
153
}
151
- hideDialogView (dialog );
152
154
return dialog ;
153
155
}
154
156
@@ -190,20 +192,27 @@ public void run() {
190
192
if (savedInstanceState == null || !savedInstanceState .getBoolean (INAPP_OPEN_TRACKED , false )) {
191
193
IterableApi .sharedInstance .trackInAppOpen (messageId , location );
192
194
}
195
+ hideDialogView ();
193
196
return relativeLayout ;
194
197
}
195
198
196
- private void hideDialogView (Dialog dialog ) {
199
+ private void hideDialogView () {
197
200
try {
198
- dialog .getWindow ().getDecorView ().setVisibility (View .INVISIBLE );
201
+ getDialog ().getWindow ().getDecorView ().setAlpha (0.0f );
202
+ webView .postDelayed (new Runnable () {
203
+ @ Override
204
+ public void run () {
205
+ showDialogView ();
206
+ }
207
+ }, DELAY_THRESHOLD_MS );
199
208
} catch (NullPointerException e ) {
200
209
IterableLogger .e (TAG , "View not present. Failed to hide before resizing inapp" );
201
210
}
202
211
}
203
212
204
- private void showDialogView (Dialog dialog ) {
213
+ private void showDialogView () {
205
214
try {
206
- dialog .getWindow ().getDecorView ().setVisibility ( View . VISIBLE );
215
+ getDialog () .getWindow ().getDecorView ().setAlpha ( 1.0f );
207
216
} catch (NullPointerException e ) {
208
217
IterableLogger .e (TAG , "View not present. Failed to show inapp" , e );
209
218
}
@@ -306,7 +315,6 @@ public void run() {
306
315
wlp .flags = WindowManager .LayoutParams .FLAG_DIM_BEHIND ;
307
316
window .setAttributes (wlp );
308
317
}
309
- showDialogView (getDialog ());
310
318
} catch (IllegalArgumentException e ) {
311
319
IterableLogger .e (TAG , "Exception while trying to resize an in-app message" , e );
312
320
}
0 commit comments