mirror of
https://github.com/etesync/android
synced 2025-01-22 21:51:04 +00:00
Tasks journal view: show the number of tasks in the journal.
This commit is contained in:
parent
7eee04f458
commit
e1573ef7ab
@ -48,6 +48,10 @@ class LocalTaskList private constructor(
|
||||
return create(account, provider, values)
|
||||
}
|
||||
|
||||
fun findByName(account: Account, provider: TaskProvider, factory: Factory, name: String): LocalTaskList?
|
||||
= AndroidTaskList.find(account, provider, factory, TaskLists._SYNC_ID + "==?", arrayOf(name)).firstOrNull()
|
||||
|
||||
|
||||
private fun valuesFromCollectionInfo(journalEntity: JournalEntity, withColor: Boolean): ContentValues {
|
||||
val info = journalEntity.info
|
||||
val values = ContentValues(3)
|
||||
|
@ -22,6 +22,7 @@ import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import at.bitfire.ical4android.CalendarStorageException
|
||||
import at.bitfire.ical4android.TaskProvider
|
||||
import at.bitfire.vcard4android.ContactsStorageException
|
||||
import com.etesync.syncadapter.App
|
||||
import com.etesync.syncadapter.R
|
||||
@ -30,6 +31,7 @@ import com.etesync.syncadapter.model.EntryEntity
|
||||
import com.etesync.syncadapter.model.JournalEntity
|
||||
import com.etesync.syncadapter.resource.LocalAddressBook
|
||||
import com.etesync.syncadapter.resource.LocalCalendar
|
||||
import com.etesync.syncadapter.resource.LocalTaskList
|
||||
import com.etesync.syncadapter.ui.importlocal.ImportActivity
|
||||
import com.etesync.syncadapter.ui.journalviewer.ListEntriesFragment
|
||||
import com.etesync.syncadapter.utils.HintManager
|
||||
@ -199,7 +201,16 @@ class ViewCollectionActivity : BaseActivity(), Refreshable {
|
||||
}
|
||||
}
|
||||
CollectionInfo.Type.TASKS -> {
|
||||
count = -1
|
||||
try {
|
||||
val providerClient = TaskProvider.acquire(this@ViewCollectionActivity, TaskProvider.ProviderName.OpenTasks)
|
||||
val resource = LocalTaskList.findByName(account, providerClient!!, LocalTaskList.Factory, info.uid!!)
|
||||
if (resource == null) {
|
||||
return null
|
||||
}
|
||||
count = resource.count()
|
||||
} catch (e: ContactsStorageException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
CollectionInfo.Type.ADDRESS_BOOK -> {
|
||||
try {
|
||||
@ -231,8 +242,8 @@ class ViewCollectionActivity : BaseActivity(), Refreshable {
|
||||
result, entryCount)
|
||||
}
|
||||
CollectionInfo.Type.TASKS -> {
|
||||
stats.text = String.format(Locale.getDefault(), "Tasks: (TBD), Journal entries: %d",
|
||||
entryCount)
|
||||
stats.text = String.format(Locale.getDefault(), "Tasks: %d, Journal entries: %d",
|
||||
result, entryCount)
|
||||
}
|
||||
CollectionInfo.Type.ADDRESS_BOOK -> {
|
||||
stats.text = String.format(Locale.getDefault(), "Contacts: %d, Journal Entries: %d",
|
||||
|
Loading…
Reference in New Issue
Block a user