Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6eb6b9f2 authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Fix clock showing 12 hour format when 24 hour format is chosen

Test: Manually
Bug: 271988126
Change-Id: I89f5b7e48deb5bc120c15306757d55b3dc1ddb75
parent c0ff8e96
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.graphics.Rect
import android.text.format.DateFormat
import android.util.TypedValue
import android.view.View
import android.view.View.OnAttachStateChangeListener
import android.view.ViewTreeObserver
import android.widget.FrameLayout
import androidx.annotation.VisibleForTesting
@@ -105,6 +106,24 @@ constructor(
                }
                updateFontSizes()
                updateTimeListeners()
                value.smallClock.view.addOnAttachStateChangeListener(
                    object : OnAttachStateChangeListener {
                        override fun onViewAttachedToWindow(p0: View?) {
                            value.events.onTimeFormatChanged(DateFormat.is24HourFormat(context))
                        }

                        override fun onViewDetachedFromWindow(p0: View?) {
                        }
                })
                value.largeClock.view.addOnAttachStateChangeListener(
                    object : OnAttachStateChangeListener {
                        override fun onViewAttachedToWindow(p0: View?) {
                            value.events.onTimeFormatChanged(DateFormat.is24HourFormat(context))
                        }

                        override fun onViewDetachedFromWindow(p0: View?) {
                        }
                })
            }
        }