mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
confetti tweaks
This commit is contained in:
parent
ba8bcfd86e
commit
dcca5f9918
6 changed files with 38 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<size android:height="4dp" android:width="8dp" />
|
||||
<size android:height="4dp" android:width="10dp" />
|
||||
<solid android:color="@color/background_blue" />
|
||||
<corners android:radius="1dp" />
|
||||
</shape>
|
||||
<corners android:radius="2dp" />
|
||||
</shape>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<size android:height="4dp" android:width="8dp" />
|
||||
<solid android:color="@color/brand_400" />
|
||||
<corners android:radius="1dp" />
|
||||
</shape>
|
||||
<size android:height="4dp" android:width="10dp" />
|
||||
<solid android:color="@color/text_brand_neon" />
|
||||
<corners android:radius="2dp" />
|
||||
</shape>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<size android:height="4dp" android:width="8dp" />
|
||||
<size android:height="4dp" android:width="10dp" />
|
||||
<solid android:color="@color/background_red" />
|
||||
<corners android:radius="1dp" />
|
||||
</shape>
|
||||
<corners android:radius="2dp" />
|
||||
</shape>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<size android:height="4dp" android:width="8dp" />
|
||||
<size android:height="4dp" android:width="10dp" />
|
||||
<solid android:color="@color/background_yellow" />
|
||||
<corners android:radius="1dp" />
|
||||
</shape>
|
||||
<corners android:radius="2dp" />
|
||||
</shape>
|
||||
|
|
|
|||
|
|
@ -198,25 +198,29 @@ private constructor(parent: ViewGroup, content: View, callback: ContentViewCallb
|
|||
{
|
||||
ParticleSystem(container, 30, ContextCompat.getDrawable(container.context, R.drawable.confetti_blue), 6000)
|
||||
.setAcceleration(0.00070f, 90)
|
||||
.setRotationSpeed(144f)
|
||||
.setRotationSpeedRange(134f, 164f)
|
||||
.setScaleRange(0.8f, 1.2f)
|
||||
.setSpeedByComponentsRange(-0.15f, 0.15f, -0.15f, -0.45f)
|
||||
.setFadeOut(200, AccelerateInterpolator())
|
||||
.emitWithGravity(container, Gravity.BOTTOM, 7, 1000)
|
||||
ParticleSystem(container, 30, ContextCompat.getDrawable(container.context, R.drawable.confetti_red), 6000)
|
||||
.setAcceleration(0.00060f, 90)
|
||||
.setRotationSpeed(144f)
|
||||
.setRotationSpeedRange(134f, 164f)
|
||||
.setScaleRange(0.8f, 1.2f)
|
||||
.setSpeedByComponentsRange(-0.15f, 0.15f, -0.15f, -0.45f)
|
||||
.setFadeOut(200, AccelerateInterpolator())
|
||||
.emitWithGravity(container, Gravity.BOTTOM, 7, 1000)
|
||||
ParticleSystem(container, 30, ContextCompat.getDrawable(container.context, R.drawable.confetti_yellow), 6000)
|
||||
.setAcceleration(0.00070f, 90)
|
||||
.setRotationSpeed(144f)
|
||||
.setRotationSpeedRange(134f, 164f)
|
||||
.setScaleRange(0.8f, 1.2f)
|
||||
.setSpeedByComponentsRange(-0.15f, 0.15f, -0.15f, -0.45f)
|
||||
.setFadeOut(200, AccelerateInterpolator())
|
||||
.emitWithGravity(container, Gravity.BOTTOM, 7, 1000)
|
||||
ParticleSystem(container, 30, ContextCompat.getDrawable(container.context, R.drawable.confetti_purple), 6000)
|
||||
.setAcceleration(0.00090f, 90)
|
||||
.setRotationSpeed(144f)
|
||||
.setRotationSpeedRange(134f, 164f)
|
||||
.setScaleRange(0.8f, 1.2f)
|
||||
.setSpeedByComponentsRange(-0.15f, 0.15f, -0.15f, -0.45f)
|
||||
.setFadeOut(200, AccelerateInterpolator())
|
||||
.emitWithGravity(container, Gravity.BOTTOM, 7, 1000)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientS
|
|||
import com.habitrpg.android.habitica.ui.views.tasks.form.StepperValueFormView
|
||||
import com.habitrpg.common.habitica.helpers.ExceptionHandler
|
||||
import com.habitrpg.common.habitica.helpers.launchCatching
|
||||
import dagger.hilt.android.internal.managers.ViewComponentManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.MainScope
|
||||
|
|
@ -148,6 +149,20 @@ class PurchaseDialog(
|
|||
setLimitedTextView()
|
||||
}
|
||||
|
||||
private fun findSnackBarActivity(context: Context): SnackbarActivity? {
|
||||
return when (context) {
|
||||
is SnackbarActivity -> context
|
||||
is ViewComponentManager.FragmentContextWrapper -> findSnackBarActivity(context.baseContext)
|
||||
else -> (context.applicationContext as? HabiticaBaseApplication)?.currentActivity?.get() as? SnackbarActivity
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
findSnackBarActivity(context)?.let {
|
||||
(it as? Activity)?.let { activity -> setOwnerActivity(activity) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePurchaseTotal() {
|
||||
priceLabel.value = shopItem.value.toDouble() * purchaseQuantity
|
||||
|
||||
|
|
@ -426,7 +441,8 @@ class PurchaseDialog(
|
|||
content = text,
|
||||
rightIcon = priceLabel.compoundDrawables[0],
|
||||
rightTextColor = rightTextColor,
|
||||
rightText = "-" + priceLabel.text
|
||||
rightText = "-" + priceLabel.text,
|
||||
isCelebratory = true
|
||||
)
|
||||
inventoryRepository.retrieveInAppRewards()
|
||||
userRepository.retrieveUser(forced = true)
|
||||
|
|
|
|||
Loading…
Reference in a new issue