From fcd137c9701ed8a233fe577a24cf9a2c23577885 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Sat, 7 Dec 2024 21:27:28 +0100 Subject: [PATCH] NF: Move sync files to their own subfolders --- .../main/java/com/ichi2/anki/DeckPicker.kt | 5 ++++ .../main/java/com/ichi2/anki/IntentHandler.kt | 1 + .../src/main/java/com/ichi2/anki/MyAccount.kt | 5 ++++ .../src/main/java/com/ichi2/anki/Reviewer.kt | 3 +++ .../com/ichi2/anki/SharedDecksActivity.kt | 1 + .../ichi2/anki/dialogs/BackupPromptDialog.kt | 4 ++-- .../ichi2/anki/dialogs/DatabaseErrorDialog.kt | 4 ++-- .../com/ichi2/anki/dialogs/SyncErrorDialog.kt | 4 ++-- .../CustomSyncServerSettingsFragment.kt | 2 +- .../anki/preferences/SyncSettingsFragment.kt | 2 +- .../java/com/ichi2/anki/{ => sync}/Sync.kt | 13 ++++++---- .../anki/{ => sync}/SyncActionProvider.kt | 4 +++- .../com/ichi2/anki/{ => sync}/SyncHandler.kt | 24 ++++++++++++++----- .../ui/windows/reviewer/ReviewerFragment.kt | 11 +++++---- .../com/ichi2/anki/worker/SyncMediaWorker.kt | 2 +- .../java/com/ichi2/anki/worker/SyncWorker.kt | 6 ++--- .../java/com/ichi2/ui/BadgeDrawableBuilder.kt | 2 +- .../main/res/layout/sync_progress_layout.xml | 2 +- .../src/main/res/menu-xlarge/deck_picker.xml | 2 +- AnkiDroid/src/main/res/menu/deck_picker.xml | 2 +- AnkiDroid/src/main/res/menu/reviewer.xml | 2 +- .../java/com/ichi2/anki/LoginActivityTest.kt | 1 + 22 files changed, 68 insertions(+), 34 deletions(-) rename AnkiDroid/src/main/java/com/ichi2/anki/{ => sync}/Sync.kt (94%) rename AnkiDroid/src/main/java/com/ichi2/anki/{ => sync}/SyncActionProvider.kt (96%) rename AnkiDroid/src/main/java/com/ichi2/anki/{ => sync}/SyncHandler.kt (96%) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt b/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt index e0e9baae1239..4e6949db27e6 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt @@ -139,6 +139,11 @@ import com.ichi2.anki.servicelayer.ScopedStorageService import com.ichi2.anki.snackbar.BaseSnackbarBuilderProvider import com.ichi2.anki.snackbar.SnackbarBuilder import com.ichi2.anki.snackbar.showSnackbar +import com.ichi2.anki.sync.SyncActionProvider +import com.ichi2.anki.sync.SyncCompletion +import com.ichi2.anki.sync.SyncCompletionListener +import com.ichi2.anki.sync.SyncHandler +import com.ichi2.anki.sync.SyncHandlerDelegate import com.ichi2.anki.ui.windows.reviewer.ReviewerFragment import com.ichi2.anki.utils.ext.dismissAllDialogFragments import com.ichi2.anki.utils.ext.showDialogFragment diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/IntentHandler.kt b/AnkiDroid/src/main/java/com/ichi2/anki/IntentHandler.kt index 447f66da16e1..d43ada039fae 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/IntentHandler.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/IntentHandler.kt @@ -32,6 +32,7 @@ import com.ichi2.anki.dialogs.DialogHandlerMessage import com.ichi2.anki.preferences.sharedPrefs import com.ichi2.anki.servicelayer.ScopedStorageService import com.ichi2.anki.services.ReminderService +import com.ichi2.anki.sync.millisecondsSinceLastSync import com.ichi2.anki.ui.windows.reviewer.ReviewerFragment import com.ichi2.anki.worker.SyncWorker import com.ichi2.annotations.NeedsTest diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt b/AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt index 014b2cd364d2..e460f5c26bd1 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt @@ -39,6 +39,11 @@ import com.ichi2.anki.CollectionManager.withCol import com.ichi2.anki.dialogs.help.HelpDialog import com.ichi2.anki.pages.RemoveAccountFragment import com.ichi2.anki.preferences.sharedPrefs +import com.ichi2.anki.sync.cancelSync +import com.ichi2.anki.sync.getEndpoint +import com.ichi2.anki.sync.isLoggedIn +import com.ichi2.anki.sync.syncLogout +import com.ichi2.anki.sync.updateLogin import com.ichi2.anki.utils.ext.removeFragmentFromContainer import com.ichi2.anki.utils.ext.showDialogFragment import com.ichi2.libanki.syncLogin diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt index d548f5eb683e..c85a2e831853 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt @@ -97,6 +97,9 @@ import com.ichi2.anki.scheduling.registerOnForgetHandler import com.ichi2.anki.servicelayer.NoteService.isMarked import com.ichi2.anki.servicelayer.NoteService.toggleMark import com.ichi2.anki.snackbar.showSnackbar +import com.ichi2.anki.sync.SyncActionProvider +import com.ichi2.anki.sync.SyncHandler +import com.ichi2.anki.sync.SyncHandlerDelegate import com.ichi2.anki.ui.internationalization.toSentenceCase import com.ichi2.anki.utils.ext.showDialogFragment import com.ichi2.anki.utils.navBarNeedsScrim diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksActivity.kt b/AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksActivity.kt index feda7e65a6ba..fd5a7f0ebbe8 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksActivity.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksActivity.kt @@ -37,6 +37,7 @@ import androidx.core.os.bundleOf import androidx.fragment.app.commit import com.google.android.material.snackbar.BaseTransientBottomBar.LENGTH_INDEFINITE import com.ichi2.anki.snackbar.showSnackbar +import com.ichi2.anki.sync.isLoggedIn import com.ichi2.annotations.NeedsTest import com.ichi2.ui.AccessibleSearchView import com.ichi2.utils.FileNameAndExtension diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/BackupPromptDialog.kt b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/BackupPromptDialog.kt index 43e1de382bc3..1c07ea824db2 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/BackupPromptDialog.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/BackupPromptDialog.kt @@ -25,11 +25,11 @@ import com.ichi2.anki.CollectionManager.withCol import com.ichi2.anki.CrashReportService import com.ichi2.anki.DeckPicker import com.ichi2.anki.R -import com.ichi2.anki.isLoggedIn -import com.ichi2.anki.millisecondsSinceLastSync import com.ichi2.anki.preferences.sharedPrefs import com.ichi2.anki.servicelayer.ScopedStorageService.collectionWillBeMadeInaccessibleAfterUninstall import com.ichi2.anki.servicelayer.ScopedStorageService.userIsPromptedToDeleteCollectionOnUninstall +import com.ichi2.anki.sync.isLoggedIn +import com.ichi2.anki.sync.millisecondsSinceLastSync import com.ichi2.compat.CompatHelper.Companion.getPackageInfoCompat import com.ichi2.compat.PackageInfoFlagsCompat import com.ichi2.libanki.utils.TimeManager diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DatabaseErrorDialog.kt b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DatabaseErrorDialog.kt index f679fccc209b..c6f8c2fa1b26 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DatabaseErrorDialog.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DatabaseErrorDialog.kt @@ -35,7 +35,6 @@ import com.ichi2.anki.AnkiActivity import com.ichi2.anki.BackupManager import com.ichi2.anki.CollectionHelper import com.ichi2.anki.CollectionManager -import com.ichi2.anki.ConflictResolution import com.ichi2.anki.DatabaseRestorationListener import com.ichi2.anki.DeckPicker import com.ichi2.anki.LocalizedUnambiguousBackupTimeFormatter @@ -54,11 +53,12 @@ import com.ichi2.anki.dialogs.DatabaseErrorDialog.DatabaseErrorDialogType.DIALOG import com.ichi2.anki.dialogs.DatabaseErrorDialog.DatabaseErrorDialogType.DIALOG_STORAGE_UNAVAILABLE_AFTER_UNINSTALL import com.ichi2.anki.dialogs.DatabaseErrorDialog.DatabaseErrorDialogType.INCOMPATIBLE_DB_VERSION import com.ichi2.anki.dialogs.ImportFileSelectionFragment.ImportOptions -import com.ichi2.anki.isLoggedIn import com.ichi2.anki.launchCatchingTask import com.ichi2.anki.requireAnkiActivity import com.ichi2.anki.servicelayer.DebugInfoService import com.ichi2.anki.showImportDialog +import com.ichi2.anki.sync.ConflictResolution +import com.ichi2.anki.sync.isLoggedIn import com.ichi2.anki.utils.ext.dismissAllDialogFragments import com.ichi2.libanki.Consts import com.ichi2.libanki.utils.TimeManager diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/SyncErrorDialog.kt b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/SyncErrorDialog.kt index f71ddbc9ac43..ad0f57a6d56a 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/SyncErrorDialog.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/SyncErrorDialog.kt @@ -25,11 +25,11 @@ import androidx.annotation.VisibleForTesting import androidx.appcompat.app.AlertDialog import androidx.core.os.bundleOf import com.ichi2.anki.AnkiActivity -import com.ichi2.anki.ConflictResolution import com.ichi2.anki.DeckPicker import com.ichi2.anki.R -import com.ichi2.anki.joinSyncMessages import com.ichi2.anki.showError +import com.ichi2.anki.sync.ConflictResolution +import com.ichi2.anki.sync.joinSyncMessages import com.ichi2.anki.utils.ext.dismissAllDialogFragments class SyncErrorDialog : AsyncDialogFragment() { diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/CustomSyncServerSettingsFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/CustomSyncServerSettingsFragment.kt index 6fa3dee7fb03..2b95992afa31 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/CustomSyncServerSettingsFragment.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/CustomSyncServerSettingsFragment.kt @@ -21,8 +21,8 @@ import androidx.appcompat.app.AlertDialog import androidx.core.content.edit import com.ichi2.anki.CollectionManager import com.ichi2.anki.R -import com.ichi2.anki.SyncPreferences import com.ichi2.anki.snackbar.showSnackbar +import com.ichi2.anki.sync.SyncPreferences import com.ichi2.preferences.VersatileTextPreference import com.ichi2.utils.show import okhttp3.HttpUrl.Companion.toHttpUrl diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/SyncSettingsFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/SyncSettingsFragment.kt index f6bf3439e488..d57531832ae8 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/SyncSettingsFragment.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/SyncSettingsFragment.kt @@ -21,9 +21,9 @@ import com.google.android.material.snackbar.Snackbar import com.ichi2.anki.CollectionManager.TR import com.ichi2.anki.CollectionManager.withCol import com.ichi2.anki.R -import com.ichi2.anki.customSyncBase import com.ichi2.anki.launchCatchingTask import com.ichi2.anki.snackbar.showSnackbar +import com.ichi2.anki.sync.customSyncBase import com.ichi2.anki.utils.ext.sharedPrefs import com.ichi2.utils.show diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt b/AnkiDroid/src/main/java/com/ichi2/anki/sync/Sync.kt similarity index 94% rename from AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt rename to AnkiDroid/src/main/java/com/ichi2/anki/sync/Sync.kt index f5b46f3bf619..90dfd25eaab4 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/sync/Sync.kt @@ -14,7 +14,7 @@ * this program. If not, see . * ****************************************************************************************/ -package com.ichi2.anki +package com.ichi2.anki.sync import android.content.Context import android.content.SharedPreferences @@ -22,9 +22,15 @@ import androidx.activity.result.ActivityResult import androidx.activity.result.ActivityResultCallback import androidx.core.content.edit import anki.sync.SyncAuth +import com.ichi2.anki.AnkiDroidApp +import com.ichi2.anki.BackupManager import com.ichi2.anki.CollectionManager.TR import com.ichi2.anki.CollectionManager.withCol +import com.ichi2.anki.DeckPicker +import com.ichi2.anki.ProgressContext +import com.ichi2.anki.R import com.ichi2.anki.preferences.sharedPrefs +import com.ichi2.anki.withProgress import com.ichi2.anki.worker.SyncMediaWorker import com.ichi2.libanki.MediaCheckResult import com.ichi2.libanki.createBackup @@ -117,10 +123,7 @@ suspend fun syncLogout(context: Context) { * or even that the ankiweb account is still valid. */ fun isLoggedIn() = - AnkiDroidApp.instance - .sharedPrefs() - .getString(SyncPreferences.HKEY, "")!! - .isNotEmpty() + AnkiDroidApp.Companion.instance.sharedPrefs().getString(SyncPreferences.HKEY, "")!!.isNotEmpty() fun millisecondsSinceLastSync(preferences: SharedPreferences) = TimeManager.time.intTimeMS() - preferences.getLong("lastSyncTime", 0) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/SyncActionProvider.kt b/AnkiDroid/src/main/java/com/ichi2/anki/sync/SyncActionProvider.kt similarity index 96% rename from AnkiDroid/src/main/java/com/ichi2/anki/SyncActionProvider.kt rename to AnkiDroid/src/main/java/com/ichi2/anki/sync/SyncActionProvider.kt index 7fb54b1fb89a..755c91cef302 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/SyncActionProvider.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/sync/SyncActionProvider.kt @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -package com.ichi2.anki +package com.ichi2.anki.sync import android.app.Activity import android.content.Context @@ -24,6 +24,8 @@ import android.view.View import androidx.appcompat.widget.AppCompatImageButton import androidx.core.view.isVisible import com.google.android.material.progressindicator.LinearProgressIndicator +import com.ichi2.anki.ActionProviderCompat +import com.ichi2.anki.R import com.ichi2.compat.setTooltipTextCompat import com.ichi2.ui.RtlCompliantActionProvider.Companion.unwrapContext diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/SyncHandler.kt b/AnkiDroid/src/main/java/com/ichi2/anki/sync/SyncHandler.kt similarity index 96% rename from AnkiDroid/src/main/java/com/ichi2/anki/SyncHandler.kt rename to AnkiDroid/src/main/java/com/ichi2/anki/sync/SyncHandler.kt index 0dbc072d6caf..697f157b3136 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/SyncHandler.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/sync/SyncHandler.kt @@ -19,7 +19,7 @@ * this program. If not, see . * ****************************************************************************************/ -package com.ichi2.anki +package com.ichi2.anki.sync import android.app.Activity.RESULT_OK import android.content.Intent @@ -41,16 +41,28 @@ import anki.sync.SyncCollectionResponse import anki.sync.SyncStatusResponse import com.google.android.material.progressindicator.LinearProgressIndicator import com.google.android.material.snackbar.Snackbar +import com.ichi2.anki.AnkiActivity +import com.ichi2.anki.AnkiDroidApp +import com.ichi2.anki.BackupManager +import com.ichi2.anki.Channel +import com.ichi2.anki.CollectionIntegrityStorageCheck +import com.ichi2.anki.CollectionManager import com.ichi2.anki.CollectionManager.TR import com.ichi2.anki.CollectionManager.withCol +import com.ichi2.anki.MyAccount +import com.ichi2.anki.ProgressContext +import com.ichi2.anki.R import com.ichi2.anki.dialogs.AsyncDialogFragment import com.ichi2.anki.dialogs.MediaCheckDialog import com.ichi2.anki.dialogs.SyncErrorDialog import com.ichi2.anki.dialogs.SyncErrorDialog.Companion.newInstance import com.ichi2.anki.dialogs.SyncErrorDialog.SyncErrorDialogListener +import com.ichi2.anki.handleDatabaseCheck +import com.ichi2.anki.launchCatchingTask import com.ichi2.anki.preferences.sharedPrefs import com.ichi2.anki.servicelayer.checkMedia import com.ichi2.anki.snackbar.showSnackbar +import com.ichi2.anki.withProgress import com.ichi2.anki.worker.SyncMediaWorker import com.ichi2.anki.worker.SyncWorker import com.ichi2.anki.worker.UniqueWorkNames @@ -336,7 +348,7 @@ class SyncHandler( override fun integrityCheck() { // #5852 - We were having issues with integrity checks where the users had run out of space. // display a dialog box if we don't have the space - val status = CollectionIntegrityStorageCheck.createInstance(activity) + val status = CollectionIntegrityStorageCheck.Companion.createInstance(activity) if (status.shouldWarnOnIntegrityCheck()) { Timber.d("Displaying File Size confirmation") AlertDialog.Builder(activity).show { @@ -376,7 +388,7 @@ class SyncHandler( return } - MyAccount.checkNotificationPermission(activity, notificationPermissionLauncher) + MyAccount.Companion.checkNotificationPermission(activity, notificationPermissionLauncher) /** Nested private function that makes the connection to * the sync server and starts syncing the data */ @@ -547,7 +559,7 @@ class SyncHandler( withCol { try { createBackup( - BackupManager.getBackupDirectoryFromCollection(path), + BackupManager.Companion.getBackupDirectoryFromCollection(path), force = true, waitForCompletion = true, ) @@ -669,7 +681,7 @@ class SyncHandler( syncMessage: String?, ) { if (delegate.activityPaused()) { - val res = AnkiDroidApp.appResources + val res = AnkiDroidApp.Companion.appResources activity.showSimpleNotification( res.getString(R.string.app_name), res.getString(messageResource), @@ -679,7 +691,7 @@ class SyncHandler( if (syncMessage.isNullOrEmpty()) { activity.showSnackbar(messageResource) } else { - val res = AnkiDroidApp.appResources + val res = AnkiDroidApp.Companion.appResources activity.showSimpleMessageDialog(title = res.getString(messageResource), message = syncMessage) } } diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt index 5ae5ab99ad88..09dd827628b2 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/reviewer/ReviewerFragment.kt @@ -23,7 +23,6 @@ import android.text.style.UnderlineSpan import android.view.Menu import android.view.MenuItem import android.view.View -import androidx.appcompat.widget.Toolbar import android.webkit.WebView import android.widget.FrameLayout import androidx.activity.result.ActivityResult @@ -31,6 +30,7 @@ import androidx.activity.result.ActivityResultCallback import androidx.activity.result.contract.ActivityResultContracts import androidx.annotation.StringRes import androidx.appcompat.view.menu.MenuBuilder +import androidx.appcompat.widget.Toolbar import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.view.MenuItemCompat import androidx.core.view.ViewCompat @@ -50,9 +50,6 @@ import com.ichi2.anki.Flag import com.ichi2.anki.NoteEditor import com.ichi2.anki.R import com.ichi2.anki.Reviewer.Companion.ENABLE_SYNC -import com.ichi2.anki.SyncActionProvider -import com.ichi2.anki.SyncHandler -import com.ichi2.anki.SyncHandlerDelegate import com.ichi2.anki.cardviewer.CardMediaPlayer import com.ichi2.anki.dialogs.MediaCheckDialog import com.ichi2.anki.dialogs.SyncErrorDialog @@ -64,6 +61,9 @@ import com.ichi2.anki.requireAnkiActivity import com.ichi2.anki.snackbar.BaseSnackbarBuilderProvider import com.ichi2.anki.snackbar.SnackbarBuilder import com.ichi2.anki.snackbar.showSnackbar +import com.ichi2.anki.sync.SyncActionProvider +import com.ichi2.anki.sync.SyncHandler +import com.ichi2.anki.sync.SyncHandlerDelegate import com.ichi2.anki.utils.ext.collectIn import com.ichi2.anki.utils.ext.collectLatestIn import com.ichi2.anki.utils.ext.dismissAllDialogFragments @@ -81,7 +81,8 @@ class ReviewerFragment : CardViewerFragment(R.layout.reviewer2), BaseSnackbarBuilderProvider, SyncHandlerDelegate, - SyncErrorDialog.SyncErrorDialogListenerProvider,Toolbar.OnMenuItemClickListener { + SyncErrorDialog.SyncErrorDialogListenerProvider, + Toolbar.OnMenuItemClickListener { /** * Whether to offer the user to sync. * Normally, only the deck picker deal with syncing. But direct intent could avoid the deckPicker. diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncMediaWorker.kt b/AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncMediaWorker.kt index b7fa39238eef..49f706b3dc3f 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncMediaWorker.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncMediaWorker.kt @@ -38,8 +38,8 @@ import anki.sync.syncAuth import com.ichi2.anki.Channel import com.ichi2.anki.CollectionManager import com.ichi2.anki.R -import com.ichi2.anki.cancelMediaSync import com.ichi2.anki.notifications.NotificationId +import com.ichi2.anki.sync.cancelMediaSync import com.ichi2.anki.utils.ext.trySetForeground import kotlinx.coroutines.CancellationException import kotlinx.coroutines.delay diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncWorker.kt b/AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncWorker.kt index cbab0b484790..d7337feee0f5 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncWorker.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/worker/SyncWorker.kt @@ -41,11 +41,11 @@ import com.ichi2.anki.CollectionManager import com.ichi2.anki.CollectionManager.TR import com.ichi2.anki.CollectionManager.withCol import com.ichi2.anki.R -import com.ichi2.anki.SyncPreferences -import com.ichi2.anki.cancelSync import com.ichi2.anki.notifications.NotificationId import com.ichi2.anki.preferences.sharedPrefs -import com.ichi2.anki.setLastSyncTimeToNow +import com.ichi2.anki.sync.SyncPreferences +import com.ichi2.anki.sync.cancelSync +import com.ichi2.anki.sync.setLastSyncTimeToNow import com.ichi2.anki.utils.ext.trySetForeground import com.ichi2.libanki.syncCollection import kotlinx.coroutines.CoroutineScope diff --git a/AnkiDroid/src/main/java/com/ichi2/ui/BadgeDrawableBuilder.kt b/AnkiDroid/src/main/java/com/ichi2/ui/BadgeDrawableBuilder.kt index 7759e8ed40ab..4acbfa0920cf 100644 --- a/AnkiDroid/src/main/java/com/ichi2/ui/BadgeDrawableBuilder.kt +++ b/AnkiDroid/src/main/java/com/ichi2/ui/BadgeDrawableBuilder.kt @@ -20,7 +20,7 @@ import android.content.Context import android.graphics.drawable.Drawable import androidx.core.content.ContextCompat import com.ichi2.anki.R -import com.ichi2.anki.SyncActionProvider +import com.ichi2.anki.sync.SyncActionProvider import timber.log.Timber class BadgeDrawableBuilder( diff --git a/AnkiDroid/src/main/res/layout/sync_progress_layout.xml b/AnkiDroid/src/main/res/layout/sync_progress_layout.xml index 18c3414e24b6..362e3173b910 100644 --- a/AnkiDroid/src/main/res/layout/sync_progress_layout.xml +++ b/AnkiDroid/src/main/res/layout/sync_progress_layout.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" - tools:context=".SyncActionProvider"> + tools:context=".sync.SyncActionProvider">