Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Android 11 Conversation features #1809

Merged
merged 7 commits into from
Aug 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -171,6 +171,7 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active
.toBitmap(width = iconSize, height = iconSize))
}
}
.apply(RequestOptions.centerCropTransform())
.submit(iconSize, iconSize)
.get()
}
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ package im.vector.app.features.home
import android.content.Context
import android.content.pm.ShortcutInfo
import android.graphics.Bitmap
import android.graphics.Canvas
import android.os.Build
import androidx.annotation.WorkerThread
import androidx.core.content.pm.ShortcutInfoCompat
@@ -46,7 +47,7 @@ class ShortcutCreator @Inject constructor(
private val adaptiveIconOuterSides = dimensionConverter.dpToPx(adaptiveIconOuterSidesDp)
private val iconSize by lazy {
if (useAdaptiveIcon) {
adaptiveIconSize - adaptiveIconOuterSides
adaptiveIconSize - (adaptiveIconOuterSides * 2)
} else {
dimensionConverter.dpToPx(72)
}
@@ -80,7 +81,11 @@ class ShortcutCreator @Inject constructor(

private fun Bitmap.toProfileImageIcon(): IconCompat {
return if (useAdaptiveIcon) {
IconCompat.createWithAdaptiveBitmap(this)
val insetBmp = Bitmap.createBitmap(adaptiveIconSize, adaptiveIconSize, Bitmap.Config.ARGB_8888)
val canvas = Canvas(insetBmp)
canvas.drawBitmap(this, adaptiveIconOuterSides.toFloat(), adaptiveIconOuterSides.toFloat(), null)

IconCompat.createWithAdaptiveBitmap(insetBmp)
} else {
IconCompat.createWithBitmap(this)
}