1717package im.vector.app.features.location.live.map
1818
1919import android.content.Context
20- import android.view.LayoutInflater
2120import android.view.View
2221import android.view.ViewGroup
2322import android.widget.PopupWindow
24- import androidx.core.content.ContextCompat
2523import im.vector.app.R
2624import im.vector.app.databinding.ViewLiveLocationMarkerPopupBinding
2725
2826class LocationLiveMapMarkerOptionsDialog (
2927 context : Context ,
30- inflater : LayoutInflater ,
3128) : PopupWindow() {
3229
3330 interface Callback {
@@ -39,7 +36,7 @@ class LocationLiveMapMarkerOptionsDialog(
3936 var callback: Callback ? = null
4037
4138 init {
42- contentView = inflater .inflate(R .layout.view_live_location_marker_popup, null , false )
39+ contentView = View .inflate(context, R .layout.view_live_location_marker_popup, null )
4340
4441 views = ViewLiveLocationMarkerPopupBinding .bind(contentView)
4542
@@ -48,8 +45,6 @@ class LocationLiveMapMarkerOptionsDialog(
4845 inputMethodMode = INPUT_METHOD_NOT_NEEDED
4946 isFocusable = true
5047 isTouchable = true
51- elevation = 8f
52- setBackgroundDrawable(ContextCompat .getDrawable(context, R .drawable.bg_live_location_marker_popup))
5348
5449 contentView.setOnClickListener {
5550 callback?.onShareLocationClicked()
@@ -58,6 +53,7 @@ class LocationLiveMapMarkerOptionsDialog(
5853
5954 fun show (anchorView : View ) {
6055 contentView.measure(View .MeasureSpec .UNSPECIFIED , View .MeasureSpec .UNSPECIFIED )
56+ // By default the left side of the dialog is aligned with the pin. We need shift it to the left to make it's center aligned with the pin.
6157 showAsDropDown(anchorView, - contentView.measuredWidth / 2 , 0 )
6258 }
6359}
0 commit comments