📄 calendardayviewscript.luac.lua
字号:
local l_13_1 = ActiveGroup:GetComponentClip().Namespace:FindName("ListView")
local l_13_2 = l_13_1:GetGenerator():GetDataByRealizedIndex(l_13_0)
trace("HandleDayAppSelection===" .. tostring(l_13_2))
if l_13_2 == 0 then
local stuff = IsToday(CalendarControl.selectedYear, CalendarControl.selectedMonth, CalendarControl.selectedDay)
if stuff then
HandleToNewAppointments()
else
HandleToNewAppointmentsByDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, CalendarControl.selectedDay)
end
elseif l_13_2 > 0 and l_13_2 < l_13_1:GetGenerator():GetCount() then
appointment:DisplayAppointment(l_13_2 - 1)
end
l_13_1:GetGenerator().SelectedIndex = -1
trace("HandleDayAppSelection index=" .. l_13_0)
end
HandleDayDownArrowPress = function()
if CalendarControl.animationObj ~= nil then
return
end
nextDay()
ShowNextDay()
end
HandleDayUpArrowPress = function()
if CalendarControl.animationObj ~= nil then
return
end
preDay()
ShowPreDay()
end
ShowDayView = function()
trace("ShowDayView")
_application:SetRightSoftkey(Softkey(Locale:GetString("IDS_CALENDAR_MONTHVIEW"), HandleSwitchToMonthView))
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_CALENDAR_TODAY"), HandleToToday))
prepareDayGroup(ActiveGroup)
ActiveGroup._visible = true
DayView:Focus()
end
RefreshListView = function()
trace("appointment change start")
appointment:GetDisplayAppointmentsByDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, CalendarControl.selectedDay)
prepareAppointmenetData()
local l_17_0 = ActiveGroup.Tag.Collection
if l_17_0 ~= nil then
local l_17_1 = l_17_0:GetCount()
for i = 1, l_17_1 do
l_17_0:pop_back()
end
l_17_1 = appointment.AppCount
for i = 0, l_17_1 do
l_17_0:push_back(i)
end
if ActiveGroup.Tag.WeatherData ~= nil then
l_17_0:push_back(l_17_1 + 1)
end
end
trace("appointment change end")
end
prepareDayGroup = function(l_18_0)
trace("prepareDayGroup start")
l_18_0.Tag = {}
appointment:GetDisplayAppointmentsByDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, CalendarControl.selectedDay)
prepareAppointmenetData()
local l_18_1 = l_18_0:GetComponentClip().Namespace
local l_18_2 = l_18_1:FindName("ListView")
local l_18_3 = calendar:GetDayOfWeek(CalendarControl.selectedYear, CalendarControl.selectedMonth, CalendarControl.selectedDay)
l_18_1:FindName("Month").String = calendar:GetDoWName(l_18_3, "ddd") .. ". " .. calendar:GetCurrentMonthName() .. " " .. CalendarControl.selectedDay
l_18_0.Tag.WeatherData = GetWeatherData(CalendarControl.selectedYear, CalendarControl.selectedMonth, CalendarControl.selectedDay)
if l_18_2:HasGenerator() then
RemoveGenerator(l_18_2, l_18_0.Tag.Collection)
end
local l_18_4 = l_18_0.Tag.WeatherData ~= nil
local l_18_5 = ResetListView(l_18_2, l_18_4)
l_18_0.Tag.Collection = l_18_5
local l_18_6 = appointment.AppCount
for i = 0, l_18_6 do
l_18_5:push_back(i)
end
if l_18_4 then
l_18_5:push_back(l_18_6 + 1)
end
trace("prepareDayGroup end" .. l_18_5:GetCount())
end
RefreshDayView = function()
DisconnectDayEvent()
RefreshListView()
ConnectDayEvent()
end
ShowPreDay = function()
DisconnectDayEvent()
CalendarControl:StartAnimation(MonthAnimate(ActiveGroup, NextGroup, onDaySwitchComplete, false, CalendarControl.dsty))
end
ShowNextDay = function()
DisconnectDayEvent()
CalendarControl:StartAnimation(MonthAnimate(ActiveGroup, NextGroup, onDaySwitchComplete, true, CalendarControl.dsty))
end
onDaySwitchComplete = function()
if bCancelSwitchCalendar then
trace("Cancel SwitchCalendarToNextComplete")
return
end
trace("onDaySwitchComplete")
local l_22_0 = ActiveGroup
ActiveGroup = NextGroup
NextGroup = l_22_0
NextGroup._visible = false
ConnectDayEvent()
end
GetNewDay = function()
prepareDayGroup(NextGroup)
end
DisconnectDayEvent = function()
trace("DisconnectDayEvent")
DayRightArrowHitArea.onPress:disconnect(HandleDayUpArrowPress)
DayLeftArrowHitArea.onPress:disconnect(HandleDayDownArrowPress)
if DayListPhysics ~= nil then
DayListPhysics:DisconnectMouseEvents()
DayListPhysics = nil
end
end
ConnectDayEvent = function()
trace("ConnectDayEvent++++")
DayRightArrowHitArea.onPress:connect(HandleDayUpArrowPress)
DayLeftArrowHitArea.onPress:connect(HandleDayDownArrowPress)
local l_25_0 = ActiveGroup:GetComponentClip().Namespace:FindName("ListView")
DayListPhysics = ScrollPhysics(l_25_0, l_25_0, HandleDayAppSelection, true)
DayListPhysics:ConnectMouseEvents()
end
prepareAppointmenetData = function()
local l_26_0 = appointment.AllAppointment
trace("prepareAppointmenetData start" .. appointment.AppCount)
local l_26_1 = appointment.AppCount - 1
AppointmentData = {}
l_26_0:First()
for i = 0, l_26_1 do
l_26_0:Next()
local val = l_26_0:GetValue()
AppointmentData[i] = {}
AppointmentData[i].Time = GetAppTimeString(val.stStart, val.stEnd, val.day, val.range)
AppointmentData[i].Subject = val.Subject
trace("******subject=" .. AppointmentData[i].Subject)
end
trace("prepareAppointmenetData end")
end
GetWeatherData = function(l_27_0, l_27_1, l_27_2)
if Forecasts == nil then
trace("no data!")
return
end
for i = WeatherData.index, 4 do
local l_27_7 = WeatherData[i]
if l_27_7.year == l_27_0 and l_27_7.month == l_27_1 and l_27_7.day == l_27_2 then
return l_27_7
end
end
return
end
SetDayWeatherIcon = function(l_28_0, l_28_1, l_28_2, l_28_3)
for i = WeatherData.index, 4 do
local l_28_8 = WeatherData[i]
trace("+++++ year=" .. l_28_8.year .. " ..month=" .. l_28_8.month .. " day=" .. l_28_8.day)
if l_28_8.year == l_28_0 then
if l_28_8.month == l_28_1 then
if l_28_8.day == l_28_2 then
local l_28_9 = l_28_3.Namespace
local l_28_10 = l_28_9:FindName("CityName")
local l_28_11 = l_28_9:FindName("Condition")
local l_28_12 = l_28_9:FindName("ForecastValue")
local l_28_13 = l_28_9:FindName("Temperature")
local l_28_14 = l_28_9:FindName("Weather")
local l_28_15 = Forecasts.forecast[i]
l_28_10.String = CityObj.cityName .. " , " .. CityObj.country
l_28_11.String = l_28_15.conditionString
l_28_11.Size.width = CalendarControl.WindowW
l_28_12.String = Locale:GetString("IDS_CALENDAR_HIGHT") .. ": " .. l_28_15.highC .. "? " .. Locale:GetString("IDS_CALENDAR_LOW") .. ": " .. l_28_15.lowC .. "?"
if i == 0 then
l_28_13._visible = true
l_28_13.String = Forecasts.currentConditions.temperatureC .. "?"
else
l_28_13._visible = false
end
trace("forecasts=" .. i .. " condition=" .. l_28_15.condition)
l_28_14.Position.x = CalendarControl.WindowW - CalendarControl.WEATHERDX
SetWeatherIconStateNoFade(l_28_14, l_28_15.condition)
break
end
end
end
end
end
IsToday = function(l_29_0, l_29_1, l_29_2)
local l_29_3 = calendar:GetToday()
if l_29_3.Year == l_29_0 and l_29_3.Month == l_29_1 and l_29_3.Day == l_29_2 then
return true
end
return false
end
trace("DayView Scripts end")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -