mirror of
https://github.com/etesync/android
synced 2025-01-03 12:21:01 +00:00
Fix build following changes.
This commit is contained in:
parent
b7c2f8841f
commit
79675261d2
@ -424,7 +424,7 @@ class LocalAddressBook(
|
||||
val values = ContentValues(1)
|
||||
values.put(Groups.TITLE, title)
|
||||
val uri = provider.insert(syncAdapterURI(Groups.CONTENT_URI), values)
|
||||
return ContentUris.parseId(uri)
|
||||
return ContentUris.parseId(uri!!)
|
||||
}
|
||||
|
||||
fun removeEmptyGroups() {
|
||||
|
@ -10,7 +10,6 @@ package com.etesync.syncadapter.resource
|
||||
|
||||
import android.accounts.Account
|
||||
import android.content.ContentProviderClient
|
||||
import android.content.ContentProviderOperation
|
||||
import android.content.ContentUris
|
||||
import android.content.ContentValues
|
||||
import android.net.Uri
|
||||
@ -24,7 +23,6 @@ import com.etesync.syncadapter.log.Logger
|
||||
import com.etesync.syncadapter.model.JournalEntity
|
||||
import com.etesync.syncadapter.resource.LocalEvent.Companion.COLUMN_UID
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.dmfs.tasks.contract.TaskContract
|
||||
import java.util.*
|
||||
import java.util.logging.Level
|
||||
|
||||
@ -210,15 +208,15 @@ class LocalCalendar private constructor(
|
||||
cursor2!!.close()
|
||||
val batch = BatchOperation(provider)
|
||||
// re-schedule original event and set it to DIRTY
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, originalID)))
|
||||
batch.enqueue(
|
||||
BatchOperation.CpoBuilder.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, originalID)))
|
||||
.withValue(LocalEvent.COLUMN_SEQUENCE, originalSequence + 1)
|
||||
.withValue(Events.DIRTY, 1)
|
||||
))
|
||||
)
|
||||
// remove exception
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newDelete(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, id)))
|
||||
))
|
||||
batch.enqueue(
|
||||
BatchOperation.CpoBuilder.newDelete(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, id)))
|
||||
)
|
||||
batch.commit()
|
||||
}
|
||||
cursor!!.close()
|
||||
@ -242,16 +240,14 @@ class LocalCalendar private constructor(
|
||||
|
||||
val batch = BatchOperation(provider)
|
||||
// original event to DIRTY
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, originalID)))
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, originalID)))
|
||||
.withValue(Events.DIRTY, 1)
|
||||
))
|
||||
)
|
||||
// increase SEQUENCE and set DIRTY to 0
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, id)))
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, id)))
|
||||
.withValue(LocalEvent.COLUMN_SEQUENCE, sequence + 1)
|
||||
.withValue(Events.DIRTY, 0)
|
||||
))
|
||||
)
|
||||
batch.commit()
|
||||
}
|
||||
cursor!!.close()
|
||||
|
@ -141,17 +141,15 @@ class LocalContact : AndroidContact, LocalAddress {
|
||||
super.insertDataRows(batch)
|
||||
|
||||
if (contact?.unknownProperties != null) {
|
||||
val op: BatchOperation.Operation
|
||||
val builder = ContentProviderOperation.newInsert(dataSyncURI())
|
||||
var builder = BatchOperation.CpoBuilder.newInsert(dataSyncURI())
|
||||
if (id == null) {
|
||||
op = BatchOperation.Operation(builder, UnknownProperties.RAW_CONTACT_ID, 0)
|
||||
builder = builder.withValue(UnknownProperties.RAW_CONTACT_ID, 0)
|
||||
} else {
|
||||
op = BatchOperation.Operation(builder)
|
||||
builder.withValue(UnknownProperties.RAW_CONTACT_ID, id)
|
||||
builder = builder.withValue(UnknownProperties.RAW_CONTACT_ID, id)
|
||||
}
|
||||
builder.withValue(UnknownProperties.MIMETYPE, UnknownProperties.CONTENT_ITEM_TYPE)
|
||||
.withValue(UnknownProperties.UNKNOWN_PROPERTIES, contact?.unknownProperties)
|
||||
batch.enqueue(op)
|
||||
batch.enqueue(builder)
|
||||
}
|
||||
|
||||
}
|
||||
@ -166,7 +164,7 @@ class LocalContact : AndroidContact, LocalAddress {
|
||||
return this.add()
|
||||
}
|
||||
|
||||
override fun buildContact(builder: ContentProviderOperation.Builder, update: Boolean) {
|
||||
override fun buildContact(builder: BatchOperation.CpoBuilder, update: Boolean) {
|
||||
super.buildContact(builder, update)
|
||||
builder.withValue(ContactsContract.RawContacts.DIRTY, if (saveAsDirty) 1 else 0)
|
||||
}
|
||||
@ -202,10 +200,10 @@ class LocalContact : AndroidContact, LocalAddress {
|
||||
if (batch == null)
|
||||
addressBook.provider!!.update(rawContactSyncURI(), values, null, null)
|
||||
else {
|
||||
val builder = ContentProviderOperation
|
||||
val builder = BatchOperation.CpoBuilder
|
||||
.newUpdate(rawContactSyncURI())
|
||||
.withValues(values)
|
||||
batch.enqueue(BatchOperation.Operation(builder))
|
||||
.withValue(COLUMN_HASHCODE, hashCode)
|
||||
batch.enqueue(builder)
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,33 +221,28 @@ class LocalContact : AndroidContact, LocalAddress {
|
||||
|
||||
|
||||
fun addToGroup(batch: BatchOperation, groupID: Long) {
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newInsert(dataSyncURI())
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newInsert(dataSyncURI())
|
||||
.withValue(GroupMembership.MIMETYPE, GroupMembership.CONTENT_ITEM_TYPE)
|
||||
.withValue(GroupMembership.RAW_CONTACT_ID, id)
|
||||
.withValue(GroupMembership.GROUP_ROW_ID, groupID)
|
||||
))
|
||||
)
|
||||
groupMemberships.add(groupID)
|
||||
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newInsert(dataSyncURI())
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newInsert(dataSyncURI())
|
||||
.withValue(CachedGroupMembership.MIMETYPE, CachedGroupMembership.CONTENT_ITEM_TYPE)
|
||||
.withValue(CachedGroupMembership.RAW_CONTACT_ID, id)
|
||||
.withValue(CachedGroupMembership.GROUP_ID, groupID)
|
||||
.withYieldAllowed(true)
|
||||
))
|
||||
)
|
||||
cachedGroupMemberships.add(groupID)
|
||||
}
|
||||
|
||||
fun removeGroupMemberships(batch: BatchOperation) {
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newDelete(dataSyncURI())
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newDelete(dataSyncURI())
|
||||
.withSelection(
|
||||
Data.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + " IN (?,?)",
|
||||
arrayOf(id.toString(), GroupMembership.CONTENT_ITEM_TYPE, CachedGroupMembership.CONTENT_ITEM_TYPE)
|
||||
)
|
||||
.withYieldAllowed(true)
|
||||
))
|
||||
)
|
||||
groupMemberships.clear()
|
||||
cachedGroupMemberships.clear()
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class LocalEvent : AndroidEvent, LocalResource<Event> {
|
||||
weAreOrganizer = isOrganizer != null && isOrganizer != 0
|
||||
}
|
||||
|
||||
override fun buildEvent(recurrence: Event?, builder: ContentProviderOperation.Builder) {
|
||||
override fun buildEvent(recurrence: Event?, builder: BatchOperation.CpoBuilder) {
|
||||
super.buildEvent(recurrence, builder)
|
||||
|
||||
val buildException = recurrence != null
|
||||
@ -101,7 +101,7 @@ class LocalEvent : AndroidEvent, LocalResource<Event> {
|
||||
.withValue(COLUMN_ETAG, eTag)
|
||||
}
|
||||
|
||||
override fun insertReminder(batch: BatchOperation, idxEvent: Int, alarm: VAlarm) {
|
||||
override fun insertReminder(batch: BatchOperation, idxEvent: Int?, alarm: VAlarm) {
|
||||
// We only support DISPLAY and AUDIO alarms so modify when inserting
|
||||
val action = alarm.action
|
||||
val modifiedAlarm = when (action?.value) {
|
||||
@ -133,7 +133,7 @@ class LocalEvent : AndroidEvent, LocalResource<Event> {
|
||||
|
||||
override fun legacyPrepareForUpload(fileName_: String?) {
|
||||
var uid: String? = null
|
||||
val c = calendar.provider.query(eventSyncURI(), arrayOf(COLUMN_UID), null, null, null)
|
||||
val c = calendar.provider.query(eventSyncURI(), arrayOf(COLUMN_UID), null, null, null)!!
|
||||
if (c.moveToNext())
|
||||
uid = c.getString(0)
|
||||
if (uid == null)
|
||||
|
@ -135,23 +135,20 @@ class LocalGroup : AndroidGroup, LocalAddress {
|
||||
val batch = BatchOperation(addressBook.provider!!)
|
||||
|
||||
// delete cached group memberships
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newDelete(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newDelete(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
||||
.withSelection(
|
||||
CachedGroupMembership.MIMETYPE + "=? AND " + CachedGroupMembership.GROUP_ID + "=?",
|
||||
arrayOf(CachedGroupMembership.CONTENT_ITEM_TYPE, id.toString())
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
// insert updated cached group memberships
|
||||
for (member in getMembers())
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newInsert(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newInsert(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
||||
.withValue(CachedGroupMembership.MIMETYPE, CachedGroupMembership.CONTENT_ITEM_TYPE)
|
||||
.withValue(CachedGroupMembership.RAW_CONTACT_ID, member)
|
||||
.withValue(CachedGroupMembership.GROUP_ID, id)
|
||||
.withYieldAllowed(true)
|
||||
))
|
||||
)
|
||||
|
||||
batch.commit()
|
||||
}
|
||||
@ -214,11 +211,9 @@ class LocalGroup : AndroidGroup, LocalAddress {
|
||||
.forEach { it.updateHashCode(batch) }
|
||||
|
||||
// remove pending memberships
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(Groups.CONTENT_URI, id)))
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(Groups.CONTENT_URI, id)))
|
||||
.withValue(COLUMN_PENDING_MEMBERS, null)
|
||||
.withYieldAllowed(true)
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,10 +12,7 @@ import android.content.ContentProviderOperation
|
||||
import android.content.ContentValues
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
import at.bitfire.ical4android.AndroidTask
|
||||
import at.bitfire.ical4android.AndroidTaskFactory
|
||||
import at.bitfire.ical4android.AndroidTaskList
|
||||
import at.bitfire.ical4android.Task
|
||||
import at.bitfire.ical4android.*
|
||||
import com.etesync.syncadapter.log.Logger
|
||||
import org.dmfs.tasks.contract.TaskContract
|
||||
import java.io.ByteArrayOutputStream
|
||||
@ -75,7 +72,7 @@ class LocalTask : AndroidTask, LocalResource<Task> {
|
||||
task?.sequence = values.getAsInteger(COLUMN_SEQUENCE)
|
||||
}
|
||||
|
||||
override fun buildTask(builder: ContentProviderOperation.Builder, update: Boolean) {
|
||||
override fun buildTask(builder: BatchOperation.CpoBuilder, update: Boolean) {
|
||||
super.buildTask(builder, update)
|
||||
builder.withValue(TaskContract.Tasks._SYNC_ID, fileName)
|
||||
.withValue(COLUMN_UID, task?.uid)
|
||||
@ -98,7 +95,7 @@ class LocalTask : AndroidTask, LocalResource<Task> {
|
||||
|
||||
override fun legacyPrepareForUpload(fileName_: String?) {
|
||||
var uid: String? = null
|
||||
val c = taskList.provider.client.query(taskSyncURI(), arrayOf(COLUMN_UID), null, null, null)
|
||||
val c = taskList.provider.client.query(taskSyncURI(), arrayOf(COLUMN_UID), null, null, null)!!
|
||||
if (c.moveToNext())
|
||||
uid = c.getString(0)
|
||||
if (uid == null)
|
||||
|
@ -102,11 +102,9 @@ constructor(context: Context, account: Account, settings: AccountSettings, extra
|
||||
val currentGroups = contact.getGroupMemberships()
|
||||
for (groupID in SetUtils.disjunction(cachedGroups, currentGroups)) {
|
||||
Logger.log.fine("Marking group as dirty: " + groupID!!)
|
||||
batch.enqueue(BatchOperation.Operation(
|
||||
ContentProviderOperation.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(ContactsContract.Groups.CONTENT_URI, groupID)))
|
||||
batch.enqueue(BatchOperation.CpoBuilder.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(ContactsContract.Groups.CONTENT_URI, groupID)))
|
||||
.withValue(ContactsContract.Groups.DIRTY, 1)
|
||||
.withYieldAllowed(true)
|
||||
))
|
||||
)
|
||||
}
|
||||
} catch (ignored: FileNotFoundException) {
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class AboutActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Spanned> {
|
||||
return LicenseLoader(context!!, args!!.getString(KEY_FILE_NAME))
|
||||
return LicenseLoader(requireContext(), args!!.getString(KEY_FILE_NAME)!!)
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<Spanned>, license: Spanned) {
|
||||
|
@ -108,7 +108,7 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
account = intent.getParcelableExtra(EXTRA_ACCOUNT)
|
||||
account = intent.getParcelableExtra(EXTRA_ACCOUNT)!!
|
||||
title = account.name
|
||||
settings = AccountSettings(this, account)
|
||||
|
||||
|
@ -42,7 +42,7 @@ class AccountSettingsActivity : BaseActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
account = intent.getParcelableExtra(KEY_ACCOUNT)
|
||||
account = intent.getParcelableExtra(KEY_ACCOUNT)!!
|
||||
title = getString(R.string.settings_title, account.name)
|
||||
|
||||
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
||||
@ -85,7 +85,7 @@ class AccountSettingsFragment() : PreferenceFragmentCompat(), LoaderManager.Load
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<AccountSettings> {
|
||||
return AccountSettingsLoader(context!!, args!!.getParcelable(KEY_ACCOUNT) as Account)
|
||||
return AccountSettingsLoader(requireContext(), (args!!.getParcelable(KEY_ACCOUNT) as Account?)!!)
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<AccountSettings>, settings: AccountSettings?) {
|
||||
@ -197,7 +197,7 @@ class LegacyAccountSettingsFragment : PreferenceFragmentCompat(), LoaderManager.
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<AccountSettings> {
|
||||
return AccountSettingsLoader(context!!, args!!.getParcelable(KEY_ACCOUNT) as Account)
|
||||
return AccountSettingsLoader(context!!, (args!!.getParcelable(KEY_ACCOUNT) as? Account)!!)
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<AccountSettings>, settings: AccountSettings?) {
|
||||
|
@ -68,7 +68,7 @@ class CollectionMembersActivity : BaseActivity(), Refreshable {
|
||||
|
||||
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
account = intent.extras!!.getParcelable(EXTRA_ACCOUNT)
|
||||
account = intent.extras!!.getParcelable(EXTRA_ACCOUNT)!!
|
||||
info = intent.extras!!.getSerializable(EXTRA_COLLECTION_INFO) as CollectionInfo
|
||||
|
||||
refresh()
|
||||
|
@ -37,7 +37,7 @@ class CreateCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
account = arguments!!.getParcelable(ARG_ACCOUNT)
|
||||
account = arguments!!.getParcelable(ARG_ACCOUNT)!!
|
||||
info = arguments!!.getSerializable(ARG_COLLECTION_INFO) as CollectionInfo
|
||||
|
||||
loaderManager.initLoader(0, null, this)
|
||||
|
@ -31,7 +31,7 @@ class WebViewActivity : BaseActivity() {
|
||||
mToolbar = supportActionBar
|
||||
mToolbar!!.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
var uri = intent.getParcelableExtra<Uri>(KEY_URL)
|
||||
var uri = intent.getParcelableExtra<Uri>(KEY_URL)!!
|
||||
uri = addQueryParams(uri)
|
||||
mWebView = findViewById<View>(R.id.webView) as WebView
|
||||
mProgressBar = findViewById<View>(R.id.progressBar) as ProgressBar
|
||||
|
@ -98,7 +98,7 @@ class ItemRevisionsListFragment : ListFragment(), AdapterView.OnItemClickListene
|
||||
if (v == null)
|
||||
v = LayoutInflater.from(context).inflate(R.layout.journal_viewer_list_item, parent, false)!!
|
||||
|
||||
val item = getItem(position)
|
||||
val item = getItem(position)!!
|
||||
|
||||
setItemView(v, cachedCollection.collectionType, item)
|
||||
|
||||
|
@ -83,7 +83,7 @@ class ListEntriesFragment : ListFragment(), AdapterView.OnItemClickListener {
|
||||
if (v == null)
|
||||
v = LayoutInflater.from(context).inflate(R.layout.journal_viewer_list_item, parent, false)!!
|
||||
|
||||
val item = getItem(position)
|
||||
val item = getItem(position)!!
|
||||
|
||||
setItemView(v, cachedCollection.collectionType, item)
|
||||
|
||||
|
@ -47,7 +47,7 @@ class LoginCredentialsChangeFragment : DialogFragment(), LoaderManager.LoaderCal
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Configuration> {
|
||||
return ServerConfigurationLoader(context!!, args!!.getParcelable(ARG_LOGIN_CREDENTIALS) as LoginCredentials)
|
||||
return ServerConfigurationLoader(requireContext(), (args!!.getParcelable(ARG_LOGIN_CREDENTIALS) as LoginCredentials?)!!)
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<Configuration>, data: Configuration?) {
|
||||
|
Loading…
Reference in New Issue
Block a user