fix a couple more weekly view related offsets

This commit is contained in:
tibbi 2020-11-02 21:09:08 +01:00
parent 2f1eb1ddf5
commit a87aec0eb6
2 changed files with 4 additions and 5 deletions

View File

@ -787,7 +787,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
private fun getThisWeekDateTime(): String {
var thisweek = DateTime().withZone(DateTimeZone.UTC).withDayOfWeek(1).withTimeAtStartOfDay().minusDays(if (config.isSundayFirst) 1 else 0)
var thisweek = DateTime().withZone(DateTimeZone.UTC).withDayOfWeek(1).withHourOfDay(12).minusDays(if (config.isSundayFirst) 1 else 0)
if (DateTime().minusDays(7).seconds() > thisweek.seconds()) {
thisweek = thisweek.plusDays(7)
}

View File

@ -30,7 +30,6 @@ import com.simplemobiletools.commons.views.MyTextView
import kotlinx.android.synthetic.main.fragment_week.*
import kotlinx.android.synthetic.main.fragment_week.view.*
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
import org.joda.time.Days
import java.util.*
@ -271,8 +270,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
applyColorFilter(primaryColor.getContrastColor())
setOnClickListener {
val offset = DateTimeZone.getDefault().getOffsetFromLocal(System.currentTimeMillis()) / 1000
val timestamp = weekTimestamp - offset + index * DAY_SECONDS + hour * 60 * 60
val timestamp = Formatter.getDateTimeFromTS(weekTimestamp + index * DAY_SECONDS).withTime(hour, 0, 0, 0).seconds()
Intent(context, EventActivity::class.java).apply {
putExtra(NEW_EVENT_START_TS, timestamp)
putExtra(NEW_EVENT_SET_HOUR_DURATION, true)
@ -497,7 +495,8 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private fun addCurrentTimeIndicator(minuteHeight: Float) {
if (todayColumnIndex != -1) {
val minutes = DateTime().minuteOfDay
val calendar = Calendar.getInstance()
val minutes = calendar.get(Calendar.HOUR_OF_DAY) * 60 + calendar.get(Calendar.MINUTE)
if (todayColumnIndex >= dayColumns.size) {
currentTimeView?.alpha = 0f
return