diff --git a/app/src/main/java/org/tasks/fragments/TaskEditControlSetFragmentManager.kt b/app/src/main/java/org/tasks/fragments/TaskEditControlSetFragmentManager.kt
index a1da8d8ea..e6440a6b0 100644
--- a/app/src/main/java/org/tasks/fragments/TaskEditControlSetFragmentManager.kt
+++ b/app/src/main/java/org/tasks/fragments/TaskEditControlSetFragmentManager.kt
@@ -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
diff --git a/app/src/main/java/org/tasks/ui/CreationDateControlSet.kt b/app/src/main/java/org/tasks/ui/CreationDateControlSet.kt
new file mode 100644
index 000000000..55f64824b
--- /dev/null
+++ b/app/src/main/java/org/tasks/ui/CreationDateControlSet.kt
@@ -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
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/tasks/ui/TaskEditViewModel.kt b/app/src/main/java/org/tasks/ui/TaskEditViewModel.kt
index e9e97574a..5cd146bd9 100644
--- a/app/src/main/java/org/tasks/ui/TaskEditViewModel.kt
+++ b/app/src/main/java/org/tasks/ui/TaskEditViewModel.kt
@@ -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
diff --git a/app/src/main/res/layout/fragment_task_edit.xml b/app/src/main/res/layout/fragment_task_edit.xml
index 5b8f23daf..704fa8100 100644
--- a/app/src/main/res/layout/fragment_task_edit.xml
+++ b/app/src/main/res/layout/fragment_task_edit.xml
@@ -151,6 +151,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
+
+
@string/TEA_control_notes
- @string/TEA_control_gcal
- @string/TEA_control_timer
+ - @string/TEA_creation_date
- @string/TEA_control_hidden_section
@@ -266,6 +267,7 @@
TEA_ctrl_comments
TEA_ctrl_gcal
TEA_ctrl_gtask
+ TEA_ctrl_creation_date
show_hidden_tasks
show_completed_tasks
reverse_sort
@@ -287,6 +289,7 @@
- @string/TEA_ctrl_notes_pref
- @string/TEA_ctrl_gcal
- @string/TEA_ctrl_timer_pref
+ - @string/TEA_ctrl_creation_date
- @string/TEA_ctrl_hide_section_pref
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index cd3ef4c7b..d49615b1f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -67,6 +67,7 @@ File %1$s contained %2$s.\n\n
Reminders
Timer Controls
----Hide Always----
+ Creation date
Load moreā¦
Ignore
Need a meeting list?
@@ -617,6 +618,7 @@ File %1$s contained %2$s.\n\n
Due %s
Created %s
Modified %s
+ Completion %s
On launch
Open last viewed list
Local lists