1
0
mirror of https://github.com/etesync/android synced 2024-11-22 16:08:13 +00:00

Move CollectionInfo and SyncEntry to the journalmanager module.

This commit is contained in:
Tom Hacohen 2020-01-29 15:26:35 +02:00
parent 09e2a9255a
commit df94fde5ff
22 changed files with 48 additions and 140 deletions

View File

@ -133,7 +133,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.anko:anko-commons:0.10.4" implementation "org.jetbrains.anko:anko-commons:0.10.4"
implementation "com.etesync:journalmanager:1.0.1" implementation "com.etesync:journalmanager:1.0.2"
def acraVersion = '5.3.0' def acraVersion = '5.3.0'
implementation "ch.acra:acra-mail:$acraVersion" implementation "ch.acra:acra-mail:$acraVersion"

View File

@ -9,40 +9,18 @@
package com.etesync.syncadapter.model package com.etesync.syncadapter.model
import android.content.ContentValues import android.content.ContentValues
import com.etesync.journalmanager.Constants
import com.etesync.journalmanager.JournalManager
import com.etesync.syncadapter.model.ServiceDB.Collections import com.etesync.syncadapter.model.ServiceDB.Collections
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import com.google.gson.annotations.Expose
import java.io.Serializable
class CollectionInfo : Serializable { class CollectionInfo : com.etesync.journalmanager.model.CollectionInfo() {
@Deprecated("") @Deprecated("")
var id: Long = 0 var id: Long = 0
var serviceID: Int = 0 var serviceID: Int = 0
// FIXME: Shouldn't be exposed, as it's already saved in the journal. We just expose it for when we save for db. fun getServiceEntity(data: MyEntityDataStore): ServiceEntity {
@Expose return data.findByKey(ServiceEntity::class.java, serviceID)
var version = -1 }
@Expose
var type: Type? = null
var uid: String? = null
@Expose
var displayName: String? = null
@Expose
var description: String? = null
@Expose
var color: Int? = null
@Expose
var timeZone: String? = null
@Expose
var selected: Boolean = false
enum class Type { enum class Type {
ADDRESS_BOOK, ADDRESS_BOOK,
@ -50,38 +28,18 @@ class CollectionInfo : Serializable {
TASKS, TASKS,
} }
init { var enumType: Type?
version = Constants.CURRENT_VERSION get() = if (super.type != null) Type.valueOf(super.type!!) else null
} set(value) {
super.type = value?.name
fun updateFromJournal(journal: JournalManager.Journal) {
uid = journal.uid!!
version = journal.version
}
fun isOfTypeService(service: String): Boolean {
return service == type.toString()
}
fun getServiceEntity(data: MyEntityDataStore): ServiceEntity {
return data.findByKey(ServiceEntity::class.java, serviceID)
}
fun toJson(): String {
return GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(this, CollectionInfo::class.java)
}
override fun toString(): String {
return "CollectionInfo(serviceID=" + this.serviceID + ", version=" + this.version + ", type=" + this.type + ", uid=" + this.uid + ", displayName=" + this.displayName + ", description=" + this.description + ", color=" + this.color + ", timeZone=" + this.timeZone + ", selected=" + this.selected + ")"
} }
companion object { companion object {
fun defaultForServiceType(service: Type): CollectionInfo { fun defaultForServiceType(service: Type): CollectionInfo {
val info = CollectionInfo() val info = CollectionInfo()
info.displayName = "Default" info.displayName = "Default"
info.selected = true info.selected = true
info.type = service info.enumType = service
return info return info
} }

View File

@ -1,5 +1,7 @@
package com.etesync.syncadapter.model; package com.etesync.syncadapter.model;
import com.etesync.journalmanager.model.SyncEntry;
import java.util.List; import java.util.List;
import io.requery.Column; import io.requery.Column;
@ -11,11 +13,9 @@ import io.requery.Generated;
import io.requery.Index; import io.requery.Index;
import io.requery.Key; import io.requery.Key;
import io.requery.ManyToOne; import io.requery.ManyToOne;
import io.requery.Persistable;
import io.requery.PostLoad; import io.requery.PostLoad;
import io.requery.ReferentialAction; import io.requery.ReferentialAction;
import io.requery.Table; import io.requery.Table;
import io.requery.sql.EntityDataStore;
public class JournalModel { public class JournalModel {
@Entity @Entity

View File

@ -92,7 +92,7 @@ public class ServiceDB {
db.beginTransactionNonExclusive(); db.beginTransactionNonExclusive();
// iterate through all tables // iterate through all tables
Cursor cursorTables = db.query("sqlite_master", new String[]{"name"}, "type='table'", null, null, null, null); Cursor cursorTables = db.query("sqlite_master", new String[]{"name"}, "enumType='table'", null, null, null, null);
while (cursorTables.moveToNext()) { while (cursorTables.moveToNext()) {
String table = cursorTables.getString(0); String table = cursorTables.getString(0);
sb.append(table).append("\n"); sb.append(table).append("\n");

View File

@ -1,52 +0,0 @@
package com.etesync.syncadapter.model
import com.etesync.syncadapter.GsonHelper
import com.etesync.journalmanager.Crypto
import com.etesync.journalmanager.JournalEntryManager
import java.io.Serializable
class SyncEntry : Serializable {
val content: String
val action: Actions
enum class Actions constructor(private val text: String) {
ADD("ADD"),
CHANGE("CHANGE"),
DELETE("DELETE");
override fun toString(): String {
return text
}
}
private constructor() {
this.content = ""
this.action = Actions.ADD
}
constructor(content: String, action: Actions) {
this.content = content
this.action = action
}
fun isAction(action: Actions): Boolean {
return this.action == action
}
fun toJson(): String {
return GsonHelper.gson.toJson(this, this.javaClass)
}
companion object {
@JvmStatic
fun fromJournalEntry(crypto: Crypto.CryptoManager, entry: JournalEntryManager.Entry): SyncEntry {
return fromJson(entry.getContent(crypto))
}
@JvmStatic
fun fromJson(json: String): SyncEntry {
return GsonHelper.gson.fromJson(json, SyncEntry::class.java)
}
}
}

View File

@ -25,7 +25,7 @@ import java.util.logging.Level
/** /**
* Account authenticator for the main DAVx5 account type. * Account authenticator for the main DAVx5 account enumType.
* *
* Gets started when a DAVx5 account is removed, too, so it also watches for account removals * Gets started when a DAVx5 account is removed, too, so it also watches for account removals
* and contains the corresponding cleanup code. * and contains the corresponding cleanup code.

View File

@ -24,7 +24,7 @@ import com.etesync.journalmanager.Exceptions
import com.etesync.journalmanager.JournalEntryManager import com.etesync.journalmanager.JournalEntryManager
import com.etesync.syncadapter.log.Logger import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.model.CollectionInfo import com.etesync.syncadapter.model.CollectionInfo
import com.etesync.syncadapter.model.SyncEntry import com.etesync.journalmanager.model.SyncEntry
import com.etesync.syncadapter.resource.LocalCalendar import com.etesync.syncadapter.resource.LocalCalendar
import com.etesync.syncadapter.resource.LocalEvent import com.etesync.syncadapter.resource.LocalEvent
import com.etesync.syncadapter.utils.EventEmailInvitation import com.etesync.syncadapter.utils.EventEmailInvitation

View File

@ -24,7 +24,7 @@ import com.etesync.journalmanager.Exceptions
import com.etesync.journalmanager.JournalEntryManager import com.etesync.journalmanager.JournalEntryManager
import com.etesync.syncadapter.log.Logger import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.model.CollectionInfo import com.etesync.syncadapter.model.CollectionInfo
import com.etesync.syncadapter.model.SyncEntry import com.etesync.journalmanager.model.SyncEntry
import com.etesync.syncadapter.resource.LocalAddress import com.etesync.syncadapter.resource.LocalAddress
import com.etesync.syncadapter.resource.LocalAddressBook import com.etesync.syncadapter.resource.LocalAddressBook
import com.etesync.syncadapter.resource.LocalContact import com.etesync.syncadapter.resource.LocalContact

View File

@ -82,7 +82,7 @@ class CachedJournalFetcher {
} }
} }
return journals.filter { it.second?.type == serviceType } return journals.filter { it.second?.enumType == serviceType }
} }
} }

View File

@ -21,9 +21,10 @@ import com.etesync.syncadapter.Constants.KEY_ACCOUNT
import com.etesync.journalmanager.Crypto import com.etesync.journalmanager.Crypto
import com.etesync.journalmanager.Exceptions import com.etesync.journalmanager.Exceptions
import com.etesync.journalmanager.JournalEntryManager import com.etesync.journalmanager.JournalEntryManager
import com.etesync.journalmanager.model.SyncEntry
import com.etesync.syncadapter.log.Logger import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.model.* import com.etesync.syncadapter.model.*
import com.etesync.syncadapter.model.SyncEntry.Actions.ADD import com.etesync.journalmanager.model.SyncEntry.Actions.ADD
import com.etesync.syncadapter.resource.* import com.etesync.syncadapter.resource.*
import com.etesync.syncadapter.ui.AccountsActivity import com.etesync.syncadapter.ui.AccountsActivity
import com.etesync.syncadapter.ui.DebugInfoActivity import com.etesync.syncadapter.ui.DebugInfoActivity

View File

@ -19,7 +19,7 @@ import com.etesync.syncadapter.R
import com.etesync.journalmanager.JournalEntryManager import com.etesync.journalmanager.JournalEntryManager
import com.etesync.syncadapter.log.Logger import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.model.CollectionInfo import com.etesync.syncadapter.model.CollectionInfo
import com.etesync.syncadapter.model.SyncEntry import com.etesync.journalmanager.model.SyncEntry
import com.etesync.syncadapter.resource.LocalTask import com.etesync.syncadapter.resource.LocalTask
import com.etesync.syncadapter.resource.LocalTaskList import com.etesync.syncadapter.resource.LocalTaskList
import okhttp3.HttpUrl import okhttp3.HttpUrl

View File

@ -171,17 +171,17 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
when (item.itemId) { when (item.itemId) {
R.id.create_calendar -> { R.id.create_calendar -> {
info = CollectionInfo() info = CollectionInfo()
info.type = CollectionInfo.Type.CALENDAR info.enumType = CollectionInfo.Type.CALENDAR
startActivity(CreateCollectionActivity.newIntent(this@AccountActivity, account, info)) startActivity(CreateCollectionActivity.newIntent(this@AccountActivity, account, info))
} }
R.id.create_tasklist -> { R.id.create_tasklist -> {
info = CollectionInfo() info = CollectionInfo()
info.type = CollectionInfo.Type.TASKS info.enumType = CollectionInfo.Type.TASKS
startActivity(CreateCollectionActivity.newIntent(this@AccountActivity, account, info)) startActivity(CreateCollectionActivity.newIntent(this@AccountActivity, account, info))
} }
R.id.create_addressbook -> { R.id.create_addressbook -> {
info = CollectionInfo() info = CollectionInfo()
info.type = CollectionInfo.Type.ADDRESS_BOOK info.enumType = CollectionInfo.Type.ADDRESS_BOOK
startActivity(CreateCollectionActivity.newIntent(this@AccountActivity, account, info)) startActivity(CreateCollectionActivity.newIntent(this@AccountActivity, account, info))
} }
R.id.install_opentasks -> { R.id.install_opentasks -> {
@ -395,7 +395,7 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
} }
val vColor = v.findViewById<View>(R.id.color) val vColor = v.findViewById<View>(R.id.color)
if (info.type == CollectionInfo.Type.ADDRESS_BOOK) { if (info.enumType == CollectionInfo.Type.ADDRESS_BOOK) {
vColor.visibility = View.GONE vColor.visibility = View.GONE
} else { } else {
vColor.setBackgroundColor(info.color ?: LocalCalendar.defaultColor) vColor.setBackgroundColor(info.color ?: LocalCalendar.defaultColor)

View File

@ -37,7 +37,7 @@ class CollectionMembersActivity : BaseActivity(), Refreshable {
setTitle(R.string.collection_members_title) setTitle(R.string.collection_members_title)
val colorSquare = findViewById<View>(R.id.color) val colorSquare = findViewById<View>(R.id.color)
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR -> { CollectionInfo.Type.CALENDAR -> {
colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor) colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor)
} }

View File

@ -42,7 +42,7 @@ open class CreateCollectionActivity : BaseActivity() {
setContentView(R.layout.activity_create_collection) setContentView(R.layout.activity_create_collection)
val displayName = findViewById<View>(R.id.display_name) as EditText val displayName = findViewById<View>(R.id.display_name) as EditText
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR -> { CollectionInfo.Type.CALENDAR -> {
setTitle(R.string.create_calendar) setTitle(R.string.create_calendar)
displayName.setHint(R.string.create_calendar_display_name_hint) displayName.setHint(R.string.create_calendar_display_name_hint)
@ -114,7 +114,7 @@ open class CreateCollectionActivity : BaseActivity() {
info.description = StringUtils.trimToNull(edit.text.toString()) info.description = StringUtils.trimToNull(edit.text.toString())
if (ok) { if (ok) {
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR, CollectionInfo.Type.TASKS -> { CollectionInfo.Type.CALENDAR, CollectionInfo.Type.TASKS -> {
val view = findViewById<View>(R.id.color) val view = findViewById<View>(R.id.color)
info.color = (view.background as ColorDrawable).color info.color = (view.background as ColorDrawable).color

View File

@ -89,13 +89,13 @@ class CreateCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
val data = (context.applicationContext as App).data val data = (context.applicationContext as App).data
// 1. find service ID // 1. find service ID
when (info.type){ when (info.enumType){
CollectionInfo.Type.ADDRESS_BOOK -> authority = App.addressBooksAuthority CollectionInfo.Type.ADDRESS_BOOK -> authority = App.addressBooksAuthority
CollectionInfo.Type.CALENDAR -> authority = CalendarContract.AUTHORITY CollectionInfo.Type.CALENDAR -> authority = CalendarContract.AUTHORITY
CollectionInfo.Type.TASKS -> authority = TaskProvider.ProviderName.OpenTasks.authority CollectionInfo.Type.TASKS -> authority = TaskProvider.ProviderName.OpenTasks.authority
} }
val serviceEntity = JournalModel.Service.fetchOrCreate(data, account.name, info.type) val serviceEntity = JournalModel.Service.fetchOrCreate(data, account.name, info.enumType)
info.serviceID = serviceEntity.id info.serviceID = serviceEntity.id
val settings = AccountSettings(context, account) val settings = AccountSettings(context, account)

View File

@ -31,7 +31,7 @@ class EditCollectionActivity : CreateCollectionActivity() {
setTitle(R.string.edit_collection) setTitle(R.string.edit_collection)
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR -> { CollectionInfo.Type.CALENDAR -> {
val colorSquare = findViewById<View>(R.id.color) val colorSquare = findViewById<View>(R.id.color)
colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor) colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor)

View File

@ -25,7 +25,7 @@ import com.etesync.syncadapter.Constants
import com.etesync.syncadapter.R import com.etesync.syncadapter.R
import com.etesync.syncadapter.model.CollectionInfo import com.etesync.syncadapter.model.CollectionInfo
import com.etesync.syncadapter.model.JournalEntity import com.etesync.syncadapter.model.JournalEntity
import com.etesync.syncadapter.model.SyncEntry import com.etesync.journalmanager.model.SyncEntry
import com.etesync.syncadapter.resource.* import com.etesync.syncadapter.resource.*
import com.etesync.syncadapter.ui.journalviewer.ListEntriesFragment.Companion.setJournalEntryView import com.etesync.syncadapter.ui.journalviewer.ListEntriesFragment.Companion.setJournalEntryView
import com.etesync.syncadapter.utils.EventEmailInvitation import com.etesync.syncadapter.utils.EventEmailInvitation
@ -102,7 +102,7 @@ class JournalItemActivity : BaseActivity(), Refreshable {
fun restoreItem(item: MenuItem) { fun restoreItem(item: MenuItem) {
// FIXME: This code makes the assumption that providers are all available. May not be true for tasks, and potentially others too. // FIXME: This code makes the assumption that providers are all available. May not be true for tasks, and potentially others too.
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR -> { CollectionInfo.Type.CALENDAR -> {
val provider = contentResolver.acquireContentProviderClient(CalendarContract.CONTENT_URI)!! val provider = contentResolver.acquireContentProviderClient(CalendarContract.CONTENT_URI)!!
val localCalendar = LocalCalendar.findByName(account, provider, LocalCalendar.Factory, info.uid!!)!! val localCalendar = LocalCalendar.findByName(account, provider, LocalCalendar.Factory, info.uid!!)!!
@ -159,7 +159,7 @@ class JournalItemActivity : BaseActivity(), Refreshable {
private class TabsAdapter(fm: FragmentManager, private val context: Context, private val info: CollectionInfo, private val syncEntry: SyncEntry) : FragmentPagerAdapter(fm) { private class TabsAdapter(fm: FragmentManager, private val context: Context, private val info: CollectionInfo, private val syncEntry: SyncEntry) : FragmentPagerAdapter(fm) {
override fun getCount(): Int { override fun getCount(): Int {
// FIXME: Make it depend on info type (only have non-raw for known types) // FIXME: Make it depend on info enumType (only have non-raw for known types)
return 2 return 2
} }
@ -215,7 +215,7 @@ class JournalItemActivity : BaseActivity(), Refreshable {
info = arguments!!.getSerializable(Constants.KEY_COLLECTION_INFO) as CollectionInfo info = arguments!!.getSerializable(Constants.KEY_COLLECTION_INFO) as CollectionInfo
syncEntry = arguments!!.getSerializable(KEY_SYNC_ENTRY) as SyncEntry syncEntry = arguments!!.getSerializable(KEY_SYNC_ENTRY) as SyncEntry
when (info.type) { when (info.enumType) {
CollectionInfo.Type.ADDRESS_BOOK -> { CollectionInfo.Type.ADDRESS_BOOK -> {
v = inflater.inflate(R.layout.contact_info, container, false) v = inflater.inflate(R.layout.contact_info, container, false)
asyncTask = loadContactTask(v) asyncTask = loadContactTask(v)

View File

@ -60,7 +60,7 @@ class ViewCollectionActivity : BaseActivity(), Refreshable {
isOwner = journalEntity!!.isOwner(account.name) isOwner = journalEntity!!.isOwner(account.name)
val colorSquare = findViewById<View>(R.id.color) val colorSquare = findViewById<View>(R.id.color)
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR -> { CollectionInfo.Type.CALENDAR -> {
colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor) colorSquare.setBackgroundColor(info.color ?: LocalCalendar.defaultColor)
} }
@ -176,7 +176,7 @@ class ViewCollectionActivity : BaseActivity(), Refreshable {
entryCount = data.count(EntryEntity::class.java).where(EntryEntity.JOURNAL.eq(journalEntity)).get().value() entryCount = data.count(EntryEntity::class.java).where(EntryEntity.JOURNAL.eq(journalEntity)).get().value()
var count: Long = -1 var count: Long = -1
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR -> { CollectionInfo.Type.CALENDAR -> {
try { try {
val providerClient = contentResolver.acquireContentProviderClient(CalendarContract.CONTENT_URI) val providerClient = contentResolver.acquireContentProviderClient(CalendarContract.CONTENT_URI)
@ -237,7 +237,7 @@ class ViewCollectionActivity : BaseActivity(), Refreshable {
if (result == null) { if (result == null) {
stats.text = "Stats loading error." stats.text = "Stats loading error."
} else { } else {
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR -> { CollectionInfo.Type.CALENDAR -> {
stats.text = String.format(Locale.getDefault(), "Events: %d, Journal entries: %d", stats.text = String.format(Locale.getDefault(), "Events: %d, Journal entries: %d",
result, entryCount) result, entryCount)

View File

@ -43,13 +43,13 @@ class ImportActivity : BaseActivity(), SelectImportMethod, ResultFragment.OnImpo
} }
override fun importAccount() { override fun importAccount() {
if (info.type == CollectionInfo.Type.CALENDAR) { if (info.enumType == CollectionInfo.Type.CALENDAR) {
supportFragmentManager.beginTransaction() supportFragmentManager.beginTransaction()
.replace(android.R.id.content, .replace(android.R.id.content,
LocalCalendarImportFragment.newInstance(account, info)) LocalCalendarImportFragment.newInstance(account, info))
.addToBackStack(LocalCalendarImportFragment::class.java.name) .addToBackStack(LocalCalendarImportFragment::class.java.name)
.commit() .commit()
} else if (info.type == CollectionInfo.Type.ADDRESS_BOOK) { } else if (info.enumType == CollectionInfo.Type.ADDRESS_BOOK) {
supportFragmentManager.beginTransaction() supportFragmentManager.beginTransaction()
.replace(android.R.id.content, .replace(android.R.id.content,
LocalContactImportFragment.newInstance(account, info)) LocalContactImportFragment.newInstance(account, info))
@ -144,7 +144,7 @@ class ImportActivity : BaseActivity(), SelectImportMethod, ResultFragment.OnImpo
text.setText(R.string.import_button_local) text.setText(R.string.import_button_local)
card.setOnClickListener { mSelectImportMethod!!.importAccount() } card.setOnClickListener { mSelectImportMethod!!.importAccount() }
if ((activity as ImportActivity).info.type == CollectionInfo.Type.TASKS) { if ((activity as ImportActivity).info.enumType == CollectionInfo.Type.TASKS) {
card.visibility = View.GONE card.visibility = View.GONE
} }

View File

@ -116,7 +116,7 @@ class ImportFragment : DialogFragment() {
intent.addCategory(Intent.CATEGORY_OPENABLE) intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.action = Intent.ACTION_GET_CONTENT intent.action = Intent.ACTION_GET_CONTENT
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR -> intent.type = "text/calendar" CollectionInfo.Type.CALENDAR -> intent.type = "text/calendar"
CollectionInfo.Type.TASKS -> intent.type = "text/calendar" CollectionInfo.Type.TASKS -> intent.type = "text/calendar"
CollectionInfo.Type.ADDRESS_BOOK -> intent.type = "text/x-vcard" CollectionInfo.Type.ADDRESS_BOOK -> intent.type = "text/x-vcard"
@ -215,7 +215,7 @@ class ImportFragment : DialogFragment() {
val context = context!! val context = context!!
val importReader = InputStreamReader(inputStream) val importReader = InputStreamReader(inputStream)
if (info.type == CollectionInfo.Type.CALENDAR) { if (info.enumType == CollectionInfo.Type.CALENDAR) {
val events = Event.eventsFromReader(importReader, null) val events = Event.eventsFromReader(importReader, null)
importReader.close() importReader.close()
@ -268,7 +268,7 @@ class ImportFragment : DialogFragment() {
entryProcessed() entryProcessed()
} }
} else if (info.type == CollectionInfo.Type.TASKS) { } else if (info.enumType == CollectionInfo.Type.TASKS) {
val tasks = Task.tasksFromReader(importReader) val tasks = Task.tasksFromReader(importReader)
importReader.close() importReader.close()
@ -317,7 +317,7 @@ class ImportFragment : DialogFragment() {
entryProcessed() entryProcessed()
} }
} else if (info.type == CollectionInfo.Type.ADDRESS_BOOK) { } else if (info.enumType == CollectionInfo.Type.ADDRESS_BOOK) {
val uidToLocalId = HashMap<String?, Long>() val uidToLocalId = HashMap<String?, Long>()
val downloader = ContactsSyncManager.ResourceDownloader(context) val downloader = ContactsSyncManager.ResourceDownloader(context)
val contacts = Contact.fromReader(importReader, downloader) val contacts = Contact.fromReader(importReader, downloader)

View File

@ -224,7 +224,7 @@ class LocalContactImportFragment : Fragment() {
private val accountResolver: AccountResolver private val accountResolver: AccountResolver
/** /**
* Provide a reference to the type of views that you are using (custom ViewHolder) * Provide a reference to the enumType of views that you are using (custom ViewHolder)
*/ */
class ViewHolder(v: View, onAccountSelected: OnAccountSelected) : RecyclerView.ViewHolder(v) { class ViewHolder(v: View, onAccountSelected: OnAccountSelected) : RecyclerView.ViewHolder(v) {
internal val titleTextView: TextView internal val titleTextView: TextView

View File

@ -19,6 +19,7 @@ import android.widget.ArrayAdapter
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.ListFragment import androidx.fragment.app.ListFragment
import com.etesync.journalmanager.model.SyncEntry
import com.etesync.syncadapter.App import com.etesync.syncadapter.App
import com.etesync.syncadapter.R import com.etesync.syncadapter.R
import com.etesync.syncadapter.model.* import com.etesync.syncadapter.model.*
@ -139,7 +140,7 @@ class ListEntriesFragment : ListFragment(), AdapterView.OnItemClickListener {
// FIXME: hacky way to make it show sensible info // FIXME: hacky way to make it show sensible info
val fullContent = syncEntry.content val fullContent = syncEntry.content
var prefix = "" var prefix = ""
when (info.type) { when (info.enumType) {
CollectionInfo.Type.CALENDAR, CollectionInfo.Type.TASKS -> { CollectionInfo.Type.CALENDAR, CollectionInfo.Type.TASKS -> {
prefix = "SUMMARY:" prefix = "SUMMARY:"
} }