Remove TaskEditActivity

pull/1051/head
Alex Baker 4 years ago
parent 43814b0810
commit 7e1a1b22d3

@ -169,9 +169,6 @@
android:scheme="content"
android:host="${applicationId}" />
</intent-filter>
</activity>
<activity android:name="com.todoroo.astrid.activity.TaskEditActivity">
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>

@ -1,38 +0,0 @@
package com.todoroo.astrid.activity
import androidx.lifecycle.lifecycleScope
import com.todoroo.astrid.dao.TaskDao
import com.todoroo.astrid.service.TaskCreator
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import org.tasks.injection.InjectingAppCompatActivity
import org.tasks.intents.TaskIntents
import javax.inject.Inject
@AndroidEntryPoint
class TaskEditActivity : InjectingAppCompatActivity() {
@Inject lateinit var taskCreator: TaskCreator
@Inject lateinit var taskDao: TaskDao
override fun onResume() {
super.onResume()
val taskId = intent.getLongExtra(TOKEN_ID, 0)
if (taskId > 0) {
lifecycleScope.launch {
val task = taskDao.fetch(taskId)
task?.let {
startActivity(TaskIntents.getEditTaskIntent(this@TaskEditActivity, it))
}
finish()
}
} else {
startActivity(TaskIntents.getEditTaskIntent(this, taskCreator.createWithValues("")))
finish()
}
}
companion object {
private const val TOKEN_ID = "id"
}
}

@ -33,14 +33,23 @@ class UriHandler : AppCompatActivity() {
finish()
}
} else {
startActivity(TaskIntents.getNewTaskIntent(this, null))
finish()
newTask()
}
}
else -> {
Timber.w("Invalid uri: ${intent.data}")
finish()
if (intent.type == "vnd.android.cursor.item/task") {
// pure calendar widget '+'
newTask()
} else {
Timber.w("Invalid uri: ${intent.data}")
finish()
}
}
}
}
private fun newTask() {
startActivity(TaskIntents.getNewTaskIntent(this, null))
finish()
}
}

@ -74,7 +74,8 @@ class TasksContentProvider : ContentProvider() {
LEFT JOIN google_task_lists ON gtl_remote_id = gt_list_id
LEFT JOIN caldav_tasks ON cd_task = _id
LEFT JOIN caldav_lists ON cdl_uuid = cd_calendar"""
private const val AUTHORITY = BuildConfig.APPLICATION_ID;
private const val AUTHORITY = BuildConfig.APPLICATION_ID
private const val PURE_CALENDAR_WIDGET = "org.tasks.tasksprovider"
@JvmField val CONTENT_URI: Uri = Uri.parse("content://$AUTHORITY")
const val URI_TASKS = 1
const val URI_OPEN_TASK = 2
@ -87,6 +88,7 @@ class TasksContentProvider : ContentProvider() {
addURI(AUTHORITY, "lists", URI_LISTS)
addURI(AUTHORITY, "google_lists", URI_GOOGLE_TASK_LISTS)
addURI(AUTHORITY, "todoagenda", URI_TODO_AGENDA)
addURI(PURE_CALENDAR_WIDGET, "tasks/*", URI_OPEN_TASK)
}
}
}
Loading…
Cancel
Save