diff --git a/app/src/main/java/com/todoroo/astrid/activity/ShareLinkActivity.kt b/app/src/main/java/com/todoroo/astrid/activity/ShareLinkActivity.kt index 2b700a28c..bcfeeb9b5 100644 --- a/app/src/main/java/com/todoroo/astrid/activity/ShareLinkActivity.kt +++ b/app/src/main/java/com/todoroo/astrid/activity/ShareLinkActivity.kt @@ -4,7 +4,6 @@ import android.content.Intent import android.net.Uri import android.os.Bundle import androidx.lifecycle.lifecycleScope -import com.google.common.collect.Lists import com.google.common.io.Files import com.todoroo.astrid.data.Task import com.todoroo.astrid.service.TaskCreator @@ -90,7 +89,7 @@ class ShareLinkActivity : InjectingAppCompatActivity() { ?: uri.lastPathSegment } val basename = Files.getNameWithoutExtension(filename!!) - return Lists.newArrayList(FileHelper.copyToUri(this, preferences.attachmentsDirectory!!, uri, basename)) + return arrayListOf(FileHelper.copyToUri(this, preferences.attachmentsDirectory!!, uri, basename)) } private fun copyMultipleAttachments(intent: Intent): ArrayList { diff --git a/app/src/main/java/com/todoroo/astrid/service/TaskDuplicator.kt b/app/src/main/java/com/todoroo/astrid/service/TaskDuplicator.kt index 0ce75df0b..b5a4dd86a 100644 --- a/app/src/main/java/com/todoroo/astrid/service/TaskDuplicator.kt +++ b/app/src/main/java/com/todoroo/astrid/service/TaskDuplicator.kt @@ -1,6 +1,5 @@ package com.todoroo.astrid.service -import com.google.common.collect.Lists import com.todoroo.andlib.utility.DateUtilities import com.todoroo.astrid.dao.TaskDao import com.todoroo.astrid.data.Task @@ -54,7 +53,7 @@ class TaskDuplicator @Inject constructor( val newId = taskDao.createNew(clone) val tags = tagDataDao.getTagDataForTask(originalId) if (tags.isNotEmpty()) { - tagDao.insert(Lists.transform(tags) { td: TagData? -> Tag(clone, td!!) }) + tagDao.insert(tags.map { Tag(clone, it) }) } val googleTask = googleTaskDao.getByTaskId(originalId) val addToTop = preferences.addTasksToTop() @@ -71,7 +70,7 @@ class TaskDuplicator @Inject constructor( } val alarms = alarmDao.getAlarms(originalId) if (alarms.isNotEmpty()) { - alarmDao.insert(Lists.transform(alarms) { a: Alarm? -> Alarm(clone.id, a!!.time) }) + alarmDao.insert(alarms.map { Alarm(clone.id, it.time) }) } gcalHelper.createTaskEventIfEnabled(clone) taskDao.save(clone, null) // TODO: delete me diff --git a/app/src/main/java/org/tasks/etesync/EteSyncClient.kt b/app/src/main/java/org/tasks/etesync/EteSyncClient.kt index 0229a8437..8fb3a273a 100644 --- a/app/src/main/java/org/tasks/etesync/EteSyncClient.kt +++ b/app/src/main/java/org/tasks/etesync/EteSyncClient.kt @@ -15,7 +15,6 @@ import com.etesync.journalmanager.model.CollectionInfo import com.etesync.journalmanager.model.CollectionInfo.Companion.fromJson import com.etesync.journalmanager.model.SyncEntry import com.etesync.journalmanager.util.TokenAuthenticator -import com.google.common.collect.Lists import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -213,7 +212,7 @@ class EteSyncClient { suspend fun pushEntries(journal: Journal, entries: List?, remoteCtag: String?) = withContext(Dispatchers.IO) { var remoteCtag = remoteCtag val journalEntryManager = JournalEntryManager(httpClient!!, httpUrl!!, journal.uid!!) - for (partition in Lists.partition(entries!!, MAX_PUSH)) { + for (partition in entries!!.chunked(MAX_PUSH)) { journalEntryManager.create(partition, remoteCtag) remoteCtag = partition[partition.size - 1].uid } diff --git a/app/src/main/java/org/tasks/gtasks/GoogleAccountManager.kt b/app/src/main/java/org/tasks/gtasks/GoogleAccountManager.kt index 12a5b9309..1a0063011 100644 --- a/app/src/main/java/org/tasks/gtasks/GoogleAccountManager.kt +++ b/app/src/main/java/org/tasks/gtasks/GoogleAccountManager.kt @@ -10,7 +10,6 @@ import android.content.Context import android.os.Bundle import com.google.api.services.drive.DriveScopes import com.google.api.services.tasks.TasksScopes -import com.google.common.collect.Lists import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -30,7 +29,7 @@ class GoogleAccountManager @Inject constructor( private val accountManager: AccountManager = AccountManager.get(context) val accounts: List - get() = Lists.transform(accountList) { account: Account? -> account!!.name } + get() = accountList.map { it.name } private val accountList: List get() = if (permissionChecker.canAccessAccounts()) { diff --git a/app/src/main/java/org/tasks/gtasks/GoogleTaskSynchronizer.kt b/app/src/main/java/org/tasks/gtasks/GoogleTaskSynchronizer.kt index 7c30fdc1c..15ba8d8cc 100644 --- a/app/src/main/java/org/tasks/gtasks/GoogleTaskSynchronizer.kt +++ b/app/src/main/java/org/tasks/gtasks/GoogleTaskSynchronizer.kt @@ -6,7 +6,6 @@ import com.google.api.client.util.DateTime import com.google.api.services.tasks.model.Task import com.google.api.services.tasks.model.TaskList import com.google.api.services.tasks.model.Tasks -import com.google.common.collect.Lists import com.todoroo.andlib.utility.DateUtilities import com.todoroo.astrid.api.GtasksFilter import com.todoroo.astrid.dao.TaskDao @@ -129,7 +128,7 @@ class GoogleTaskSynchronizer @Inject constructor( preferences.setString(R.string.p_default_list, null) } } - for (list in googleTaskListDao.getByRemoteId(Lists.transform(gtaskLists) { obj: TaskList? -> obj!!.id })) { + for (list in googleTaskListDao.getByRemoteId(gtaskLists.map { it.id })) { if (isNullOrEmpty(list.remoteId)) { firebase.reportException(RuntimeException("Empty remote id")) continue diff --git a/app/src/main/java/org/tasks/jobs/NotificationService.kt b/app/src/main/java/org/tasks/jobs/NotificationService.kt index 45cd5b7d8..6155634a9 100644 --- a/app/src/main/java/org/tasks/jobs/NotificationService.kt +++ b/app/src/main/java/org/tasks/jobs/NotificationService.kt @@ -2,7 +2,6 @@ package org.tasks.jobs import android.content.Intent import android.os.IBinder -import com.google.common.collect.Lists import com.todoroo.andlib.utility.AndroidUtilities import dagger.hilt.android.AndroidEntryPoint import org.tasks.Notifier @@ -31,7 +30,7 @@ class NotificationService : InjectingService() { if (!notificationQueue.remove(overdueJobs)) { throw RuntimeException("Failed to remove jobs from queue") } - notifier.triggerNotifications(Lists.transform(overdueJobs) { obj: NotificationQueueEntry? -> obj!!.toNotification() }) + notifier.triggerNotifications(overdueJobs.map { it.toNotification() }) } }