show a swipe guide if the user doesnt finish swiping in any side

This commit is contained in:
tibbi 2018-07-08 22:21:54 +02:00
parent 104a832354
commit 037ff0c55f
2 changed files with 19 additions and 0 deletions

View File

@ -22,6 +22,7 @@ class ReminderActivity : SimpleActivity() {
private val increaseVolumeHandler = Handler() private val increaseVolumeHandler = Handler()
private val maxReminderDurationHandler = Handler() private val maxReminderDurationHandler = Handler()
private val swipeGuideFadeHandler = Handler()
private var isAlarmReminder = false private var isAlarmReminder = false
private var didVibrate = false private var didVibrate = false
private var alarm: Alarm? = null private var alarm: Alarm? = null
@ -88,6 +89,12 @@ class ReminderActivity : SimpleActivity() {
reminder_draggable.animate().x(initialDraggableX).withEndAction { reminder_draggable.animate().x(initialDraggableX).withEndAction {
reminder_draggable_background.animate().alpha(0.2f) reminder_draggable_background.animate().alpha(0.2f)
} }
reminder_guide.animate().alpha(1f).start()
swipeGuideFadeHandler.removeCallbacksAndMessages(null)
swipeGuideFadeHandler.postDelayed({
reminder_guide.animate().alpha(0f).start()
}, 2000L)
} }
} }
MotionEvent.ACTION_MOVE -> { MotionEvent.ACTION_MOVE -> {
@ -151,6 +158,7 @@ class ReminderActivity : SimpleActivity() {
super.onDestroy() super.onDestroy()
increaseVolumeHandler.removeCallbacksAndMessages(null) increaseVolumeHandler.removeCallbacksAndMessages(null)
maxReminderDurationHandler.removeCallbacksAndMessages(null) maxReminderDurationHandler.removeCallbacksAndMessages(null)
swipeGuideFadeHandler.removeCallbacksAndMessages(null)
destroyPlayer() destroyPlayer()
} }

View File

@ -83,4 +83,15 @@
app:layout_constraintStart_toEndOf="@+id/reminder_draggable" app:layout_constraintStart_toEndOf="@+id/reminder_draggable"
app:layout_constraintTop_toTopOf="@+id/reminder_draggable"/> app:layout_constraintTop_toTopOf="@+id/reminder_draggable"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/reminder_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:text="@string/swipe_right_to_dismiss"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/reminder_draggable"/>
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>