Added animation on accept/hangup call arrows on CallIncomingActivity when screen is locked

This commit is contained in:
Sylvain Berfini 2020-10-26 11:19:50 +01:00
parent d4a8bdfa38
commit de29c590ac
2 changed files with 53 additions and 9 deletions

View file

@ -19,12 +19,15 @@
*/
package org.linphone.activities.call.views
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.View.OnTouchListener
import android.view.animation.LinearInterpolator
import android.widget.LinearLayout
import androidx.databinding.DataBindingUtil
import org.linphone.R
@ -121,6 +124,7 @@ class AnswerDeclineIncomingCallButtons : LinearLayout {
)
updateSlideMode()
configureAnimation()
}
private fun updateSlideMode() {
@ -131,4 +135,43 @@ class AnswerDeclineIncomingCallButtons : LinearLayout {
binding.declineButton.setOnTouchListener(mDeclineTouchListener)
}
}
private fun configureAnimation() {
val accept1 = ObjectAnimator.ofFloat(binding.arrowAccept1, "alpha", 1f, 0.6f, 0.4f, 1f).apply {
repeatCount = ObjectAnimator.INFINITE
repeatMode = ObjectAnimator.RESTART
}
val accept2 = ObjectAnimator.ofFloat(binding.arrowAccept2, "alpha", 0.6f, 1f, 0.4f, 0.6f).apply {
repeatCount = ObjectAnimator.INFINITE
repeatMode = ObjectAnimator.RESTART
}
val accept3 = ObjectAnimator.ofFloat(binding.arrowAccept3, "alpha", 0.4f, 0.6f, 1f, 0.4f).apply {
repeatCount = ObjectAnimator.INFINITE
repeatMode = ObjectAnimator.RESTART
}
val hangup1 = ObjectAnimator.ofFloat(binding.arrowHangup1, "alpha", 1f, 0.6f, 0.4f, 1f).apply {
repeatCount = ObjectAnimator.INFINITE
repeatMode = ObjectAnimator.RESTART
}
val hangup2 = ObjectAnimator.ofFloat(binding.arrowHangup2, "alpha", 0.6f, 1f, 0.4f, 0.6f).apply {
repeatCount = ObjectAnimator.INFINITE
repeatMode = ObjectAnimator.RESTART
}
val hangup3 = ObjectAnimator.ofFloat(binding.arrowHangup3, "alpha", 0.4f, 0.6f, 1f, 0.4f).apply {
repeatCount = ObjectAnimator.INFINITE
repeatMode = ObjectAnimator.RESTART
}
AnimatorSet().apply {
duration = 2000
interpolator = LinearInterpolator()
playTogether(accept1, accept2, accept3, hangup1, hangup2, hangup3)
start()
}
}
}

View file

@ -42,25 +42,25 @@
android:orientation="horizontal">
<ImageView
android:id="@+id/arrow_hangup"
android:id="@+id/arrow_hangup_1"
android:contentDescription="@string/content_description_slide_right_hangup"
android:src="@drawable/arrow_hangup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/arrow_hangup_2"
android:src="@drawable/arrow_hangup"
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.6"/>
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/arrow_hangup_3"
android:src="@drawable/arrow_hangup"
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.4"/>
android:layout_height="wrap_content"/>
</LinearLayout>
@ -88,20 +88,21 @@
android:orientation="horizontal">
<ImageView
android:id="@+id/arrow_accept_3"
android:src="@drawable/arrow_accept"
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.4"/>
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/arrow_accept_2"
android:src="@drawable/arrow_accept"
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.6"/>
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/arrow_accept_1"
android:src="@drawable/arrow_accept"
android:contentDescription="@string/content_description_slide_left_answer"
android:layout_width="wrap_content"