diff --git a/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt b/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt index d4130762412f..e858c6fa97d9 100644 --- a/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt +++ b/app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt @@ -27,7 +27,6 @@ import android.graphics.drawable.LayerDrawable import android.net.Uri import android.os.Bundle import android.os.Parcelable -import android.view.Gravity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -246,7 +245,7 @@ class ImageDetailFragment : Fragment(), Injectable { } val markerOverlay = ItemizedIconOverlay( - mutableListOf(OverlayItem("Location", "", location)), + mutableListOf(OverlayItem(null, null, location)), imagePinDrawable(context), markerOnGestureListener(latitude, longitude), context @@ -340,28 +339,16 @@ class ImageDetailFragment : Fragment(), Injectable { } } - @Suppress("MagicNumber") private fun imagePinDrawable(context: Context): LayerDrawable { + val drawable = ContextCompat.getDrawable(context, R.drawable.photo_pin) as LayerDrawable + val bitmap = ThumbnailsCacheManager.getBitmapFromDiskCache(ThumbnailsCacheManager.PREFIX_THUMBNAIL + file.remoteId) - val foreground = BitmapUtils.bitmapToCircularBitmapDrawable(resources, bitmap) - val background = ContextCompat.getDrawable(context, R.drawable.photo_pin) - - val layerDrawable = if (foreground != null) { - LayerDrawable(arrayOf(background, foreground)) - } else { - val d = ContextCompat.getDrawable(context, R.drawable.file_image) - LayerDrawable(arrayOf(background, d)) + BitmapUtils.bitmapToCircularBitmapDrawable(resources, bitmap)?.let { + drawable.setDrawable(1, it) } - val dp = DisplayUtils.convertDpToPixel(2f, context) - layerDrawable.apply { - setLayerSize(1, 38 * dp, 38 * dp) - setLayerSize(0, 40 * dp, 47 * dp) - setLayerInsetTop(1, dp) - setLayerGravity(1, Gravity.CENTER_HORIZONTAL) - } - return layerDrawable + return drawable } /** diff --git a/app/src/main/res/drawable/photo_pin.xml b/app/src/main/res/drawable/photo_pin.xml index c9f036f6d85b..58c13b7a5248 100644 --- a/app/src/main/res/drawable/photo_pin.xml +++ b/app/src/main/res/drawable/photo_pin.xml @@ -1,3 +1,4 @@ + - - - - + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/photo_pin_background.xml b/app/src/main/res/drawable/photo_pin_background.xml new file mode 100644 index 000000000000..c9f036f6d85b --- /dev/null +++ b/app/src/main/res/drawable/photo_pin_background.xml @@ -0,0 +1,36 @@ + + + + +