This commit is contained in:
Gangphon 2024-02-18 15:15:24 +08:00
parent 1deb6b3c4b
commit cc6d44cbe1
3 changed files with 10 additions and 5 deletions

View File

@ -11,7 +11,7 @@ android {
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0.22-tts"
versionName "1.0.23-sche"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -386,7 +386,8 @@ public class MainActivity extends ComponentActivity implements Choreographer.Fra
if(Util.buf.length()>1000000) Util.buf.replace(0, 100000, "");
Util.println("isDiff: "+isDiff+" endMs: "+lastPage.endMilli+" millis:"+milli);
syncProg(isDiff ? milli : lastPage.endMilli);
Util.println("after. curAva: "+progView.curAva+" endMs: "+page(progView.curAva).endMilli);
if(progView.avas.isEmpty()) Util.println("after. No Avas");
else Util.println("after. curAva: "+progView.curAva+" endMs: "+page(progView.curAva).endMilli);
choreographer.postFrameCallback(this);
canAdd = false;
for(var call : progView.calls) call.doFrame(milli);

View File

@ -15,6 +15,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import gnph.util.Dates;
import gnph.util.JSList;
@ -498,7 +499,7 @@ public class Prog extends AbsLayout {
public static class Sche {
long startDate = -1, endDate = -1;
int startTime = -1, endTime = -1;
JSList<Long> weeks;
HashSet<Integer> weeks;
}
public static class Page {
@ -531,7 +532,7 @@ public class Prog extends AbsLayout {
if(notInRange(sche.startDate, local, sche.endDate)) continue;
if(notInRange(sche.startTime, time, sche.endTime)) continue;
if(sche.weeks==null) return true;
if(week==-1) week = (local / 86400000L + 3) % 7 + 1;
if(week==-1) week = (local / 86400000L + 4) % 7;
if(sche.weeks.contains(week)) return true;
}
return false;
@ -582,7 +583,10 @@ public class Prog extends AbsLayout {
}
if(sche.startDate==sche.endDate) sche.startDate = sche.endDate = -1;
JSList<Long> weekFilter = schedule.jslist("weekFilter");
if(weekFilter!=null && ! weekFilter.isEmpty() && weekFilter.size() < 7) sche.weeks = weekFilter;
if(weekFilter!=null && ! weekFilter.isEmpty() && weekFilter.size() < 7) {
sche.weeks = new HashSet<>();
for(var week : weekFilter) sche.weeks.add(week.intValue() % 7);
}
if(sches==null) sches = new ArrayList<>();
sches.add(sche);
}