From 15fa42ba9b367057d4382f247fc8066a484cca5b Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Mon, 27 Dec 2021 17:55:48 +0300 Subject: [PATCH] Lint fixes. --- .../epoxy/bottomsheet/BottomSheetMessagePreviewItem.kt | 2 -- .../timeline/action/MessageActionsEpoxyController.kt | 1 - .../room/detail/timeline/factory/MessageItemFactory.kt | 1 - .../java/im/vector/app/features/location/LocationData.kt | 1 - .../app/features/location/LocationPreviewFragment.kt | 9 +++------ .../im/vector/app/features/location/LocationTracker.kt | 3 +++ .../im/vector/app/features/location/MapTilerMapView.kt | 1 - 7 files changed, 6 insertions(+), 12 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/epoxy/bottomsheet/BottomSheetMessagePreviewItem.kt b/vector/src/main/java/im/vector/app/core/epoxy/bottomsheet/BottomSheetMessagePreviewItem.kt index ae9efe367a..7c18dd818e 100644 --- a/vector/src/main/java/im/vector/app/core/epoxy/bottomsheet/BottomSheetMessagePreviewItem.kt +++ b/vector/src/main/java/im/vector/app/core/epoxy/bottomsheet/BottomSheetMessagePreviewItem.kt @@ -39,8 +39,6 @@ import im.vector.app.features.location.MapTilerMapView import im.vector.app.features.location.VectorMapListener import im.vector.app.features.media.ImageContentRenderer import org.matrix.android.sdk.api.extensions.orFalse -import org.matrix.android.sdk.api.session.room.model.message.LocationInfo -import org.matrix.android.sdk.api.session.room.model.message.MessageLocationContent import org.matrix.android.sdk.api.util.MatrixItem /** diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsEpoxyController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsEpoxyController.kt index 0bd4f1bf21..3e1edfa158 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsEpoxyController.kt @@ -43,7 +43,6 @@ import im.vector.app.features.location.LocationData import im.vector.app.features.media.ImageContentRenderer import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.failure.Failure -import org.matrix.android.sdk.api.session.events.model.toContent import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.room.model.message.MessageLocationContent import org.matrix.android.sdk.api.session.room.send.SendState diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt index b0df2d6a54..607e4c1252 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -185,7 +185,6 @@ class MessageItemFactory @Inject constructor( highlight: Boolean, callback: TimelineEventController.Callback?, attributes: AbsMessageItem.Attributes): MessageLocationItem? { - val geoUri = locationContent.locationInfo?.geoUri ?: locationContent.geoUri val locationData = LocationData.create(geoUri) diff --git a/vector/src/main/java/im/vector/app/features/location/LocationData.kt b/vector/src/main/java/im/vector/app/features/location/LocationData.kt index 874e159e80..b790bde710 100644 --- a/vector/src/main/java/im/vector/app/features/location/LocationData.kt +++ b/vector/src/main/java/im/vector/app/features/location/LocationData.kt @@ -68,4 +68,3 @@ data class LocationData( } } } - diff --git a/vector/src/main/java/im/vector/app/features/location/LocationPreviewFragment.kt b/vector/src/main/java/im/vector/app/features/location/LocationPreviewFragment.kt index e13456dbdc..1a7ed49209 100644 --- a/vector/src/main/java/im/vector/app/features/location/LocationPreviewFragment.kt +++ b/vector/src/main/java/im/vector/app/features/location/LocationPreviewFragment.kt @@ -16,21 +16,18 @@ package im.vector.app.features.location -import android.content.Intent -import android.net.Uri import android.os.Bundle import android.view.LayoutInflater import android.view.MenuItem import android.view.View import android.view.ViewGroup -import im.vector.app.core.platform.VectorBaseFragment -import im.vector.app.databinding.FragmentLocationPreviewBinding -import javax.inject.Inject import com.airbnb.mvrx.args import im.vector.app.R +import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.utils.openLocation +import im.vector.app.databinding.FragmentLocationPreviewBinding import im.vector.app.features.home.room.detail.timeline.helper.LocationPinProvider -import org.matrix.android.sdk.api.extensions.tryOrNull +import javax.inject.Inject class LocationPreviewFragment @Inject constructor( private val locationPinProvider: LocationPinProvider diff --git a/vector/src/main/java/im/vector/app/features/location/LocationTracker.kt b/vector/src/main/java/im/vector/app/features/location/LocationTracker.kt index 0ea1e6810b..6e55735f9b 100644 --- a/vector/src/main/java/im/vector/app/features/location/LocationTracker.kt +++ b/vector/src/main/java/im/vector/app/features/location/LocationTracker.kt @@ -16,10 +16,12 @@ package im.vector.app.features.location +import android.Manifest import android.content.Context import android.location.Location import android.location.LocationListener import android.location.LocationManager +import androidx.annotation.RequiresPermission import timber.log.Timber import javax.inject.Inject @@ -65,6 +67,7 @@ class LocationTracker @Inject constructor( } } + @RequiresPermission(anyOf = [Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION]) fun stop() { locationManager?.removeUpdates(this) callback = null diff --git a/vector/src/main/java/im/vector/app/features/location/MapTilerMapView.kt b/vector/src/main/java/im/vector/app/features/location/MapTilerMapView.kt index 627b9e5ec3..386e96988f 100644 --- a/vector/src/main/java/im/vector/app/features/location/MapTilerMapView.kt +++ b/vector/src/main/java/im/vector/app/features/location/MapTilerMapView.kt @@ -19,7 +19,6 @@ package im.vector.app.features.location import android.content.Context import android.graphics.drawable.Drawable import android.util.AttributeSet -import com.mapbox.mapboxsdk.Mapbox import com.mapbox.mapboxsdk.camera.CameraPosition import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.maps.MapView