@@ -161,12 +161,12 @@ void showInAppMessageView(Activity currentActivity) {
161
161
);
162
162
webViewLayoutParams .addRule (RelativeLayout .CENTER_IN_PARENT );
163
163
164
- LinearLayout .LayoutParams linearLayoutParams = hasBackground ? createParentLinearLayoutParams () : null ;
164
+ RelativeLayout .LayoutParams relativeLayoutParams = hasBackground ? createParentRelativeLayoutParams () : null ;
165
165
166
166
showDraggableView (
167
167
displayLocation ,
168
168
webViewLayoutParams ,
169
- linearLayoutParams ,
169
+ relativeLayoutParams ,
170
170
createDraggableLayoutParams (pageHeight , displayLocation , disableDragDismiss )
171
171
);
172
172
}
@@ -175,22 +175,23 @@ private int getDisplayYSize() {
175
175
return OSViewUtils .getWindowHeight (currentActivity );
176
176
}
177
177
178
- private LinearLayout .LayoutParams createParentLinearLayoutParams () {
179
- LinearLayout .LayoutParams linearLayoutParams = new LinearLayout .LayoutParams (pageWidth , LinearLayout .LayoutParams .MATCH_PARENT );
180
-
178
+ private RelativeLayout .LayoutParams createParentRelativeLayoutParams () {
179
+ RelativeLayout .LayoutParams relativeLayoutParams = new RelativeLayout .LayoutParams (pageWidth , RelativeLayout .LayoutParams .MATCH_PARENT );
181
180
switch (displayLocation ) {
182
181
case TOP_BANNER :
183
- linearLayoutParams .gravity = Gravity .CENTER_HORIZONTAL | Gravity .TOP ;
182
+ relativeLayoutParams .addRule (RelativeLayout .ALIGN_PARENT_TOP );
183
+ relativeLayoutParams .addRule (RelativeLayout .CENTER_HORIZONTAL );
184
184
break ;
185
185
case BOTTOM_BANNER :
186
- linearLayoutParams .gravity = Gravity .CENTER_HORIZONTAL | Gravity .BOTTOM ;
186
+ relativeLayoutParams .addRule (RelativeLayout .ALIGN_PARENT_BOTTOM );
187
+ relativeLayoutParams .addRule (RelativeLayout .CENTER_HORIZONTAL );
187
188
break ;
188
189
case CENTER_MODAL :
189
190
case FULL_SCREEN :
190
- linearLayoutParams . gravity = Gravity . CENTER ;
191
+ relativeLayoutParams . addRule ( RelativeLayout . CENTER_IN_PARENT ) ;
191
192
}
192
193
193
- return linearLayoutParams ;
194
+ return relativeLayoutParams ;
194
195
}
195
196
196
197
private DraggableRelativeLayout .Params createDraggableLayoutParams (int pageHeight , WebViewManager .Position displayLocation , boolean disableDragging ) {
@@ -229,7 +230,7 @@ private DraggableRelativeLayout.Params createDraggableLayoutParams(int pageHeigh
229
230
230
231
private void showDraggableView (final WebViewManager .Position displayLocation ,
231
232
final RelativeLayout .LayoutParams relativeLayoutParams ,
232
- final LinearLayout .LayoutParams linearLayoutParams ,
233
+ final RelativeLayout .LayoutParams draggableRelativeLayoutParams ,
233
234
final DraggableRelativeLayout .Params webViewLayoutParams ) {
234
235
OSUtils .runOnMainUIThread (new Runnable () {
235
236
@ Override
@@ -240,8 +241,8 @@ public void run() {
240
241
webView .setLayoutParams (relativeLayoutParams );
241
242
242
243
Context context = currentActivity .getApplicationContext ();
243
- setUpDraggableLayout (context , linearLayoutParams , webViewLayoutParams );
244
- setUpParentLinearLayout (context );
244
+ setUpDraggableLayout (context , draggableRelativeLayoutParams , webViewLayoutParams );
245
+ setUpParentRelativeLayout (context );
245
246
createPopupWindow (parentRelativeLayout );
246
247
247
248
if (messageController != null ) {
@@ -276,6 +277,10 @@ private void createPopupWindow(@NonNull RelativeLayout parentRelativeLayout) {
276
277
case BOTTOM_BANNER :
277
278
gravity = Gravity .CENTER_HORIZONTAL | Gravity .BOTTOM ;
278
279
break ;
280
+ case CENTER_MODAL :
281
+ case FULL_SCREEN :
282
+ gravity = Gravity .CENTER_HORIZONTAL ;
283
+ break ;
279
284
}
280
285
}
281
286
@@ -293,8 +298,10 @@ private void createPopupWindow(@NonNull RelativeLayout parentRelativeLayout) {
293
298
0
294
299
);
295
300
}
301
+ /*
296
302
297
- private void setUpParentLinearLayout (Context context ) {
303
+ */
304
+ private void setUpParentRelativeLayout (Context context ) {
298
305
parentRelativeLayout = new RelativeLayout (context );
299
306
parentRelativeLayout .setBackgroundDrawable (new ColorDrawable (Color .TRANSPARENT ));
300
307
parentRelativeLayout .setClipChildren (false );
@@ -303,11 +310,11 @@ private void setUpParentLinearLayout(Context context) {
303
310
}
304
311
305
312
private void setUpDraggableLayout (final Context context ,
306
- LinearLayout .LayoutParams linearLayoutParams ,
313
+ RelativeLayout .LayoutParams relativeLayoutParams ,
307
314
DraggableRelativeLayout .Params draggableParams ) {
308
315
draggableRelativeLayout = new DraggableRelativeLayout (context );
309
- if (linearLayoutParams != null )
310
- draggableRelativeLayout .setLayoutParams (linearLayoutParams );
316
+ if (relativeLayoutParams != null )
317
+ draggableRelativeLayout .setLayoutParams (relativeLayoutParams );
311
318
draggableRelativeLayout .setParams (draggableParams );
312
319
draggableRelativeLayout .setListener (new DraggableRelativeLayout .DraggableListener () {
313
320
@ Override
0 commit comments