Skip to content

Commit c408f82

Browse files
committed
Code review fixes.
1 parent 619da0e commit c408f82

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapMarkerOptionsDialog.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@
1717
package im.vector.app.features.location.live.map
1818

1919
import android.content.Context
20-
import android.view.LayoutInflater
2120
import android.view.View
2221
import android.view.ViewGroup
2322
import android.widget.PopupWindow
24-
import androidx.core.content.ContextCompat
2523
import im.vector.app.R
2624
import im.vector.app.databinding.ViewLiveLocationMarkerPopupBinding
2725

2826
class 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
}

vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
143143
y = (screenLocation?.y ?: 0f) - views.liveLocationPopupAnchor.height
144144
}
145145

146-
LocationLiveMapMarkerOptionsDialog(requireContext(), layoutInflater)
146+
LocationLiveMapMarkerOptionsDialog(requireContext())
147147
.apply {
148148
callback = object : LocationLiveMapMarkerOptionsDialog.Callback {
149149
override fun onShareLocationClicked() {

vector/src/main/res/layout/view_live_location_marker_popup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
android:layout_width="wrap_content"
55
android:layout_height="wrap_content"
6+
android:background="@drawable/bg_live_location_marker_popup"
7+
android:elevation="8dp"
68
android:padding="8dp">
79

810
<ImageView

0 commit comments

Comments
 (0)