[UI] Made Playlist Preview images rounded

This commit is contained in:
Prathamesh More 2021-11-26 19:01:39 +05:30
parent 49effb8b9e
commit 216d25e3f0
2 changed files with 7 additions and 17 deletions

View file

@ -40,7 +40,7 @@ public class AutoGeneratedPlaylistBitmap {
List<Bitmap> art = new ArrayList<>(); List<Bitmap> art = new ArrayList<>();
for (Long id : albumID) { for (Long id : albumID) {
Bitmap bitmap = getBitmapWithAlbumId(context, id); Bitmap bitmap = getBitmapWithAlbumId(context, id);
if (bitmap != null) art.add(bitmap); if (bitmap != null) art.add(BitmapEditor.getRoundedCornerBitmap(bitmap, 10));
if (art.size() == 9) break; if (art.size() == 9) break;
} }
return MergedImageUtils.INSTANCE.joinImages(art); return MergedImageUtils.INSTANCE.joinImages(art);

View file

@ -1,6 +1,9 @@
package code.name.monkey.retromusic.util package code.name.monkey.retromusic.util
import android.graphics.* import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Matrix
import android.graphics.Paint
import com.bumptech.glide.util.Util.assertBackgroundThread import com.bumptech.glide.util.Util.assertBackgroundThread
@ -75,25 +78,12 @@ internal object MergedImageUtils {
val bit = Bitmap.createScaledBitmap(bitmap, onePartSize, onePartSize, true) val bit = Bitmap.createScaledBitmap(bitmap, onePartSize, onePartSize, true)
canvas.drawBitmap( canvas.drawBitmap(
bit, bit,
(onePartSize * (i % parts)).toFloat(), (onePartSize * (i % parts)).toFloat() + (i % 3) * 50,
(onePartSize * (i / parts)).toFloat(), (onePartSize * (i / parts)).toFloat() + (i / 3) * 50,
paint paint
) )
bit.recycle() bit.recycle()
} }
paint.color = Color.WHITE
paint.strokeWidth = 10f
val oneThirdSize = (IMAGE_SIZE / 3).toFloat()
val twoThirdSize = (IMAGE_SIZE / 3 * 2).toFloat()
// vertical lines
canvas.drawLine(oneThirdSize, 0f, oneThirdSize, imageSize.toFloat(), paint)
canvas.drawLine(twoThirdSize, 0f, twoThirdSize, imageSize.toFloat(), paint)
// horizontal lines
canvas.drawLine(0f, oneThirdSize, imageSize.toFloat(), oneThirdSize, paint)
canvas.drawLine(0f, twoThirdSize, imageSize.toFloat(), twoThirdSize, paint)
return result return result
} }