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

View File

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