@@ -55,7 +55,6 @@ class InAppMessageView {
55
55
56
56
private static final int ACTIVITY_FINISH_AFTER_DISMISS_DELAY_MS = 600 ;
57
57
private static final int ACTIVITY_INIT_DELAY = 200 ;
58
- private static final int MARGIN_PX_SIZE = dpToPx (24 );
59
58
private static final int DRAG_THRESHOLD_PX_SIZE = dpToPx (4 );
60
59
private PopupWindow popupWindow ;
61
60
@@ -69,6 +68,8 @@ interface InAppMessageViewListener {
69
68
private final Handler handler = new Handler ();
70
69
private int pageWidth ;
71
70
private int pageHeight ;
71
+ private int marginPxSizeWidth = dpToPx (24 );
72
+ private int marginPxSizeHeight = dpToPx (24 );
72
73
private double dismissDuration ;
73
74
private boolean hasBackground ;
74
75
private boolean shouldDismissWhenActive = false ;
@@ -194,22 +195,22 @@ private LinearLayout.LayoutParams createParentLinearLayoutParams() {
194
195
195
196
private DraggableRelativeLayout .Params createDraggableLayoutParams (int pageHeight , WebViewManager .Position displayLocation , boolean disableDragging ) {
196
197
DraggableRelativeLayout .Params draggableParams = new DraggableRelativeLayout .Params ();
197
- draggableParams .maxXPos = MARGIN_PX_SIZE ;
198
- draggableParams .maxYPos = MARGIN_PX_SIZE ;
198
+ draggableParams .maxXPos = marginPxSizeWidth ;
199
+ draggableParams .maxYPos = marginPxSizeHeight ;
199
200
draggableParams .draggingDisabled = disableDragging ;
200
201
draggableParams .messageHeight = pageHeight ;
201
202
draggableParams .height = getDisplayYSize ();
202
203
203
204
switch (displayLocation ) {
204
205
case TOP_BANNER :
205
- draggableParams .dragThresholdY = MARGIN_PX_SIZE - DRAG_THRESHOLD_PX_SIZE ;
206
+ draggableParams .dragThresholdY = marginPxSizeHeight - DRAG_THRESHOLD_PX_SIZE ;
206
207
break ;
207
208
case BOTTOM_BANNER :
208
209
draggableParams .posY = getDisplayYSize () - pageHeight ;
209
- draggableParams .dragThresholdY = MARGIN_PX_SIZE + DRAG_THRESHOLD_PX_SIZE ;
210
+ draggableParams .dragThresholdY = marginPxSizeHeight + DRAG_THRESHOLD_PX_SIZE ;
210
211
break ;
211
212
case FULL_SCREEN :
212
- draggableParams .messageHeight = pageHeight = getDisplayYSize () - (MARGIN_PX_SIZE * 2 );
213
+ draggableParams .messageHeight = pageHeight = getDisplayYSize () - (marginPxSizeHeight * 2 );
213
214
// fall through for FULL_SCREEN since it shares similar params to CENTER_MODAL
214
215
case CENTER_MODAL :
215
216
int y = (getDisplayYSize () / 2 ) - (pageHeight / 2 );
@@ -335,7 +336,7 @@ public void onDragEnd() {
335
336
cardView .setTag (IN_APP_MESSAGE_CARD_VIEW_TAG );
336
337
cardView .addView (webView );
337
338
338
- draggableRelativeLayout .setPadding (MARGIN_PX_SIZE , MARGIN_PX_SIZE , MARGIN_PX_SIZE , MARGIN_PX_SIZE );
339
+ draggableRelativeLayout .setPadding (marginPxSizeWidth , marginPxSizeHeight , marginPxSizeWidth , marginPxSizeHeight );
339
340
draggableRelativeLayout .setClipChildren (false );
340
341
draggableRelativeLayout .setClipToPadding (false );
341
342
draggableRelativeLayout .addView (cardView );
@@ -543,7 +544,7 @@ private void animateTop(View messageView, int height, Animation.AnimationListene
543
544
// Animate the message view from above the screen downward to the top
544
545
OneSignalAnimate .animateViewByTranslation (
545
546
messageView ,
546
- -height - MARGIN_PX_SIZE ,
547
+ -height - marginPxSizeHeight ,
547
548
0f ,
548
549
IN_APP_BANNER_ANIMATION_DURATION_MS ,
549
550
new OneSignalBounceInterpolator (0.1 , 8.0 ),
@@ -555,7 +556,7 @@ private void animateBottom(View messageView, int height, Animation.AnimationList
555
556
// Animate the message view from under the screen upward to the bottom
556
557
OneSignalAnimate .animateViewByTranslation (
557
558
messageView ,
558
- height + MARGIN_PX_SIZE ,
559
+ height + marginPxSizeHeight ,
559
560
0f ,
560
561
IN_APP_BANNER_ANIMATION_DURATION_MS ,
561
562
new OneSignalBounceInterpolator (0.1 , 8.0 ),
0 commit comments