Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eaaeb7fa35 | ||
|
|
6ba2f2cfdf | ||
|
|
51c7fa1464 | ||
|
|
df9d92f116 | ||
|
|
5b517f39d6 | ||
|
|
b20208fb40 | ||
|
|
9b733f2102 | ||
|
|
0738fc466e | ||
|
|
7491083e6a | ||
|
|
13786f6c8e | ||
|
|
92952a2cf2 |
@@ -24,12 +24,12 @@ class CountdownCanvasView @JvmOverloads constructor(
|
||||
isFakeBoldText = false
|
||||
}
|
||||
private val ringPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
color = Color.parseColor("#6750A4")
|
||||
color = ContextCompat.getColor(context, R.color.md_color_ring_progress)
|
||||
style = Paint.Style.STROKE
|
||||
strokeWidth = 16f
|
||||
}
|
||||
private val ringBgPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
color = Color.parseColor("#D0BCFF")
|
||||
color = ContextCompat.getColor(context, R.color.md_color_ring_track)
|
||||
style = Paint.Style.STROKE
|
||||
strokeWidth = 16f
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ class CountdownDialog(
|
||||
private val prefs: SharedPreferences
|
||||
) : Dialog(context) {
|
||||
private lateinit var cvCountdown: CountdownCanvasView
|
||||
private lateinit var btnStop: Button
|
||||
private lateinit var btnRestart: Button
|
||||
private lateinit var btnStop: View
|
||||
private lateinit var btnRestart: View
|
||||
private lateinit var btnDismiss: Button
|
||||
private var timer: CountDownTimer? = null
|
||||
private var toneGenerator: ToneGenerator? = null
|
||||
@@ -61,14 +61,10 @@ class CountdownDialog(
|
||||
val progress = millisUntilFinished.toFloat() / durationMillis
|
||||
cvCountdown.setProgress(progress)
|
||||
|
||||
if (millisUntilFinished >= durationMillis) {
|
||||
cvCountdown.setText(context.getString(R.string.countdown_text))
|
||||
} else {
|
||||
val secondsLeft = (millisUntilFinished / 1000).toInt() + 1
|
||||
cvCountdown.setText(secondsLeft.toString())
|
||||
}
|
||||
|
||||
if (millisUntilFinished <= 3000 && millisUntilFinished > 1000) {
|
||||
if (secondsLeft >= 1 && secondsLeft <= 3) {
|
||||
playTone(ToneGenerator.TONE_PROP_BEEP)
|
||||
if (prefs.getBoolean("vibration", true)) {
|
||||
vibrator?.vibrate(50)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:color="#81C784" />
|
||||
<item android:color="#E8E8E8" />
|
||||
</selector>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<size android:width="120dp" android:height="120dp" />
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="40dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:startColor="#81C784"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<size android:width="120dp" android:height="120dp" />
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="40dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:startColor="#C8E6C9"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<size android:width="120dp" android:height="120dp" />
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="40dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:startColor="#66BB6A"
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#6750A4"
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M7.41,8.59L12,13.17l4.59,-4.58L18,10l-6,6 -6,-6z"/>
|
||||
</vector>
|
||||
|
||||
@@ -112,8 +112,8 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDurationLabel"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:background="@drawable/btn_duration_selector"
|
||||
android:text="@string/start_timer"
|
||||
@@ -146,6 +146,8 @@
|
||||
style="@style/Widget.Material3.Chip.Suggestion.Elevated"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="56dp"
|
||||
app:chipBackgroundColor="@color/chip_duration_bg"
|
||||
android:text="5s" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
@@ -153,7 +155,9 @@
|
||||
style="@style/Widget.Material3.Chip.Suggestion.Elevated"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="56dp"
|
||||
android:checked="true"
|
||||
app:chipBackgroundColor="@color/chip_duration_bg"
|
||||
android:text="10s" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
@@ -161,6 +165,8 @@
|
||||
style="@style/Widget.Material3.Chip.Suggestion.Elevated"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="56dp"
|
||||
app:chipBackgroundColor="@color/chip_duration_bg"
|
||||
android:text="15s" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
@@ -168,6 +174,8 @@
|
||||
style="@style/Widget.Material3.Chip.Suggestion.Elevated"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="56dp"
|
||||
app:chipBackgroundColor="@color/chip_duration_bg"
|
||||
android:text="30s" />
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
</HorizontalScrollView>
|
||||
|
||||
@@ -26,33 +26,41 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<Button
|
||||
<FrameLayout
|
||||
android:id="@+id/btnStop"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/btn_stop_selector"
|
||||
android:drawableTop="@drawable/ic_stop_square"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="Stop"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<Button
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/stop_timer"
|
||||
android:src="@drawable/ic_stop_square" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/btnRestart"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/btn_restart_selector"
|
||||
android:drawableTop="@drawable/ic_refresh_square"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="Restart"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/restart_timer"
|
||||
android:src="@drawable/ic_refresh_square" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
<resources>
|
||||
<color name="color_gradient_start">#1B3A1B</color>
|
||||
<color name="color_gradient_end">#0D1F0D</color>
|
||||
<color name="md_color_ring_progress">#A5D6A7</color>
|
||||
<color name="md_color_ring_track">#2E7D32</color>
|
||||
</resources>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="md_theme_dark_primary">#A5D6A7</color>
|
||||
<color name="md_theme_dark_primaryContainer">#2E7D32</color>
|
||||
<color name="md_theme_dark_secondary">#869F7C</color>
|
||||
|
||||
<style name="Theme.CountdownTimer" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
|
||||
@@ -3,4 +3,6 @@
|
||||
<color name="color_gradient_start">#E8F5E9</color>
|
||||
<color name="color_gradient_end">#C8E6C9</color>
|
||||
<color name="color_icon_tint">#2E7D32</color>
|
||||
<color name="md_color_ring_progress">#2E7D32</color>
|
||||
<color name="md_color_ring_track">#81C784</color>
|
||||
</resources>
|
||||
|
||||
@@ -11,4 +11,6 @@
|
||||
<string name="settings">Settings</string>
|
||||
<string name="vibration">Vibration</string>
|
||||
<string name="sounds">Sounds</string>
|
||||
<string name="stop_timer">Stop Timer</string>
|
||||
<string name="restart_timer">Restart Timer</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<resources>
|
||||
<style name="Theme.CountdownTimer" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/md_theme_light_primary</item>
|
||||
<item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer</item>
|
||||
<item name="colorSecondary">@color/md_theme_light_secondary</item>
|
||||
<item name="android:statusBarColor">@color/color_gradient_start</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
</style>
|
||||
|
||||
<color name="md_theme_light_primary">#2E7D32</color>
|
||||
<color name="md_theme_light_primaryContainer">#81C784</color>
|
||||
<color name="md_theme_light_secondary">#4C6842</color>
|
||||
<color name="md_theme_light_surface">#F1F8E9</color>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user