blob: 215445abaa2277b15a6b32260ce331b97f067df1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package com.mapbox.mapboxsdk.annotations;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import com.mapbox.mapboxsdk.R;
class BubblePopupHelper {
static PopupWindow create(@NonNull Context context, @NonNull BubbleLayout bubbleLayout) {
PopupWindow popupWindow = new PopupWindow(context);
popupWindow.setContentView(bubbleLayout);
popupWindow.setOutsideTouchable(true);
popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
// change background color to transparent
Drawable drawable;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
drawable = context.getDrawable(R.drawable.mapbox_popup_window_transparent);
} else {
drawable = context.getResources().getDrawable(R.drawable.mapbox_popup_window_transparent);
}
popupWindow.setBackgroundDrawable(drawable);
return popupWindow;
}
}
|