Fix compilation issues after merge of develop

This commit is contained in:
Benoit Marty 2022-01-25 14:36:32 +01:00
parent b619f70904
commit 460f39176c
2 changed files with 10 additions and 15 deletions

View File

@ -25,8 +25,8 @@ import com.bumptech.glide.request.transition.Transition
import im.vector.app.R
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.glide.GlideApp
import im.vector.app.core.utils.DimensionConverter
import im.vector.app.features.home.AvatarRenderer
import org.billcarsonfr.jsonviewer.Utils
import org.matrix.android.sdk.api.util.toMatrixItem
import javax.inject.Inject
import javax.inject.Singleton
@ -35,6 +35,7 @@ import javax.inject.Singleton
class LocationPinProvider @Inject constructor(
private val context: Context,
private val activeSessionHolder: ActiveSessionHolder,
private val dimensionConverter: DimensionConverter,
private val avatarRenderer: AvatarRenderer
) {
private val cache = mutableMapOf<String, Drawable>()
@ -50,14 +51,14 @@ class LocationPinProvider @Inject constructor(
}
activeSessionHolder.getActiveSession().getUser(userId)?.toMatrixItem()?.let {
val size = Utils.dpToPx(44, context)
val size = dimensionConverter.dpToPx(44)
avatarRenderer.render(glideRequests, it, object : CustomTarget<Drawable>(size, size) {
override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
val bgUserPin = ContextCompat.getDrawable(context, R.drawable.bg_map_user_pin)!!
val layerDrawable = LayerDrawable(arrayOf(bgUserPin, resource))
val horizontalInset = Utils.dpToPx(4, context)
val topInset = Utils.dpToPx(4, context)
val bottomInset = Utils.dpToPx(8, context)
val horizontalInset = dimensionConverter.dpToPx(4)
val topInset = dimensionConverter.dpToPx(4)
val bottomInset = dimensionConverter.dpToPx(8)
layerDrawable.setLayerInset(1, horizontalInset, topInset, horizontalInset, bottomInset)
cache[userId] = layerDrawable

View File

@ -19,10 +19,8 @@ package im.vector.app.features.location
import android.content.Context
import android.content.Intent
import android.os.Parcelable
import com.google.android.material.appbar.MaterialToolbar
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.ToolbarConfigurable
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivityLocationSharingBinding
import kotlinx.parcelize.Parcelize
@ -36,23 +34,19 @@ data class LocationSharingArgs(
) : Parcelable
@AndroidEntryPoint
class LocationSharingActivity : VectorBaseActivity<ActivityLocationSharingBinding>(),
ToolbarConfigurable {
class LocationSharingActivity : VectorBaseActivity<ActivityLocationSharingBinding>() {
override fun getBinding() = ActivityLocationSharingBinding.inflate(layoutInflater)
override fun configure(toolbar: MaterialToolbar) {
configureToolbar(toolbar)
}
override fun initUiAndData() {
val locationSharingArgs: LocationSharingArgs? = intent?.extras?.getParcelable(EXTRA_LOCATION_SHARING_ARGS)
if (locationSharingArgs == null) {
finish()
return
}
configure(views.toolbar)
supportActionBar?.title = getString(locationSharingArgs.mode.titleRes)
setupToolbar(views.toolbar)
.setTitle(locationSharingArgs.mode.titleRes)
.allowBack()
if (isFirstCreation()) {
when (locationSharingArgs.mode) {