Move MyAndroidTask to separate file

pull/1306/head
Alex Baker 5 years ago
parent 585b85aa78
commit e6f7e572a2

@ -0,0 +1,26 @@
package org.tasks.data
import android.database.Cursor
import at.bitfire.ical4android.AndroidTask
import at.bitfire.ical4android.MiscUtils.CursorHelper.toValues
import at.bitfire.ical4android.Task
import org.dmfs.tasks.contract.TaskContract
class MyAndroidTask() : AndroidTask(null) {
constructor(cursor: Cursor) : this() {
val values = cursor.toValues()
task = Task()
populateTask(values)
populateRelatedTo(values)
if (values.containsKey(TaskContract.Properties.PROPERTY_ID)) {
// process the first property, which is combined with the task row
populateProperty(values)
while (cursor.moveToNext()) {
// process the other properties
populateProperty(cursor.toValues(true))
}
}
}
}

@ -5,8 +5,6 @@ import android.content.ContentProviderOperation.*
import android.content.ContentValues
import android.content.Context
import android.database.Cursor
import at.bitfire.ical4android.AndroidTask
import at.bitfire.ical4android.MiscUtils.CursorHelper.toValues
import at.bitfire.ical4android.Task
import at.bitfire.ical4android.UnknownProperty
import dagger.hilt.android.qualifiers.ApplicationContext
@ -242,23 +240,5 @@ class OpenTaskDao @Inject constructor(
private fun Cursor.getLong(columnName: String): Long =
getLong(getColumnIndex(columnName))
private class MyAndroidTask(cursor: Cursor) : AndroidTask(null) {
init {
val values = cursor.toValues()
task = Task()
populateTask(values)
populateRelatedTo(values)
if (values.containsKey(Properties.PROPERTY_ID)) {
// process the first property, which is combined with the task row
populateProperty(values)
while (cursor.moveToNext()) {
// process the other properties
populateProperty(cursor.toValues(true))
}
}
}
}
}
}
Loading…
Cancel
Save