From 2b4e4e90e6b2debcb82196d94b552716a7e1c05e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 5 Feb 2017 10:59:26 +0100 Subject: [PATCH] fade out the Plus after 5 seconds --- .../simplemobiletools/calendar/fragments/WeekFragment.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt index bf500970d..aa4d1fb37 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt @@ -21,6 +21,7 @@ import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.calendar.interfaces.WeeklyCalendar import com.simplemobiletools.calendar.models.Event import com.simplemobiletools.calendar.views.MyScrollView +import com.simplemobiletools.commons.extensions.beGone import kotlinx.android.synthetic.main.fragment_week.* import kotlinx.android.synthetic.main.fragment_week.view.* import org.joda.time.DateTime @@ -29,6 +30,7 @@ import kotlin.comparisons.compareBy class WeekFragment : Fragment(), WeeklyCalendar { val CLICK_DURATION_THRESHOLD = 150 + val PLUS_FADEOUT_DELAY = 5000L private var mListener: WeekScrollListener? = null private var mWeekTimestamp = 0 @@ -172,7 +174,8 @@ class WeekFragment : Fragment(), WeeklyCalendar { MotionEvent.ACTION_DOWN -> clickStartTime = System.currentTimeMillis() MotionEvent.ACTION_UP -> { if (System.currentTimeMillis() - clickStartTime < CLICK_DURATION_THRESHOLD) { - selectedGrid?.visibility = View.GONE + selectedGrid?.animation?.cancel() + selectedGrid?.beGone() val rowHeight = resources.getDimension(R.dimen.weekly_view_row_height) val hour = (event.y / rowHeight).toInt() @@ -190,6 +193,9 @@ class WeekFragment : Fragment(), WeeklyCalendar { startActivity(this) } } + animate().alpha(0f).setStartDelay(PLUS_FADEOUT_DELAY).withEndAction { + beGone() + } } } }