diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt index deaf3fda..f6dab6b9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt @@ -6,6 +6,7 @@ import android.media.MediaPlayer import android.net.Uri import android.os.Bundle import android.os.Handler +import android.view.MotionEvent import android.view.animation.AnimationUtils import com.simplemobiletools.clock.R import com.simplemobiletools.clock.extensions.* @@ -16,7 +17,6 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.MINUTE_SECONDS import kotlinx.android.synthetic.main.activity_reminder.* - class ReminderActivity : SimpleActivity() { private val INCREASE_VOLUME_DELAY = 3000L @@ -26,6 +26,7 @@ class ReminderActivity : SimpleActivity() { private var alarm: Alarm? = null private var mediaPlayer: MediaPlayer? = null private var lastVolumeValue = 0.1f + private var dragDownX = 0f override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -64,8 +65,26 @@ class ReminderActivity : SimpleActivity() { private fun setupButtons() { reminder_draggable_background.startAnimation(AnimationUtils.loadAnimation(this, R.anim.pulsing_animation)) reminder_draggable_background.applyColorFilter(getAdjustedPrimaryColor()) + var minDragX = 0f + var maxDragX = 0f - reminder_stop.setOnClickListener { + reminder_dismiss.onGlobalLayout { + minDragX = reminder_snooze.left.toFloat() + maxDragX = reminder_dismiss.left.toFloat() + } + + reminder_draggable.setOnTouchListener { v, event -> + when (event.action) { + MotionEvent.ACTION_DOWN -> dragDownX = event.x + MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> dragDownX = 0f + MotionEvent.ACTION_MOVE -> { + reminder_draggable.x = Math.min(maxDragX, Math.max(minDragX, event.rawX - dragDownX)) + } + } + true + } + + reminder_dismiss.setOnClickListener { finish() } diff --git a/app/src/main/res/drawable-hdpi/ic_alarm_big.png b/app/src/main/res/drawable-hdpi/ic_alarm_big.png new file mode 100644 index 00000000..21ed21a4 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_alarm_big.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_alarm_big.png b/app/src/main/res/drawable-xhdpi/ic_alarm_big.png new file mode 100644 index 00000000..b45924d4 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_alarm_big.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_alarm_big.png b/app/src/main/res/drawable-xxhdpi/ic_alarm_big.png new file mode 100644 index 00000000..602a7406 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_alarm_big.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_alarm_big.png b/app/src/main/res/drawable-xxxhdpi/ic_alarm_big.png new file mode 100644 index 00000000..e918305b Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_alarm_big.png differ diff --git a/app/src/main/res/layout/activity_reminder.xml b/app/src/main/res/layout/activity_reminder.xml index 697aff56..95f1eb7a 100644 --- a/app/src/main/res/layout/activity_reminder.xml +++ b/app/src/main/res/layout/activity_reminder.xml @@ -32,7 +32,6 @@ @@ -61,17 +60,17 @@ android:id="@+id/reminder_draggable" android:layout_width="@dimen/stopwatch_button_small_size" android:layout_height="@dimen/stopwatch_button_small_size" - android:layout_marginBottom="16dp" + android:layout_marginBottom="@dimen/activity_margin" android:padding="@dimen/normal_margin" - android:src="@drawable/ic_alarm" + android:src="@drawable/ic_alarm_big" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/reminder_stop" + app:layout_constraintEnd_toStartOf="@+id/reminder_dismiss" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toEndOf="@+id/reminder_snooze" app:layout_constraintTop_toBottomOf="@+id/reminder_text"/>