Merge pull request #2004 from Naveen3Singh/allow_sharing_tasks
Allow sharing tasks
This commit is contained in:
commit
1ab3167fab
|
@ -91,6 +91,7 @@ class TaskActivity : SimpleActivity() {
|
|||
if (::mTask.isInitialized) {
|
||||
task_toolbar.menu.apply {
|
||||
findItem(R.id.delete).isVisible = mTask.id != null
|
||||
findItem(R.id.share).isVisible = mTask.id != null
|
||||
findItem(R.id.duplicate).isVisible = mTask.id != null
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +103,7 @@ class TaskActivity : SimpleActivity() {
|
|||
R.id.save -> saveCurrentTask()
|
||||
R.id.delete -> deleteTask()
|
||||
R.id.duplicate -> duplicateTask()
|
||||
R.id.share -> shareTask()
|
||||
else -> return@setOnMenuItemClickListener false
|
||||
}
|
||||
return@setOnMenuItemClickListener true
|
||||
|
@ -502,6 +504,10 @@ class TaskActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun shareTask() {
|
||||
shareEvents(arrayListOf(mTask.id!!))
|
||||
}
|
||||
|
||||
private fun deleteTask() {
|
||||
if (mTask.id == null) {
|
||||
return
|
||||
|
|
|
@ -22,7 +22,7 @@ fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
|
|||
return@ensureBackgroundThread
|
||||
}
|
||||
|
||||
val events = eventsDB.getEventsWithIds(ids) as ArrayList<Event>
|
||||
val events = eventsDB.getEventsOrTasksWithIds(ids) as ArrayList<Event>
|
||||
if (events.isEmpty()) {
|
||||
toast(R.string.no_items_found)
|
||||
}
|
||||
|
|
|
@ -81,8 +81,8 @@ interface EventsDao {
|
|||
@Query("SELECT * FROM events WHERE source = :source AND type = $TYPE_EVENT")
|
||||
fun getEventsFromCalDAVCalendar(source: String): List<Event>
|
||||
|
||||
@Query("SELECT * FROM events WHERE id IN (:ids) AND type = $TYPE_EVENT")
|
||||
fun getEventsWithIds(ids: List<Long>): List<Event>
|
||||
@Query("SELECT * FROM events WHERE id IN (:ids)")
|
||||
fun getEventsOrTasksWithIds(ids: List<Long>): List<Event>
|
||||
|
||||
//val selection = "$COL_REMINDER_MINUTES != -1 AND ($COL_START_TS > ? OR $COL_REPEAT_INTERVAL != 0) AND $COL_START_TS != 0"
|
||||
@Query("SELECT * FROM events WHERE reminder_1_minutes != -1 AND (start_ts > :currentTS OR repeat_interval != 0) AND start_ts != 0")
|
||||
|
|
|
@ -16,4 +16,9 @@
|
|||
android:icon="@drawable/ic_copy_vector"
|
||||
android:title="@string/duplicate_task"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/share"
|
||||
android:icon="@drawable/ic_share_vector"
|
||||
android:title="@string/share"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
|
|
Loading…
Reference in New Issue