From f01856275f25867149e77d2d3c7d08e84388b866 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 22 Mar 2020 15:34:43 +0100 Subject: [PATCH] removing the config for setting the weeky view end time --- .../pro/activities/SettingsActivity.kt | 28 ++------------- .../calendar/pro/fragments/WeekFragment.kt | 10 ------ .../calendar/pro/helpers/Config.kt | 4 --- .../calendar/pro/helpers/Constants.kt | 1 - app/src/main/res/layout/activity_settings.xml | 34 ------------------- 5 files changed, 2 insertions(+), 75 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt index ed8bc09ee..214cd3f0c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt @@ -54,7 +54,6 @@ class SettingsActivity : SimpleActivity() { setupWeekNumbers() setupShowGrid() setupWeeklyStart() - setupWeeklyEnd() setupVibrate() setupReminderSound() setupReminderAudioStream() @@ -302,29 +301,8 @@ class SettingsActivity : SimpleActivity() { (0..24).mapTo(items) { RadioItem(it, getHoursString(it)) } RadioGroupDialog(this@SettingsActivity, items, config.startWeeklyAt) { - if (it as Int >= config.endWeeklyAt) { - toast(R.string.day_end_before_start) - } else { - config.startWeeklyAt = it - settings_start_weekly_at.text = getHoursString(it) - } - } - } - } - - private fun setupWeeklyEnd() { - settings_end_weekly_at.text = getHoursString(config.endWeeklyAt) - settings_end_weekly_at_holder.setOnClickListener { - val items = ArrayList() - (0..24).mapTo(items) { RadioItem(it, getHoursString(it)) } - - RadioGroupDialog(this@SettingsActivity, items, config.endWeeklyAt) { - if (it as Int <= config.startWeeklyAt) { - toast(R.string.day_end_before_start) - } else { - config.endWeeklyAt = it - settings_end_weekly_at.text = getHoursString(it) - } + config.startWeeklyAt = it as Int + settings_start_weekly_at.text = getHoursString(it) } } } @@ -676,7 +654,6 @@ class SettingsActivity : SimpleActivity() { put(WIDGET_TEXT_COLOR, config.widgetTextColor) put(WEEK_NUMBERS, config.showWeekNumbers) put(START_WEEKLY_AT, config.startWeeklyAt) - put(END_WEEKLY_AT, config.endWeeklyAt) put(VIBRATE, config.vibrateOnReminder) put(LAST_EVENT_REMINDER_MINUTES, config.lastEventReminderMinutes1) put(LAST_EVENT_REMINDER_MINUTES_2, config.lastEventReminderMinutes2) @@ -770,7 +747,6 @@ class SettingsActivity : SimpleActivity() { WIDGET_TEXT_COLOR -> config.widgetTextColor = value.toInt() WEEK_NUMBERS -> config.showWeekNumbers = value.toBoolean() START_WEEKLY_AT -> config.startWeeklyAt = value.toInt() - END_WEEKLY_AT -> config.endWeeklyAt = value.toInt() VIBRATE -> config.vibrateOnReminder = value.toBoolean() LAST_EVENT_REMINDER_MINUTES -> config.lastEventReminderMinutes1 = value.toInt() LAST_EVENT_REMINDER_MINUTES_2 -> config.lastEventReminderMinutes2 = value.toInt() diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt index ff07c8149..7eb897d61 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt @@ -45,7 +45,6 @@ class WeekFragment : Fragment(), WeeklyCalendar { private var weekTimestamp = 0L private var rowHeight = 0f private var minScrollY = -1 - private var maxScrollY = -1 private var todayColumnIndex = -1 private var clickStartTime = 0L private var primaryColor = 0 @@ -119,15 +118,9 @@ class WeekFragment : Fragment(), WeeklyCalendar { } minScrollY = (rowHeight * config.startWeeklyAt).toInt() - maxScrollY = (rowHeight * config.endWeeklyAt).toInt() val bounds = Rect() week_events_holder.getGlobalVisibleRect(bounds) - maxScrollY -= bounds.bottom - bounds.top - if (minScrollY > maxScrollY) { - maxScrollY = -1 - } - checkScrollLimits(scrollView.scrollY) } } @@ -178,8 +171,6 @@ class WeekFragment : Fragment(), WeeklyCalendar { private fun checkScrollLimits(y: Int) { if (minScrollY != -1 && y < minScrollY) { scrollView.scrollY = minScrollY - } else if (maxScrollY != -1 && y > maxScrollY) { - scrollView.scrollY = maxScrollY } else if (isFragmentVisible) { listener?.scrollTo(y) } @@ -502,7 +493,6 @@ class WeekFragment : Fragment(), WeeklyCalendar { } if (!wasExtraHeightAdded) { - maxScrollY += mView.week_all_day_holder.height wasExtraHeightAdded = true } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt index df066e846..1e19edd06 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt @@ -24,10 +24,6 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getInt(START_WEEKLY_AT, 7) set(startWeeklyAt) = prefs.edit().putInt(START_WEEKLY_AT, startWeeklyAt).apply() - var endWeeklyAt: Int - get() = prefs.getInt(END_WEEKLY_AT, 23) - set(endWeeklyAt) = prefs.edit().putInt(END_WEEKLY_AT, endWeeklyAt).apply() - var vibrateOnReminder: Boolean get() = prefs.getBoolean(VIBRATE, false) set(vibrate) = prefs.edit().putBoolean(VIBRATE, vibrate).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index 715435756..9965734de 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -41,7 +41,6 @@ const val YEAR = 31536000 // Shared Preferences const val WEEK_NUMBERS = "week_numbers" const val START_WEEKLY_AT = "start_weekly_at" -const val END_WEEKLY_AT = "end_weekly_at" const val VIBRATE = "vibrate" const val REMINDER_SOUND_URI = "reminder_sound_uri" const val REMINDER_SOUND_TITLE = "reminder_sound_title" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 12b08a023..a9be6b66f 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -661,37 +661,6 @@ - - - - - - - - @@ -1059,7 +1026,6 @@ android:layout_height="wrap_content" android:layout_centerVertical="true" android:paddingStart="@dimen/medium_margin" - android:paddingLeft="@dimen/medium_margin" android:text="@string/import_settings"/>