Skip to content
This repository was archived by the owner on May 3, 2021. It is now read-only.

Commit 2a69acd

Browse files
committed
Stuck time bug fix
1 parent 1668053 commit 2a69acd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/src/main/java/com/layoutxml/twelveish/MyWatchFace.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public class MyWatchFace extends CanvasWatchFaceService {
7272
private String text2;
7373
private float x;
7474
private float basey;
75+
private int lastSignificantMinutes = -1;
76+
private int lastSignificantHours = -1;
7577
//SharedPreferences:
7678
private int backgroundColor;
7779
private int mainColor;
@@ -796,6 +798,10 @@ public void onDraw(Canvas canvas, Rect bounds) {
796798
int hourDigital = militaryTime ? mCalendar.get(Calendar.HOUR_OF_DAY) : mCalendar.get(Calendar.HOUR);
797799
if (hourDigital == 0 && !militaryTime)
798800
hourDigital = 12;
801+
if (hourDigital-lastSignificantHours!=0 || minutes-lastSignificantMinutes>5 || lastSignificantMinutes-minutes<-5) {
802+
significantTimeChange = true;
803+
getDate();
804+
}
799805

800806
//Get digital clock
801807
String ampmSymbols = (ampm) ? (mCalendar.get(Calendar.HOUR_OF_DAY) >= 12 ? " pm" : " am") : "";
@@ -843,6 +849,8 @@ public void onDraw(Canvas canvas, Rect bounds) {
843849

844850
//Draw text clock
845851
if (significantTimeChange) {
852+
lastSignificantMinutes = minutes;
853+
lastSignificantHours = hourDigital;
846854
int index = minutes / 5;
847855
int hourText = militaryTextTime ? mCalendar.get(Calendar.HOUR_OF_DAY) + TimeShift[index] : mCalendar.get(Calendar.HOUR) + TimeShift[index];
848856
if (hourText >= 24 && militaryTextTime)

0 commit comments

Comments
 (0)