removing the config for setting the weeky view end time

This commit is contained in:
tibbi 2020-03-22 15:34:43 +01:00
parent fb6f168318
commit f01856275f
5 changed files with 2 additions and 75 deletions

View file

@ -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<RadioItem>()
(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()

View file

@ -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
}
}

View file

@ -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()

View file

@ -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"

View file

@ -661,37 +661,6 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_end_weekly_at_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/bigger_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/bigger_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_end_weekly_at_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/settings_end_weekly_at"
android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin"
android:text="@string/end_day_at"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_end_weekly_at"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin"
android:background="@null"
android:clickable="false"/>
</RelativeLayout>
<View
android:id="@+id/monthly_view_divider"
android:layout_width="match_parent"
@ -1014,7 +983,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginLeft="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/migrating"
android:textAllCaps="true"
@ -1037,7 +1005,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin"
android:text="@string/export_settings"/>
</RelativeLayout>
@ -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"/>
</RelativeLayout>