mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-21 21:29:00 +00:00
Add bounds to pet/mount share drawables (#1150)
* Set bounds on pet/mount share drawable * Variablizing image side lengths
This commit is contained in:
parent
30539ba6a0
commit
2bd02914ea
1 changed files with 6 additions and 2 deletions
|
|
@ -523,9 +523,11 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
.setNeutralButton(R.string.share) { hatchingDialog, _ ->
|
||||
val event1 = ShareEvent()
|
||||
event1.sharedMessage = getString(R.string.share_hatched, potionName, eggName) + " https://habitica.com/social/hatch-pet"
|
||||
val sharedImage = Bitmap.createBitmap(140, 140, Bitmap.Config.ARGB_8888)
|
||||
val petImageSideLength = 140
|
||||
val sharedImage = Bitmap.createBitmap(petImageSideLength, petImageSideLength, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(sharedImage)
|
||||
canvas.drawColor(ContextCompat.getColor(this, R.color.brand_300))
|
||||
petImageView?.drawable?.setBounds(0, 0, petImageSideLength, petImageSideLength)
|
||||
petImageView?.drawable?.draw(canvas)
|
||||
event1.shareImage = sharedImage
|
||||
EventBus.getDefault().post(event1)
|
||||
|
|
@ -557,9 +559,11 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
.setNeutralButton(R.string.share) { hatchingDialog, _ ->
|
||||
val event1 = ShareEvent()
|
||||
event1.sharedMessage = getString(R.string.share_raised, pet.text) + " https://habitica.com/social/raise-pet"
|
||||
val sharedImage = Bitmap.createBitmap(99, 99, Bitmap.Config.ARGB_8888)
|
||||
val mountImageSideLength = 99
|
||||
val sharedImage = Bitmap.createBitmap(mountImageSideLength, mountImageSideLength, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(sharedImage)
|
||||
canvas.drawColor(ContextCompat.getColor(this, R.color.brand_300))
|
||||
mountImageView.drawable.setBounds(0, 0, mountImageSideLength, mountImageSideLength)
|
||||
mountImageView.drawable.draw(canvas)
|
||||
event1.shareImage = sharedImage
|
||||
EventBus.getDefault().post(event1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue