mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Better handling for first day of week setting. Fixes #1392
This commit is contained in:
parent
87d923788f
commit
0b7db35699
7 changed files with 23 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
classpath('com.noveogroup.android:check:1.2.5') {
|
||||
exclude module: 'checkstyle'
|
||||
exclude module: 'pmd-java'
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ class TaskFormActivity : BaseActivity() {
|
|||
lateinit var taskAlarmManager: TaskAlarmManager
|
||||
@Inject
|
||||
lateinit var challengeRepository: ChallengeRepository
|
||||
@Inject
|
||||
lateinit var sharedPreferences: SharedPreferences
|
||||
|
||||
private var challenge: Challenge? = null
|
||||
|
||||
|
|
@ -253,6 +255,7 @@ class TaskFormActivity : BaseActivity() {
|
|||
}
|
||||
|
||||
private fun configureForm() {
|
||||
val firstDayOfWeek = sharedPreferences.getInt("FirstDayOfTheWeek", -1)
|
||||
val habitViewsVisibility = if (taskType == Task.TYPE_HABIT) View.VISIBLE else View.GONE
|
||||
binding.habitScoringButtons.visibility = habitViewsVisibility
|
||||
binding.habitResetStreakTitleView.visibility = habitViewsVisibility
|
||||
|
|
@ -280,10 +283,12 @@ class TaskFormActivity : BaseActivity() {
|
|||
binding.remindersTitleView.visibility = if (isChallengeTask) View.GONE else todoDailyViewsVisibility
|
||||
binding.remindersContainer.visibility = if (isChallengeTask) View.GONE else todoDailyViewsVisibility
|
||||
binding.remindersContainer.taskType = taskType
|
||||
binding.remindersContainer.firstDayOfWeek = firstDayOfWeek
|
||||
|
||||
binding.schedulingTitleView.visibility = todoDailyViewsVisibility
|
||||
binding.taskSchedulingControls.visibility = todoDailyViewsVisibility
|
||||
binding.taskSchedulingControls.taskType = taskType
|
||||
binding.taskSchedulingControls.firstDayOfWeek = firstDayOfWeek
|
||||
|
||||
val rewardHideViews = if (taskType == Task.TYPE_REWARD) View.GONE else View.VISIBLE
|
||||
binding.taskDifficultyTitleView.visibility = rewardHideViews
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ class ReminderContainer @JvmOverloads constructor(
|
|||
layoutTransition = animatedTransitions
|
||||
}
|
||||
|
||||
var firstDayOfWeek: Int? = null
|
||||
|
||||
init {
|
||||
orientation = VERTICAL
|
||||
|
||||
|
|
@ -61,6 +63,7 @@ class ReminderContainer @JvmOverloads constructor(
|
|||
|
||||
private fun addReminderViewAt(index: Int, item: RemindersItem? = null) {
|
||||
val view = ReminderItemFormView(context)
|
||||
view.firstDayOfWeek = firstDayOfWeek
|
||||
view.taskType = taskType
|
||||
item?.let {
|
||||
view.item = it
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ class ReminderItemFormView @JvmOverloads constructor(
|
|||
binding.textView.text = formattedTime
|
||||
}
|
||||
|
||||
var firstDayOfWeek: Int? = null
|
||||
|
||||
var tintColor: Int = context.getThemeColor(R.attr.taskFormTint)
|
||||
var valueChangedListener: ((Date) -> Unit)? = null
|
||||
var animDuration = 0L
|
||||
|
|
@ -111,6 +113,9 @@ class ReminderItemFormView @JvmOverloads constructor(
|
|||
calendar.get(Calendar.YEAR),
|
||||
calendar.get(Calendar.MONTH),
|
||||
calendar.get(Calendar.DAY_OF_MONTH))
|
||||
if ((firstDayOfWeek ?: -1) >= 0) {
|
||||
timePickerDialog.datePicker.firstDayOfWeek = firstDayOfWeek ?: 0
|
||||
}
|
||||
timePickerDialog.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ class TaskSchedulingControls @JvmOverloads constructor(
|
|||
generateSummary()
|
||||
}
|
||||
|
||||
var firstDayOfWeek: Int? = null
|
||||
|
||||
private val weekdays: Array<String> by lazy {
|
||||
DateFormatSymbols().weekdays
|
||||
}
|
||||
|
|
@ -142,6 +144,10 @@ class TaskSchedulingControls @JvmOverloads constructor(
|
|||
startDate = Date()
|
||||
}
|
||||
}
|
||||
|
||||
if ((firstDayOfWeek ?: -1) >= 0) {
|
||||
datePickerDialog.datePicker.firstDayOfWeek = firstDayOfWeek ?: 0
|
||||
}
|
||||
if (taskType == Task.TYPE_TODO) {
|
||||
datePickerDialog.setButton(DialogInterface.BUTTON_NEUTRAL, resources.getString(R.string.clear)) { _, _ ->
|
||||
dueDate = null
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ buildscript {
|
|||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath 'com.google.gms:google-services:4.3.4'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
|
||||
|
|
|
|||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#Wed Jun 03 15:04:01 CEST 2020
|
||||
#Tue Oct 27 15:21:10 CET 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
|
|
|
|||
Loading…
Reference in a new issue