diff --git a/app/src/main/java/com/sduduzog/slimlauncher/ui/main/BinaryClockView.kt b/app/src/main/java/com/sduduzog/slimlauncher/ui/main/BinaryClockView.kt index 3e393f8e..34e589e7 100644 --- a/app/src/main/java/com/sduduzog/slimlauncher/ui/main/BinaryClockView.kt +++ b/app/src/main/java/com/sduduzog/slimlauncher/ui/main/BinaryClockView.kt @@ -4,6 +4,7 @@ import android.content.Context import android.graphics.Canvas import android.graphics.Paint import android.graphics.RectF +import android.text.format.DateFormat import android.util.AttributeSet import com.sduduzog.slimlauncher.R import java.util.Calendar @@ -89,4 +90,18 @@ class BinaryClockView(context: Context, attrs: AttributeSet) : setMeasuredDimension(w, h) } + + override fun updateClock() { + super.updateClock() + + val timeFormat = context.getSharedPreferences( + context.getString(R.string.prefs_settings), + Context.MODE_PRIVATE + )?.getInt(context.getString(R.string.prefs_settings_key_time_format), 0) + is24Hour = when (timeFormat) { + 1 -> true + 2 -> false + else -> DateFormat.is24HourFormat(context) + } + } } diff --git a/app/src/main/java/com/sduduzog/slimlauncher/ui/main/ClockView.kt b/app/src/main/java/com/sduduzog/slimlauncher/ui/main/ClockView.kt index 936cbb57..062d973e 100644 --- a/app/src/main/java/com/sduduzog/slimlauncher/ui/main/ClockView.kt +++ b/app/src/main/java/com/sduduzog/slimlauncher/ui/main/ClockView.kt @@ -24,7 +24,7 @@ abstract class ClockView(context: Context, attrs: AttributeSet) : View(context, return paint } - fun updateClock() { + open fun updateClock() { requestLayout() invalidate() }