Переглянути джерело

decrease lint warnings

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 4 роки тому
батько
коміт
60827afe5c

+ 3 - 2
app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingLocationMessageViewHolder.kt

@@ -19,6 +19,7 @@ import android.widget.ImageView
 import android.widget.RelativeLayout
 import android.widget.TextView
 import android.widget.Toast
+import androidx.appcompat.content.res.AppCompatResources
 import androidx.core.view.ViewCompat
 import androidx.emoji.widget.EmojiTextView
 import autodagger.AutoInjector
@@ -122,8 +123,8 @@ class IncomingLocationMessageViewHolder(incomingView: View) : MessageHolders
                 // do nothing, avatar is set
             } else if (message.actorType == "bots" && message.actorId == "changelog") {
                 val layers = arrayOfNulls<Drawable>(2)
-                layers[0] = context?.getDrawable(R.drawable.ic_launcher_background)
-                layers[1] = context?.getDrawable(R.drawable.ic_launcher_foreground)
+                layers[0] = AppCompatResources.getDrawable(context!!, R.drawable.ic_launcher_background)
+                layers[1] = AppCompatResources.getDrawable(context!!, R.drawable.ic_launcher_foreground)
                 val layerDrawable = LayerDrawable(layers)
                 messageUserAvatarView?.setImageDrawable(DisplayUtils.getRoundedDrawable(layerDrawable))
             } else if (message.actorType == "bots") {

+ 2 - 1
app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingLocationMessageViewHolder.kt

@@ -17,6 +17,7 @@ import android.widget.ImageView
 import android.widget.RelativeLayout
 import android.widget.TextView
 import android.widget.Toast
+import androidx.appcompat.content.res.AppCompatResources
 import androidx.core.view.ViewCompat
 import androidx.emoji.widget.EmojiTextView
 import autodagger.AutoInjector
@@ -203,7 +204,7 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
         }
 
         readStatusDrawableInt?.let { drawableInt ->
-            context?.resources?.getDrawable(drawableInt, null)?.let {
+            AppCompatResources.getDrawable(context!!, drawableInt)?.let {
                 it.setColorFilter(context?.resources!!.getColor(R.color.white60), PorterDuff.Mode.SRC_ATOP)
                 checkMark?.setImageDrawable(it)
             }

+ 6 - 6
app/src/main/java/com/nextcloud/talk/controllers/LocationPickerController.kt

@@ -238,7 +238,7 @@ class LocationPickerController(args: Bundle) : BaseController(args), SearchView.
         myLocation = GeoPoint(13.0, 52.0)
 
         var zoomToCurrentPositionAllowed = !receivedChosenGeocodingResult
-        locationOverlay.runOnFirstFix(Runnable {
+        locationOverlay.runOnFirstFix {
             myLocation = locationOverlay.myLocation
             if (zoomToCurrentPositionAllowed) {
                 activity!!.runOnUiThread {
@@ -246,16 +246,16 @@ class LocationPickerController(args: Bundle) : BaseController(args), SearchView.
                     mapController?.setCenter(myLocation)
                 }
             }
-        })
+        }
 
         if (receivedChosenGeocodingResult && geocodedLat != 0.0 && geocodedLon != 0.0) {
             mapController?.setCenter(GeoPoint(geocodedLat, geocodedLon))
         }
 
-        btCenterMap?.setOnClickListener(View.OnClickListener {
+        btCenterMap?.setOnClickListener {
             mapController?.animateTo(myLocation)
             moveToCurrentLocationWasClicked = true
-        })
+        }
 
         map?.addMapListener(DelayedMapListener(object : MapListener {
             override fun onScroll(paramScrollEvent: ScrollEvent): Boolean {
@@ -422,7 +422,7 @@ class LocationPickerController(args: Bundle) : BaseController(args), SearchView.
     }
 
     companion object {
-        private val TAG = "LocationPickerController"
-        private val REQUEST_PERMISSIONS_REQUEST_CODE = 1
+        private const val TAG = "LocationPicker"
+        private const val REQUEST_PERMISSIONS_REQUEST_CODE = 1
     }
 }

+ 2 - 0
build.gradle

@@ -49,6 +49,8 @@ buildscript {
 configurations.all {
     // check for updates every build
     resolutionStrategy.cacheChangingModulesFor 3600, 'seconds'
+    exclude module: 'httpclient'
+    exclude module: 'commons-logging'
 }
 
 allprojects {