Merge branch 'main' of ssh://github.com/ydario/tasks into main

pull/1921/head
Alex Baker 2 years ago
commit de50854c99

@ -54,6 +54,7 @@ class TaskEditControlSetFragmentManager @Inject constructor(
CommentBarFragment.TAG -> CommentBarFragment()
ListFragment.TAG -> ListFragment()
SubtaskControlSet.TAG -> SubtaskControlSet()
CreationDateControlSet.TAG -> CreationDateControlSet()
else -> throw RuntimeException("Unsupported fragment")
}
@ -89,7 +90,8 @@ class TaskEditControlSetFragmentManager @Inject constructor(
R.id.row_10,
R.id.row_11,
R.id.row_12,
R.id.row_13
R.id.row_13,
R.id.row_14
)
private val TASK_EDIT_CONTROL_SET_FRAGMENTS = intArrayOf(
DeadlineControlSet.TAG,
@ -103,6 +105,7 @@ class TaskEditControlSetFragmentManager @Inject constructor(
FilesControlSet.TAG,
TagsControlSet.TAG,
RepeatControlSet.TAG,
CreationDateControlSet.TAG,
CommentBarFragment.TAG,
ListFragment.TAG,
SubtaskControlSet.TAG

@ -0,0 +1,39 @@
package org.tasks.ui
import android.view.ViewGroup
import android.widget.TextView
import dagger.hilt.android.AndroidEntryPoint
import org.tasks.R
import org.tasks.databinding.ControlSetDeadlineBinding
import org.tasks.preferences.Preferences
import java.text.SimpleDateFormat
import java.util.*
import javax.inject.Inject
@AndroidEntryPoint
class CreationDateControlSet : TaskEditControlFragment() {
@Inject lateinit var locale: Locale
@Inject lateinit var preferences: Preferences
private lateinit var date: TextView
override fun bind(parent: ViewGroup?) =
ControlSetDeadlineBinding.inflate(layoutInflater, parent, true).let {
val formatter = SimpleDateFormat( "yyyy-MM-dd HH:mm", locale)
date = it.dueDate
var dateRecords = context?.getString( R.string.sort_created_group, formatter.format( viewModel.creationDate!!)) + "\n" +
context?.getString( R.string.sort_modified_group, formatter.format( viewModel.modificationDate!!))
if (viewModel.completionDate!! != 0L)
dateRecords += "\n" + context?.getString( R.string.sort_completion_group, formatter.format( viewModel.completionDate!!))
date.text = dateRecords
it.root
}
override val icon = R.drawable.ic_outline_schedule_24px
override fun controlId() = TAG
companion object {
const val TAG = R.string.TEA_ctrl_creation_date
}
}

@ -123,6 +123,15 @@ class TaskEditViewModel @Inject constructor(
lateinit var task: Task
private set
var creationDate: Long? = null
get() = field ?: task.creationDate
var modificationDate: Long? = null
get() = field ?: task.modificationDate
var completionDate: Long? = null
get() = field ?: task.completionDate
var title: String? = null
get() = field ?: task.title

@ -151,6 +151,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@+id/row_14"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/comments"
android:layout_width="match_parent"

@ -248,6 +248,7 @@
<item>@string/TEA_control_notes</item>
<item>@string/TEA_control_gcal</item>
<item>@string/TEA_control_timer</item>
<item>@string/TEA_creation_date</item>
<item>@string/TEA_control_hidden_section</item>
</string-array>
@ -266,6 +267,7 @@
<string name="TEA_ctrl_comments">TEA_ctrl_comments</string>
<string name="TEA_ctrl_gcal">TEA_ctrl_gcal</string>
<string name="TEA_ctrl_google_task_list">TEA_ctrl_gtask</string>
<string name="TEA_ctrl_creation_date">TEA_ctrl_creation_date</string>
<string name="p_show_hidden_tasks">show_hidden_tasks</string>
<string name="p_show_completed_tasks">show_completed_tasks</string>
<string name="p_reverse_sort">reverse_sort</string>
@ -287,6 +289,7 @@
<item>@string/TEA_ctrl_notes_pref</item>
<item>@string/TEA_ctrl_gcal</item>
<item>@string/TEA_ctrl_timer_pref</item>
<item>@string/TEA_ctrl_creation_date</item>
<item>@string/TEA_ctrl_hide_section_pref</item>
</string-array>

@ -67,6 +67,7 @@ File %1$s contained %2$s.\n\n
<string name="TEA_control_reminders">Reminders</string>
<string name="TEA_control_timer">Timer Controls</string>
<string name="TEA_control_hidden_section">----Hide Always----</string>
<string name="TEA_creation_date">Creation date</string>
<string name="TEA_load_more">Load more…</string>
<string name="CRA_ignore">Ignore</string>
<string name="CRA_title">Need a meeting list?</string>
@ -617,6 +618,7 @@ File %1$s contained %2$s.\n\n
<string name="sort_due_group">Due %s</string>
<string name="sort_created_group">Created %s</string>
<string name="sort_modified_group">Modified %s</string>
<string name="sort_completion_group">Completion %s</string>
<string name="on_launch">On launch</string>
<string name="open_last_viewed_list">Open last viewed list</string>
<string name="local_lists">Local lists</string>

Loading…
Cancel
Save