diff --git a/app/src/main/java/org/oppia/app/databinding/ViewBindingAdapter.kt b/app/src/main/java/org/oppia/app/databinding/ViewBindingAdapter.kt new file mode 100644 index 00000000000..ae0bffe24cb --- /dev/null +++ b/app/src/main/java/org/oppia/app/databinding/ViewBindingAdapter.kt @@ -0,0 +1,41 @@ +package org.oppia.app.databinding + +import android.animation.AnimatorSet +import android.animation.ValueAnimator +import android.view.View +import androidx.core.animation.doOnEnd +import androidx.databinding.BindingAdapter + +private val appearAnimator: ValueAnimator = ValueAnimator.ofFloat(0f, 1f) +private val disappearAnimator: ValueAnimator = ValueAnimator.ofFloat(1f, 2f) +private val animatorSet = AnimatorSet() + +@BindingAdapter("app:flashingAnimation") +fun setFlashingAnimation(view: View, isFlashing: Boolean) { + appearAnimator.addUpdateListener { + view.scaleX = it.animatedValue as Float + view.scaleY = it.animatedValue as Float + view.alpha = it.animatedValue as Float + } + appearAnimator.duration = 1500 + + disappearAnimator.addUpdateListener { + view.scaleX = it.animatedValue as Float + view.scaleY = it.animatedValue as Float + view.alpha = 2f - it.animatedValue as Float + } + disappearAnimator.duration = 500 + + if (isFlashing) { + animatorSet.playSequentially(appearAnimator, disappearAnimator) + animatorSet.start() + animatorSet.doOnEnd { + animatorSet.start() + } + } else { + animatorSet.cancel() + view.scaleX = 0f + view.scaleY = 0f + view.alpha = 0f + } +} diff --git a/app/src/main/res/drawable/radar_moving_circle.xml b/app/src/main/res/drawable/radar_moving_circle.xml new file mode 100644 index 00000000000..baaea787bf6 --- /dev/null +++ b/app/src/main/res/drawable/radar_moving_circle.xml @@ -0,0 +1,7 @@ + + + + diff --git a/app/src/main/res/layout/state_fragment.xml b/app/src/main/res/layout/state_fragment.xml index 27517168896..83c7c256062 100755 --- a/app/src/main/res/layout/state_fragment.xml +++ b/app/src/main/res/layout/state_fragment.xml @@ -56,6 +56,16 @@ android:visibility="@{viewModel.isHintBulbVisible() ? View.VISIBLE : View.GONE}" android:layout_gravity="bottom|start"> + + #FF000000 #999999 + #FFCD2A