Commit 9d598cea authored by Ricki Hirner's avatar Ricki Hirner

move lambda expressions out of parentheses; use CREATOR-named companion objects for Parcelable

parent 2915a1f2
......@@ -58,20 +58,6 @@ data class CollectionInfo(
WEBCAL // iCalendar subscription
}
companion object {
val DAV_PROPERTIES = arrayOf(
ResourceType.NAME,
CurrentUserPrivilegeSet.NAME,
DisplayName.NAME,
AddressbookDescription.NAME, SupportedAddressData.NAME,
CalendarDescription.NAME, CalendarColor.NAME, SupportedCalendarComponentSet.NAME,
Source.NAME
)
}
constructor(dav: DavResponse): this(UrlUtils.withTrailingSlash(dav.url)) {
dav[ResourceType::class.java]?.let { type ->
when {
......@@ -185,8 +171,8 @@ data class CollectionInfo(
dest.writeString(url.toString())
writeOrNull(id, { dest.writeLong(it) })
writeOrNull(serviceID, { dest.writeLong(it) })
writeOrNull(id) { dest.writeLong(it) }
writeOrNull(serviceID) { dest.writeLong(it) }
dest.writeString(type?.name)
......@@ -194,7 +180,7 @@ data class CollectionInfo(
dest.writeByte(if (forceReadOnly) 1 else 0)
dest.writeString(displayName)
dest.writeString(description)
writeOrNull(color, { dest.writeInt(it) })
writeOrNull(color) { dest.writeInt(it) }
dest.writeString(timeZone)
dest.writeByte(if (supportsVEVENT) 1 else 0)
......@@ -206,9 +192,17 @@ data class CollectionInfo(
dest.writeByte(if (confirmed) 1 else 0)
}
@Suppress("unused")
@JvmField
val CREATOR = object: Parcelable.Creator<CollectionInfo> {
companion object CREATOR : Parcelable.Creator<CollectionInfo> {
val DAV_PROPERTIES = arrayOf(
ResourceType.NAME,
CurrentUserPrivilegeSet.NAME,
DisplayName.NAME,
AddressbookDescription.NAME, SupportedAddressData.NAME,
CalendarDescription.NAME, CalendarColor.NAME, SupportedCalendarComponentSet.NAME,
Source.NAME
)
override fun createFromParcel(parcel: Parcel): CollectionInfo {
fun<T> readOrNull(parcel: Parcel, read: () -> T): T? {
return if (parcel.readByte() == 0.toByte())
......@@ -220,8 +214,8 @@ data class CollectionInfo(
return CollectionInfo(
HttpUrl.parse(parcel.readString())!!,
readOrNull(parcel, { parcel.readLong() }),
readOrNull(parcel, { parcel.readLong() }),
readOrNull(parcel) { parcel.readLong() },
readOrNull(parcel) { parcel.readLong() },
parcel.readString()?.let { Type.valueOf(it) },
......@@ -229,7 +223,7 @@ data class CollectionInfo(
parcel.readByte() != 0.toByte(),
parcel.readString(),
parcel.readString(),
readOrNull(parcel, { parcel.readInt() }),
readOrNull(parcel) { parcel.readInt() },
parcel.readString(),
parcel.readByte() != 0.toByte(),
......
......@@ -101,16 +101,16 @@ class Settings: Service(), Provider.Observer {
}
fun getBoolean(key: String) =
getValue(key, { provider -> provider.getBoolean(key) })
getValue(key) { provider -> provider.getBoolean(key) }
fun getInt(key: String) =
getValue(key, { provider -> provider.getInt(key) })
getValue(key) { provider -> provider.getInt(key) }
fun getLong(key: String) =
getValue(key, { provider -> provider.getLong(key) })
getValue(key) { provider -> provider.getLong(key) }
fun getString(key: String) =
getValue(key, { provider -> provider.getString(key) })
getValue(key) { provider -> provider.getString(key) }
fun isWritable(key: String): Boolean {
......@@ -143,16 +143,16 @@ class Settings: Service(), Provider.Observer {
}
fun putBoolean(key: String, value: Boolean?) =
putValue(key, value, { provider -> provider.putBoolean(key, value) })
putValue(key, value) { provider -> provider.putBoolean(key, value) }
fun putInt(key: String, value: Int?) =
putValue(key, value, { provider -> provider.putInt(key, value) })
putValue(key, value) { provider -> provider.putInt(key, value) }
fun putLong(key: String, value: Long?) =
putValue(key, value, { provider -> provider.putLong(key, value) })
putValue(key, value) { provider -> provider.putLong(key, value) }
fun putString(key: String, value: String?) =
putValue(key, value, { provider -> provider.putString(key, value) })
putValue(key, value) { provider -> provider.putString(key, value) }
fun remove(key: String): Boolean {
var deleted = false
......
......@@ -56,16 +56,16 @@ class SharedPreferencesProvider(
}
override fun getBoolean(key: String): Pair<Boolean?, Boolean> =
getValue(key, { preferences -> preferences.getBoolean(key, /* will never be used: */ false) })
getValue(key) { preferences -> preferences.getBoolean(key, /* will never be used: */ false) }
override fun getInt(key: String): Pair<Int?, Boolean> =
getValue(key, { preferences -> preferences.getInt(key, /* will never be used: */ -1) })
getValue(key) { preferences -> preferences.getInt(key, /* will never be used: */ -1) }
override fun getLong(key: String): Pair<Long?, Boolean> =
getValue(key, { preferences -> preferences.getLong(key, /* will never be used: */ -1) })
getValue(key) { preferences -> preferences.getLong(key, /* will never be used: */ -1) }
override fun getString(key: String): Pair<String?, Boolean> =
getValue(key, { preferences -> preferences.getString(key, /* will never be used: */ null) })
getValue(key) { preferences -> preferences.getString(key, /* will never be used: */ null) }
override fun isWritable(key: String) =
......@@ -84,16 +84,16 @@ class SharedPreferencesProvider(
}
override fun putBoolean(key: String, value: Boolean?) =
putValue(key, value, { editor, v -> editor.putBoolean(key, v) })
putValue(key, value) { editor, v -> editor.putBoolean(key, v) }
override fun putInt(key: String, value: Int?) =
putValue(key, value, { editor, v -> editor.putInt(key, v) })
putValue(key, value) { editor, v -> editor.putInt(key, v) }
override fun putLong(key: String, value: Long?) =
putValue(key, value, { editor, v -> editor.putLong(key, v) })
putValue(key, value) { editor, v -> editor.putLong(key, v) }
override fun putString(key: String, value: String?) =
putValue(key, value, { editor, v -> editor.putString(key, v) })
putValue(key, value) { editor, v -> editor.putString(key, v) }
override fun remove(key: String): Boolean {
Logger.log.fine("Removing setting $key")
......
......@@ -93,26 +93,26 @@ abstract class BaseDavSyncManager<ResourceType: LocalResource<*>, out Collection
// but only if they don't have changed on the server. Then finally remove them from the local address book.
val localList = localCollection.findDeleted()
for (local in localList)
useLocal(local, {
useLocal(local) {
abortIfCancelled()
val fileName = local.fileName
if (fileName != null) {
Logger.log.info("$fileName has been deleted locally -> deleting from server")
useRemote(DavResource(httpClient.okHttpClient, collectionURL.newBuilder().addPathSegment(fileName).build()), { remote ->
useRemote(DavResource(httpClient.okHttpClient, collectionURL.newBuilder().addPathSegment(fileName).build())) { remote ->
try {
remote.delete(local.eTag)
numDeleted++
} catch (e: HttpException) {
Logger.log.warning("Couldn't delete $fileName from server; ignoring (may be downloaded again)")
}
})
}
} else
Logger.log.info("Removing local record #${local.id} which has been deleted locally and was never uploaded")
local.delete()
syncResult.stats.numDeletes++
})
}
Logger.log.info("Removed $numDeleted record(s) from server")
return numDeleted > 0
}
......@@ -128,7 +128,7 @@ abstract class BaseDavSyncManager<ResourceType: LocalResource<*>, out Collection
// upload dirty contacts
for (local in localCollection.findDirty())
useLocal(local, {
useLocal(local) {
abortIfCancelled()
if (local.fileName == null) {
......@@ -137,7 +137,7 @@ abstract class BaseDavSyncManager<ResourceType: LocalResource<*>, out Collection
}
val fileName = local.fileName!!
useRemote(DavResource(httpClient.okHttpClient, collectionURL.newBuilder().addPathSegment(fileName).build()), { remote ->
useRemote(DavResource(httpClient.okHttpClient, collectionURL.newBuilder().addPathSegment(fileName).build())) { remote ->
// generate entity to upload (VCard, iCal, whatever)
val body = prepareUpload(local)
......@@ -171,8 +171,8 @@ abstract class BaseDavSyncManager<ResourceType: LocalResource<*>, out Collection
}
local.clearDirty(eTag)
})
})
}
}
Logger.log.info("Sent $numUploaded record(s) to server")
return numUploaded > 0
}
......@@ -214,7 +214,7 @@ abstract class BaseDavSyncManager<ResourceType: LocalResource<*>, out Collection
val changes = RemoteChanges(null, false)
for ((name, remote) in remoteResources)
useLocal(localCollection.findByName(name), { local ->
useLocal(localCollection.findByName(name)) { local ->
if (local == null) {
Logger.log.info("$name has been added remotely")
changes.updated += remote
......@@ -231,7 +231,7 @@ abstract class BaseDavSyncManager<ResourceType: LocalResource<*>, out Collection
// mark as remotely present, so that this resource won't be deleted at the end
local.updateFlags(LocalResource.FLAG_REMOTELY_PRESENT)
}
})
}
return changes
}
......
......@@ -82,7 +82,7 @@ class CalendarSyncManager(
else
SyncAlgorithm.COLLECTION_SYNC
override fun prepareUpload(resource: LocalEvent): RequestBody = useLocal(resource, {
override fun prepareUpload(resource: LocalEvent): RequestBody = useLocal(resource) {
val event = requireNotNull(resource.event)
Logger.log.log(Level.FINE, "Preparing upload of event ${resource.fileName}", event)
......@@ -93,7 +93,7 @@ class CalendarSyncManager(
DavCalendar.MIME_ICALENDAR_UTF8,
os.toByteArray()
)
})
}
override fun listAllRemote(): Map<String, DavResponse> {
// calculate time range limits
......@@ -123,7 +123,7 @@ class CalendarSyncManager(
for (name in changes.deleted)
localCollection.findByName(name)?.let {
Logger.log.info("Deleting local event $name")
useLocal(it, { local -> local.delete() })
useLocal(it) { local -> local.delete() }
syncResult.stats.numDeletes++
}
......@@ -133,7 +133,7 @@ class CalendarSyncManager(
for (bunch in toDownload.chunked(MULTIGET_MAX_RESOURCES)) {
if (bunch.size == 1)
// only one contact, use GET
useRemote(DavResource(httpClient.okHttpClient, bunch.first()), {
useRemote(DavResource(httpClient.okHttpClient, bunch.first())) {
it.get(DavCalendar.MIME_ICALENDAR.toString()).use { dav ->
// CalDAV servers MUST return ETag on GET [https://tools.ietf.org/html/rfc4791#section-5.3.4]
val eTag = dav[GetETag::class.java]?.eTag
......@@ -143,7 +143,7 @@ class CalendarSyncManager(
processVEvent(dav.fileName(), eTag, reader)
}
}
})
}
else {
// multiple contacts, use multi-get
useRemoteCollection {
......@@ -151,7 +151,7 @@ class CalendarSyncManager(
// process multiget results
for (remote in dav.members)
useRemote(remote, {
useRemote(remote) {
val eTag = remote[GetETag::class.java]?.eTag
?: throw DavException("Received multi-get response without ETag")
......@@ -160,7 +160,7 @@ class CalendarSyncManager(
?: throw DavException("Received multi-get response without task data")
processVEvent(remote.fileName(), eTag, StringReader(iCalendar))
})
}
}
}
}
......@@ -185,7 +185,7 @@ class CalendarSyncManager(
val newData = events.first()
// delete local event, if it exists
useLocal(localCollection.findByName(fileName), { local ->
useLocal(localCollection.findByName(fileName)) { local ->
if (local != null) {
Logger.log.info("Updating $fileName in local calendar")
local.eTag = eTag
......@@ -193,12 +193,12 @@ class CalendarSyncManager(
syncResult.stats.numUpdates++
} else {
Logger.log.info("Adding $fileName to local calendar")
useLocal(LocalEvent(localCollection, newData, fileName, eTag, LocalResource.FLAG_REMOTELY_PRESENT), {
useLocal(LocalEvent(localCollection, newData, fileName, eTag, LocalResource.FLAG_REMOTELY_PRESENT)) {
it.add()
})
}
syncResult.stats.numInserts++
}
})
}
} else
Logger.log.info("Received VCALENDAR with not exactly one VEVENT with UID and without RECURRENCE-ID; ignoring $fileName")
}
......
......@@ -149,13 +149,13 @@ class ContactsSyncManager(
if (readOnly) {
for (group in localCollection.findDeletedGroups()) {
Logger.log.warning("Restoring locally deleted group (read-only address book!)")
useLocal(group, { it.resetDeleted() })
useLocal(group) { it.resetDeleted() }
numDiscarded++
}
for (contact in localCollection.findDeletedContacts()) {
Logger.log.warning("Restoring locally deleted contact (read-only address book!)")
useLocal(contact, { it.resetDeleted() })
useLocal(contact) { it.resetDeleted() }
numDiscarded++
}
......@@ -171,13 +171,13 @@ class ContactsSyncManager(
if (readOnly) {
for (group in localCollection.findDirtyGroups()) {
Logger.log.warning("Resetting locally modified group to ETag=null (read-only address book!)")
useLocal(group, { it.clearDirty(null) })
useLocal(group) { it.clearDirty(null) }
numDiscarded++
}
for (contact in localCollection.findDirtyContacts()) {
Logger.log.warning("Resetting locally modified contact to ETag=null (read-only address book!)")
useLocal(contact, { it.clearDirty(null) })
useLocal(contact) { it.clearDirty(null) }
numDiscarded++
}
......@@ -193,16 +193,16 @@ class ContactsSyncManager(
Logger.log.fine("Finally removing group $group")
// useless because Android deletes group memberships as soon as a group is set to DELETED:
// group.markMembersDirty()
useLocal(group, { it.delete() })
useLocal(group) { it.delete() }
}
// groups with DIRTY=1: mark all memberships as dirty, then clean DIRTY flag of group
for (group in localCollection.findDirtyGroups()) {
Logger.log.fine("Marking members of modified group $group as dirty")
useLocal(group, {
useLocal(group) {
it.markMembersDirty()
it.clearDirty(null)
})
}
}
} else {
/* groups as separate VCards: there are group contacts and individual contacts */
......@@ -246,7 +246,7 @@ class ContactsSyncManager(
notificationManager.notify("discarded_${account.name}", 0, notification)
}
override fun prepareUpload(resource: LocalAddress): RequestBody = useLocal(resource, {
override fun prepareUpload(resource: LocalAddress): RequestBody = useLocal(resource) {
val contact: Contact
if (resource is LocalContact) {
contact = resource.contact!!
......@@ -280,7 +280,7 @@ class ContactsSyncManager(
if (hasVCard4) DavAddressBook.MIME_VCARD4 else DavAddressBook.MIME_VCARD3_UTF8,
os.toByteArray()
)
})
}
override fun listAllRemote() = useRemoteCollection {
// fetch list of remote VCards and build hash table to index file name
......@@ -308,7 +308,7 @@ class ContactsSyncManager(
for (name in changes.deleted)
localCollection.findByName(name)?.let {
Logger.log.info("Deleting local address $name")
useLocal(it, { it.delete() })
useLocal(it) { it.delete() }
syncResult.stats.numDeletes++
}
......@@ -322,7 +322,7 @@ class ContactsSyncManager(
for (bunch in toDownload.chunked(CalendarSyncManager.MULTIGET_MAX_RESOURCES)) {
if (bunch.size == 1)
// only one contact, use GET
useRemote(DavResource(httpClient.okHttpClient, bunch.first()), {
useRemote(DavResource(httpClient.okHttpClient, bunch.first())) {
it.get("text/vcard;version=4.0, text/vcard;charset=utf-8;q=0.8, text/vcard;q=0.5").use { dav ->
// CardDAV servers MUST return ETag on GET [https://tools.ietf.org/html/rfc6352#section-6.3.2.3]
val eTag = dav[GetETag::class.java]?.eTag
......@@ -332,15 +332,14 @@ class ContactsSyncManager(
processVCard(dav.fileName(), eTag, reader, downloader)
}
}
})
}
else {
// multiple contacts, use multi-get
useRemoteCollection {
it.multiget(bunch, hasVCard4).use { dav ->
// process multi-get results
for (remote in dav.members)
useRemote(remote, {
useRemote(remote) {
val eTag = remote[GetETag::class.java]?.eTag
?: throw DavException("Received multi-get response without ETag")
......@@ -349,7 +348,7 @@ class ContactsSyncManager(
?: throw DavException("Received multi-get response without address data")
processVCard(remote.fileName(), eTag, StringReader(vCard), downloader)
})
}
}
}
}
......@@ -393,7 +392,7 @@ class ContactsSyncManager(
}
// update local contact, if it exists
useLocal(localCollection.findByName(fileName), {
useLocal(localCollection.findByName(fileName)) {
var local = it
if (local != null) {
Logger.log.log(Level.INFO, "Updating $fileName in local address book", newData)
......@@ -422,16 +421,16 @@ class ContactsSyncManager(
if (local == null) {
if (newData.group) {
Logger.log.log(Level.INFO, "Creating local group", newData)
useLocal(LocalGroup(localCollection, newData, fileName, eTag, LocalResource.FLAG_REMOTELY_PRESENT), {
useLocal(LocalGroup(localCollection, newData, fileName, eTag, LocalResource.FLAG_REMOTELY_PRESENT)) {
it.add()
local = it
})
}
} else {
Logger.log.log(Level.INFO, "Creating local contact", newData)
useLocal(LocalContact(localCollection, newData, fileName, eTag, LocalResource.FLAG_REMOTELY_PRESENT), {
useLocal(LocalContact(localCollection, newData, fileName, eTag, LocalResource.FLAG_REMOTELY_PRESENT)) {
it.add()
local = it
})
}
}
syncResult.stats.numInserts++
}
......@@ -453,9 +452,9 @@ class ContactsSyncManager(
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
// workaround for Android 7 which sets DIRTY flag when only meta-data is changed
// workaround for Android 7 which sets DIRTY flag when only meta-data is changed
(local as? LocalContact)?.updateHashCode(null)
})
}
}
......
......@@ -75,7 +75,7 @@ class TasksSyncManager(
override fun syncAlgorithm() = SyncAlgorithm.PROPFIND_REPORT
override fun prepareUpload(resource: LocalTask): RequestBody = useLocal(resource, {
override fun prepareUpload(resource: LocalTask): RequestBody = useLocal(resource) {
val task = requireNotNull(resource.task)
Logger.log.log(Level.FINE, "Preparing upload of task ${resource.fileName}", task)
......@@ -86,7 +86,7 @@ class TasksSyncManager(
DavCalendar.MIME_ICALENDAR_UTF8,
os.toByteArray()
)
})
}
override fun listAllRemote() = useRemoteCollection { remote ->
remote.calendarQuery("VTODO", null, null).use { dav ->
......@@ -104,7 +104,7 @@ class TasksSyncManager(
for (name in changes.deleted) {
localCollection.findByName(name)?.let {
Logger.log.info("Deleting local task $name")
useLocal(it, { it.delete() })
useLocal(it) { it.delete() }
syncResult.stats.numDeletes++
}
}
......@@ -115,7 +115,7 @@ class TasksSyncManager(
for (bunch in toDownload.chunked(MULTIGET_MAX_RESOURCES)) {
if (bunch.size == 1)
// only one contact, use GET
useRemote(DavResource(httpClient.okHttpClient, bunch.first()), { remote ->
useRemote(DavResource(httpClient.okHttpClient, bunch.first())) { remote ->
remote.get(DavCalendar.MIME_ICALENDAR.toString()).use { dav ->
// CalDAV servers MUST return ETag on GET [https://tools.ietf.org/html/rfc4791#section-5.3.4]
val eTag = dav[GetETag::class.java]?.eTag
......@@ -125,13 +125,13 @@ class TasksSyncManager(
processVTodo(remote.fileName(), eTag, reader)
}
}
})
}
else {
// multiple contacts, use multi-get
davCollection.multiget(bunch).use { dav ->
// process multiget results
for (remote in dav.members)
useRemote(remote, {
useRemote(remote) {
val eTag = remote[GetETag::class.java]?.eTag
?: throw DavException("Received multi-get response without ETag")
......@@ -140,7 +140,7 @@ class TasksSyncManager(
?: throw DavException("Received multi-get response without task data")
processVTodo(remote.fileName(), eTag, StringReader(iCalendar))
})
}
}
}
......@@ -161,7 +161,7 @@ class TasksSyncManager(
val newData = tasks.first()
// update local task, if it exists
useLocal(localCollection.findByName(fileName), { local ->
useLocal(localCollection.findByName(fileName)) { local ->
if (local != null) {
Logger.log.info("Updating $fileName in local task list")
local.eTag = eTag
......@@ -169,12 +169,12 @@ class TasksSyncManager(
syncResult.stats.numUpdates++
} else {
Logger.log.info("Adding $fileName to local task list")
useLocal(LocalTask(localCollection, newData, fileName, eTag, LocalResource.FLAG_REMOTELY_PRESENT), {
useLocal(LocalTask(localCollection, newData, fileName, eTag, LocalResource.FLAG_REMOTELY_PRESENT)) {
it.add()
})
}
syncResult.stats.numInserts++
}
})
}
} else
Logger.log.info("Received VCALENDAR with not exactly one VTODO; ignoring $fileName")
}
......
......@@ -142,9 +142,9 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
.setTitle(R.string.account_delete_confirmation_title)
.setMessage(R.string.account_delete_confirmation_text)
.setNegativeButton(android.R.string.no, null)
.setPositiveButton(android.R.string.yes, { _, _ ->
.setPositiveButton(android.R.string.yes) { _, _ ->
deleteAccount()
})
}
.show()
}
else ->
......@@ -220,7 +220,7 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
isChecked = info.forceReadOnly
}
popup.setOnMenuItemClickListener({ item ->
popup.setOnMenuItemClickListener { item ->
when (item.itemId) {
R.id.force_read_only -> {
val nowChecked = !item.isChecked
......@@ -241,7 +241,7 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
DeleteCollectionFragment.ConfirmDeleteCollectionFragment.newInstance(account, info).show(supportFragmentManager, null)
}
true
})
}
popup.show()
// long click was handled
......@@ -270,9 +270,9 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
val installIntent = Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=at.bitfire.icsdroid"))
if (packageManager.resolveActivity(installIntent, 0) != null)
snack.setAction(R.string.account_install_icsdroid, {
snack.setAction(R.string.account_install_icsdroid) {
startActivity(installIntent)
})
}
snack.show()
}
......@@ -569,11 +569,11 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
v.findViewById<ImageView>(R.id.read_only).visibility =
if (info.readOnly || info.forceReadOnly) View.VISIBLE else View.GONE
v.findViewById<ImageView>(R.id.action_overflow).setOnClickListener({ view ->
v.findViewById<ImageView>(R.id.action_overflow).setOnClickListener { view ->
(context as? AccountActivity)?.let {
it.onActionOverflowListener(view, info)
}
})
}
return v
}
......@@ -623,11 +623,11 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
if (info.type == CollectionInfo.Type.WEBCAL)
overflow.visibility = View.GONE
else
overflow.setOnClickListener({ view ->
overflow.setOnClickListener { view ->
(context as? AccountActivity)?.let {
it.onActionOverflowListener(view, info)
}
})
}
return v
}
......@@ -720,7 +720,7 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
}, null)
activity!!.finish()
})
.setNegativeButton(android.R.string.cancel, { _, _ -> })
.setNegativeButton(android.R.string.cancel) { _, _ -> }
.create()
}
}
......
......@@ -130,9 +130,9 @@ class AccountSettingsActivity: AppCompatActivity() {
prefCertAlias.setOnPreferenceClickListener {
KeyChain.choosePrivateKeyAlias(activity, { alias ->
accountSettings.credentials(Credentials(certificateAlias = alias))
Handler(Looper.getMainLooper()).post({
Handler(Looper.getMainLooper()).post {
loaderManager.restartLoader(0, arguments, this)
})
}
}, null, null, null, -1, credentials.certificateAlias)
true
}
......@@ -240,7 +240,7 @@ class AccountSettingsActivity: AppCompatActivity() {
.setIcon(R.drawable.ic_error_dark)
.setTitle(R.string.settings_contact_group_method_change)
.setMessage(R.string.settings_contact_group_method_change_reload_contacts)