From 043e3784e8b5e14b2a37cbe5f58801ce098f888d Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 26 Feb 2020 18:03:34 -0500 Subject: [PATCH] Run linter --- app/src/main/java/eu/kanade/tachiyomi/App.kt | 1 - .../java/eu/kanade/tachiyomi/AppModule.kt | 2 - .../java/eu/kanade/tachiyomi/Migrations.kt | 3 +- .../tachiyomi/data/backup/BackupConst.kt | 1 - .../data/backup/BackupCreateService.kt | 4 +- .../tachiyomi/data/backup/BackupManager.kt | 2 +- .../data/backup/BackupRestoreService.kt | 54 ++++++++++++------- .../backup/serializer/CategoryTypeAdapter.kt | 2 +- .../backup/serializer/HistoryTypeAdapter.kt | 2 +- .../backup/serializer/MangaTypeAdapter.kt | 2 +- .../tachiyomi/data/cache/ChapterCache.kt | 6 +-- .../kanade/tachiyomi/data/cache/CoverCache.kt | 3 +- .../tachiyomi/data/database/DatabaseHelper.kt | 5 +- .../tachiyomi/data/database/DbExtensions.kt | 1 - .../tachiyomi/data/database/DbOpenCallback.kt | 1 - .../tachiyomi/data/database/DbProvider.kt | 3 +- .../database/mappers/ChapterTypeMapping.kt | 1 - .../data/database/mappers/TrackTypeMapping.kt | 1 - .../data/database/models/Category.kt | 3 +- .../data/database/models/CategoryImpl.kt | 1 - .../data/database/models/ChapterImpl.kt | 3 +- .../data/database/models/LibraryManga.kt | 3 +- .../tachiyomi/data/database/models/Manga.kt | 3 +- .../data/database/models/MangaCategory.kt | 1 - .../database/models/MangaChapterHistory.kt | 2 +- .../data/database/models/MangaImpl.kt | 2 - .../tachiyomi/data/database/models/Track.kt | 1 - .../data/database/models/TrackImpl.kt | 1 - .../data/database/queries/CategoryQueries.kt | 3 +- .../data/database/queries/ChapterQueries.kt | 1 - .../database/queries/MangaCategoryQueries.kt | 3 +- .../data/database/queries/RawQueries.kt | 2 +- .../data/database/queries/TrackQueries.kt | 3 +- .../resolvers/ChapterBackupPutResolver.kt | 2 - .../resolvers/ChapterProgressPutResolver.kt | 2 - .../ChapterSourceOrderPutResolver.kt | 3 +- .../resolvers/HistoryLastReadPutResolver.kt | 1 - .../resolvers/LibraryMangaGetResolver.kt | 1 - .../resolvers/MangaChapterGetResolver.kt | 1 - .../resolvers/MangaFavoritePutResolver.kt | 2 - .../resolvers/MangaFlagsPutResolver.kt | 2 - .../resolvers/MangaLastUpdatedPutResolver.kt | 2 - .../resolvers/MangaTitlePutResolver.kt | 1 - .../resolvers/MangaViewerPutResolver.kt | 1 - .../data/database/tables/CategoryTable.kt | 1 - .../data/database/tables/ChapterTable.kt | 1 - .../database/tables/MangaCategoryTable.kt | 1 - .../tachiyomi/data/download/DownloadCache.kt | 29 +++++----- .../data/download/DownloadManager.kt | 1 - .../data/download/DownloadNotifier.kt | 2 +- .../data/download/DownloadPendingDeleter.kt | 19 ++++--- .../data/download/DownloadProvider.kt | 1 - .../data/download/DownloadService.kt | 1 - .../tachiyomi/data/download/DownloadStore.kt | 5 +- .../tachiyomi/data/download/Downloader.kt | 20 +++---- .../data/download/model/DownloadQueue.kt | 11 ++-- .../tachiyomi/data/glide/FileFetcher.kt | 2 +- .../data/glide/LibraryMangaUrlFetcher.kt | 12 ++--- .../tachiyomi/data/glide/MangaModelLoader.kt | 14 ++--- .../tachiyomi/data/glide/MangaSignature.kt | 2 +- .../data/glide/PassthroughModelLoader.kt | 16 +++--- .../tachiyomi/data/glide/TachiGlideModule.kt | 2 +- .../data/library/LibraryUpdateRanker.kt | 1 - .../data/library/LibraryUpdateService.kt | 24 ++++----- .../data/notification/NotificationReceiver.kt | 13 +++-- .../data/preference/PreferenceKeys.kt | 1 - .../data/preference/PreferenceValues.kt | 1 - .../data/preference/PreferencesHelper.kt | 4 +- .../tachiyomi/data/track/TrackManager.kt | 1 - .../tachiyomi/data/track/anilist/Anilist.kt | 2 - .../data/track/anilist/AnilistApi.kt | 6 +-- .../data/track/anilist/AnilistInterceptor.kt | 2 - .../data/track/anilist/AnilistModels.kt | 30 ++++++----- .../tachiyomi/data/track/anilist/OAuth.kt | 11 ++-- .../tachiyomi/data/track/bangumi/Avatar.kt | 6 +-- .../data/track/bangumi/BangumiApi.kt | 4 +- .../data/track/bangumi/Collection.kt | 18 +++---- .../tachiyomi/data/track/bangumi/OAuth.kt | 14 +++-- .../tachiyomi/data/track/bangumi/Status.kt | 6 +-- .../tachiyomi/data/track/bangumi/User.kt | 14 ++--- .../tachiyomi/data/track/kitsu/Kitsu.kt | 3 +- .../tachiyomi/data/track/kitsu/KitsuApi.kt | 37 +++++-------- .../data/track/kitsu/KitsuInterceptor.kt | 1 - .../tachiyomi/data/track/kitsu/KitsuModels.kt | 2 - .../tachiyomi/data/track/kitsu/OAuth.kt | 13 ++--- .../tachiyomi/data/track/model/TrackSearch.kt | 1 - .../data/track/myanimelist/MyAnimeList.kt | 1 - .../data/track/myanimelist/MyAnimeListApi.kt | 7 ++- .../tachiyomi/data/track/shikimori/OAuth.kt | 12 ++--- .../data/track/shikimori/ShikimoriApi.kt | 5 -- .../kanade/tachiyomi/data/updater/Release.kt | 1 - .../tachiyomi/data/updater/UpdateChecker.kt | 1 - .../tachiyomi/data/updater/UpdateResult.kt | 1 - .../tachiyomi/data/updater/UpdaterJob.kt | 1 - .../tachiyomi/data/updater/UpdaterService.kt | 4 +- .../data/updater/devrepo/DevRepoRelease.kt | 1 - .../updater/devrepo/DevRepoUpdateChecker.kt | 1 - .../updater/devrepo/DevRepoUpdateResult.kt | 1 - .../data/updater/github/GithubRelease.kt | 9 ++-- .../data/updater/github/GithubService.kt | 1 - .../updater/github/GithubUpdateChecker.kt | 1 - .../data/updater/github/GithubUpdateResult.kt | 1 - .../tachiyomi/extension/ExtensionManager.kt | 5 +- .../tachiyomi/extension/model/Extension.kt | 49 +++++++++-------- .../util/ExtensionInstallReceiver.kt | 1 - .../extension/util/ExtensionInstaller.kt | 5 +- .../extension/util/ExtensionLoader.kt | 1 - .../network/CloudflareInterceptor.kt | 17 +++--- .../kanade/tachiyomi/network/NetworkHelper.kt | 3 +- .../tachiyomi/network/OkHttpExtensions.kt | 8 +-- .../tachiyomi/network/ProgressListener.kt | 2 +- .../tachiyomi/network/ProgressResponseBody.kt | 2 +- .../eu/kanade/tachiyomi/network/Requests.kt | 20 ++++--- .../tachiyomi/source/CatalogueSource.kt | 2 +- .../eu/kanade/tachiyomi/source/LocalSource.kt | 9 ++-- .../java/eu/kanade/tachiyomi/source/Source.kt | 3 +- .../kanade/tachiyomi/source/model/Filter.kt | 5 +- .../tachiyomi/source/model/FilterList.kt | 3 +- .../tachiyomi/source/model/MangasPage.kt | 2 +- .../eu/kanade/tachiyomi/source/model/Page.kt | 9 ++-- .../kanade/tachiyomi/source/model/SChapter.kt | 3 +- .../tachiyomi/source/model/SChapterImpl.kt | 1 - .../kanade/tachiyomi/source/model/SManga.kt | 3 +- .../tachiyomi/source/model/SMangaImpl.kt | 3 +- .../tachiyomi/source/online/HttpSource.kt | 6 +-- .../tachiyomi/source/online/LoginSource.kt | 3 +- .../ui/base/activity/BaseActivity.kt | 3 +- .../ui/base/activity/BaseRxActivity.kt | 1 - .../ui/base/controller/BaseController.kt | 1 - .../ui/base/controller/DialogController.kt | 2 +- .../NoToolbarElevationController.kt | 2 +- .../ui/base/controller/RxController.kt | 30 ++++++----- .../ui/base/holder/BaseFlexibleViewHolder.kt | 10 ++-- .../tachiyomi/ui/base/holder/SlicedHolder.kt | 10 ++-- .../ui/base/presenter/BasePresenter.kt | 1 - .../presenter/NucleusConductorDelegate.kt | 1 - .../NucleusConductorLifecycleListener.kt | 1 - .../ui/catalogue/CatalogueAdapter.kt | 1 - .../ui/catalogue/CataloguePresenter.kt | 8 +-- .../kanade/tachiyomi/ui/catalogue/LangItem.kt | 10 ++-- .../catalogue/SourceDividerItemDecoration.kt | 9 ++-- .../tachiyomi/ui/catalogue/SourceItem.kt | 10 ++-- .../browse/BrowseCatalogueController.kt | 4 +- .../browse/BrowseCataloguePresenter.kt | 11 ++-- .../ui/catalogue/browse/CatalogueHolder.kt | 1 - .../ui/catalogue/browse/CatalogueItem.kt | 13 +++-- .../catalogue/browse/CatalogueListHolder.kt | 1 - .../browse/CatalogueNavigationView.kt | 6 +-- .../ui/catalogue/browse/CataloguePager.kt | 3 +- .../ui/catalogue/browse/NoResultsException.kt | 2 +- .../tachiyomi/ui/catalogue/browse/Pager.kt | 1 - .../ui/catalogue/browse/ProgressItem.kt | 2 - .../tachiyomi/ui/catalogue/filter/SortItem.kt | 1 - .../ui/catalogue/filter/TriStateItem.kt | 3 +- .../CatalogueSearchCardAdapter.kt | 3 +- .../CatalogueSearchCardHolder.kt | 5 +- .../global_search/CatalogueSearchCardItem.kt | 9 ++-- .../CatalogueSearchController.kt | 5 +- .../global_search/CatalogueSearchHolder.kt | 1 - .../global_search/CatalogueSearchItem.kt | 13 +++-- .../global_search/CatalogueSearchPresenter.kt | 11 ++-- .../latest/LatestUpdatesController.kt | 2 - .../ui/catalogue/latest/LatestUpdatesPager.kt | 1 - .../latest/LatestUpdatesPresenter.kt | 3 +- .../tachiyomi/ui/category/CategoryAdapter.kt | 1 - .../ui/category/CategoryController.kt | 3 +- .../ui/category/CategoryCreateDialog.kt | 1 - .../tachiyomi/ui/category/CategoryHolder.kt | 1 - .../tachiyomi/ui/category/CategoryItem.kt | 11 ++-- .../ui/category/CategoryPresenter.kt | 5 +- .../ui/category/CategoryRenameDialog.kt | 1 - .../tachiyomi/ui/download/DownloadAdapter.kt | 1 - .../ui/download/DownloadController.kt | 5 +- .../tachiyomi/ui/download/DownloadHolder.kt | 1 - .../ui/download/DownloadPresenter.kt | 3 +- .../ui/extension/ExtensionController.kt | 1 - .../extension/ExtensionDetailsController.kt | 1 - .../ui/extension/ExtensionDetailsPresenter.kt | 4 +- .../ExtensionDividerItemDecoration.kt | 9 ++-- .../ui/extension/ExtensionGroupItem.kt | 9 ++-- .../tachiyomi/ui/extension/ExtensionHolder.kt | 1 - .../tachiyomi/ui/extension/ExtensionItem.kt | 17 +++--- .../ui/extension/ExtensionPresenter.kt | 20 ++++--- .../ui/library/ChangeMangaCategoriesDialog.kt | 11 ++-- .../tachiyomi/ui/library/LibraryAdapter.kt | 1 - .../ui/library/LibraryCategoryAdapter.kt | 1 - .../ui/library/LibraryCategoryView.kt | 2 - .../tachiyomi/ui/library/LibraryController.kt | 8 ++- .../tachiyomi/ui/library/LibraryGridHolder.kt | 7 ++- .../tachiyomi/ui/library/LibraryHolder.kt | 5 +- .../tachiyomi/ui/library/LibraryItem.kt | 10 ++-- .../tachiyomi/ui/library/LibraryListHolder.kt | 7 ++- .../ui/library/LibraryNavigationView.kt | 5 +- .../tachiyomi/ui/library/LibraryPresenter.kt | 21 ++++---- .../tachiyomi/ui/library/LibrarySort.kt | 1 - .../kanade/tachiyomi/ui/main/MainActivity.kt | 26 +++++---- .../kanade/tachiyomi/ui/main/TabsAnimator.kt | 1 - .../tachiyomi/ui/manga/MangaController.kt | 4 +- .../ui/manga/chapter/ChapterHolder.kt | 11 ++-- .../tachiyomi/ui/manga/chapter/ChapterItem.kt | 11 ++-- .../ui/manga/chapter/ChaptersAdapter.kt | 7 ++- .../ui/manga/chapter/ChaptersController.kt | 3 +- .../ui/manga/chapter/ChaptersPresenter.kt | 20 ++++--- .../ui/manga/chapter/DeleteChaptersDialog.kt | 1 - .../manga/chapter/DeletingChaptersDialog.kt | 1 - .../chapter/DownloadCustomChaptersDialog.kt | 2 +- .../ui/manga/info/MangaInfoController.kt | 13 ++--- .../ui/manga/info/MangaInfoPresenter.kt | 21 ++++---- .../ui/manga/track/SetTrackChaptersDialog.kt | 3 +- .../ui/manga/track/SetTrackScoreDialog.kt | 3 +- .../ui/manga/track/SetTrackStatusDialog.kt | 1 - .../tachiyomi/ui/manga/track/TrackAdapter.kt | 1 - .../ui/manga/track/TrackController.kt | 1 - .../ui/manga/track/TrackPresenter.kt | 10 ++-- .../ui/manga/track/TrackSearchAdapter.kt | 6 +-- .../ui/manga/track/TrackSearchDialog.kt | 3 +- .../tachiyomi/ui/migration/MangaAdapter.kt | 2 +- .../tachiyomi/ui/migration/MangaHolder.kt | 5 +- .../tachiyomi/ui/migration/MangaItem.kt | 10 ++-- .../ui/migration/MigrationController.kt | 1 - .../ui/migration/MigrationPresenter.kt | 15 ++++-- .../ui/migration/SearchController.kt | 4 +- .../tachiyomi/ui/migration/SearchPresenter.kt | 6 +-- .../tachiyomi/ui/migration/SelectionHeader.kt | 8 ++- .../tachiyomi/ui/migration/SourceItem.kt | 9 ++-- .../tachiyomi/ui/migration/ViewState.kt | 10 ++-- .../tachiyomi/ui/more/AboutController.kt | 6 +-- .../tachiyomi/ui/more/MoreController.kt | 3 +- .../ui/reader/PageIndicatorTextView.kt | 4 +- .../tachiyomi/ui/reader/ReaderActivity.kt | 8 ++- .../ui/reader/ReaderColorFilterSheet.kt | 7 ++- .../ui/reader/ReaderColorFilterView.kt | 4 +- .../tachiyomi/ui/reader/ReaderPageSheet.kt | 5 +- .../tachiyomi/ui/reader/ReaderPresenter.kt | 21 ++++---- .../tachiyomi/ui/reader/ReaderSeekBar.kt | 5 +- .../ui/reader/ReaderSettingsSheet.kt | 1 - .../tachiyomi/ui/reader/SaveImageNotifier.kt | 1 - .../ui/reader/loader/ChapterLoader.kt | 7 ++- .../ui/reader/loader/DirectoryPageLoader.kt | 3 +- .../ui/reader/loader/DownloadPageLoader.kt | 9 ++-- .../ui/reader/loader/EpubPageLoader.kt | 3 +- .../ui/reader/loader/HttpPageLoader.kt | 17 +++--- .../tachiyomi/ui/reader/loader/PageLoader.kt | 1 - .../ui/reader/loader/RarPageLoader.kt | 7 ++- .../ui/reader/loader/ZipPageLoader.kt | 2 +- .../ui/reader/model/ChapterTransition.kt | 7 +-- .../tachiyomi/ui/reader/model/ReaderPage.kt | 9 ++-- .../ui/reader/model/ViewerChapters.kt | 7 ++- .../tachiyomi/ui/reader/viewer/BaseViewer.kt | 1 - .../viewer/GestureDetectorWithLongTap.kt | 5 +- .../ui/reader/viewer/ReaderProgressBar.kt | 7 ++- .../tachiyomi/ui/reader/viewer/pager/Pager.kt | 5 +- .../ui/reader/viewer/pager/PagerButton.kt | 1 - .../ui/reader/viewer/pager/PagerConfig.kt | 5 +- .../ui/reader/viewer/pager/PagerPageHolder.kt | 27 +++++----- .../viewer/pager/PagerTransitionHolder.kt | 5 +- .../ui/reader/viewer/pager/PagerViewer.kt | 1 - .../reader/viewer/pager/PagerViewerAdapter.kt | 1 - .../reader/viewer/webtoon/WebtoonAdapter.kt | 5 +- .../viewer/webtoon/WebtoonBaseHolder.kt | 5 +- .../ui/reader/viewer/webtoon/WebtoonConfig.kt | 5 +- .../ui/reader/viewer/webtoon/WebtoonFrame.kt | 9 ++-- .../viewer/webtoon/WebtoonLayoutManager.kt | 1 - .../viewer/webtoon/WebtoonPageHolder.kt | 29 +++++----- .../viewer/webtoon/WebtoonRecyclerView.kt | 24 ++++----- .../webtoon/WebtoonSubsamplingImageView.kt | 5 +- .../viewer/webtoon/WebtoonTransitionHolder.kt | 5 +- .../ui/reader/viewer/webtoon/WebtoonViewer.kt | 5 +- .../recent_updates/DeletingChaptersDialog.kt | 1 - .../ui/recent_updates/RecentChapterItem.kt | 11 ++-- .../recent_updates/RecentChaptersAdapter.kt | 2 +- .../RecentChaptersController.kt | 2 - .../recent_updates/RecentChaptersPresenter.kt | 15 +++--- .../ui/recently_read/RecentlyReadAdapter.kt | 6 +-- .../recently_read/RecentlyReadController.kt | 1 - .../ui/recently_read/RecentlyReadHolder.kt | 8 ++- .../ui/recently_read/RecentlyReadItem.kt | 10 ++-- .../ui/recently_read/RecentlyReadPresenter.kt | 7 ++- .../ui/recently_read/RemoveHistoryDialog.kt | 1 - .../ui/security/BiometricUnlockActivity.kt | 3 +- .../ui/security/SecureActivityDelegate.kt | 7 ++- .../ui/setting/SettingsBackupController.kt | 4 +- .../ui/setting/SettingsDownloadController.kt | 4 +- .../ui/setting/SettingsGeneralController.kt | 5 +- .../ui/setting/SettingsLibraryController.kt | 4 +- .../ui/setting/SettingsReaderController.kt | 3 +- .../ui/setting/SettingsSourcesController.kt | 3 +- .../ui/setting/SettingsTrackingController.kt | 7 ++- .../ui/setting/track/AnilistLoginActivity.kt | 1 - .../ui/setting/track/BangumiLoginActivity.kt | 1 - .../setting/track/ShikomoriLoginActivity.kt | 1 - .../tachiyomi/util/PreferenceExtensions.kt | 2 +- .../util/chapter/ChapterRecognition.kt | 1 - .../util/chapter/ChapterSourceSync.kt | 14 ++--- .../tachiyomi/util/lang/RetryWithDelay.kt | 8 +-- .../kanade/tachiyomi/util/storage/DiskUtil.kt | 1 - .../kanade/tachiyomi/util/storage/EpubFile.kt | 5 +- .../tachiyomi/util/storage/FileExtensions.kt | 1 - .../tachiyomi/util/storage/OkioExtensions.kt | 4 +- .../kanade/tachiyomi/util/system/ImageUtil.kt | 1 - .../tachiyomi/util/system/LocaleHelper.kt | 3 +- .../util/system/WebViewClientCompat.kt | 45 ++++++++-------- .../tachiyomi/widget/AutofitRecyclerView.kt | 1 - .../widget/DialogCustomDownloadView.kt | 1 - .../widget/DrawerSwipeCloseListener.kt | 4 +- .../tachiyomi/widget/ElevationAppBarLayout.kt | 5 +- .../widget/ExtendedNavigationView.kt | 25 ++++----- .../widget/IgnoreFirstSpinnerListener.kt | 1 - .../tachiyomi/widget/MinMaxNumberPicker.kt | 1 - .../tachiyomi/widget/NegativeSeekBar.kt | 2 - .../eu/kanade/tachiyomi/widget/OutlineSpan.kt | 33 ++++++------ .../kanade/tachiyomi/widget/PTSansTextView.kt | 2 - .../widget/PreCachingLayoutManager.kt | 1 - .../widget/RecyclerViewPagerAdapter.kt | 2 - .../tachiyomi/widget/RevealAnimationView.kt | 1 - .../widget/SimpleAnimationListener.kt | 2 +- .../tachiyomi/widget/SimpleNavigationView.kt | 41 +++++++------- .../tachiyomi/widget/StateImageViewTarget.kt | 10 ++-- .../tachiyomi/widget/ViewPagerAdapter.kt | 1 - .../preference/LoginCheckBoxPreference.kt | 7 ++- .../preference/LoginDialogPreference.kt | 2 - .../widget/preference/LoginPreference.kt | 1 - .../widget/preference/SourceLoginDialog.kt | 1 - .../preference/SwitchPreferenceCategory.kt | 8 +-- .../widget/preference/TrackLoginDialog.kt | 1 - .../widget/preference/TrackLogoutDialog.kt | 1 - .../CustomRobolectricGradleTestRunner.kt | 2 +- .../tachiyomi/data/backup/BackupTest.kt | 5 +- .../tachiyomi/data/database/CategoryTest.kt | 1 - .../data/database/ChapterRecognitionTest.kt | 1 - .../data/library/LibraryUpdateServiceTest.kt | 2 +- 331 files changed, 876 insertions(+), 1075 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index cffddba7e..ba6a1e035 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -90,5 +90,4 @@ open class App : Application(), LifecycleObserver { protected open fun setupNotificationChannels() { Notifications.createChannels(this) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt index 4c0621a1a..29551719a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt @@ -52,7 +52,5 @@ class AppModule(val app: Application) : InjektModule { GlobalScope.launch { get() } GlobalScope.launch { get() } - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 3a4694718..a965abba6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -59,5 +59,4 @@ object Migrations { } return false } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupConst.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupConst.kt index eee806a11..9a34744b8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupConst.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupConst.kt @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.data.backup import eu.kanade.tachiyomi.BuildConfig.APPLICATION_ID as ID - object BackupConst { const val INTENT_FILTER = "SettingsBackupFragment" diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreateService.kt index 0d993a701..b202ee9d3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupCreateService.kt @@ -5,8 +5,8 @@ import android.content.Context import android.content.Intent import android.net.Uri import com.google.gson.JsonArray -import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.BuildConfig.APPLICATION_ID as ID +import eu.kanade.tachiyomi.data.database.models.Manga /** * [IntentService] used to backup [Manga] information to [JsonArray] @@ -45,7 +45,6 @@ class BackupCreateService : IntentService(NAME) { } context.startService(intent) } - } private val backupManager by lazy { BackupManager(this) } @@ -59,5 +58,4 @@ class BackupCreateService : IntentService(NAME) { // Create backup backupManager.createBackup(uri, flags, false) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt index cce57f7bf..e9621f18a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt @@ -32,10 +32,10 @@ import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource import eu.kanade.tachiyomi.util.system.sendLocalBroadcast +import kotlin.math.max import rx.Observable import timber.log.Timber import uy.kohesive.injekt.injectLazy -import kotlin.math.max class BackupManager(val context: Context, version: Int = CURRENT_VERSION) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt index 3e058485f..dea25ef82 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt @@ -26,17 +26,17 @@ import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.util.lang.chop import eu.kanade.tachiyomi.util.system.isServiceRunning import eu.kanade.tachiyomi.util.system.sendLocalBroadcast -import rx.Observable -import rx.Subscription -import rx.schedulers.Schedulers -import timber.log.Timber -import uy.kohesive.injekt.injectLazy import java.io.File import java.text.SimpleDateFormat import java.util.Date import java.util.Locale import java.util.concurrent.ExecutorService import java.util.concurrent.Executors +import rx.Observable +import rx.Subscription +import rx.schedulers.Schedulers +import timber.log.Timber +import uy.kohesive.injekt.injectLazy /** * Restores backup from json file @@ -119,7 +119,6 @@ class BackupRestoreService : Service() { */ internal val trackManager: TrackManager by injectLazy() - private lateinit var executor: ExecutorService /** @@ -250,7 +249,6 @@ class BackupRestoreService : Service() { putExtra(BackupConst.ACTION, BackupConst.ACTION_RESTORE_COMPLETED_DIALOG) } sendLocalBroadcast(completeIntent) - } .doOnError { error -> Timber.e(error) @@ -296,9 +294,13 @@ class BackupRestoreService : Service() { * @param tracks tracking data from json * @return [Observable] containing manga restore information */ - private fun getMangaRestoreObservable(manga: Manga, chapters: List, - categories: List, history: List, - tracks: List): Observable? { + private fun getMangaRestoreObservable( + manga: Manga, + chapters: List, + categories: List, + history: List, + tracks: List + ): Observable? { // Get source val source = backupManager.sourceManager.getOrStub(manga.source) val dbManga = backupManager.getMangaFromDatabase(manga) @@ -321,9 +323,14 @@ class BackupRestoreService : Service() { * @param chapters chapters of manga that needs updating * @param categories categories that need updating */ - private fun mangaFetchObservable(source: Source, manga: Manga, chapters: List, - categories: List, history: List, - tracks: List): Observable { + private fun mangaFetchObservable( + source: Source, + manga: Manga, + chapters: List, + categories: List, + history: List, + tracks: List + ): Observable { return backupManager.restoreMangaFetchObservable(source, manga) .onErrorReturn { errors.add(Date() to "${manga.title} - ${it.message}") @@ -349,9 +356,14 @@ class BackupRestoreService : Service() { } } - private fun mangaNoFetchObservable(source: Source, backupManga: Manga, chapters: List, - categories: List, history: List, - tracks: List): Observable { + private fun mangaNoFetchObservable( + source: Source, + backupManga: Manga, + chapters: List, + categories: List, + history: List, + tracks: List + ): Observable { return Observable.just(backupManga) .flatMap { manga -> @@ -434,8 +446,13 @@ class BackupRestoreService : Service() { * @param amount total restoreAmount of manga * @param title title of restored manga */ - private fun showRestoreProgress(progress: Int, amount: Int, title: String, errors: Int, - content: String = getString(R.string.dialog_restoring_backup, title.chop(15))) { + private fun showRestoreProgress( + progress: Int, + amount: Int, + title: String, + errors: Int, + content: String = getString(R.string.dialog_restoring_backup, title.chop(15)) + ) { val intent = Intent(BackupConst.INTENT_FILTER).apply { putExtra(BackupConst.EXTRA_PROGRESS, progress) putExtra(BackupConst.EXTRA_AMOUNT, amount) @@ -445,5 +462,4 @@ class BackupRestoreService : Service() { } sendLocalBroadcast(intent) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/CategoryTypeAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/CategoryTypeAdapter.kt index b31279268..1beb5d979 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/CategoryTypeAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/CategoryTypeAdapter.kt @@ -28,4 +28,4 @@ object CategoryTypeAdapter { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/HistoryTypeAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/HistoryTypeAdapter.kt index e313c3b90..863a1a1f3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/HistoryTypeAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/HistoryTypeAdapter.kt @@ -29,4 +29,4 @@ object HistoryTypeAdapter { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/MangaTypeAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/MangaTypeAdapter.kt index 1aaaeda10..a18b98f1d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/MangaTypeAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/serializer/MangaTypeAdapter.kt @@ -34,4 +34,4 @@ object MangaTypeAdapter { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt index d18c34911..b5a684118 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt @@ -9,13 +9,13 @@ import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.util.storage.DiskUtil import eu.kanade.tachiyomi.util.storage.saveTo +import java.io.File +import java.io.IOException import okhttp3.Response import okio.buffer import okio.sink import rx.Observable import uy.kohesive.injekt.injectLazy -import java.io.File -import java.io.IOException /** * Class used to create chapter cache @@ -135,7 +135,6 @@ class ChapterCache(private val context: Context) { diskCache.flush() editor.commit() editor.abortUnlessCommitted() - } catch (e: Exception) { // Ignore. } finally { @@ -201,4 +200,3 @@ class ChapterCache(private val context: Context) { return "${chapter.manga_id}${chapter.url}" } } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt index 5869925e4..2fa227146 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/cache/CoverCache.kt @@ -37,7 +37,7 @@ class CoverCache(private val context: Context) { * Copy the given stream to this cache. * * @param thumbnailUrl url of the thumbnail. - * @param inputStream the stream to copy. + * @param inputStream the stream to copy. * @throws IOException if there's any error. */ @Throws(IOException::class) @@ -63,5 +63,4 @@ class CoverCache(private val context: Context) { val file = getCoverFile(thumbnailUrl) return file.exists() && file.delete() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/DatabaseHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/DatabaseHelper.kt index 6d73fa2bf..da1e3625f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/DatabaseHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/DatabaseHelper.kt @@ -11,8 +11,8 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory /** * This class provides operations to manage the database through its interfaces. */ -open class DatabaseHelper(context: Context) - : MangaQueries, ChapterQueries, TrackQueries, CategoryQueries, MangaCategoryQueries, HistoryQueries { +open class DatabaseHelper(context: Context) : + MangaQueries, ChapterQueries, TrackQueries, CategoryQueries, MangaCategoryQueries, HistoryQueries { private val configuration = SupportSQLiteOpenHelper.Configuration.builder(context) .name(DbOpenCallback.DATABASE_NAME) @@ -32,5 +32,4 @@ open class DatabaseHelper(context: Context) inline fun inTransaction(block: () -> Unit) = db.inTransaction(block) fun lowLevel() = db.lowLevel() - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/DbExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/DbExtensions.kt index 252ac0829..caaba0e10 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/DbExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/DbExtensions.kt @@ -22,4 +22,3 @@ inline fun StorIOSQLite.inTransactionReturn(block: () -> T): T { lowLevel().endTransaction() } } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/DbOpenCallback.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/DbOpenCallback.kt index 88d8a014e..2ac8f8955 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/DbOpenCallback.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/DbOpenCallback.kt @@ -69,5 +69,4 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) { override fun onConfigure(db: SupportSQLiteDatabase) { db.setForeignKeyConstraintsEnabled(true) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/DbProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/DbProvider.kt index 7af8dff0c..4609852b9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/DbProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/DbProvider.kt @@ -5,5 +5,4 @@ import com.pushtorefresh.storio.sqlite.impl.DefaultStorIOSQLite interface DbProvider { val db: DefaultStorIOSQLite - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/ChapterTypeMapping.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/ChapterTypeMapping.kt index 2e903a64b..a610f8969 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/ChapterTypeMapping.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/ChapterTypeMapping.kt @@ -85,4 +85,3 @@ class ChapterDeleteResolver : DefaultDeleteResolver() { .whereArgs(obj.id) .build() } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt index 6759316de..797c6a252 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt @@ -54,7 +54,6 @@ class TrackPutResolver : DefaultPutResolver() { put(COL_STATUS, obj.status) put(COL_TRACKING_URL, obj.tracking_url) put(COL_SCORE, obj.score) - } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt index c88d93261..3657caa72 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt @@ -23,5 +23,4 @@ interface Category : Serializable { fun createDefault(): Category = create("Default").apply { id = 0 } } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/CategoryImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/CategoryImpl.kt index 65a004477..3e59a674e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/CategoryImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/CategoryImpl.kt @@ -22,5 +22,4 @@ class CategoryImpl : Category { override fun hashCode(): Int { return name.hashCode() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/ChapterImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/ChapterImpl.kt index d2067abfd..167df2b05 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/ChapterImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/ChapterImpl.kt @@ -37,5 +37,4 @@ class ChapterImpl : Chapter { override fun hashCode(): Int { return url.hashCode() } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/LibraryManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/LibraryManga.kt index b9a7d9428..35cf30c67 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/LibraryManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/LibraryManga.kt @@ -5,5 +5,4 @@ class LibraryManga : MangaImpl() { var unread: Int = 0 var category: Int = 0 - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt index 1782662dc..128fd5ae8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt @@ -88,5 +88,4 @@ interface Manga : SManga { this.source = source } } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaCategory.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaCategory.kt index 305d5ef9c..220337088 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaCategory.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaCategory.kt @@ -17,5 +17,4 @@ class MangaCategory { return mc } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapterHistory.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapterHistory.kt index e11fe8f83..5ed7ed455 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapterHistory.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapterHistory.kt @@ -5,6 +5,6 @@ package eu.kanade.tachiyomi.data.database.models * * @param manga object containing manga * @param chapter object containing chater - * @param history object containing history + * @param history object containing history */ data class MangaChapterHistory(val manga: Manga, val chapter: Chapter, val history: History) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaImpl.kt index 977864c24..1b2420b98 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaImpl.kt @@ -39,11 +39,9 @@ open class MangaImpl : Manga { val manga = other as Manga return url == manga.url - } override fun hashCode(): Int { return url.hashCode() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt index 19133e037..c64363efa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt @@ -37,5 +37,4 @@ interface Track : Serializable { sync_id = serviceId } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt index 65f6ec7ab..03a878e14 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt @@ -41,5 +41,4 @@ class TrackImpl : Track { result = 31 * result + media_id return result } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/CategoryQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/CategoryQueries.kt index edf839d8f..d677d880d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/CategoryQueries.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/CategoryQueries.kt @@ -32,5 +32,4 @@ interface CategoryQueries : DbProvider { fun deleteCategory(category: Category) = db.delete().`object`(category).prepare() fun deleteCategories(categories: List) = db.delete().objects(categories).prepare() - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt index caf7566e8..b9313e0f2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt @@ -88,5 +88,4 @@ interface ChapterQueries : DbProvider { .objects(chapters) .withPutResolver(ChapterSourceOrderPutResolver()) .prepare() - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/MangaCategoryQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/MangaCategoryQueries.kt index 7ad7f937e..926339d0c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/MangaCategoryQueries.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/MangaCategoryQueries.kt @@ -28,5 +28,4 @@ interface MangaCategoryQueries : DbProvider { insertMangasCategories(mangasCategories).executeAsBlocking() } } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/RawQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/RawQueries.kt index 554c238b5..a57d2ed05 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/RawQueries.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/RawQueries.kt @@ -119,4 +119,4 @@ fun getCategoriesForMangaQuery() = """ JOIN ${MangaCategory.TABLE} ON ${Category.TABLE}.${Category.COL_ID} = ${MangaCategory.TABLE}.${MangaCategory.COL_CATEGORY_ID} WHERE ${MangaCategory.COL_MANGA_ID} = ? -""" \ No newline at end of file +""" diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/TrackQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/TrackQueries.kt index a93877faf..fee55dbd5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/TrackQueries.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/TrackQueries.kt @@ -30,5 +30,4 @@ interface TrackQueries : DbProvider { .whereArgs(manga.id, sync.id) .build()) .prepare() - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterBackupPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterBackupPutResolver.kt index 1c3e6fb74..d42758bea 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterBackupPutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterBackupPutResolver.kt @@ -30,6 +30,4 @@ class ChapterBackupPutResolver : PutResolver() { put(ChapterTable.COL_BOOKMARK, chapter.bookmark) put(ChapterTable.COL_LAST_PAGE_READ, chapter.last_page_read) } - } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterProgressPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterProgressPutResolver.kt index 18009d711..d646d50c3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterProgressPutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterProgressPutResolver.kt @@ -30,6 +30,4 @@ class ChapterProgressPutResolver : PutResolver() { put(ChapterTable.COL_BOOKMARK, chapter.bookmark) put(ChapterTable.COL_LAST_PAGE_READ, chapter.last_page_read) } - } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterSourceOrderPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterSourceOrderPutResolver.kt index 77bc0afad..40c7a7df7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterSourceOrderPutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterSourceOrderPutResolver.kt @@ -28,5 +28,4 @@ class ChapterSourceOrderPutResolver : PutResolver() { fun mapToContentValues(chapter: Chapter) = ContentValues(1).apply { put(ChapterTable.COL_SOURCE_ORDER, chapter.source_order) } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/HistoryLastReadPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/HistoryLastReadPutResolver.kt index f1d68c22a..98ec17cb4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/HistoryLastReadPutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/HistoryLastReadPutResolver.kt @@ -60,5 +60,4 @@ class HistoryLastReadPutResolver : HistoryPutResolver() { fun mapToUpdateContentValues(history: History) = ContentValues(1).apply { put(HistoryTable.COL_LAST_READ, history.last_read) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.kt index 77369827a..aac8ead3e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/LibraryMangaGetResolver.kt @@ -21,5 +21,4 @@ class LibraryMangaGetResolver : DefaultGetResolver(), BaseMangaGet return manga } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt index 4f9ce536f..edd6a8983 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt @@ -24,5 +24,4 @@ class MangaChapterGetResolver : DefaultGetResolver() { return MangaChapter(manga, chapter) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaFavoritePutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaFavoritePutResolver.kt index c0057d213..a2d23f505 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaFavoritePutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaFavoritePutResolver.kt @@ -28,6 +28,4 @@ class MangaFavoritePutResolver : PutResolver() { fun mapToContentValues(manga: Manga) = ContentValues(1).apply { put(MangaTable.COL_FAVORITE, manga.favorite) } - } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaFlagsPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaFlagsPutResolver.kt index 0c9b28c52..4ed0a0728 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaFlagsPutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaFlagsPutResolver.kt @@ -28,6 +28,4 @@ class MangaFlagsPutResolver : PutResolver() { fun mapToContentValues(manga: Manga) = ContentValues(1).apply { put(MangaTable.COL_CHAPTER_FLAGS, manga.chapter_flags) } - } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaLastUpdatedPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaLastUpdatedPutResolver.kt index 8b2672ea9..b1e5e7816 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaLastUpdatedPutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaLastUpdatedPutResolver.kt @@ -28,6 +28,4 @@ class MangaLastUpdatedPutResolver : PutResolver() { fun mapToContentValues(manga: Manga) = ContentValues(1).apply { put(MangaTable.COL_LAST_UPDATE, manga.last_update) } - } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaTitlePutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaTitlePutResolver.kt index 702173afb..0ffb18ffd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaTitlePutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaTitlePutResolver.kt @@ -28,5 +28,4 @@ class MangaTitlePutResolver : PutResolver() { fun mapToContentValues(manga: Manga) = ContentValues(1).apply { put(MangaTable.COL_TITLE, manga.title) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaViewerPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaViewerPutResolver.kt index e40f397a8..a6b7c9b19 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaViewerPutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaViewerPutResolver.kt @@ -28,5 +28,4 @@ class MangaViewerPutResolver : PutResolver() { fun mapToContentValues(manga: Manga) = ContentValues(1).apply { put(MangaTable.COL_VIEWER, manga.viewer) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/CategoryTable.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/CategoryTable.kt index 65af41013..297c2a8e0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/CategoryTable.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/CategoryTable.kt @@ -19,5 +19,4 @@ object CategoryTable { $COL_ORDER INTEGER NOT NULL, $COL_FLAGS INTEGER NOT NULL )""" - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/ChapterTable.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/ChapterTable.kt index a2350caa0..afd54675a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/ChapterTable.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/ChapterTable.kt @@ -61,5 +61,4 @@ object ChapterTable { val addScanlator: String get() = "ALTER TABLE $TABLE ADD COLUMN $COL_SCANLATOR TEXT DEFAULT NULL" - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/MangaCategoryTable.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/MangaCategoryTable.kt index a42e91e92..d0d34bbb7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/MangaCategoryTable.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/MangaCategoryTable.kt @@ -20,5 +20,4 @@ object MangaCategoryTable { FOREIGN KEY($COL_MANGA_ID) REFERENCES ${MangaTable.TABLE} (${MangaTable.COL_ID}) ON DELETE CASCADE )""" - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index 72c3f2a99..f257bbc16 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -8,9 +8,9 @@ import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.source.SourceManager +import java.util.concurrent.TimeUnit import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.concurrent.TimeUnit /** * Cache where we dump the downloads directory from the filesystem. This class is needed because @@ -24,10 +24,10 @@ import java.util.concurrent.TimeUnit * @param preferences the preferences of the app. */ class DownloadCache( - private val context: Context, - private val provider: DownloadProvider, - private val sourceManager: SourceManager, - private val preferences: PreferencesHelper = Injekt.get() + private val context: Context, + private val provider: DownloadProvider, + private val sourceManager: SourceManager, + private val preferences: PreferencesHelper = Injekt.get() ) { /** @@ -233,20 +233,26 @@ class DownloadCache( /** * Class to store the files under the root downloads directory. */ - private class RootDirectory(val dir: UniFile, - var files: Map = hashMapOf()) + private class RootDirectory( + val dir: UniFile, + var files: Map = hashMapOf() + ) /** * Class to store the files under a source directory. */ - private class SourceDirectory(val dir: UniFile, - var files: Map = hashMapOf()) + private class SourceDirectory( + val dir: UniFile, + var files: Map = hashMapOf() + ) /** * Class to store the files under a manga directory. */ - private class MangaDirectory(val dir: UniFile, - var files: Set = hashSetOf()) + private class MangaDirectory( + val dir: UniFile, + var files: Set = hashSetOf() + ) /** * Returns a new map containing only the key entries of [transform] that are not null. @@ -270,5 +276,4 @@ class DownloadCache( } return destination } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index 4e23599d0..a938724bf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -206,5 +206,4 @@ class DownloadManager(context: Context) { deleteChapters(chapters, manga, source) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt index 4de44ddbd..9c22626f2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt @@ -117,7 +117,7 @@ internal class DownloadNotifier(private val context: Context) { addAction(R.drawable.ic_play_arrow_white_24dp, context.getString(R.string.action_resume), NotificationReceiver.resumeDownloadsPendingBroadcast(context)) - //Clear action + // Clear action addAction(R.drawable.ic_close_white_24dp, context.getString(R.string.action_cancel_all), NotificationReceiver.clearDownloadsPendingBroadcast(context)) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt index 894b9e493..a4e9fd67a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt @@ -120,27 +120,27 @@ class DownloadPendingDeleter(context: Context) { * Class used to save an entry of chapters with their manga into preferences. */ private data class Entry( - val chapters: List, - val manga: MangaEntry + val chapters: List, + val manga: MangaEntry ) /** * Class used to save an entry for a chapter into preferences. */ private data class ChapterEntry( - val id: Long, - val url: String, - val name: String + val id: Long, + val url: String, + val name: String ) /** * Class used to save an entry for a manga into preferences. */ private data class MangaEntry( - val id: Long, - val url: String, - val title: String, - val source: Long + val id: Long, + val url: String, + val title: String, + val source: Long ) /** @@ -176,5 +176,4 @@ class DownloadPendingDeleter(context: Context) { it.name = name } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index 9e71903a3..d13918387 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -126,5 +126,4 @@ class DownloadProvider(private val context: Context) { fun getChapterDirName(chapter: Chapter): String { return DiskUtil.buildValidFilename(chapter.name) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt index 2ad104bc9..5b6a5471b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt @@ -194,5 +194,4 @@ class DownloadService : Service() { setContentTitle(getString(R.string.download_notifier_downloader_title)) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt index e9754053c..cfa82a275 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt @@ -15,8 +15,8 @@ import uy.kohesive.injekt.injectLazy * @param context the application context. */ class DownloadStore( - context: Context, - private val sourceManager: SourceManager + context: Context, + private val sourceManager: SourceManager ) { /** @@ -133,5 +133,4 @@ class DownloadStore( * @param order the order of the download in the queue. */ data class DownloadObject(val mangaId: Long, val chapterId: Long, val order: Int) - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 3bfb3507d..cc82b848c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -43,10 +43,10 @@ import timber.log.Timber * @param sourceManager the source manager. */ class Downloader( - private val context: Context, - private val provider: DownloadProvider, - private val cache: DownloadCache, - private val sourceManager: SourceManager + private val context: Context, + private val provider: DownloadProvider, + private val cache: DownloadCache, + private val sourceManager: SourceManager ) { /** @@ -152,7 +152,7 @@ class Downloader( fun clearQueue(isNotification: Boolean = false) { destroySubscriptions() - //Needed to update the chapter view + // Needed to update the chapter view if (isNotification) { queue .filter { it.status == Download.QUEUE } @@ -291,7 +291,6 @@ class Downloader( notifier.onError(error.message, download.chapter.name) download } - } /** @@ -394,8 +393,12 @@ class Downloader( * @param tmpDir the directory where the download is currently stored. * @param dirname the real (non temporary) directory name of the download. */ - private fun ensureSuccessfulDownload(download: Download, mangaDir: UniFile, - tmpDir: UniFile, dirname: String) { + private fun ensureSuccessfulDownload( + download: Download, + mangaDir: UniFile, + tmpDir: UniFile, + dirname: String + ) { // Ensure that the chapter folder has all the images. val downloadedImages = tmpDir.listFiles().orEmpty().filterNot { it.name!!.endsWith(".tmp") } @@ -439,5 +442,4 @@ class Downloader( companion object { const val TMP_DIR_SUFFIX = "_tmp" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt index 9b04f4c3d..b912b033a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt @@ -5,14 +5,15 @@ import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.download.DownloadStore import eu.kanade.tachiyomi.source.model.Page +import java.util.concurrent.CopyOnWriteArrayList import rx.Observable import rx.subjects.PublishSubject -import java.util.concurrent.CopyOnWriteArrayList class DownloadQueue( - private val store: DownloadStore, - private val queue: MutableList = CopyOnWriteArrayList()) - : List by queue { + private val store: DownloadStore, + private val queue: MutableList = CopyOnWriteArrayList() +) : + List by queue { private val statusSubject = PublishSubject.create() @@ -80,7 +81,6 @@ class DownloadQueue( .onBackpressureBuffer() .filter { it == Page.READY } .map { download } - } else if (download.status == Download.DOWNLOADED || download.status == Download.ERROR) { setPagesSubject(download.pages, null) } @@ -96,5 +96,4 @@ class DownloadQueue( } } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/glide/FileFetcher.kt b/app/src/main/java/eu/kanade/tachiyomi/data/glide/FileFetcher.kt index a795e2e05..039d7d763 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/glide/FileFetcher.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/glide/FileFetcher.kt @@ -48,4 +48,4 @@ open class FileFetcher(private val file: File) : DataFetcher { override fun getDataSource(): DataSource { return DataSource.LOCAL } -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/glide/LibraryMangaUrlFetcher.kt b/app/src/main/java/eu/kanade/tachiyomi/data/glide/LibraryMangaUrlFetcher.kt index 3fe3cea69..c61e3fc92 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/glide/LibraryMangaUrlFetcher.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/glide/LibraryMangaUrlFetcher.kt @@ -16,10 +16,12 @@ import java.io.InputStream * @param manga the manga of the cover to load. * @param file the file where this cover should be. It may exists or not. */ -class LibraryMangaUrlFetcher(private val networkFetcher: DataFetcher, - private val manga: Manga, - private val file: File) - : FileFetcher(file) { +class LibraryMangaUrlFetcher( + private val networkFetcher: DataFetcher, + private val manga: Manga, + private val file: File +) : + FileFetcher(file) { override fun loadData(priority: Priority, callback: DataFetcher.DataCallback) { if (!file.exists()) { @@ -52,7 +54,6 @@ class LibraryMangaUrlFetcher(private val networkFetcher: DataFetcher { * @param width the width of the view where the resource will be loaded. * @param height the height of the view where the resource will be loaded. */ - override fun buildLoadData(manga: Manga, width: Int, height: Int, - options: Options): ModelLoader.LoadData? { + override fun buildLoadData( + manga: Manga, + width: Int, + height: Int, + options: Options + ): ModelLoader.LoadData? { // Check thumbnail is not null or empty val url = manga.thumbnail_url if (url == null || url.isEmpty()) { @@ -142,5 +145,4 @@ class MangaModelLoader : ModelLoader { value } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/glide/MangaSignature.kt b/app/src/main/java/eu/kanade/tachiyomi/data/glide/MangaSignature.kt index aa3ebf6f9..cdf880e42 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/glide/MangaSignature.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/glide/MangaSignature.kt @@ -24,4 +24,4 @@ class MangaSignature(manga: Manga, file: File) : Key { override fun updateDiskCacheKey(md: MessageDigest) { md.update(key.toByteArray(Key.CHARSET)) } -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/glide/PassthroughModelLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/glide/PassthroughModelLoader.kt index bb117086e..dd6d546f8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/glide/PassthroughModelLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/glide/PassthroughModelLoader.kt @@ -14,10 +14,10 @@ import java.io.InputStream class PassthroughModelLoader : ModelLoader { override fun buildLoadData( - model: InputStream, - width: Int, - height: Int, - options: Options + model: InputStream, + width: Int, + height: Int, + options: Options ): ModelLoader.LoadData? { return ModelLoader.LoadData(ObjectKey(model), Fetcher(model)) } @@ -49,12 +49,11 @@ class PassthroughModelLoader : ModelLoader { } override fun loadData( - priority: Priority, - callback: DataFetcher.DataCallback + priority: Priority, + callback: DataFetcher.DataCallback ) { callback.onDataReady(stream) } - } /** @@ -63,12 +62,11 @@ class PassthroughModelLoader : ModelLoader { class Factory : ModelLoaderFactory { override fun build( - multiFactory: MultiModelLoaderFactory + multiFactory: MultiModelLoaderFactory ): ModelLoader { return PassthroughModelLoader() } override fun teardown() {} } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/glide/TachiGlideModule.kt b/app/src/main/java/eu/kanade/tachiyomi/data/glide/TachiGlideModule.kt index 6e323ac39..eb65782fc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/glide/TachiGlideModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/glide/TachiGlideModule.kt @@ -15,9 +15,9 @@ import com.bumptech.glide.module.AppGlideModule import com.bumptech.glide.request.RequestOptions import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.network.NetworkHelper +import java.io.InputStream import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.io.InputStream /** * Class used to update Glide module settings diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt index 4de8f9bb2..b392e006a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt @@ -39,5 +39,4 @@ object LibraryUpdateRanker { compareValues(mangaFirst.title, mangaSecond.title) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index c44176205..c68777400 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -39,16 +39,16 @@ import eu.kanade.tachiyomi.util.system.isServiceRunning import eu.kanade.tachiyomi.util.system.notification import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationManager +import java.text.DecimalFormat +import java.text.DecimalFormatSymbols +import java.util.ArrayList +import java.util.concurrent.atomic.AtomicInteger import rx.Observable import rx.Subscription import rx.schedulers.Schedulers import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.text.DecimalFormat -import java.text.DecimalFormatSymbols -import java.util.ArrayList -import java.util.concurrent.atomic.AtomicInteger /** * This class will take care of updating the chapters of the manga from the library. It can be @@ -59,11 +59,11 @@ import java.util.concurrent.atomic.AtomicInteger * destroyed. */ class LibraryUpdateService( - val db: DatabaseHelper = Injekt.get(), - val sourceManager: SourceManager = Injekt.get(), - val preferences: PreferencesHelper = Injekt.get(), - val downloadManager: DownloadManager = Injekt.get(), - val trackManager: TrackManager = Injekt.get() + val db: DatabaseHelper = Injekt.get(), + val sourceManager: SourceManager = Injekt.get(), + val preferences: PreferencesHelper = Injekt.get(), + val downloadManager: DownloadManager = Injekt.get(), + val trackManager: TrackManager = Injekt.get() ) : Service() { /** @@ -109,8 +109,8 @@ class LibraryUpdateService( */ enum class Target { CHAPTERS, // Manga chapters - DETAILS, // Manga metadata - TRACKING // Tracking metadata + DETAILS, // Manga metadata + TRACKING // Tracking metadata } companion object { @@ -169,7 +169,6 @@ class LibraryUpdateService( fun stop(context: Context) { context.stopService(Intent(context, LibraryUpdateService::class.java)) } - } /** @@ -589,5 +588,4 @@ class LibraryUpdateService( } return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt index 7ec0cd816..2d7089ec0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt @@ -6,6 +6,7 @@ import android.content.Context import android.content.Intent import android.os.Build import android.os.Handler +import eu.kanade.tachiyomi.BuildConfig.APPLICATION_ID as ID import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.models.Chapter @@ -23,11 +24,10 @@ import eu.kanade.tachiyomi.util.storage.DiskUtil import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.toast +import java.io.File import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy -import java.io.File -import eu.kanade.tachiyomi.BuildConfig.APPLICATION_ID as ID /** * Global [BroadcastReceiver] that runs on UI thread @@ -407,8 +407,13 @@ class NotificationReceiver : BroadcastReceiver() { * @param context context of application * @param manga manga of chapter */ - internal fun markAsReadPendingBroadcast(context: Context, manga: Manga, chapters: - Array, groupId: Int): + internal fun markAsReadPendingBroadcast( + context: Context, + manga: Manga, + chapters: + Array, + groupId: Int + ): PendingIntent { val newIntent = Intent(context, NotificationReceiver::class.java).apply { action = ACTION_MARK_AS_READ diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 722380f0d..03f05e273 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -144,5 +144,4 @@ object PreferenceKeys { fun trackPassword(syncId: Int) = "pref_mangasync_password_$syncId" fun trackToken(syncId: Int) = "track_token_$syncId" - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt index 5fdeb8964..15b338de0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt @@ -12,5 +12,4 @@ object PreferenceValues { const val THEME_DARK_DEFAULT = "default" const val THEME_DARK_BLUE = "blue" const val THEME_DARK_AMOLED = "amoled" - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index eb700ba8b..38da493c0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -8,14 +8,14 @@ import android.preference.PreferenceManager import com.f2prateek.rx.preferences.Preference import com.f2prateek.rx.preferences.RxSharedPreferences import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys +import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.source.Source import java.io.File import java.text.DateFormat import java.text.SimpleDateFormat import java.util.Locale -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values fun Preference.getOrDefault(): T = get() ?: defaultValue()!! diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackManager.kt index ce32d35c9..afa6f0d50 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackManager.kt @@ -32,5 +32,4 @@ class TrackManager(private val context: Context) { fun getService(id: Int) = services.find { it.id == id } fun hasLoggedServices() = services.any { it.isLogged } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt index 4394fb574..d30b32cad 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt @@ -209,6 +209,4 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) { null } } - } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt index 2b68c4d5e..4e1e804d4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt @@ -7,13 +7,12 @@ import com.google.gson.JsonParser import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.network.asObservableSuccess +import java.util.Calendar import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.RequestBody.Companion.toRequestBody import rx.Observable -import java.util.Calendar - class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) { @@ -143,7 +142,6 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) { } } - fun findLibManga(track: Track, userid: Int): Observable { val query = """ |query (${'$'}id: Int!, ${'$'}manga_id: Int!) { @@ -201,7 +199,6 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) { val media = page["mediaList"].array val entries = media.map { jsonToALUserManga(it.obj) } entries.firstOrNull()?.toTrack() - } } @@ -283,5 +280,4 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) { .appendQueryParameter("response_type", "token") .build() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistInterceptor.kt index 137034206..4fd13dae1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistInterceptor.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.track.anilist import okhttp3.Interceptor import okhttp3.Response - class AnilistInterceptor(val anilist: Anilist, private var token: String?) : Interceptor { /** @@ -54,5 +53,4 @@ class AnilistInterceptor(val anilist: Anilist, private var token: String?) : Int this.oauth = oauth anilist.saveOAuth(oauth) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistModels.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistModels.kt index 2cbfaa0fb..115a6e905 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistModels.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistModels.kt @@ -5,19 +5,20 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.model.TrackSearch -import uy.kohesive.injekt.injectLazy import java.text.SimpleDateFormat import java.util.Locale +import uy.kohesive.injekt.injectLazy data class ALManga( - val media_id: Int, - val title_romaji: String, - val image_url_lge: String, - val description: String?, - val type: String, - val publishing_status: String, - val start_date_fuzzy: Long, - val total_chapters: Int) { + val media_id: Int, + val title_romaji: String, + val image_url_lge: String, + val description: String?, + val type: String, + val publishing_status: String, + val start_date_fuzzy: Long, + val total_chapters: Int +) { fun toTrack() = TrackSearch.create(TrackManager.ANILIST).apply { media_id = this@ALManga.media_id @@ -40,11 +41,12 @@ data class ALManga( } data class ALUserManga( - val library_id: Long, - val list_status: String, - val score_raw: Int, - val chapters_read: Int, - val manga: ALManga) { + val library_id: Long, + val list_status: String, + val score_raw: Int, + val chapters_read: Int, + val manga: ALManga +) { fun toTrack() = Track.create(TrackManager.ANILIST).apply { media_id = manga.media_id diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/OAuth.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/OAuth.kt index a53760ba5..5df10fd51 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/OAuth.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/OAuth.kt @@ -1,10 +1,11 @@ package eu.kanade.tachiyomi.data.track.anilist data class OAuth( - val access_token: String, - val token_type: String, - val expires: Long, - val expires_in: Long) { + val access_token: String, + val token_type: String, + val expires: Long, + val expires_in: Long +) { fun isExpired() = System.currentTimeMillis() > expires -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Avatar.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Avatar.kt index d058a85f5..b54f4ec02 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Avatar.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Avatar.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.data.track.bangumi data class Avatar( - val large: String? = "", - val medium: String? = "", - val small: String? = "" + val large: String? = "", + val medium: String? = "", + val small: String? = "" ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt index 3b356f653..a0e050315 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiApi.kt @@ -11,13 +11,13 @@ import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.asObservableSuccess +import java.net.URLEncoder import okhttp3.CacheControl import okhttp3.FormBody import okhttp3.OkHttpClient import okhttp3.Request import rx.Observable import uy.kohesive.injekt.injectLazy -import java.net.URLEncoder class BangumiApi(private val client: OkHttpClient, interceptor: BangumiInterceptor) { @@ -94,7 +94,6 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept val response = parser.parse(responseBody).obj["list"]?.array response?.filter { it.obj["type"].asInt == 1 }?.map { jsonToSearch(it.obj) } } - } private fun jsonToSearch(obj: JsonObject): TrackSearch { @@ -207,5 +206,4 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept .add("redirect_uri", redirectUrl) .build()) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Collection.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Collection.kt index 03143d19f..d9e3f7642 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Collection.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Collection.kt @@ -1,13 +1,13 @@ package eu.kanade.tachiyomi.data.track.bangumi data class Collection( - val `private`: Int? = 0, - val comment: String? = "", - val ep_status: Int? = 0, - val lasttouch: Int? = 0, - val rating: Int? = 0, - val status: Status? = Status(), - val tag: List? = listOf(), - val user: User? = User(), - val vol_status: Int? = 0 + val `private`: Int? = 0, + val comment: String? = "", + val ep_status: Int? = 0, + val lasttouch: Int? = 0, + val rating: Int? = 0, + val status: Status? = Status(), + val tag: List? = listOf(), + val user: User? = User(), + val vol_status: Int? = 0 ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt index 811d0fd45..d3dfda20f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/OAuth.kt @@ -1,16 +1,14 @@ package eu.kanade.tachiyomi.data.track.bangumi data class OAuth( - val access_token: String, - val token_type: String, - val created_at: Long, - val expires_in: Long, - val refresh_token: String?, - val user_id: Long? + val access_token: String, + val token_type: String, + val created_at: Long, + val expires_in: Long, + val refresh_token: String?, + val user_id: Long? ) { // Access token refresh before expired fun isExpired() = (System.currentTimeMillis() / 1000) > (created_at + expires_in - 3600) - } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Status.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Status.kt index 3d2ea3c14..fbae6a3dd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Status.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Status.kt @@ -1,7 +1,7 @@ package eu.kanade.tachiyomi.data.track.bangumi data class Status( - val id: Int? = 0, - val name: String? = "", - val type: String? = "" + val id: Int? = 0, + val name: String? = "", + val type: String? = "" ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/User.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/User.kt index 9e82f533e..274bc3bcb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/User.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/User.kt @@ -1,11 +1,11 @@ package eu.kanade.tachiyomi.data.track.bangumi data class User( - val avatar: Avatar? = Avatar(), - val id: Int? = 0, - val nickname: String? = "", - val sign: String? = "", - val url: String? = "", - val usergroup: Int? = 0, - val username: String? = "" + val avatar: Avatar? = Avatar(), + val id: Int? = 0, + val nickname: String? = "", + val sign: String? = "", + val url: String? = "", + val usergroup: Int? = 0, + val username: String? = "" ) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt index 4b4f8cbcf..0fcaba4fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt @@ -7,10 +7,10 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch +import java.text.DecimalFormat import rx.Completable import rx.Observable import uy.kohesive.injekt.injectLazy -import java.text.DecimalFormat class Kitsu(private val context: Context, id: Int) : TrackService(id) { @@ -140,5 +140,4 @@ class Kitsu(private val context: Context, id: Int) : TrackService(id) { null } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt index fa72b6d54..b9f173290 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt @@ -94,7 +94,6 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) } } - fun search(query: String): Observable> { return searchRest .getKey().map { json -> @@ -104,7 +103,6 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) } } - private fun algoliaSearch(key: String, query: String): Observable> { val jsonObject = jsonObject("params" to "query=$query$algoliaFilter") return algoliaRest @@ -163,35 +161,33 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) @Headers("Content-Type: application/vnd.api+json") @POST("library-entries") fun addLibManga( - @Body data: JsonObject + @Body data: JsonObject ): Observable @Headers("Content-Type: application/vnd.api+json") @PATCH("library-entries/{id}") fun updateLibManga( - @Path("id") remoteId: Int, - @Body data: JsonObject + @Path("id") remoteId: Int, + @Body data: JsonObject ): Observable - @GET("library-entries") fun findLibManga( - @Query("filter[manga_id]", encoded = true) remoteId: Int, - @Query("filter[user_id]", encoded = true) userId: String, - @Query("include") includes: String = "manga" + @Query("filter[manga_id]", encoded = true) remoteId: Int, + @Query("filter[user_id]", encoded = true) userId: String, + @Query("include") includes: String = "manga" ): Observable @GET("library-entries") fun getLibManga( - @Query("filter[id]", encoded = true) remoteId: Int, - @Query("include") includes: String = "manga" + @Query("filter[id]", encoded = true) remoteId: Int, + @Query("include") includes: String = "manga" ): Observable @GET("users") fun getCurrentUser( - @Query("filter[self]", encoded = true) self: Boolean = true + @Query("filter[self]", encoded = true) self: Boolean = true ): Observable - } private interface SearchKeyRest { @@ -209,13 +205,12 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) @FormUrlEncoded @POST("oauth/token") fun requestAccessToken( - @Field("username") username: String, - @Field("password") password: String, - @Field("grant_type") grantType: String = "password", - @Field("client_id") client_id: String = clientId, - @Field("client_secret") client_secret: String = clientSecret + @Field("username") username: String, + @Field("password") password: String, + @Field("grant_type") grantType: String = "password", + @Field("client_id") client_id: String = clientId, + @Field("client_secret") client_secret: String = clientSecret ): Observable - } companion object { @@ -229,12 +224,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) private const val algoliaAppId = "AWQO5J657S" private const val algoliaFilter = "&facetFilters=%5B%22kind%3Amanga%22%5D&attributesToRetrieve=%5B%22synopsis%22%2C%22canonicalTitle%22%2C%22chapterCount%22%2C%22posterImage%22%2C%22startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D" - fun mangaUrl(remoteId: Int): String { return baseMangaUrl + remoteId } - fun refreshTokenRequest(token: String) = POST("${loginUrl}oauth/token", body = FormBody.Builder() .add("grant_type", "refresh_token") @@ -242,7 +235,5 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) .add("client_secret", clientSecret) .add("refresh_token", token) .build()) - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuInterceptor.kt index 44b874bea..1f1d4e8f2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuInterceptor.kt @@ -42,5 +42,4 @@ class KitsuInterceptor(val kitsu: Kitsu, val gson: Gson) : Interceptor { this.oauth = oauth kitsu.saveToken(oauth) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt index 397846294..fa02a952f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt @@ -41,7 +41,6 @@ class KitsuSearchManga(obj: JsonObject) { } } - class KitsuLibManga(obj: JsonObject, manga: JsonObject) { val id by manga.byInt private val canonicalTitle by manga["attributes"].byString @@ -78,7 +77,6 @@ class KitsuLibManga(obj: JsonObject, manga: JsonObject) { "planned" -> Kitsu.PLAN_TO_READ else -> throw Exception("Unknown status") } - } fun Track.toKitsuStatus() = when (status) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/OAuth.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/OAuth.kt index 678567ce9..a10981c51 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/OAuth.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/OAuth.kt @@ -1,11 +1,12 @@ package eu.kanade.tachiyomi.data.track.kitsu data class OAuth( - val access_token: String, - val token_type: String, - val created_at: Long, - val expires_in: Long, - val refresh_token: String?) { + val access_token: String, + val token_type: String, + val created_at: Long, + val expires_in: Long, + val refresh_token: String? +) { fun isExpired() = (System.currentTimeMillis() / 1000) > (created_at + expires_in - 3600) -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt index 0c0ec8ee1..ee1100b76 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt @@ -59,5 +59,4 @@ class TrackSearch : Track { sync_id = serviceId } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt index 24fb80128..e2a45e1fe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt @@ -159,5 +159,4 @@ class Myanimelist(private val context: Context, id: Int) : TrackService(id) { return ckCount == 2 } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt index fd754e0fe..dd3d56341 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt @@ -10,6 +10,9 @@ import eu.kanade.tachiyomi.network.asObservable import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.util.selectInt import eu.kanade.tachiyomi.util.selectText +import java.io.BufferedReader +import java.io.InputStreamReader +import java.util.zip.GZIPInputStream import okhttp3.FormBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.OkHttpClient @@ -22,10 +25,6 @@ import org.jsoup.nodes.Document import org.jsoup.nodes.Element import org.jsoup.parser.Parser import rx.Observable -import java.io.BufferedReader -import java.io.InputStreamReader -import java.util.zip.GZIPInputStream - class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListInterceptor) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/OAuth.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/OAuth.kt index 1f6a38b47..8c6f2a982 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/OAuth.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/OAuth.kt @@ -1,13 +1,13 @@ package eu.kanade.tachiyomi.data.track.shikimori data class OAuth( - val access_token: String, - val token_type: String, - val created_at: Long, - val expires_in: Long, - val refresh_token: String?) { + val access_token: String, + val token_type: String, + val created_at: Long, + val expires_in: Long, + val refresh_token: String? +) { // Access token lives 1 day fun isExpired() = (System.currentTimeMillis() / 1000) > (created_at + expires_in - 3600) } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt index d8802711a..15c4626d3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt @@ -74,7 +74,6 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter val response = parser.parse(responseBody).array response.map { jsonToSearch(it.obj) } } - } private fun jsonToSearch(obj: JsonObject): TrackSearch { @@ -171,7 +170,6 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter .build() ) - companion object { private const val clientId = "1aaf4cf232372708e98b5abc813d795b539c5a916dbbfe9ac61bf02a360832cc" private const val clientSecret = "229942c742dd4cde803125d17d64501d91c0b12e14cb1e5120184d77d67024c0" @@ -195,7 +193,6 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter .appendQueryParameter("response_type", "code") .build() - fun refreshTokenRequest(token: String) = POST(oauthUrl, body = FormBody.Builder() .add("grant_type", "refresh_token") @@ -203,7 +200,5 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter .add("client_secret", clientSecret) .add("refresh_token", token) .build()) - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/Release.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/Release.kt index 9ac138e98..61f2bd787 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/Release.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/Release.kt @@ -9,5 +9,4 @@ interface Release { * @return download link of latest release. */ val downloadLink: String - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateChecker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateChecker.kt index b237fb679..9f1e8eac1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateChecker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateChecker.kt @@ -20,5 +20,4 @@ abstract class UpdateChecker { * Returns observable containing release information */ abstract suspend fun checkForUpdate(): UpdateResult - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateResult.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateResult.kt index 2923aa445..a147c01df 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateResult.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdateResult.kt @@ -4,5 +4,4 @@ abstract class UpdateResult { open class NewUpdate(val release: T) : UpdateResult() open class NoNewUpdate : UpdateResult() - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt index 867e0f521..b0542e0f1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt @@ -64,5 +64,4 @@ class UpdaterJob : Job() { JobManager.instance().cancelAllForTag(TAG) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt index ddce70db7..624d5cfdb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt @@ -12,9 +12,9 @@ import eu.kanade.tachiyomi.network.ProgressListener import eu.kanade.tachiyomi.network.newCallWithProgress import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.storage.saveTo +import java.io.File import timber.log.Timber import uy.kohesive.injekt.injectLazy -import java.io.File class UpdaterService : IntentService(UpdaterService::class.java.name) { @@ -119,5 +119,3 @@ class UpdaterService : IntentService(UpdaterService::class.java.name) { } } } - - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoRelease.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoRelease.kt index ea8a79a18..0f2b1ac75 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoRelease.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoRelease.kt @@ -10,5 +10,4 @@ class DevRepoRelease(override val info: String) : Release { companion object { const val LATEST_URL = "https://tachiyomi.kanade.eu/latest" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateChecker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateChecker.kt index d221a3b93..37b772692 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateChecker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateChecker.kt @@ -38,5 +38,4 @@ class DevRepoUpdateChecker : UpdateChecker() { DevRepoUpdateResult.NoNewUpdate() } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateResult.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateResult.kt index 8afba1f03..1b62201a8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateResult.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/devrepo/DevRepoUpdateResult.kt @@ -6,5 +6,4 @@ sealed class DevRepoUpdateResult : UpdateResult() { class NewUpdate(release: DevRepoRelease) : UpdateResult.NewUpdate(release) class NoNewUpdate : UpdateResult.NoNewUpdate() - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubRelease.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubRelease.kt index 548e3db0e..09f1b37d0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubRelease.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubRelease.kt @@ -11,9 +11,11 @@ import eu.kanade.tachiyomi.data.updater.Release * @param info log of latest release. * @param assets assets of latest release. */ -class GithubRelease(@SerializedName("tag_name") val version: String, - @SerializedName("body") override val info: String, - @SerializedName("assets") private val assets: List) : Release { +class GithubRelease( + @SerializedName("tag_name") val version: String, + @SerializedName("body") override val info: String, + @SerializedName("assets") private val assets: List +) : Release { /** * Get download link of latest release from the assets. @@ -28,4 +30,3 @@ class GithubRelease(@SerializedName("tag_name") val version: String, */ inner class Assets(@SerializedName("browser_download_url") val downloadLink: String) } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubService.kt index 1fb721b3a..5c6b5ac09 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubService.kt @@ -26,5 +26,4 @@ interface GithubService { @GET("/repos/inorichi/tachiyomi/releases/latest") suspend fun getLatestVersion(): GithubRelease - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubUpdateChecker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubUpdateChecker.kt index c30f89bf1..20ab5de5c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubUpdateChecker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubUpdateChecker.kt @@ -20,5 +20,4 @@ class GithubUpdateChecker : UpdateChecker() { GithubUpdateResult.NoNewUpdate() } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubUpdateResult.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubUpdateResult.kt index 6e7fc1b86..8462f937e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubUpdateResult.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/github/GithubUpdateResult.kt @@ -6,5 +6,4 @@ sealed class GithubUpdateResult : UpdateResult() { class NewUpdate(release: GithubRelease) : UpdateResult.NewUpdate(release) class NoNewUpdate : UpdateResult.NoNewUpdate() - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt index 0c2dcf4ef..9dbd347e5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt @@ -29,8 +29,8 @@ import uy.kohesive.injekt.api.get * @param preferences The application preferences. */ class ExtensionManager( - private val context: Context, - private val preferences: PreferencesHelper = Injekt.get() + private val context: Context, + private val preferences: PreferencesHelper = Injekt.get() ) { /** @@ -341,5 +341,4 @@ class ExtensionManager( } return this } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt index f0a53690f..7fb384cc0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt @@ -10,28 +10,33 @@ sealed class Extension { abstract val versionCode: Int abstract val lang: String? - data class Installed(override val name: String, - override val pkgName: String, - override val versionName: String, - override val versionCode: Int, - val sources: List, - override val lang: String, - val hasUpdate: Boolean = false, - val isObsolete: Boolean = false) : Extension() + data class Installed( + override val name: String, + override val pkgName: String, + override val versionName: String, + override val versionCode: Int, + val sources: List, + override val lang: String, + val hasUpdate: Boolean = false, + val isObsolete: Boolean = false + ) : Extension() - data class Available(override val name: String, - override val pkgName: String, - override val versionName: String, - override val versionCode: Int, - override val lang: String, - val apkName: String, - val iconUrl: String) : Extension() - - data class Untrusted(override val name: String, - override val pkgName: String, - override val versionName: String, - override val versionCode: Int, - val signatureHash: String, - override val lang: String? = null) : Extension() + data class Available( + override val name: String, + override val pkgName: String, + override val versionName: String, + override val versionCode: Int, + override val lang: String, + val apkName: String, + val iconUrl: String + ) : Extension() + data class Untrusted( + override val name: String, + override val pkgName: String, + override val versionName: String, + override val versionCode: Int, + val signatureHash: String, + override val lang: String? = null + ) : Extension() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt index f2a136579..7cff79314 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt @@ -115,5 +115,4 @@ internal class ExtensionInstallReceiver(private val listener: Listener) : fun onExtensionUntrusted(extension: Extension.Untrusted) fun onPackageUninstalled(pkgName: String) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstaller.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstaller.kt index 7b2a15d10..6aaa84854 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstaller.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstaller.kt @@ -11,11 +11,11 @@ import com.jakewharton.rxrelay.PublishRelay import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.InstallStep import eu.kanade.tachiyomi.util.storage.getUriCompat +import java.io.File +import java.util.concurrent.TimeUnit import rx.Observable import rx.android.schedulers.AndroidSchedulers import timber.log.Timber -import java.io.File -import java.util.concurrent.TimeUnit /** * The installer which installs, updates and uninstalls the extensions. @@ -243,5 +243,4 @@ internal class ExtensionInstaller(private val context: Context) { const val APK_MIME = "application/vnd.android.package-archive" const val EXTRA_DOWNLOAD_ID = "ExtensionInstaller.extra.DOWNLOAD_ID" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index b03613595..8065fe1f4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -185,5 +185,4 @@ internal object ExtensionLoader { null } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt index 8c1822f8b..2c7cc9f16 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt @@ -12,15 +12,15 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.WebViewClientCompat import eu.kanade.tachiyomi.util.system.isOutdated import eu.kanade.tachiyomi.util.system.toast +import java.io.IOException +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit import okhttp3.Cookie import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Interceptor import okhttp3.Request import okhttp3.Response import uy.kohesive.injekt.injectLazy -import java.io.IOException -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit class CloudflareInterceptor(private val context: Context) : Interceptor { @@ -108,11 +108,11 @@ class CloudflareInterceptor(private val context: Context) : Interceptor { } override fun onReceivedErrorCompat( - view: WebView, - errorCode: Int, - description: String?, - failingUrl: String, - isMainFrame: Boolean + view: WebView, + errorCode: Int, + description: String?, + failingUrl: String, + isMainFrame: Boolean ) { if (isMainFrame) { if (errorCode == 503) { @@ -157,5 +157,4 @@ class CloudflareInterceptor(private val context: Context) : Interceptor { private val SERVER_CHECK = arrayOf("cloudflare-nginx", "cloudflare") private val COOKIE_NAMES = listOf("__cfduid", "cf_clearance") } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt index 21445593e..c19fbdd39 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.network import android.content.Context +import java.io.File import okhttp3.Cache import okhttp3.OkHttpClient -import java.io.File class NetworkHelper(context: Context) { @@ -21,5 +21,4 @@ class NetworkHelper(context: Context) { val cloudflareClient = client.newBuilder() .addInterceptor(CloudflareInterceptor(context)) .build() - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt index e3d3adb66..9ef935e8a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt @@ -1,14 +1,14 @@ package eu.kanade.tachiyomi.network +import java.io.IOException +import java.util.concurrent.atomic.AtomicBoolean +import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException import kotlinx.coroutines.suspendCancellableCoroutine import okhttp3.* import rx.Observable import rx.Producer import rx.Subscription -import java.io.IOException -import java.util.concurrent.atomic.AtomicBoolean -import kotlin.coroutines.resume -import kotlin.coroutines.resumeWithException fun Call.asObservable(): Observable { return Observable.unsafeCreate { subscriber -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/ProgressListener.kt b/app/src/main/java/eu/kanade/tachiyomi/network/ProgressListener.kt index 4bebcf87d..2e219895f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/ProgressListener.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/ProgressListener.kt @@ -2,4 +2,4 @@ package eu.kanade.tachiyomi.network interface ProgressListener { fun update(bytesRead: Long, contentLength: Long, done: Boolean) -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/ProgressResponseBody.kt b/app/src/main/java/eu/kanade/tachiyomi/network/ProgressResponseBody.kt index 8308acc1c..c52ad7437 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/ProgressResponseBody.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/ProgressResponseBody.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.network +import java.io.IOException import okhttp3.MediaType import okhttp3.ResponseBody import okio.* -import java.io.IOException class ProgressResponseBody(private val responseBody: ResponseBody, private val progressListener: ProgressListener) : ResponseBody() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/Requests.kt b/app/src/main/java/eu/kanade/tachiyomi/network/Requests.kt index 9b2697a51..47ded5f3f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/Requests.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/Requests.kt @@ -1,15 +1,17 @@ package eu.kanade.tachiyomi.network -import okhttp3.* import java.util.concurrent.TimeUnit.MINUTES +import okhttp3.* private val DEFAULT_CACHE_CONTROL = CacheControl.Builder().maxAge(10, MINUTES).build() private val DEFAULT_HEADERS = Headers.Builder().build() private val DEFAULT_BODY: RequestBody = FormBody.Builder().build() -fun GET(url: String, - headers: Headers = DEFAULT_HEADERS, - cache: CacheControl = DEFAULT_CACHE_CONTROL): Request { +fun GET( + url: String, + headers: Headers = DEFAULT_HEADERS, + cache: CacheControl = DEFAULT_CACHE_CONTROL +): Request { return Request.Builder() .url(url) @@ -18,10 +20,12 @@ fun GET(url: String, .build() } -fun POST(url: String, - headers: Headers = DEFAULT_HEADERS, - body: RequestBody = DEFAULT_BODY, - cache: CacheControl = DEFAULT_CACHE_CONTROL): Request { +fun POST( + url: String, + headers: Headers = DEFAULT_HEADERS, + body: RequestBody = DEFAULT_BODY, + cache: CacheControl = DEFAULT_CACHE_CONTROL +): Request { return Request.Builder() .url(url) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/CatalogueSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/CatalogueSource.kt index f5f11a00b..c78033ea6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/CatalogueSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/CatalogueSource.kt @@ -43,4 +43,4 @@ interface CatalogueSource : Source { * Returns the list of filters for the source. */ fun getFilterList(): FilterList -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt index 5d6eb7fc5..7b6c7bea3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt @@ -10,10 +10,6 @@ import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder import eu.kanade.tachiyomi.util.storage.DiskUtil import eu.kanade.tachiyomi.util.storage.EpubFile import eu.kanade.tachiyomi.util.system.ImageUtil -import junrar.Archive -import junrar.rarfile.FileHeader -import rx.Observable -import timber.log.Timber import java.io.File import java.io.FileInputStream import java.io.InputStream @@ -22,6 +18,10 @@ import java.util.Scanner import java.util.concurrent.TimeUnit import java.util.zip.ZipEntry import java.util.zip.ZipFile +import junrar.Archive +import junrar.rarfile.FileHeader +import rx.Observable +import timber.log.Timber class LocalSource(private val context: Context) : CatalogueSource { companion object { @@ -255,5 +255,4 @@ class LocalSource(private val context: Context) : CatalogueSource { data class Rar(val file: File) : Format() data class Epub(val file: File) : Format() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/Source.kt b/app/src/main/java/eu/kanade/tachiyomi/source/Source.kt index 7a5f43a84..93a8a809e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/Source.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/Source.kt @@ -40,5 +40,4 @@ interface Source { * @param chapter the chapter. */ fun fetchPageList(chapter: SChapter): Observable> - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/Filter.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/Filter.kt index 3e9c2324c..f30b2f52d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/Filter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/Filter.kt @@ -20,8 +20,8 @@ sealed class Filter(val name: String, var state: T) { abstract class Group(name: String, state: List) : Filter>(name, state) - abstract class Sort(name: String, val values: Array, state: Selection? = null) - : Filter(name, state) { + abstract class Sort(name: String, val values: Array, state: Selection? = null) : + Filter(name, state) { data class Selection(val index: Int, val ascending: Boolean) } @@ -37,5 +37,4 @@ sealed class Filter(val name: String, var state: T) { result = 31 * result + (state?.hashCode() ?: 0) return result } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/FilterList.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/FilterList.kt index e24db65b6..42b6bc74b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/FilterList.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/FilterList.kt @@ -3,5 +3,4 @@ package eu.kanade.tachiyomi.source.model data class FilterList(val list: List>) : List> by list { constructor(vararg fs: Filter<*>) : this(if (fs.isNotEmpty()) fs.asList() else emptyList()) - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/MangasPage.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/MangasPage.kt index 12dd172a7..a377c36ea 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/MangasPage.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/MangasPage.kt @@ -1,3 +1,3 @@ package eu.kanade.tachiyomi.source.model -data class MangasPage(val mangas: List, val hasNextPage: Boolean) \ No newline at end of file +data class MangasPage(val mangas: List, val hasNextPage: Boolean) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/Page.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/Page.kt index 18c1e75b0..1bd2c39e5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/Page.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/Page.kt @@ -5,10 +5,10 @@ import eu.kanade.tachiyomi.network.ProgressListener import rx.subjects.Subject open class Page( - val index: Int, - val url: String = "", - var imageUrl: String? = null, - @Transient var uri: Uri? = null // Deprecated but can't be deleted due to extensions + val index: Int, + val url: String = "", + var imageUrl: String? = null, + @Transient var uri: Uri? = null // Deprecated but can't be deleted due to extensions ) : ProgressListener { val number: Int @@ -48,5 +48,4 @@ open class Page( const val READY = 3 const val ERROR = 4 } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapter.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapter.kt index 0017e51d6..f53bbe8f0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapter.kt @@ -27,5 +27,4 @@ interface SChapter : Serializable { return SChapterImpl() } } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapterImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapterImpl.kt index 3d44fa6df..4d5e43f1e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapterImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/SChapterImpl.kt @@ -11,5 +11,4 @@ class SChapterImpl : SChapter { override var chapter_number: Float = -1f override var scanlator: String? = null - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/SManga.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/SManga.kt index 3e3ef8206..f7a88ea9b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/SManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/SManga.kt @@ -54,5 +54,4 @@ interface SManga : Serializable { return SMangaImpl() } } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/model/SMangaImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/source/model/SMangaImpl.kt index 3dbba4b99..c944474a1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/model/SMangaImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/model/SMangaImpl.kt @@ -19,5 +19,4 @@ class SMangaImpl : SManga { override var thumbnail_url: String? = null override var initialized: Boolean = false - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt index 087c8da97..84c4c86fc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt @@ -6,15 +6,15 @@ import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.newCallWithProgress import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.model.* +import java.net.URI +import java.net.URISyntaxException +import java.security.MessageDigest import okhttp3.Headers import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response import rx.Observable import uy.kohesive.injekt.injectLazy -import java.net.URI -import java.net.URISyntaxException -import java.security.MessageDigest /** * A simple implementation for sources from a website. diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/LoginSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/LoginSource.kt index 8aae073e3..71ef19005 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/LoginSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/LoginSource.kt @@ -11,5 +11,4 @@ interface LoginSource : Source { fun login(username: String, password: String): Observable fun isAuthenticationSuccessful(response: Response): Boolean - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt index e284d94b7..766e57532 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt @@ -6,12 +6,12 @@ import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.util.system.LocaleHelper import uy.kohesive.injekt.injectLazy -import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values abstract class BaseActivity : AppCompatActivity() { @@ -54,5 +54,4 @@ abstract class BaseActivity : AppCompatActivity() { SecureActivityDelegate.onResume(this) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseRxActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseRxActivity.kt index 5105ac048..4da986bb9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseRxActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseRxActivity.kt @@ -24,5 +24,4 @@ abstract class BaseRxActivity

> : NucleusAppCompatActivity

Observable.subscribeUntilDetach(): Subscription { return subscribe().also { untilDetachSubscriptions.add(it) } @@ -53,15 +52,19 @@ abstract class RxController(bundle: Bundle? = null) : BaseController(bundle) { return subscribe(onNext).also { untilDetachSubscriptions.add(it) } } - fun Observable.subscribeUntilDetach(onNext: (T) -> Unit, - onError: (Throwable) -> Unit): Subscription { + fun Observable.subscribeUntilDetach( + onNext: (T) -> Unit, + onError: (Throwable) -> Unit + ): Subscription { return subscribe(onNext, onError).also { untilDetachSubscriptions.add(it) } } - fun Observable.subscribeUntilDetach(onNext: (T) -> Unit, - onError: (Throwable) -> Unit, - onCompleted: () -> Unit): Subscription { + fun Observable.subscribeUntilDetach( + onNext: (T) -> Unit, + onError: (Throwable) -> Unit, + onCompleted: () -> Unit + ): Subscription { return subscribe(onNext, onError, onCompleted).also { untilDetachSubscriptions.add(it) } } @@ -76,17 +79,20 @@ abstract class RxController(bundle: Bundle? = null) : BaseController(bundle) { return subscribe(onNext).also { untilDestroySubscriptions.add(it) } } - fun Observable.subscribeUntilDestroy(onNext: (T) -> Unit, - onError: (Throwable) -> Unit): Subscription { + fun Observable.subscribeUntilDestroy( + onNext: (T) -> Unit, + onError: (Throwable) -> Unit + ): Subscription { return subscribe(onNext, onError).also { untilDestroySubscriptions.add(it) } } - fun Observable.subscribeUntilDestroy(onNext: (T) -> Unit, - onError: (Throwable) -> Unit, - onCompleted: () -> Unit): Subscription { + fun Observable.subscribeUntilDestroy( + onNext: (T) -> Unit, + onError: (Throwable) -> Unit, + onCompleted: () -> Unit + ): Subscription { return subscribe(onNext, onError, onCompleted).also { untilDestroySubscriptions.add(it) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/holder/BaseFlexibleViewHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/holder/BaseFlexibleViewHolder.kt index 3cc6b9c2a..c4953b85d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/holder/BaseFlexibleViewHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/holder/BaseFlexibleViewHolder.kt @@ -5,11 +5,13 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.viewholders.FlexibleViewHolder import kotlinx.android.extensions.LayoutContainer -abstract class BaseFlexibleViewHolder(view: View, - adapter: FlexibleAdapter<*>, - stickyHeader: Boolean = false) : +abstract class BaseFlexibleViewHolder( + view: View, + adapter: FlexibleAdapter<*>, + stickyHeader: Boolean = false +) : FlexibleViewHolder(view, adapter, stickyHeader), LayoutContainer { override val containerView: View? get() = itemView -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/holder/SlicedHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/holder/SlicedHolder.kt index 499c4056c..d31e6062d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/holder/SlicedHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/holder/SlicedHolder.kt @@ -41,8 +41,13 @@ interface SlicedHolder { } } - private fun applySlice(radius: Float, topRect: Boolean, bottomRect: Boolean, - topShadow: Boolean, bottomShadow: Boolean) { + private fun applySlice( + radius: Float, + topRect: Boolean, + bottomRect: Boolean, + topShadow: Boolean, + bottomShadow: Boolean + ) { val margin = margin slice.setRadius(radius) @@ -62,5 +67,4 @@ interface SlicedHolder { val margin get() = 8.dpToPx - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/BasePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/BasePresenter.kt index d10d3fc7b..fe095d463 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/BasePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/BasePresenter.kt @@ -66,5 +66,4 @@ open class BasePresenter : RxPresenter() { } } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorDelegate.kt index bce36974b..cd07ed478 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorDelegate.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorDelegate.kt @@ -43,5 +43,4 @@ class NucleusConductorDelegate

>(private val factory: PresenterF fun onDestroy() { presenter?.destroy() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorLifecycleListener.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorLifecycleListener.kt index 0e2502033..f59febccf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorLifecycleListener.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorLifecycleListener.kt @@ -29,5 +29,4 @@ class NucleusConductorLifecycleListener(private val delegate: NucleusConductorDe companion object { private const val PRESENTER_STATE_KEY = "presenter_state" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt index 6c9200731..ca7822878 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueAdapter.kt @@ -45,4 +45,3 @@ class CatalogueAdapter(val controller: CatalogueController) : fun onLatestClick(position: Int) } } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt index eb8dcc22c..cd538a92a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt @@ -7,13 +7,13 @@ import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter +import java.util.TreeMap +import java.util.concurrent.TimeUnit import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.TreeMap -import java.util.concurrent.TimeUnit /** * Presenter of [CatalogueController] @@ -23,8 +23,8 @@ import java.util.concurrent.TimeUnit * @param preferences application preferences. */ class CataloguePresenter( - val sourceManager: SourceManager = Injekt.get(), - private val preferences: PreferencesHelper = Injekt.get() + val sourceManager: SourceManager = Injekt.get(), + private val preferences: PreferencesHelper = Injekt.get() ) : BasePresenter() { /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/LangItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/LangItem.kt index 7bf01f1d4..5206496e9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/LangItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/LangItem.kt @@ -32,11 +32,11 @@ data class LangItem(val code: String) : AbstractHeaderItem() { * Binds this item to the given view holder. */ override fun bindViewHolder( - adapter: FlexibleAdapter>, - holder: LangHolder, - position: Int, - payloads: MutableList) { + adapter: FlexibleAdapter>, + holder: LangHolder, + position: Int, + payloads: MutableList + ) { holder.bind(this) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt index 698155fe6..baf596eeb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt @@ -36,9 +36,12 @@ class SourceDividerItemDecoration(context: Context) : RecyclerView.ItemDecoratio } } - override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, - state: RecyclerView.State) { + override fun getItemOffsets( + outRect: Rect, + view: View, + parent: RecyclerView, + state: RecyclerView.State + ) { outRect.set(0, 0, 0, divider.intrinsicHeight) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceItem.kt index 9543e5e69..4b9ad1ebf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceItem.kt @@ -35,11 +35,11 @@ data class SourceItem(val source: CatalogueSource, val header: LangItem? = null) * Binds this item to the given view holder. */ override fun bindViewHolder( - adapter: FlexibleAdapter>, - holder: SourceHolder, - position: Int, - payloads: MutableList) { + adapter: FlexibleAdapter>, + holder: SourceHolder, + position: Int, + payloads: MutableList + ) { holder.bind(this) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt index 4ae23275e..c511022db 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt @@ -36,6 +36,7 @@ import eu.kanade.tachiyomi.util.view.inflate import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.widget.AutofitRecyclerView +import java.util.concurrent.TimeUnit import kotlinx.android.synthetic.main.catalogue_controller.catalogue_view import kotlinx.android.synthetic.main.catalogue_controller.progress import kotlinx.android.synthetic.main.main_activity.drawer @@ -44,7 +45,6 @@ import rx.Subscription import rx.android.schedulers.AndroidSchedulers import timber.log.Timber import uy.kohesive.injekt.injectLazy -import java.util.concurrent.TimeUnit /** * Controller to manage the catalogues available in the app. @@ -525,7 +525,6 @@ open class BrowseCatalogueController(bundle: Bundle) : } activity.toast(activity.getString(R.string.manga_added_library)) } - } /** @@ -542,5 +541,4 @@ open class BrowseCatalogueController(bundle: Bundle) : protected companion object { const val SOURCE_ID_KEY = "sourceId" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCataloguePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCataloguePresenter.kt index d17cca5e0..4a7742cf4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCataloguePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCataloguePresenter.kt @@ -29,11 +29,11 @@ import uy.kohesive.injekt.api.get * Presenter of [BrowseCatalogueController]. */ open class BrowseCataloguePresenter( - sourceId: Long, - sourceManager: SourceManager = Injekt.get(), - private val db: DatabaseHelper = Injekt.get(), - private val prefs: PreferencesHelper = Injekt.get(), - private val coverCache: CoverCache = Injekt.get() + sourceId: Long, + sourceManager: SourceManager = Injekt.get(), + private val db: DatabaseHelper = Injekt.get(), + private val prefs: PreferencesHelper = Injekt.get(), + private val coverCache: CoverCache = Injekt.get() ) : BasePresenter() { /** @@ -372,5 +372,4 @@ open class BrowseCataloguePresenter( changeMangaFavorite(manga) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueHolder.kt index 9a0ec3916..62b7ae426 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueHolder.kt @@ -22,7 +22,6 @@ abstract class CatalogueHolder(view: View, adapter: FlexibleAdapter<*>) : */ abstract fun onSetValues(manga: Manga) - /** * Updates the image for this holder. Useful to update the image when the manga is initialized * and the url is now known. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueItem.kt index 1faf51143..92c4ed915 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueItem.kt @@ -27,8 +27,8 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference> + view: View, + adapter: FlexibleAdapter> ): CatalogueHolder { val parent = adapter.recyclerView return if (parent is AutofitRecyclerView) { @@ -45,10 +45,10 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference>, - holder: CatalogueHolder, - position: Int, - payloads: List? + adapter: FlexibleAdapter>, + holder: CatalogueHolder, + position: Int, + payloads: List? ) { holder.onSetValues(manga) } @@ -64,5 +64,4 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference) : .into(thumbnail) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt index f36f16622..888af9542 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueNavigationView.kt @@ -12,9 +12,8 @@ import kotlinx.android.synthetic.main.catalogue_drawer_content.view.reset_btn import kotlinx.android.synthetic.main.catalogue_drawer_content.view.search_btn import kotlinx.android.synthetic.main.catalogue_drawer_content.view.title - -class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) - : SimpleNavigationView(context, attrs) { +class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : + SimpleNavigationView(context, attrs) { val adapter: FlexibleAdapter> = FlexibleAdapter>(null) .setDisplayHeadersAtStartUp(true) @@ -38,5 +37,4 @@ class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs: fun setFilters(items: List>) { adapter.updateDataSet(items) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CataloguePager.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CataloguePager.kt index a7b563074..08dad01c2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CataloguePager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CataloguePager.kt @@ -28,5 +28,4 @@ open class CataloguePager(val source: CatalogueSource, val query: String, val fi } } } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/NoResultsException.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/NoResultsException.kt index 723782f5e..ae6f39bcd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/NoResultsException.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/NoResultsException.kt @@ -1,3 +1,3 @@ package eu.kanade.tachiyomi.ui.catalogue.browse -class NoResultsException : Exception() \ No newline at end of file +class NoResultsException : Exception() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/Pager.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/Pager.kt index 104e5887d..62b88aa85 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/Pager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/Pager.kt @@ -27,5 +27,4 @@ abstract class Pager(var currentPage: Int = 1) { hasNextPage = mangasPage.hasNextPage && mangasPage.mangas.isNotEmpty() results.call(Pair(page, mangasPage.mangas)) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/ProgressItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/ProgressItem.kt index b9e918dc5..545cff952 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/ProgressItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/ProgressItem.kt @@ -10,7 +10,6 @@ import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.viewholders.FlexibleViewHolder import eu.kanade.tachiyomi.R - class ProgressItem : AbstractFlexibleItem() { private var loadMore = true @@ -47,5 +46,4 @@ class ProgressItem : AbstractFlexibleItem() { val progressBar: ProgressBar = view.findViewById(R.id.progress_bar) val progressMessage: TextView = view.findViewById(R.id.progress_message) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortItem.kt index 358cfa135..2e8b92d3f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/SortItem.kt @@ -71,5 +71,4 @@ class SortItem(val name: String, val group: SortGroup) : AbstractSectionableItem class Holder(view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter) { val text: CheckedTextView = itemView.findViewById(R.id.nav_view_item) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/TriStateItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/TriStateItem.kt index 16f76697c..4cf52397f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/TriStateItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/filter/TriStateItem.kt @@ -9,10 +9,10 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.AbstractFlexibleItem import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.viewholders.FlexibleViewHolder +import eu.kanade.tachiyomi.R as TR import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.getResourceColor -import eu.kanade.tachiyomi.R as TR open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem() { @@ -72,5 +72,4 @@ open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem>, holder: CatalogueSearchCardHolder, - position: Int, payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: CatalogueSearchCardHolder, + position: Int, + payloads: List? + ) { holder.bind(manga) } @@ -33,5 +37,4 @@ class CatalogueSearchCardItem(val manga: Manga) : AbstractFlexibleItem(), CatalogueSearchCardAdapter.OnMangaClickListener { @@ -186,5 +186,4 @@ open class CatalogueSearchController( fun onMangaInitialized(source: CatalogueSource, manga: Manga) { getHolder(source)?.setImage(manga) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchHolder.kt index 91e441872..3239638c5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchHolder.kt @@ -103,5 +103,4 @@ class CatalogueSearchHolder(view: View, val adapter: CatalogueSearchAdapter) : title.gone() source_card.gone() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchItem.kt index eb652e607..bd284f485 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchItem.kt @@ -15,8 +15,8 @@ import eu.kanade.tachiyomi.source.CatalogueSource * @param results the search results. * @param highlighted whether this search item should be highlighted/marked in the catalogue search view. */ -class CatalogueSearchItem(val source: CatalogueSource, val results: List?, val highlighted: Boolean = false) - : AbstractFlexibleItem() { +class CatalogueSearchItem(val source: CatalogueSource, val results: List?, val highlighted: Boolean = false) : + AbstractFlexibleItem() { /** * Set view. @@ -39,8 +39,12 @@ class CatalogueSearchItem(val source: CatalogueSource, val results: List>, holder: CatalogueSearchHolder, - position: Int, payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: CatalogueSearchHolder, + position: Int, + payloads: List? + ) { holder.bind(this) } @@ -64,5 +68,4 @@ class CatalogueSearchItem(val source: CatalogueSource, val results: List() { /** @@ -204,7 +204,6 @@ open class CatalogueSearchPresenter( .map { Pair(it, source) } .concatMap { getMangaDetailsObservable(it.first, it.second) } .map { Pair(source as CatalogueSource, it) } - } .onBackpressureBuffer() .observeOn(AndroidSchedulers.mainThread()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesController.kt index bae5863ac..532e1c835 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesController.kt @@ -33,7 +33,5 @@ class LatestUpdatesController(bundle: Bundle) : BrowseCatalogueController(bundle } override fun cleanupSecondaryDrawer(drawer: DrawerLayout) { - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesPager.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesPager.kt index 7ab58f4e1..704b375c0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesPager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesPager.kt @@ -18,5 +18,4 @@ class LatestUpdatesPager(val source: CatalogueSource) : Pager() { .observeOn(AndroidSchedulers.mainThread()) .doOnNext { onPageReceived(it) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesPresenter.kt index a1be55797..9b514528a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/latest/LatestUpdatesPresenter.kt @@ -12,5 +12,4 @@ class LatestUpdatesPresenter(sourceId: Long) : BrowseCataloguePresenter(sourceId override fun createPager(query: String, filters: FilterList): Pager { return LatestUpdatesPager(source) } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryAdapter.kt index 0ad0eb90c..dbfeca2cc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryAdapter.kt @@ -46,5 +46,4 @@ class CategoryAdapter(controller: CategoryController) : */ fun onItemReleased(position: Int) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt index 028091c50..067ba3b98 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt @@ -244,7 +244,7 @@ class CategoryController : NucleusController(), private fun toggleSelection(position: Int) { val adapter = adapter ?: return - //Mark the position selected + // Mark the position selected adapter.toggleSelection(position) if (adapter.selectedItemCount == 0) { @@ -321,5 +321,4 @@ class CategoryController : NucleusController(), fun onCategoryExistsError() { activity?.toast(R.string.error_category_exists) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryCreateDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryCreateDialog.kt index 82306d079..43783503c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryCreateDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryCreateDialog.kt @@ -43,5 +43,4 @@ class CategoryCreateDialog(bundle: Bundle? = null) : DialogController(bundle) interface Listener { fun createCategory(name: String) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt index 7181c07fd..09e49d627 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt @@ -50,5 +50,4 @@ class CategoryHolder(view: View, val adapter: CategoryAdapter) : BaseFlexibleVie super.onItemReleased(position) adapter.onItemReleaseListener.onItemReleased(position) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryItem.kt index 7b01cb3de..250a871b2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryItem.kt @@ -43,10 +43,12 @@ class CategoryItem(val category: Category) : AbstractFlexibleItem>, - holder: CategoryHolder, - position: Int, - payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: CategoryHolder, + position: Int, + payloads: List? + ) { holder.bind(category) } @@ -69,5 +71,4 @@ class CategoryItem(val category: Category) : AbstractFlexibleItem() { /** @@ -103,5 +103,4 @@ class CategoryPresenter( fun categoryExists(name: String): Boolean { return categories.any { it.name.equals(name, true) } } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryRenameDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryRenameDialog.kt index 023333c83..0edf1c9e0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryRenameDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryRenameDialog.kt @@ -82,5 +82,4 @@ class CategoryRenameDialog(bundle: Bundle? = null) : DialogController(bundle) private companion object { const val CATEGORY_KEY = "CategoryRenameDialog.category" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadAdapter.kt index 2738a765c..994b83e8f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadAdapter.kt @@ -68,5 +68,4 @@ class DownloadAdapter : RecyclerView.Adapter() { val download = items[position] holder.onSetValues(download) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt index 5af88e427..9833e1835 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadController.kt @@ -7,13 +7,13 @@ import eu.kanade.tachiyomi.data.download.DownloadService import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.ui.base.controller.NucleusController +import java.util.HashMap +import java.util.concurrent.TimeUnit import kotlinx.android.synthetic.main.download_controller.empty_view import kotlinx.android.synthetic.main.download_controller.recycler import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers -import java.util.HashMap -import java.util.concurrent.TimeUnit /** * Controller that shows the currently active downloads. @@ -243,5 +243,4 @@ class DownloadController : NucleusController() { empty_view?.hide() } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt index dd0e7fe6d..f82a606a2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadHolder.kt @@ -65,5 +65,4 @@ class DownloadHolder(private val view: View) : BaseViewHolder(view) { val pages = download.pages ?: return view.download_progress_text.text = "${download.downloadedImages}/${pages.size}" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadPresenter.kt index 9d9c8ce44..54135f6b6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadPresenter.kt @@ -5,11 +5,11 @@ import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.download.model.DownloadQueue import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter +import java.util.ArrayList import rx.Observable import rx.android.schedulers.AndroidSchedulers import timber.log.Timber import uy.kohesive.injekt.injectLazy -import java.util.ArrayList /** * Presenter of [DownloadController]. @@ -61,5 +61,4 @@ class DownloadPresenter : BasePresenter() { fun clearQueue() { downloadManager.clearQueue() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionController.kt index ab17120cd..7deccaee1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionController.kt @@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import kotlinx.android.synthetic.main.extension_controller.ext_recycler import kotlinx.android.synthetic.main.extension_controller.ext_swipe_refresh - /** * Controller to manage the catalogues available in the app. */ diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt index a3d814d73..604c7657d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt @@ -196,5 +196,4 @@ class ExtensionDetailsController(bundle: Bundle? = null) : const val PKGNAME_KEY = "pkg_name" const val LASTOPENPREFERENCE_KEY = "last_open_preference" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsPresenter.kt index 1b9b958f0..93b79d467 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsPresenter.kt @@ -8,8 +8,8 @@ import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get class ExtensionDetailsPresenter( - val pkgName: String, - private val extensionManager: ExtensionManager = Injekt.get() + val pkgName: String, + private val extensionManager: ExtensionManager = Injekt.get() ) : BasePresenter() { val extension = extensionManager.installedExtensions.find { it.pkgName == pkgName } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDividerItemDecoration.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDividerItemDecoration.kt index 7c3162d69..8d8662c4a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDividerItemDecoration.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDividerItemDecoration.kt @@ -36,9 +36,12 @@ class ExtensionDividerItemDecoration(context: Context) : RecyclerView.ItemDecora } } - override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, - state: RecyclerView.State) { + override fun getItemOffsets( + outRect: Rect, + view: View, + parent: RecyclerView, + state: RecyclerView.State + ) { outRect.set(0, 0, 0, divider.intrinsicHeight) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionGroupItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionGroupItem.kt index b90e6f870..154df6811 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionGroupItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionGroupItem.kt @@ -32,8 +32,12 @@ data class ExtensionGroupItem(val name: String, val size: Int, val showSize: Boo /** * Binds this item to the given view holder. */ - override fun bindViewHolder(adapter: FlexibleAdapter>, holder: ExtensionGroupHolder, - position: Int, payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: ExtensionGroupHolder, + position: Int, + payloads: List? + ) { holder.bind(this) } @@ -49,5 +53,4 @@ data class ExtensionGroupItem(val name: String, val size: Int, val showSize: Boo override fun hashCode(): Int { return name.hashCode() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt index 5e92335b4..ac4e2fa00 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionHolder.kt @@ -101,5 +101,4 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) : setText(R.string.ext_install) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionItem.kt index 7a0bd406a..3c3b63ad5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionItem.kt @@ -16,9 +16,11 @@ import eu.kanade.tachiyomi.source.CatalogueSource * @param source Instance of [CatalogueSource] containing source information. * @param header The header for this item. */ -data class ExtensionItem(val extension: Extension, - val header: ExtensionGroupItem? = null, - val installStep: InstallStep? = null) : +data class ExtensionItem( + val extension: Extension, + val header: ExtensionGroupItem? = null, + val installStep: InstallStep? = null +) : AbstractSectionableItem(header) { /** @@ -38,8 +40,12 @@ data class ExtensionItem(val extension: Extension, /** * Binds this item to the given view holder. */ - override fun bindViewHolder(adapter: FlexibleAdapter>, holder: ExtensionHolder, - position: Int, payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: ExtensionHolder, + position: Int, + payloads: List? + ) { if (payloads == null || payloads.isEmpty()) { holder.bind(this) @@ -57,5 +63,4 @@ data class ExtensionItem(val extension: Extension, override fun hashCode(): Int { return extension.pkgName.hashCode() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionPresenter.kt index 5df0a26cf..e66f40b10 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionPresenter.kt @@ -10,22 +10,22 @@ import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.InstallStep import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.util.system.LocaleHelper +import java.util.concurrent.TimeUnit import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.concurrent.TimeUnit -private typealias ExtensionTuple - = Triple, List, List> +private typealias ExtensionTuple = + Triple, List, List> /** * Presenter of [ExtensionController]. */ open class ExtensionPresenter( - private val extensionManager: ExtensionManager = Injekt.get(), - private val preferences: PreferencesHelper = Injekt.get() + private val extensionManager: ExtensionManager = Injekt.get(), + private val preferences: PreferencesHelper = Injekt.get() ) : BasePresenter() { private var extensions = emptyList() @@ -45,8 +45,7 @@ open class ExtensionPresenter( val availableObservable = extensionManager.getAvailableExtensionsObservable() .startWith(emptyList()) - return Observable.combineLatest(installedObservable, untrustedObservable, availableObservable) - { installed, untrusted, available -> Triple(installed, untrusted, available) } + return Observable.combineLatest(installedObservable, untrustedObservable, availableObservable) { installed, untrusted, available -> Triple(installed, untrusted, available) } .debounce(100, TimeUnit.MILLISECONDS) .map(::toItems) .observeOn(AndroidSchedulers.mainThread()) @@ -68,9 +67,9 @@ open class ExtensionPresenter( val availableSorted = available // Filter out already installed extensions and disabled languages .filter { avail -> - installed.none { it.pkgName == avail.pkgName } - && untrusted.none { it.pkgName == avail.pkgName } - && (avail.lang in activeLangs || avail.lang == "all") + installed.none { it.pkgName == avail.pkgName } && + untrusted.none { it.pkgName == avail.pkgName } && + (avail.lang in activeLangs || avail.lang == "all") } .sortedBy { it.pkgName } @@ -153,5 +152,4 @@ open class ExtensionPresenter( fun trustSignature(signatureHash: String) { extensionManager.trustSignature(signatureHash) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/ChangeMangaCategoriesDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/ChangeMangaCategoriesDialog.kt index 8513ac91e..7c2a02605 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/ChangeMangaCategoriesDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/ChangeMangaCategoriesDialog.kt @@ -18,8 +18,12 @@ class ChangeMangaCategoriesDialog(bundle: Bundle? = null) : private var preselected = emptyArray() - constructor(target: T, mangas: List, categories: List, - preselected: Array) : this() { + constructor( + target: T, + mangas: List, + categories: List, + preselected: Array + ) : this() { this.mangas = mangas this.categories = categories @@ -44,5 +48,4 @@ class ChangeMangaCategoriesDialog(bundle: Bundle? = null) : interface Listener { fun updateCategoriesForMangas(mangas: List, categories: List) } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt index 9eb0c9531..27bb23182 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt @@ -99,5 +99,4 @@ class LibraryAdapter(private val controller: LibraryController) : RecyclerViewPa } } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryAdapter.kt index 455cd304e..fbcad7254 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryAdapter.kt @@ -44,5 +44,4 @@ class LibraryCategoryAdapter(view: LibraryCategoryView) : } updateDataSet(mangas.filter { it.filter(s) }) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt index 441d03091..9ab39c762 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt @@ -267,7 +267,6 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att controller.invalidateActionMode() } - /** * Tells the presenter to set the selection for the given position. * @@ -279,5 +278,4 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att controller.setSelection(item.manga, true) controller.invalidateActionMode() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 2e6204043..0cf5ba06b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -35,6 +35,7 @@ import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.view.inflate +import java.io.IOException import kotlinx.android.synthetic.main.library_controller.empty_view import kotlinx.android.synthetic.main.library_controller.library_pager import kotlinx.android.synthetic.main.main_activity.drawer @@ -43,12 +44,10 @@ import rx.Subscription import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.io.IOException - class LibraryController( - bundle: Bundle? = null, - private val preferences: PreferencesHelper = Injekt.get() + bundle: Bundle? = null, + private val preferences: PreferencesHelper = Injekt.get() ) : NucleusController(bundle), TabbedController, SecondaryDrawerController, @@ -556,5 +555,4 @@ class LibraryController( */ const val REQUEST_IMAGE_OPEN = 101 } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt index f0700f479..22ff302e2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt @@ -17,8 +17,8 @@ import kotlinx.android.synthetic.main.catalogue_grid_item.* * @constructor creates a new library holder. */ class LibraryGridHolder( - private val view: View, - private val adapter: FlexibleAdapter<*> + private val view: View, + private val adapter: FlexibleAdapter<*> ) : LibraryHolder(view, adapter) { @@ -42,7 +42,7 @@ class LibraryGridHolder( visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE text = item.downloadCount.toString() } - //set local visibility if its local manga + // set local visibility if its local manga local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE // Update the cover. @@ -53,5 +53,4 @@ class LibraryGridHolder( .centerCrop() .into(thumbnail) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt index 4136ce312..b5715de23 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt @@ -12,8 +12,8 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder */ abstract class LibraryHolder( - view: View, - adapter: FlexibleAdapter<*> + view: View, + adapter: FlexibleAdapter<*> ) : BaseFlexibleViewHolder(view, adapter) { /** @@ -23,5 +23,4 @@ abstract class LibraryHolder( * @param item the manga item to bind. */ abstract fun onSetValues(item: LibraryItem) - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt index bb1362b78..1651b7f97 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt @@ -49,10 +49,12 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference } } - override fun bindViewHolder(adapter: FlexibleAdapter>, - holder: LibraryHolder, - position: Int, - payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: LibraryHolder, + position: Int, + payloads: List? + ) { holder.onSetValues(this) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt index 53b448dd7..81bb4951d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt @@ -18,8 +18,8 @@ import kotlinx.android.synthetic.main.catalogue_list_item.* */ class LibraryListHolder( - private val view: View, - private val adapter: FlexibleAdapter<*> + private val view: View, + private val adapter: FlexibleAdapter<*> ) : LibraryHolder(view, adapter) { /** @@ -42,7 +42,7 @@ class LibraryListHolder( visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE text = "${item.downloadCount}" } - //show local text badge if local manga + // show local text badge if local manga local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE // Create thumbnail onclick to simulate long click @@ -61,5 +61,4 @@ class LibraryListHolder( .dontAnimate() .into(thumbnail) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryNavigationView.kt index dba3457cd..7c0491f71 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryNavigationView.kt @@ -14,8 +14,8 @@ import uy.kohesive.injekt.injectLazy /** * The navigation view shown in a drawer with the different options to show the library. */ -class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) - : ExtendedNavigationView(context, attrs) { +class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : + ExtendedNavigationView(context, attrs) { /** * Preferences helper. @@ -161,6 +161,5 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A item.group.items.forEach { adapter.notifyItemChanged(it) } } - } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 87aab5fa9..e95a9fb4e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -17,17 +17,17 @@ import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.util.lang.combineLatest import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed +import java.io.IOException +import java.io.InputStream +import java.util.ArrayList +import java.util.Collections +import java.util.Comparator import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.io.IOException -import java.io.InputStream -import java.util.ArrayList -import java.util.Collections -import java.util.Comparator /** * Class containing library information. @@ -43,11 +43,11 @@ private typealias LibraryMap = Map> * Presenter of [LibraryController]. */ class LibraryPresenter( - private val db: DatabaseHelper = Injekt.get(), - private val preferences: PreferencesHelper = Injekt.get(), - private val coverCache: CoverCache = Injekt.get(), - private val sourceManager: SourceManager = Injekt.get(), - private val downloadManager: DownloadManager = Injekt.get() + private val db: DatabaseHelper = Injekt.get(), + private val preferences: PreferencesHelper = Injekt.get(), + private val coverCache: CoverCache = Injekt.get(), + private val sourceManager: SourceManager = Injekt.get(), + private val downloadManager: DownloadManager = Injekt.get() ) : BasePresenter() { private val context = preferences.context @@ -375,5 +375,4 @@ class LibraryPresenter( } return false } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySort.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySort.kt index feb35cf4b..4fd8d4bf7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySort.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySort.kt @@ -8,5 +8,4 @@ object LibrarySort { const val UNREAD = 3 const val TOTAL = 4 const val LATEST_CHAPTER = 6 - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 986f64196..ec3228eb9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -21,7 +21,6 @@ import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController import kotlinx.android.synthetic.main.main_activity.* - class MainActivity : BaseActivity() { private lateinit var router: Router @@ -92,17 +91,25 @@ class MainActivity : BaseActivity() { } router.addChangeListener(object : ControllerChangeHandler.ControllerChangeListener { - override fun onChangeStarted(to: Controller?, from: Controller?, isPush: Boolean, - container: ViewGroup, handler: ControllerChangeHandler) { + override fun onChangeStarted( + to: Controller?, + from: Controller?, + isPush: Boolean, + container: ViewGroup, + handler: ControllerChangeHandler + ) { syncActivityViewWithController(to, from) } - override fun onChangeCompleted(to: Controller?, from: Controller?, isPush: Boolean, - container: ViewGroup, handler: ControllerChangeHandler) { - + override fun onChangeCompleted( + to: Controller?, + from: Controller?, + isPush: Boolean, + container: ViewGroup, + handler: ControllerChangeHandler + ) { } - }) syncActivityViewWithController(router.backstack.lastOrNull()?.controller()) @@ -142,10 +149,10 @@ class MainActivity : BaseActivity() { router.pushController(RouterTransaction.with(DownloadController())) } Intent.ACTION_SEARCH, "com.google.android.gms.actions.SEARCH_ACTION" -> { - //If the intent match the "standard" Android search intent + // If the intent match the "standard" Android search intent // or the Google-specific search intent (triggered by saying or typing "search *query* on *Tachiyomi*" in Google Search/Google Assistant) - //Get the search query provided in extras, and if not null, perform a global search with it. + // Get the search query provided in extras, and if not null, perform a global search with it. val query = intent.getStringExtra(SearchManager.QUERY) if (query != null && query.isNotEmpty()) { if (router.backstackSize > 1) { @@ -245,5 +252,4 @@ class MainActivity : BaseActivity() { const val INTENT_SEARCH_QUERY = "query" const val INTENT_SEARCH_FILTER = "filter" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/TabsAnimator.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/TabsAnimator.kt index 5719036f0..304473c17 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/TabsAnimator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/TabsAnimator.kt @@ -102,5 +102,4 @@ class TabsAnimator(val tabs: TabLayout) { */ private val isMeasured: Boolean get() = tabsHeight > 0 - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index cdd204990..ea5ff57df 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -27,12 +27,12 @@ import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersController import eu.kanade.tachiyomi.ui.manga.info.MangaInfoController import eu.kanade.tachiyomi.ui.manga.track.TrackController import eu.kanade.tachiyomi.util.system.toast +import java.util.Date import kotlinx.android.synthetic.main.main_activity.tabs import kotlinx.android.synthetic.main.manga_controller.manga_pager import rx.Subscription import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.Date class MangaController : RxController, TabbedController { @@ -170,7 +170,6 @@ class MangaController : RxController, TabbedController { override fun getPageTitle(position: Int): CharSequence { return tabTitles[position] } - } companion object { @@ -181,5 +180,4 @@ class MangaController : RxController, TabbedController { const val CHAPTERS_CONTROLLER = 1 const val TRACK_CONTROLLER = 2 } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt index 65288ee09..d3052f5c0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt @@ -9,12 +9,12 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.setVectorCompat -import kotlinx.android.synthetic.main.chapters_item.* import java.util.Date +import kotlinx.android.synthetic.main.chapters_item.* class ChapterHolder( - private val view: View, - private val adapter: ChaptersAdapter + private val view: View, + private val adapter: ChaptersAdapter ) : BaseFlexibleViewHolder(view, adapter) { init { @@ -49,9 +49,9 @@ class ChapterHolder( chapter_date.text = "" } - //add scanlator if exists + // add scanlator if exists chapter_scanlator.text = chapter.scanlator - //allow longer titles if there is no scanlator (most sources) + // allow longer titles if there is no scanlator (most sources) if (chapter_scanlator.text.isNullOrBlank()) { chapter_title.maxLines = 2 chapter_scanlator.gone() @@ -118,5 +118,4 @@ class ChapterHolder( // Finally show the PopupMenu popup.show() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterItem.kt index 32a37aa65..b705a4907 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterItem.kt @@ -35,10 +35,12 @@ class ChapterItem(val chapter: Chapter, val manga: Manga) : AbstractFlexibleItem return ChapterHolder(view, adapter as ChaptersAdapter) } - override fun bindViewHolder(adapter: FlexibleAdapter>, - holder: ChapterHolder, - position: Int, - payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: ChapterHolder, + position: Int, + payloads: List? + ) { holder.bind(this, manga) } @@ -54,5 +56,4 @@ class ChapterItem(val chapter: Chapter, val manga: Manga) : AbstractFlexibleItem override fun hashCode(): Int { return chapter.id!!.hashCode() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersAdapter.kt index 6767db03e..c6ecf7efc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersAdapter.kt @@ -7,14 +7,14 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.util.system.getResourceColor -import uy.kohesive.injekt.injectLazy import java.text.DateFormat import java.text.DecimalFormat import java.text.DecimalFormatSymbols +import uy.kohesive.injekt.injectLazy class ChaptersAdapter( - controller: ChaptersController, - context: Context + controller: ChaptersController, + context: Context ) : FlexibleAdapter(null, controller, true) { val preferences: PreferencesHelper by injectLazy() @@ -46,5 +46,4 @@ class ChaptersAdapter( interface OnMenuItemClickListener { fun onMenuItemClick(position: Int, item: MenuItem) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt index 32621de63..0b7edd7b8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt @@ -233,7 +233,6 @@ class ChaptersController : NucleusController(), } actionMode?.invalidate() } - } private fun initialFetchChapters() { @@ -466,7 +465,7 @@ class ChaptersController : NucleusController(), fun onChaptersDeleted(chapters: List) { dismissDeletingDialog() - //this is needed so the downloaded text gets removed from the item + // this is needed so the downloaded text gets removed from the item chapters.forEach { adapter?.updateItem(it) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt index 3f9bc0204..172121062 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt @@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed +import java.util.Date import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers @@ -21,20 +22,19 @@ import rx.schedulers.Schedulers import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.Date /** * Presenter of [ChaptersController]. */ class ChaptersPresenter( - val manga: Manga, - val source: Source, - private val chapterCountRelay: BehaviorRelay, - private val lastUpdateRelay: BehaviorRelay, - private val mangaFavoriteRelay: PublishRelay, - val preferences: PreferencesHelper = Injekt.get(), - private val db: DatabaseHelper = Injekt.get(), - private val downloadManager: DownloadManager = Injekt.get() + val manga: Manga, + val source: Source, + private val chapterCountRelay: BehaviorRelay, + private val lastUpdateRelay: BehaviorRelay, + private val mangaFavoriteRelay: PublishRelay, + val preferences: PreferencesHelper = Injekt.get(), + private val db: DatabaseHelper = Injekt.get(), + private val downloadManager: DownloadManager = Injekt.get() ) : BasePresenter() { /** @@ -98,7 +98,6 @@ class ChaptersPresenter( // Emit the upload date of the most recent chapter lastUpdateRelay.call(Date(chapters.maxBy { it.date_upload }?.date_upload ?: 0)) - } .subscribe { chaptersRelay.call(it) }) } @@ -414,5 +413,4 @@ class ChaptersPresenter( fun sortDescending(): Boolean { return manga.sortDescending() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeleteChaptersDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeleteChaptersDialog.kt index c382e5d44..56f37c0dd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeleteChaptersDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeleteChaptersDialog.kt @@ -28,5 +28,4 @@ class DeleteChaptersDialog(bundle: Bundle? = null) : DialogController(bundle) interface Listener { fun deleteChapters() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeletingChaptersDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeletingChaptersDialog.kt index 07a3f318f..8531ba9ae 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeletingChaptersDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeletingChaptersDialog.kt @@ -23,5 +23,4 @@ class DeletingChaptersDialog(bundle: Bundle? = null) : DialogController(bundle) override fun showDialog(router: Router) { showDialog(router, TAG) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DownloadCustomChaptersDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DownloadCustomChaptersDialog.kt index 22ddee7bf..3820e22b6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DownloadCustomChaptersDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DownloadCustomChaptersDialog.kt @@ -74,4 +74,4 @@ class DownloadCustomChaptersDialog : DialogController // Key to retrieve max chapters from bundle on process death. const val KEY_ITEM_MAX = "DownloadCustomChaptersDialog.int.maxChapters" } -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt index ba66320dc..5be0456c1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt @@ -45,12 +45,12 @@ import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.util.lang.truncateCenter import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.view.snack -import jp.wasabeef.glide.transformations.CropSquareTransformation -import kotlinx.android.synthetic.main.manga_info_controller.* -import uy.kohesive.injekt.injectLazy import java.text.DateFormat import java.text.DecimalFormat import java.util.Date +import jp.wasabeef.glide.transformations.CropSquareTransformation +import kotlinx.android.synthetic.main.manga_info_controller.* +import uy.kohesive.injekt.injectLazy /** * Fragment that shows manga information. @@ -153,14 +153,13 @@ class MangaInfoController : NucleusController(), * If true update view with manga information, * if false fetch manga information * - * @param manga manga object containing information about manga. + * @param manga manga object containing information about manga. * @param source the source of the manga. */ fun onNextManga(manga: Manga, source: Source) { if (manga.initialized) { // Update view. setMangaInfo(manga, source) - } else { // Initialize manga. fetchMangaFromSource() @@ -176,7 +175,7 @@ class MangaInfoController : NucleusController(), private fun setMangaInfo(manga: Manga, source: Source?) { val view = view ?: return - //update full title TextView. + // update full title TextView. manga_full_title.text = if (manga.title.isBlank()) { view.context.getString(R.string.unknown) } else { @@ -339,7 +338,6 @@ class MangaInfoController : NucleusController(), presenter.fetchMangaFromSource() } - /** * Update swipe refresh to stop showing refresh in progress spinner. */ @@ -577,5 +575,4 @@ class MangaInfoController : NucleusController(), successCallback.intentSender) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt index 8e02f35de..3296af312 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt @@ -12,13 +12,13 @@ import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed +import java.util.Date import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.Date /** * Presenter of MangaInfoFragment. @@ -26,14 +26,14 @@ import java.util.Date * Observable updates should be called from here. */ class MangaInfoPresenter( - val manga: Manga, - val source: Source, - private val chapterCountRelay: BehaviorRelay, - private val lastUpdateRelay: BehaviorRelay, - private val mangaFavoriteRelay: PublishRelay, - private val db: DatabaseHelper = Injekt.get(), - private val downloadManager: DownloadManager = Injekt.get(), - private val coverCache: CoverCache = Injekt.get() + val manga: Manga, + val source: Source, + private val chapterCountRelay: BehaviorRelay, + private val lastUpdateRelay: BehaviorRelay, + private val mangaFavoriteRelay: PublishRelay, + private val db: DatabaseHelper = Injekt.get(), + private val downloadManager: DownloadManager = Injekt.get(), + private val coverCache: CoverCache = Injekt.get() ) : BasePresenter() { /** @@ -59,7 +59,7 @@ class MangaInfoPresenter( .subscribe { setFavorite(it) } .apply { add(this) } - //update last update date + // update last update date lastUpdateRelay.observeOn(AndroidSchedulers.mainThread()) .subscribeLatestCache(MangaInfoController::setLastUpdateDate) } @@ -169,5 +169,4 @@ class MangaInfoPresenter( fun moveMangaToCategory(manga: Manga, category: Category?) { moveMangaToCategories(manga, listOfNotNull(category)) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt index 59279a2ef..6c70bfe00 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt @@ -70,5 +70,4 @@ class SetTrackChaptersDialog : DialogController private companion object { const val KEY_ITEM_TRACK = "SetTrackChaptersDialog.item.track" } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackScoreDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackScoreDialog.kt index 382a29a11..b8ae96d16 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackScoreDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackScoreDialog.kt @@ -76,5 +76,4 @@ class SetTrackScoreDialog : DialogController private companion object { const val KEY_ITEM_TRACK = "SetTrackScoreDialog.item.track" } - -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackStatusDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackStatusDialog.kt index 8b2f929fc..b6e1aaf97 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackStatusDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackStatusDialog.kt @@ -54,5 +54,4 @@ class SetTrackStatusDialog : DialogController private companion object { const val KEY_ITEM_TRACK = "SetTrackStatusDialog.item.track" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt index 3323c908c..a399150bd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt @@ -41,5 +41,4 @@ class TrackAdapter(controller: TrackController) : RecyclerView.Adapter(), private companion object { const val TAG_SEARCH_CONTROLLER = "track_search_controller" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt index 32af5b0e9..dee9b3894 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt @@ -16,12 +16,11 @@ import rx.schedulers.Schedulers import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get - class TrackPresenter( - val manga: Manga, - preferences: PreferencesHelper = Injekt.get(), - private val db: DatabaseHelper = Injekt.get(), - private val trackManager: TrackManager = Injekt.get() + val manga: Manga, + preferences: PreferencesHelper = Injekt.get(), + private val db: DatabaseHelper = Injekt.get(), + private val trackManager: TrackManager = Injekt.get() ) : BasePresenter() { private val context = preferences.context @@ -130,5 +129,4 @@ class TrackPresenter( track.last_chapter_read = chapterNumber updateRemote(track, item.service) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt index 05bbfc3d8..4482aea39 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt @@ -10,11 +10,11 @@ import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.inflate -import kotlinx.android.synthetic.main.track_search_item.view.* import java.util.ArrayList +import kotlinx.android.synthetic.main.track_search_item.view.* -class TrackSearchAdapter(context: Context) - : ArrayAdapter(context, R.layout.track_search_item, ArrayList()) { +class TrackSearchAdapter(context: Context) : + ArrayAdapter(context, R.layout.track_search_item, ArrayList()) { override fun getView(position: Int, view: View?, parent: ViewGroup): View { var v = view diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchDialog.kt index fff2dc0d6..33df2f822 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchDialog.kt @@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.util.lang.plusAssign +import java.util.concurrent.TimeUnit import kotlinx.android.synthetic.main.track_search_dialog.view.progress import kotlinx.android.synthetic.main.track_search_dialog.view.track_search import kotlinx.android.synthetic.main.track_search_dialog.view.track_search_list @@ -21,7 +22,6 @@ import rx.android.schedulers.AndroidSchedulers import rx.subscriptions.CompositeSubscription import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.concurrent.TimeUnit class TrackSearchDialog : DialogController { @@ -148,5 +148,4 @@ class TrackSearchDialog : DialogController { private companion object { const val KEY_SERVICE = "service_id" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaAdapter.kt index 0fb2c24f8..a2860c2e5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaAdapter.kt @@ -14,4 +14,4 @@ class MangaAdapter(controller: MigrationController) : super.updateDataSet(items) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaHolder.kt index 81f22ff70..850de20fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaHolder.kt @@ -9,8 +9,8 @@ import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail import kotlinx.android.synthetic.main.catalogue_list_item.title class MangaHolder( - private val view: View, - private val adapter: FlexibleAdapter<*> + private val view: View, + private val adapter: FlexibleAdapter<*> ) : BaseFlexibleViewHolder(view, adapter) { fun bind(item: MangaItem) { @@ -33,5 +33,4 @@ class MangaHolder( .dontAnimate() .into(thumbnail) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaItem.kt index 3183c913b..94a67fdba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MangaItem.kt @@ -18,10 +18,12 @@ class MangaItem(val manga: Manga) : AbstractFlexibleItem() { return MangaHolder(view, adapter) } - override fun bindViewHolder(adapter: FlexibleAdapter>, - holder: MangaHolder, - position: Int, - payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: MangaHolder, + position: Int, + payloads: List? + ) { holder.bind(this) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationController.kt index 5ea347c8f..9b94a72c1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationController.kt @@ -131,5 +131,4 @@ class MigrationController : NucleusController(), companion object { const val LOADING_DIALOG_TAG = "LoadingDialog" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationPresenter.kt index 99a1286e8..297c57997 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationPresenter.kt @@ -21,9 +21,9 @@ import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get class MigrationPresenter( - private val sourceManager: SourceManager = Injekt.get(), - private val db: DatabaseHelper = Injekt.get(), - private val preferences: PreferencesHelper = Injekt.get() + private val sourceManager: SourceManager = Injekt.get(), + private val db: DatabaseHelper = Injekt.get(), + private val preferences: PreferencesHelper = Injekt.get() ) : BasePresenter() { var state = ViewState() @@ -94,8 +94,13 @@ class MigrationPresenter( .subscribe() } - private fun migrateMangaInternal(source: Source, sourceChapters: List, - prevManga: Manga, manga: Manga, replace: Boolean) { + private fun migrateMangaInternal( + source: Source, + sourceChapters: List, + prevManga: Manga, + manga: Manga, + replace: Boolean + ) { val flags = preferences.migrateFlags().getOrDefault() val migrateChapters = MigrationFlags.hasChapters(flags) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchController.kt index f6f82dad3..a2fe8e1d1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchController.kt @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchPresenter import uy.kohesive.injekt.injectLazy class SearchController( - private var manga: Manga? = null + private var manga: Manga? = null ) : CatalogueSearchController(manga?.title) { private var newManga: Manga? = null @@ -95,7 +95,5 @@ class SearchController( } .build() } - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchPresenter.kt index b4a31c0da..bddf2eebd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchPresenter.kt @@ -8,8 +8,8 @@ import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchItem import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchPresenter class SearchPresenter( - initialQuery: String? = "", - private val manga: Manga + initialQuery: String? = "", + private val manga: Manga ) : CatalogueSearchPresenter(initialQuery) { override fun getEnabledSources(): List { @@ -19,7 +19,7 @@ class SearchPresenter( } override fun createCatalogueSearchItem(source: CatalogueSource, results: List?): CatalogueSearchItem { - //Set the catalogue search item as highlighted if the source matches that of the selected manga + // Set the catalogue search item as highlighted if the source matches that of the selected manga return CatalogueSearchItem(source, results, source.id == manga.source) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SelectionHeader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SelectionHeader.kt index 9562b0cdb..a0658e3db 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SelectionHeader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SelectionHeader.kt @@ -31,8 +31,12 @@ class SelectionHeader : AbstractHeaderItem() { /** * Binds this item to the given view holder. */ - override fun bindViewHolder(adapter: FlexibleAdapter>, holder: Holder, - position: Int, payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: Holder, + position: Int, + payloads: List? + ) { // Intentionally empty } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceItem.kt index f154bc1f3..99528cf5b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceItem.kt @@ -34,10 +34,13 @@ data class SourceItem(val source: Source, val header: SelectionHeader? = null) : /** * Binds this item to the given view holder. */ - override fun bindViewHolder(adapter: FlexibleAdapter>, holder: SourceHolder, - position: Int, payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: SourceHolder, + position: Int, + payloads: List? + ) { holder.bind(this) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/ViewState.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/ViewState.kt index 7caa5e9ec..0481ed603 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/ViewState.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/ViewState.kt @@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.ui.migration import eu.kanade.tachiyomi.source.Source data class ViewState( - val selectedSource: Source? = null, - val mangaForSource: List = emptyList(), - val sourcesWithManga: List = emptyList(), - val isReplacingManga: Boolean = false -) \ No newline at end of file + val selectedSource: Source? = null, + val mangaForSource: List = emptyList(), + val sourcesWithManga: List = emptyList(), + val isReplacingManga: Boolean = false +) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt index c7ca1ed00..7e189004c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt @@ -8,6 +8,7 @@ import androidx.preference.PreferenceScreen import com.afollestad.materialdialogs.MaterialDialog import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.updater.UpdateChecker @@ -21,14 +22,13 @@ import eu.kanade.tachiyomi.util.lang.launchNow import eu.kanade.tachiyomi.util.lang.toTimestampString import eu.kanade.tachiyomi.util.preference.* import eu.kanade.tachiyomi.util.system.toast -import timber.log.Timber -import uy.kohesive.injekt.injectLazy import java.text.DateFormat import java.text.ParseException import java.text.SimpleDateFormat import java.util.Locale import java.util.TimeZone -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys +import timber.log.Timber +import uy.kohesive.injekt.injectLazy class AboutController : SettingsController() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt index f6cd6d422..ca3e59e4f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt @@ -12,7 +12,7 @@ import eu.kanade.tachiyomi.util.preference.* import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.openInBrowser -class MoreController : SettingsController() { +class MoreController : SettingsController() { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { titleRes = R.string.label_more @@ -77,5 +77,4 @@ class MoreController : SettingsController() { companion object { private const val URL_HELP = "https://tachiyomi.org/help/" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/PageIndicatorTextView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/PageIndicatorTextView.kt index 275102501..6d8514941 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/PageIndicatorTextView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/PageIndicatorTextView.kt @@ -15,8 +15,8 @@ import eu.kanade.tachiyomi.widget.OutlineSpan * Page indicator found at the bottom of the reader */ class PageIndicatorTextView( - context: Context, - attrs: AttributeSet? = null + context: Context, + attrs: AttributeSet? = null ) : AppCompatTextView(context, attrs) { init { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 2973872c9..071da9b8f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -41,6 +41,9 @@ import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.widget.SimpleAnimationListener import eu.kanade.tachiyomi.widget.SimpleSeekBarListener +import java.io.File +import java.util.concurrent.TimeUnit +import kotlin.math.abs import kotlinx.android.synthetic.main.reader_activity.* import me.zhanghai.android.systemuihelper.SystemUiHelper import nucleus.factory.RequiresPresenter @@ -50,9 +53,6 @@ import rx.android.schedulers.AndroidSchedulers import rx.subscriptions.CompositeSubscription import timber.log.Timber import uy.kohesive.injekt.injectLazy -import java.io.File -import java.util.concurrent.TimeUnit -import kotlin.math.abs /** * Activity containing the reader of Tachiyomi. This activity is mostly a container of the @@ -747,7 +747,5 @@ class ReaderActivity : BaseRxActivity() { color_overlay.visibility = View.VISIBLE color_overlay.setFilterColor(value, preferences.colorFilterMode().getOrDefault()) } - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterSheet.kt index 75282a58f..1039d12c2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterSheet.kt @@ -13,6 +13,8 @@ import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.util.lang.plusAssign import eu.kanade.tachiyomi.widget.IgnoreFirstSpinnerListener import eu.kanade.tachiyomi.widget.SimpleSeekBarListener +import java.util.concurrent.TimeUnit +import kotlin.math.abs import kotlinx.android.synthetic.main.reader_color_filter.* import kotlinx.android.synthetic.main.reader_color_filter_sheet.brightness_overlay import kotlinx.android.synthetic.main.reader_color_filter_sheet.color_overlay @@ -20,8 +22,6 @@ import rx.Subscription import rx.android.schedulers.AndroidSchedulers import rx.subscriptions.CompositeSubscription import uy.kohesive.injekt.injectLazy -import java.util.concurrent.TimeUnit -import kotlin.math.abs /** * Color filter sheet to toggle custom filter and brightness overlay. @@ -181,7 +181,7 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ val green = getGreenFromColor(color) val blue = getBlueFromColor(color) - //Initialize values + // Initialize values with(view) { txt_color_filter_alpha_value.text = alpha.toString() @@ -324,5 +324,4 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ /** Integer mask of blue value **/ const val BLUE_MASK: Long = 0x000000FF } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterView.kt index 3787f2a59..eb04c1013 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderColorFilterView.kt @@ -9,8 +9,8 @@ import android.util.AttributeSet import android.view.View class ReaderColorFilterView( - context: Context, - attrs: AttributeSet? = null + context: Context, + attrs: AttributeSet? = null ) : View(context, attrs) { private val colorFilterPaint: Paint = Paint() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt index ad06c7cc3..89d61f83d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt @@ -15,8 +15,8 @@ import kotlinx.android.synthetic.main.reader_page_sheet.share_layout * Sheet to show when a page is long clicked. */ class ReaderPageSheet( - private val activity: ReaderActivity, - private val page: ReaderPage + private val activity: ReaderActivity, + private val page: ReaderPage ) : BottomSheetDialog(activity) { /** @@ -72,5 +72,4 @@ class ReaderPageSheet( activity.saveImage(page) dismiss() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index 43f7b9a66..bb2111ae7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -23,6 +23,9 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters import eu.kanade.tachiyomi.util.storage.DiskUtil import eu.kanade.tachiyomi.util.system.ImageUtil +import java.io.File +import java.util.Date +import java.util.concurrent.TimeUnit import rx.Completable import rx.Observable import rx.Subscription @@ -31,19 +34,16 @@ import rx.schedulers.Schedulers import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.io.File -import java.util.Date -import java.util.concurrent.TimeUnit /** * Presenter used by the activity to perform background operations. */ class ReaderPresenter( - private val db: DatabaseHelper = Injekt.get(), - private val sourceManager: SourceManager = Injekt.get(), - private val downloadManager: DownloadManager = Injekt.get(), - private val coverCache: CoverCache = Injekt.get(), - private val preferences: PreferencesHelper = Injekt.get() + private val db: DatabaseHelper = Injekt.get(), + private val sourceManager: SourceManager = Injekt.get(), + private val downloadManager: DownloadManager = Injekt.get(), + private val coverCache: CoverCache = Injekt.get(), + private val preferences: PreferencesHelper = Injekt.get() ) : BasePresenter() { /** @@ -237,8 +237,8 @@ class ReaderPresenter( * Callers must also handle the onError event. */ private fun getLoadObservable( - loader: ChapterLoader, - chapter: ReaderChapter + loader: ChapterLoader, + chapter: ReaderChapter ): Observable { return loader.loadChapter(chapter) .andThen(Observable.fromCallable { @@ -638,5 +638,4 @@ class ReaderPresenter( .subscribeOn(Schedulers.io()) .subscribe() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSeekBar.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSeekBar.kt index 473bf0f79..0615c1f4f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSeekBar.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSeekBar.kt @@ -10,8 +10,8 @@ import androidx.appcompat.widget.AppCompatSeekBar * Seekbar to show current chapter progress. */ class ReaderSeekBar @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null + context: Context, + attrs: AttributeSet? = null ) : AppCompatSeekBar(context, attrs) { /** @@ -41,5 +41,4 @@ class ReaderSeekBar @JvmOverloads constructor( } return super.onTouchEvent(event) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt index 84760567f..f565d272a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt @@ -109,5 +109,4 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia } setSelection(pref.getOrDefault() - offset, false) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/SaveImageNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/SaveImageNotifier.kt index 4e4a18ff1..714211d48 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/SaveImageNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/SaveImageNotifier.kt @@ -103,5 +103,4 @@ class SaveImageNotifier(private val context: Context) { } updateNotification() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt index 10b8c303a..77a7b24a9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt @@ -16,9 +16,9 @@ import timber.log.Timber * Loader used to retrieve the [PageLoader] for a given chapter. */ class ChapterLoader( - private val downloadManager: DownloadManager, - private val manga: Manga, - private val source: Source + private val downloadManager: DownloadManager, + private val manga: Manga, + private val source: Source ) { /** @@ -80,5 +80,4 @@ class ChapterLoader( else -> error("Loader not implemented") } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt index 3a1a4bedf..77f921b5c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt @@ -4,9 +4,9 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder import eu.kanade.tachiyomi.util.system.ImageUtil -import rx.Observable import java.io.File import java.io.FileInputStream +import rx.Observable /** * Loader used to load a chapter from a directory given on [file]. @@ -37,5 +37,4 @@ class DirectoryPageLoader(val file: File) : PageLoader() { override fun getPage(page: ReaderPage): Observable { return Observable.just(Page.READY) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt index 4a7169271..b2d5540c2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt @@ -15,10 +15,10 @@ import uy.kohesive.injekt.injectLazy * Loader used to load a chapter from the downloaded chapters. */ class DownloadPageLoader( - private val chapter: ReaderChapter, - private val manga: Manga, - private val source: Source, - private val downloadManager: DownloadManager + private val chapter: ReaderChapter, + private val manga: Manga, + private val source: Source, + private val downloadManager: DownloadManager ) : PageLoader() { /** @@ -45,5 +45,4 @@ class DownloadPageLoader( override fun getPage(page: ReaderPage): Observable { return Observable.just(Page.READY) // TODO maybe check if file still exists? } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/EpubPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/EpubPageLoader.kt index 2bb519adc..4e1bff814 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/EpubPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/EpubPageLoader.kt @@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.ui.reader.loader import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.util.storage.EpubFile -import rx.Observable import java.io.File +import rx.Observable /** * Loader used to load a chapter from a .epub file. @@ -50,5 +50,4 @@ class EpubPageLoader(file: File) : PageLoader() { Page.READY }) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt index 8f6926d8a..42df16098 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt @@ -6,6 +6,9 @@ import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.util.lang.plusAssign +import java.util.concurrent.PriorityBlockingQueue +import java.util.concurrent.atomic.AtomicInteger +import kotlin.math.min import rx.Completable import rx.Observable import rx.schedulers.Schedulers @@ -15,17 +18,14 @@ import rx.subscriptions.CompositeSubscription import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.concurrent.PriorityBlockingQueue -import java.util.concurrent.atomic.AtomicInteger -import kotlin.math.min /** * Loader used to load chapters from an online source. */ class HttpPageLoader( - private val chapter: ReaderChapter, - private val source: HttpSource, - private val chapterCache: ChapterCache = Injekt.get() + private val chapter: ReaderChapter, + private val source: HttpSource, + private val chapterCache: ChapterCache = Injekt.get() ) : PageLoader() { /** @@ -165,8 +165,8 @@ class HttpPageLoader( * Data class used to keep ordering of pages in order to maintain priority. */ private class PriorityPage( - val page: ReaderPage, - val priority: Int + val page: ReaderPage, + val priority: Int ) : Comparable { companion object { @@ -179,7 +179,6 @@ class HttpPageLoader( val p = other.priority.compareTo(priority) return if (p != 0) p else identifier.compareTo(other.identifier) } - } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/PageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/PageLoader.kt index b0b872b6d..de7e4e541 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/PageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/PageLoader.kt @@ -42,5 +42,4 @@ abstract class PageLoader { * online source is used. */ open fun retryPage(page: ReaderPage) {} - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/RarPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/RarPageLoader.kt index ee471805c..b37b2e06c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/RarPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/RarPageLoader.kt @@ -4,14 +4,14 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder import eu.kanade.tachiyomi.util.system.ImageUtil -import junrar.Archive -import junrar.rarfile.FileHeader -import rx.Observable import java.io.File import java.io.InputStream import java.io.PipedInputStream import java.io.PipedOutputStream import java.util.concurrent.Executors +import junrar.Archive +import junrar.rarfile.FileHeader +import rx.Observable /** * Loader used to load a chapter from a .rar or .cbr file. @@ -83,5 +83,4 @@ class RarPageLoader(file: File) : PageLoader() { } return pipeIn } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt index cddee9808..b55796d3a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt @@ -4,10 +4,10 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder import eu.kanade.tachiyomi.util.system.ImageUtil -import rx.Observable import java.io.File import java.util.zip.ZipEntry import java.util.zip.ZipFile +import rx.Observable /** * Loader used to load a chapter from a .zip or .cbz file. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ChapterTransition.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ChapterTransition.kt index 60e0a9817..96105e634 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ChapterTransition.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ChapterTransition.kt @@ -6,11 +6,13 @@ sealed class ChapterTransition { abstract val to: ReaderChapter? class Prev( - override val from: ReaderChapter, override val to: ReaderChapter? + override val from: ReaderChapter, + override val to: ReaderChapter? ) : ChapterTransition() class Next( - override val from: ReaderChapter, override val to: ReaderChapter? + override val from: ReaderChapter, + override val to: ReaderChapter? ) : ChapterTransition() override fun equals(other: Any?): Boolean { @@ -30,5 +32,4 @@ sealed class ChapterTransition { override fun toString(): String { return "${javaClass.simpleName}(from=${from.chapter.url}, to=${to?.chapter?.url})" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderPage.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderPage.kt index 34b415253..35a10331d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderPage.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderPage.kt @@ -4,12 +4,11 @@ import eu.kanade.tachiyomi.source.model.Page import java.io.InputStream class ReaderPage( - index: Int, - url: String = "", - imageUrl: String? = null, - var stream: (() -> InputStream)? = null + index: Int, + url: String = "", + imageUrl: String? = null, + var stream: (() -> InputStream)? = null ) : Page(index, url, imageUrl, null) { lateinit var chapter: ReaderChapter - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ViewerChapters.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ViewerChapters.kt index 1e950c6c7..9d4304840 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ViewerChapters.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ViewerChapters.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.ui.reader.model data class ViewerChapters( - val currChapter: ReaderChapter, - val prevChapter: ReaderChapter?, - val nextChapter: ReaderChapter? + val currChapter: ReaderChapter, + val prevChapter: ReaderChapter?, + val nextChapter: ReaderChapter? ) { fun ref() { @@ -17,5 +17,4 @@ data class ViewerChapters( prevChapter?.unref() nextChapter?.unref() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/BaseViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/BaseViewer.kt index 7420db518..223cb087f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/BaseViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/BaseViewer.kt @@ -42,5 +42,4 @@ interface BaseViewer { * return true if the event was handled, false otherwise. */ fun handleGenericMotionEvent(event: MotionEvent): Boolean - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/GestureDetectorWithLongTap.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/GestureDetectorWithLongTap.kt index a96392b52..52e1ab9bc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/GestureDetectorWithLongTap.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/GestureDetectorWithLongTap.kt @@ -12,8 +12,8 @@ import kotlin.math.abs * one conflicts with the quick scale feature. */ open class GestureDetectorWithLongTap( - context: Context, - listener: Listener + context: Context, + listener: Listener ) : GestureDetector(context, listener) { private val handler = Handler() @@ -71,5 +71,4 @@ open class GestureDetectorWithLongTap( open fun onLongTapConfirmed(ev: MotionEvent) { } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderProgressBar.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderProgressBar.kt index 3bdd3a0a1..ed215bf81 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderProgressBar.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderProgressBar.kt @@ -24,9 +24,9 @@ import kotlin.math.min * user also approximately knows how much the operation will take. */ class ReaderProgressBar @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 ) : View(context, attrs, defStyleAttr) { /** @@ -209,5 +209,4 @@ class ReaderProgressBar @JvmOverloads constructor( start() } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/Pager.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/Pager.kt index a256a5c6e..b89bc9ee0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/Pager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/Pager.kt @@ -13,8 +13,8 @@ import eu.kanade.tachiyomi.ui.reader.viewer.GestureDetectorWithLongTap * pager can also be declared to be vertical by creating it with [isHorizontal] to false. */ open class Pager( - context: Context, - isHorizontal: Boolean = true + context: Context, + isHorizontal: Boolean = true ) : DirectionalViewPager(context, isHorizontal) { /** @@ -104,5 +104,4 @@ open class Pager( fun setGestureDetectorEnabled(enabled: Boolean) { isGestureDetectorEnabled = enabled } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerButton.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerButton.kt index f14f328c3..57cef1c8a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerButton.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerButton.kt @@ -21,5 +21,4 @@ class PagerButton(context: Context, viewer: PagerViewer) : AppCompatButton(conte false } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerConfig.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerConfig.kt index 23be72f32..89d69b29e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerConfig.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerConfig.kt @@ -77,8 +77,8 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe } private fun Preference.register( - valueAssignment: (T) -> Unit, - onChanged: (T) -> Unit = {} + valueAssignment: (T) -> Unit, + onChanged: (T) -> Unit = {} ) { asObservable() .doOnNext(valueAssignment) @@ -109,5 +109,4 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe enum class ZoomType { Left, Center, Right } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt index b1d1d02bb..f77c25d55 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt @@ -37,20 +37,20 @@ import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.widget.ViewPagerAdapter +import java.io.InputStream +import java.util.concurrent.TimeUnit import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers -import java.io.InputStream -import java.util.concurrent.TimeUnit /** * View of the ViewPager that contains a page of a chapter. */ @SuppressLint("ViewConstructor") class PagerPageHolder( - val viewer: PagerViewer, - val page: ReaderPage + val viewer: PagerViewer, + val page: ReaderPage ) : FrameLayout(viewer.activity), ViewPagerAdapter.PositionableView { /** @@ -442,21 +442,21 @@ class PagerPageHolder( .transition(DrawableTransitionOptions.with(NoTransition.getFactory())) .listener(object : RequestListener { override fun onLoadFailed( - e: GlideException?, - model: Any?, - target: Target?, - isFirstResource: Boolean + e: GlideException?, + model: Any?, + target: Target?, + isFirstResource: Boolean ): Boolean { onImageDecodeError() return false } override fun onResourceReady( - resource: Drawable?, - model: Any?, - target: Target?, - dataSource: DataSource?, - isFirstResource: Boolean + resource: Drawable?, + model: Any?, + target: Target?, + dataSource: DataSource?, + isFirstResource: Boolean ): Boolean { if (resource is GifDrawable) { resource.setLoopCount(GifDrawable.LOOP_INTRINSIC) @@ -467,5 +467,4 @@ class PagerPageHolder( }) .into(this) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt index 8cacf8776..fb480f8a1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerTransitionHolder.kt @@ -27,8 +27,8 @@ import rx.android.schedulers.AndroidSchedulers */ @SuppressLint("ViewConstructor") class PagerTransitionHolder( - val viewer: PagerViewer, - val transition: ChapterTransition + val viewer: PagerViewer, + val transition: ChapterTransition ) : LinearLayout(viewer.activity), ViewPagerAdapter.PositionableView { /** @@ -205,5 +205,4 @@ class PagerTransitionHolder( private fun View.wrapContent() { layoutParams = ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt index 26ee569e6..67b1368f9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt @@ -323,5 +323,4 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer { } return false } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt index ad6f39747..4162eaf85 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt @@ -101,5 +101,4 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() { } return PagerAdapter.POSITION_NONE } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.kt index 7756345d8..3a27815de 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.kt @@ -121,8 +121,8 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter, - private val newItems: List + private val oldItems: List, + private val newItems: List ) : DiffUtil.Callback() { /** @@ -168,5 +168,4 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter Preference.register( - valueAssignment: (T) -> Unit, - onChanged: (T) -> Unit = {} + valueAssignment: (T) -> Unit, + onChanged: (T) -> Unit = {} ) { asObservable() .doOnNext(valueAssignment) @@ -76,5 +76,4 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) { .subscribe() .addTo(subscriptions) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt index 955dc898e..3f919569c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt @@ -68,13 +68,12 @@ class WebtoonFrame(context: Context) : FrameLayout(context) { } override fun onFling( - e1: MotionEvent?, - e2: MotionEvent?, - velocityX: Float, - velocityY: Float + e1: MotionEvent?, + e2: MotionEvent?, + velocityX: Float, + velocityY: Float ): Boolean { return recycler?.zoomFling(velocityX.toInt(), velocityY.toInt()) ?: false } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt index d1985c5e4..026887169 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt @@ -51,5 +51,4 @@ class WebtoonLayoutManager(activity: ReaderActivity) : LinearLayoutManager(activ return if (child == null) NO_POSITION else getPosition(child) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt index 15ccd8a67..7aeac3bba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.reader.viewer.webtoon import android.annotation.SuppressLint import android.content.Intent -import android.graphics.Color import android.graphics.drawable.Drawable import android.net.Uri import android.view.Gravity @@ -32,15 +31,14 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressBar import eu.kanade.tachiyomi.util.system.ImageUtil import eu.kanade.tachiyomi.util.system.dpToPx -import eu.kanade.tachiyomi.util.system.pxToDp import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.visible +import java.io.InputStream +import java.util.concurrent.TimeUnit import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers -import java.io.InputStream -import java.util.concurrent.TimeUnit /** * Holder of the webtoon reader for a single page of a chapter. @@ -50,8 +48,8 @@ import java.util.concurrent.TimeUnit * @constructor creates a new webtoon holder. */ class WebtoonPageHolder( - private val frame: FrameLayout, - viewer: WebtoonViewer + private val frame: FrameLayout, + viewer: WebtoonViewer ) : WebtoonBaseHolder(frame, viewer) { /** @@ -493,21 +491,21 @@ class WebtoonPageHolder( .transition(DrawableTransitionOptions.with(NoTransition.getFactory())) .listener(object : RequestListener { override fun onLoadFailed( - e: GlideException?, - model: Any?, - target: Target?, - isFirstResource: Boolean + e: GlideException?, + model: Any?, + target: Target?, + isFirstResource: Boolean ): Boolean { onImageDecodeError() return false } override fun onResourceReady( - resource: Drawable?, - model: Any?, - target: Target?, - dataSource: DataSource?, - isFirstResource: Boolean + resource: Drawable?, + model: Any?, + target: Target?, + dataSource: DataSource?, + isFirstResource: Boolean ): Boolean { if (resource is GifDrawable) { resource.setLoopCount(GifDrawable.LOOP_INTRINSIC) @@ -518,5 +516,4 @@ class WebtoonPageHolder( }) .into(this) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt index 85738b48c..c98916397 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt @@ -18,9 +18,9 @@ import kotlin.math.abs * Implementation of a [RecyclerView] used by the webtoon reader. */ open class WebtoonRecyclerView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyle: Int = 0 + context: Context, + attrs: AttributeSet? = null, + defStyle: Int = 0 ) : RecyclerView(context, attrs, defStyle) { private var isZooming = false @@ -77,12 +77,12 @@ open class WebtoonRecyclerView @JvmOverloads constructor( } private fun zoom( - fromRate: Float, - toRate: Float, - fromX: Float, - toX: Float, - fromY: Float, - toY: Float + fromRate: Float, + toRate: Float, + fromX: Float, + toX: Float, + fromY: Float, + toY: Float ) { isZooming = true val animatorSet = AnimatorSet() @@ -102,7 +102,6 @@ open class WebtoonRecyclerView @JvmOverloads constructor( animatorSet.start() animatorSet.addListener(object : Animator.AnimatorListener { override fun onAnimationStart(animation: Animator) { - } override fun onAnimationEnd(animation: Animator) { @@ -111,11 +110,9 @@ open class WebtoonRecyclerView @JvmOverloads constructor( } override fun onAnimationCancel(animation: Animator) { - } override fun onAnimationRepeat(animation: Animator) { - } }) } @@ -222,7 +219,6 @@ open class WebtoonRecyclerView @JvmOverloads constructor( performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) } } - } inner class Detector : GestureDetectorWithLongTap(context, listener) { @@ -310,7 +306,6 @@ open class WebtoonRecyclerView @JvmOverloads constructor( } return super.onTouchEvent(ev) } - } private companion object { @@ -318,5 +313,4 @@ open class WebtoonRecyclerView @JvmOverloads constructor( const val DEFAULT_RATE = 1f const val MAX_SCALE_RATE = 3f } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonSubsamplingImageView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonSubsamplingImageView.kt index 692c0596b..88f916161 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonSubsamplingImageView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonSubsamplingImageView.kt @@ -10,12 +10,11 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView * webtoon viewer handles all the gestures. */ class WebtoonSubsamplingImageView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null + context: Context, + attrs: AttributeSet? = null ) : SubsamplingScaleImageView(context, attrs) { override fun onTouchEvent(event: MotionEvent): Boolean { return false } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt index 86b71b440..22e1c2dd8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonTransitionHolder.kt @@ -24,8 +24,8 @@ import rx.android.schedulers.AndroidSchedulers * Holder of the webtoon viewer that contains a chapter transition. */ class WebtoonTransitionHolder( - val layout: LinearLayout, - viewer: WebtoonViewer + val layout: LinearLayout, + viewer: WebtoonViewer ) : WebtoonBaseHolder(layout, viewer) { /** @@ -212,5 +212,4 @@ class WebtoonTransitionHolder( pagesContainer.addView(textView) pagesContainer.addView(retryBtn) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index 1ef206fed..17f030b94 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -12,10 +12,10 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer -import rx.subscriptions.CompositeSubscription -import timber.log.Timber import kotlin.math.max import kotlin.math.min +import rx.subscriptions.CompositeSubscription +import timber.log.Timber /** * Implementation of a [BaseViewer] to display pages with a [RecyclerView]. @@ -264,5 +264,4 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer { val position = layoutManager.findLastEndVisibleItemPosition() adapter.notifyItemRangeChanged(max(0, position - 1), min(2, adapter.itemCount - position)) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/DeletingChaptersDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/DeletingChaptersDialog.kt index 4d310c7e3..8d03dce65 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/DeletingChaptersDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/DeletingChaptersDialog.kt @@ -23,5 +23,4 @@ class DeletingChaptersDialog(bundle: Bundle? = null) : DialogController(bundle) override fun showDialog(router: Router) { showDialog(router, TAG) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChapterItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChapterItem.kt index b593cecc6..d801940ce 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChapterItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChapterItem.kt @@ -35,10 +35,12 @@ class RecentChapterItem(val chapter: Chapter, val manga: Manga, header: DateItem return RecentChapterHolder(view, adapter as RecentChaptersAdapter) } - override fun bindViewHolder(adapter: FlexibleAdapter>, - holder: RecentChapterHolder, - position: Int, - payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: RecentChapterHolder, + position: Int, + payloads: List? + ) { holder.bind(this) } @@ -54,5 +56,4 @@ class RecentChapterItem(val chapter: Chapter, val manga: Manga, header: DateItem override fun hashCode(): Int { return chapter.id!!.hashCode() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersAdapter.kt index 233c90fce..e829a7135 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersAdapter.kt @@ -16,4 +16,4 @@ class RecentChaptersAdapter(val controller: RecentChaptersController) : interface OnCoverClickListener { fun onCoverClick(position: Int) } -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersController.kt index 61c7ca8bb..3d8ede07f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersController.kt @@ -254,7 +254,6 @@ class RecentChaptersController : NucleusController(), override fun onCoverClick(position: Int) { val chapterClicked = adapter?.getItem(position) as? RecentChapterItem ?: return openManga(chapterClicked) - } fun openManga(chapter: RecentChapterItem) { @@ -333,5 +332,4 @@ class RecentChaptersController : NucleusController(), adapter?.clearSelection() actionMode = null } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersPresenter.kt index 689e544a2..1da0c3803 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChaptersPresenter.kt @@ -8,21 +8,21 @@ import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter +import java.util.Calendar +import java.util.Date +import java.util.TreeMap import rx.Observable import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.Calendar -import java.util.Date -import java.util.TreeMap class RecentChaptersPresenter( - val preferences: PreferencesHelper = Injekt.get(), - private val db: DatabaseHelper = Injekt.get(), - private val downloadManager: DownloadManager = Injekt.get(), - private val sourceManager: SourceManager = Injekt.get() + val preferences: PreferencesHelper = Injekt.get(), + private val db: DatabaseHelper = Injekt.get(), + private val downloadManager: DownloadManager = Injekt.get(), + private val sourceManager: SourceManager = Injekt.get() ) : BasePresenter() { /** @@ -204,5 +204,4 @@ class RecentChaptersPresenter( } } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadAdapter.kt index a8d82abb1..67d09ff2d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadAdapter.kt @@ -4,10 +4,10 @@ import eu.davidea.flexibleadapter.FlexibleAdapter import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.source.SourceManager -import uy.kohesive.injekt.injectLazy import java.text.DateFormat import java.text.DecimalFormat import java.text.DecimalFormatSymbols +import uy.kohesive.injekt.injectLazy /** * Adapter of RecentlyReadHolder. @@ -17,8 +17,8 @@ import java.text.DecimalFormatSymbols * @param controller a RecentlyReadController object * @constructor creates an instance of the adapter. */ -class RecentlyReadAdapter(controller: RecentlyReadController) - : FlexibleAdapter(null, controller, true) { +class RecentlyReadAdapter(controller: RecentlyReadController) : + FlexibleAdapter(null, controller, true) { val sourceManager by injectLazy() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt index 0f9588de9..3840311f5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt @@ -115,5 +115,4 @@ class RecentlyReadController : NucleusController(), presenter.removeFromHistory(history) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadHolder.kt index 7e08ab680..a0ad0a481 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadHolder.kt @@ -7,8 +7,8 @@ import eu.kanade.tachiyomi.data.database.models.MangaChapterHistory import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.util.lang.toTimestampString -import kotlinx.android.synthetic.main.recently_read_item.* import java.util.Date +import kotlinx.android.synthetic.main.recently_read_item.* /** * Holder that contains recent manga item @@ -20,8 +20,8 @@ import java.util.Date * @constructor creates a new recent chapter holder. */ class RecentlyReadHolder( - view: View, - val adapter: RecentlyReadAdapter + view: View, + val adapter: RecentlyReadAdapter ) : BaseFlexibleViewHolder(view, adapter) { init { @@ -68,6 +68,4 @@ class RecentlyReadHolder( .into(cover) } } - - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadItem.kt index e98e2dd5c..7ab671ee6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadItem.kt @@ -18,10 +18,12 @@ class RecentlyReadItem(val mch: MangaChapterHistory) : AbstractFlexibleItem>, - holder: RecentlyReadHolder, - position: Int, - payloads: List?) { + override fun bindViewHolder( + adapter: FlexibleAdapter>, + holder: RecentlyReadHolder, + position: Int, + payloads: List? + ) { holder.bind(mch) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt index 7493948d2..70352745a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt @@ -6,12 +6,12 @@ import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.data.database.models.History import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter -import rx.Observable -import rx.android.schedulers.AndroidSchedulers -import uy.kohesive.injekt.injectLazy import java.util.Calendar import java.util.Comparator import java.util.Date +import rx.Observable +import rx.android.schedulers.AndroidSchedulers +import uy.kohesive.injekt.injectLazy /** * Presenter of RecentlyReadFragment. @@ -107,5 +107,4 @@ class RecentlyReadPresenter : BasePresenter() { else -> throw NotImplementedError("Unknown sorting method") } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RemoveHistoryDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RemoveHistoryDialog.kt index 8ba4dad7c..320bbc661 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RemoveHistoryDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RemoveHistoryDialog.kt @@ -52,5 +52,4 @@ class RemoveHistoryDialog(bundle: Bundle? = null) : DialogController(bundle) interface Listener { fun removeHistory(manga: Manga, history: History, all: Boolean) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/security/BiometricUnlockActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/security/BiometricUnlockActivity.kt index 654628211..3cfbf273e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/security/BiometricUnlockActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/security/BiometricUnlockActivity.kt @@ -5,9 +5,9 @@ import androidx.appcompat.app.AppCompatActivity import androidx.biometric.BiometricPrompt import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import uy.kohesive.injekt.injectLazy import java.util.Date import java.util.concurrent.Executors +import uy.kohesive.injekt.injectLazy /** * Blank activity with a BiometricPrompt. @@ -41,5 +41,4 @@ class BiometricUnlockActivity : AppCompatActivity() { biometricPrompt.authenticate(promptInfo) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt index d9310c086..b962cfddf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt @@ -6,8 +6,8 @@ import androidx.biometric.BiometricManager import androidx.fragment.app.FragmentActivity import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault -import uy.kohesive.injekt.injectLazy import java.util.Date +import uy.kohesive.injekt.injectLazy object SecureActivityDelegate { @@ -41,8 +41,7 @@ object SecureActivityDelegate { private fun isAppLocked(): Boolean { return locked && - (preferences.lockAppAfter().getOrDefault() <= 0 - || Date().time >= preferences.lastAppUnlock().getOrDefault() + 60 * 1000 * preferences.lockAppAfter().getOrDefault()) + (preferences.lockAppAfter().getOrDefault() <= 0 || + Date().time >= preferences.lastAppUnlock().getOrDefault() + 60 * 1000 * preferences.lockAppAfter().getOrDefault()) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt index b913e416b..5e5c89e50 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt @@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.data.backup.BackupCreateService import eu.kanade.tachiyomi.data.backup.BackupCreatorJob import eu.kanade.tachiyomi.data.backup.BackupRestoreService import eu.kanade.tachiyomi.data.backup.models.Backup +import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.popControllerWithTag @@ -28,7 +29,6 @@ import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.unregisterLocalReceiver import java.io.File import java.util.concurrent.TimeUnit -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsBackupController : SettingsController() { @@ -139,7 +139,6 @@ class SettingsBackupController : SettingsController() { backupNumber.isVisible = it > 0 } } - } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { @@ -440,5 +439,4 @@ class SettingsBackupController : SettingsController() { const val TAG_CREATING_BACKUP_DIALOG = "CreatingBackupDialog" const val TAG_RESTORING_BACKUP_DIALOG = "RestoringBackupDialog" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt index 9fa6501bd..01876cafa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt @@ -14,16 +14,16 @@ import com.hippo.unifile.UniFile import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.models.Category +import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.util.preference.* import eu.kanade.tachiyomi.util.system.getFilePicker +import java.io.File import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy -import java.io.File -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsDownloadController : SettingsController() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index a41550ee1..12416f9a3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -6,11 +6,11 @@ import android.provider.Settings import androidx.biometric.BiometricManager import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys +import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.util.preference.* import eu.kanade.tachiyomi.util.system.LocaleHelper -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values class SettingsGeneralController : SettingsController() { @@ -166,5 +166,4 @@ class SettingsGeneralController : SettingsController() { } } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index d2ed9f5ec..0b6c87eec 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.library.LibraryUpdateJob +import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.ui.base.controller.DialogController @@ -21,7 +22,6 @@ import kotlinx.android.synthetic.main.pref_library_columns.view.portrait_columns import rx.Observable import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsLibraryController : SettingsController() { @@ -226,7 +226,5 @@ class SettingsLibraryController : SettingsController() { } } } - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt index 2cc38d672..a7fabc144 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt @@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.ui.setting import android.os.Build import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.util.preference.* import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys +import eu.kanade.tachiyomi.util.preference.* class SettingsReaderController : SettingsController() { @@ -151,5 +151,4 @@ class SettingsReaderController : SettingsController() { }.apply { dependency = Keys.readWithVolumeKeys } } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesController.kt index 49ae9a32d..c34b47694 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesController.kt @@ -14,9 +14,9 @@ import eu.kanade.tachiyomi.util.preference.titleRes import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.widget.preference.LoginCheckBoxPreference import eu.kanade.tachiyomi.widget.preference.SourceLoginDialog +import java.util.TreeMap import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.util.TreeMap class SettingsSourcesController : SettingsController(), SourceLoginDialog.Listener { @@ -116,5 +116,4 @@ class SettingsSourcesController : SettingsController(), private fun getSourceKey(sourceId: Long): String { return "source_$sourceId" } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt index c00eaa5d2..d870465bb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt @@ -5,6 +5,7 @@ import android.content.Intent import androidx.browser.customtabs.CustomTabsIntent import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.anilist.AnilistApi @@ -16,7 +17,6 @@ import eu.kanade.tachiyomi.widget.preference.LoginPreference import eu.kanade.tachiyomi.widget.preference.TrackLoginDialog import eu.kanade.tachiyomi.widget.preference.TrackLogoutDialog import uy.kohesive.injekt.injectLazy -import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys class SettingsTrackingController : SettingsController(), TrackLoginDialog.Listener, @@ -70,8 +70,8 @@ class SettingsTrackingController : SettingsController(), } private inline fun PreferenceScreen.trackPreference( - service: TrackService, - crossinline login: () -> Unit + service: TrackService, + crossinline login: () -> Unit ): LoginPreference { return initThenAdd(LoginPreference(context).apply { key = Keys.trackUsername(service.id) @@ -110,5 +110,4 @@ class SettingsTrackingController : SettingsController(), override fun trackLogoutDialogClosed(service: TrackService) { updatePreference(service.id) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/AnilistLoginActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/AnilistLoginActivity.kt index bc8925a3f..d0ced84f0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/AnilistLoginActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/AnilistLoginActivity.kt @@ -47,5 +47,4 @@ class AnilistLoginActivity : AppCompatActivity() { intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) startActivity(intent) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BangumiLoginActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BangumiLoginActivity.kt index 284f1558e..772d3866f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BangumiLoginActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BangumiLoginActivity.kt @@ -46,5 +46,4 @@ class BangumiLoginActivity : AppCompatActivity() { intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) startActivity(intent) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/ShikomoriLoginActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/ShikomoriLoginActivity.kt index 4b80ba0eb..b109d3421 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/ShikomoriLoginActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/ShikomoriLoginActivity.kt @@ -46,5 +46,4 @@ class ShikimoriLoginActivity : AppCompatActivity() { intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) startActivity(intent) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/PreferenceExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/PreferenceExtensions.kt index 34e1e0557..f6b85b33e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/PreferenceExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/PreferenceExtensions.kt @@ -1,13 +1,13 @@ package eu.kanade.tachiyomi.util import android.content.SharedPreferences +import kotlin.coroutines.CoroutineContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.channelFlow import kotlinx.coroutines.flow.flowOn -import kotlin.coroutines.CoroutineContext @ExperimentalCoroutinesApi inline fun SharedPreferences.getKey(key: String, default: T, dispatcher: CoroutineContext = Dispatchers.Default): Flow { diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterRecognition.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterRecognition.kt index c1c001fcc..d0da5f6fb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterRecognition.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterRecognition.kt @@ -140,5 +140,4 @@ object ChapterRecognition { private fun parseAlphaPostFix(alpha: Char): Float { return ("0." + (alpha.toInt() - 96).toString()).toFloat() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt index 8da294b0d..8eb1e6ea2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt @@ -18,10 +18,12 @@ import java.util.TreeSet * @param source the source of the chapters. * @return a pair of new insertions and deletions. */ -fun syncChaptersWithSource(db: DatabaseHelper, - rawSourceChapters: List, - manga: Manga, - source: Source): Pair, List> { +fun syncChaptersWithSource( + db: DatabaseHelper, + rawSourceChapters: List, + manga: Manga, + source: Source +): Pair, List> { if (rawSourceChapters.isEmpty()) { throw Exception("No chapters found") @@ -51,7 +53,7 @@ fun syncChaptersWithSource(db: DatabaseHelper, if (dbChapter == null) { toAdd.add(sourceChapter) } else { - //this forces metadata update for the main viewable things in the chapter list + // this forces metadata update for the main viewable things in the chapter list if (source is HttpSource) { source.prepareNewChapter(sourceChapter, manga) } @@ -137,7 +139,7 @@ fun syncChaptersWithSource(db: DatabaseHelper, return Pair(toAdd.subtract(readded).toList(), toDelete.subtract(readded).toList()) } -//checks if the chapter in db needs updated +// checks if the chapter in db needs updated private fun shouldUpdateDbChapter(dbChapter: Chapter, sourceChapter: SChapter): Boolean { return dbChapter.scanlator != sourceChapter.scanlator || dbChapter.name != sourceChapter.name || dbChapter.date_upload != sourceChapter.date_upload || diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/RetryWithDelay.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/RetryWithDelay.kt index 7cdef09b1..a14825a4b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/RetryWithDelay.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/RetryWithDelay.kt @@ -1,15 +1,15 @@ package eu.kanade.tachiyomi.util.lang +import java.util.concurrent.TimeUnit.MILLISECONDS import rx.Observable import rx.Scheduler import rx.functions.Func1 import rx.schedulers.Schedulers -import java.util.concurrent.TimeUnit.MILLISECONDS class RetryWithDelay( - private val maxRetries: Int = 1, - private val retryStrategy: (Int) -> Int = { 1000 }, - private val scheduler: Scheduler = Schedulers.computation() + private val maxRetries: Int = 1, + private val retryStrategy: (Int) -> Int = { 1000 }, + private val scheduler: Scheduler = Schedulers.computation() ) : Func1, Observable<*>> { private var retryCount = 0 diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt index d9f177269..4ad9f57b4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt @@ -114,4 +114,3 @@ object DiskUtil { } } } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/storage/EpubFile.kt b/app/src/main/java/eu/kanade/tachiyomi/util/storage/EpubFile.kt index a160308d3..c2a2b7869 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/storage/EpubFile.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/storage/EpubFile.kt @@ -1,12 +1,12 @@ package eu.kanade.tachiyomi.util.storage -import org.jsoup.Jsoup -import org.jsoup.nodes.Document import java.io.Closeable import java.io.File import java.io.InputStream import java.util.zip.ZipEntry import java.util.zip.ZipFile +import org.jsoup.Jsoup +import org.jsoup.nodes.Document /** * Wrapper over ZipFile to load files in epub format. @@ -113,5 +113,4 @@ class EpubFile(file: File) : Closeable { } } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/storage/FileExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/storage/FileExtensions.kt index 2b2ad5843..53523c6d4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/storage/FileExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/storage/FileExtensions.kt @@ -17,4 +17,3 @@ fun File.getUriCompat(context: Context): Uri { FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", this) else Uri.fromFile(this) } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/storage/OkioExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/storage/OkioExtensions.kt index c3f72c866..0eac12d48 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/storage/OkioExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/storage/OkioExtensions.kt @@ -1,10 +1,10 @@ package eu.kanade.tachiyomi.util.storage +import java.io.File +import java.io.OutputStream import okio.BufferedSource import okio.buffer import okio.sink -import java.io.File -import java.io.OutputStream /** * Saves the given source to a file and closes it. Directories will be created if needed. diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt index 6cef67b09..f59708a0c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt @@ -70,5 +70,4 @@ object ImageUtil { GIF("image/gif", "gif"), WEBP("image/webp", "webp") } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt index 64264c87f..2d411780b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt @@ -7,8 +7,8 @@ import android.os.Build import android.view.ContextThemeWrapper import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import uy.kohesive.injekt.injectLazy import java.util.Locale +import uy.kohesive.injekt.injectLazy /** * Utility class to change the application's language in runtime. @@ -141,5 +141,4 @@ object LocaleHelper { } return newConfig } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/WebViewClientCompat.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/WebViewClientCompat.kt index 7e1f840cd..b53b87988 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/WebViewClientCompat.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/WebViewClientCompat.kt @@ -16,18 +16,18 @@ abstract class WebViewClientCompat : WebViewClient() { } open fun onReceivedErrorCompat( - view: WebView, - errorCode: Int, - description: String?, - failingUrl: String, - isMainFrame: Boolean) { - + view: WebView, + errorCode: Int, + description: String?, + failingUrl: String, + isMainFrame: Boolean + ) { } @TargetApi(Build.VERSION_CODES.N) final override fun shouldOverrideUrlLoading( - view: WebView, - request: WebResourceRequest + view: WebView, + request: WebResourceRequest ): Boolean { return shouldOverrideUrlCompat(view, request.url.toString()) } @@ -37,46 +37,45 @@ abstract class WebViewClientCompat : WebViewClient() { } final override fun shouldInterceptRequest( - view: WebView, - request: WebResourceRequest + view: WebView, + request: WebResourceRequest ): WebResourceResponse? { return shouldInterceptRequestCompat(view, request.url.toString()) } final override fun shouldInterceptRequest( - view: WebView, - url: String + view: WebView, + url: String ): WebResourceResponse? { return shouldInterceptRequestCompat(view, url) } @TargetApi(Build.VERSION_CODES.M) final override fun onReceivedError( - view: WebView, - request: WebResourceRequest, - error: WebResourceError + view: WebView, + request: WebResourceRequest, + error: WebResourceError ) { onReceivedErrorCompat(view, error.errorCode, error.description?.toString(), request.url.toString(), request.isForMainFrame) } final override fun onReceivedError( - view: WebView, - errorCode: Int, - description: String?, - failingUrl: String + view: WebView, + errorCode: Int, + description: String?, + failingUrl: String ) { onReceivedErrorCompat(view, errorCode, description, failingUrl, failingUrl == view.url) } @TargetApi(Build.VERSION_CODES.M) final override fun onReceivedHttpError( - view: WebView, - request: WebResourceRequest, - error: WebResourceResponse + view: WebView, + request: WebResourceRequest, + error: WebResourceResponse ) { onReceivedErrorCompat(view, error.statusCode, error.reasonPhrase, request.url .toString(), request.isForMainFrame) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/AutofitRecyclerView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/AutofitRecyclerView.kt index b2d18e823..e843e628a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/AutofitRecyclerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/AutofitRecyclerView.kt @@ -42,5 +42,4 @@ class AutofitRecyclerView @JvmOverloads constructor(context: Context, attrs: Att spanCount = count } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/DialogCustomDownloadView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/DialogCustomDownloadView.kt index 883755cff..5e05cdb5c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/DialogCustomDownloadView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/DialogCustomDownloadView.kt @@ -37,7 +37,6 @@ class DialogCustomDownloadView @JvmOverloads constructor(context: Context, attrs addView(inflate(R.layout.download_custom_amount)) } - /** * Called when view is added * diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/DrawerSwipeCloseListener.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/DrawerSwipeCloseListener.kt index 22a1850d3..1e369f622 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/DrawerSwipeCloseListener.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/DrawerSwipeCloseListener.kt @@ -5,8 +5,8 @@ import android.view.ViewGroup import androidx.drawerlayout.widget.DrawerLayout class DrawerSwipeCloseListener( - private val drawer: DrawerLayout, - private val navigationView: ViewGroup + private val drawer: DrawerLayout, + private val navigationView: ViewGroup ) : DrawerLayout.SimpleDrawerListener() { override fun onDrawerOpened(drawerView: View) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/ElevationAppBarLayout.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/ElevationAppBarLayout.kt index 3586ab9b5..e7d0f70c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/ElevationAppBarLayout.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/ElevationAppBarLayout.kt @@ -8,8 +8,8 @@ import com.google.android.material.R import com.google.android.material.appbar.AppBarLayout class ElevationAppBarLayout @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null + context: Context, + attrs: AttributeSet? = null ) : AppBarLayout(context, attrs) { private var origStateAnimator: StateListAnimator? = null @@ -37,5 +37,4 @@ class ElevationAppBarLayout @JvmOverloads constructor( addState(IntArray(0), objAnimator) } } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt index ee9e6d6d0..3241b0172 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt @@ -17,10 +17,11 @@ import eu.kanade.tachiyomi.util.system.getResourceColor * inflation and allowing customizable items (multiple selections, custom views, etc). */ open class ExtendedNavigationView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0) - : SimpleNavigationView(context, attrs, defStyleAttr) { + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : + SimpleNavigationView(context, attrs, defStyleAttr) { /** * Every item of the nav view. Generic items must belong to this list, custom items could be @@ -46,15 +47,15 @@ open class ExtendedNavigationView @JvmOverloads constructor( /** * A checkbox belonging to a group. The group must handle selections and restrictions. */ - class CheckboxGroup(resTitle: Int, override val group: Group, checked: Boolean = false) - : Checkbox(resTitle, checked), GroupedItem + class CheckboxGroup(resTitle: Int, override val group: Group, checked: Boolean = false) : + Checkbox(resTitle, checked), GroupedItem /** * A radio belonging to a group (a sole radio makes no sense). The group must handle * selections and restrictions. */ - class Radio(val resTitle: Int, override val group: Group, var checked: Boolean = false) - : Item(), GroupedItem + class Radio(val resTitle: Int, override val group: Group, var checked: Boolean = false) : + Item(), GroupedItem /** * An item with which needs more than two states (selected/deselected). @@ -83,8 +84,8 @@ open class ExtendedNavigationView @JvmOverloads constructor( * An item with which needs more than two states (selected/deselected) belonging to a group. * The group must handle selections and restrictions. */ - abstract class MultiStateGroup(resTitle: Int, override val group: Group, state: Int = 0) - : MultiState(resTitle, state), GroupedItem + abstract class MultiStateGroup(resTitle: Int, override val group: Group, state: Int = 0) : + MultiState(resTitle, state), GroupedItem /** * A multistate item for sorting lists (unselected, ascending, descending). @@ -105,7 +106,6 @@ open class ExtendedNavigationView @JvmOverloads constructor( else -> null } } - } } @@ -153,7 +153,6 @@ open class ExtendedNavigationView @JvmOverloads constructor( * selections of its items. */ fun onItemClicked(item: Item) - } /** @@ -232,7 +231,5 @@ open class ExtendedNavigationView @JvmOverloads constructor( } abstract fun onItemClicked(item: Item) - } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/IgnoreFirstSpinnerListener.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/IgnoreFirstSpinnerListener.kt index 190e8a4f9..107e6fa55 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/IgnoreFirstSpinnerListener.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/IgnoreFirstSpinnerListener.kt @@ -17,6 +17,5 @@ class IgnoreFirstSpinnerListener(private val block: (Int) -> Unit) : OnItemSelec } override fun onNothingSelected(parent: AdapterView<*>?) { - } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/MinMaxNumberPicker.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/MinMaxNumberPicker.kt index 07adb8d0c..bdc7d79d1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/MinMaxNumberPicker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/MinMaxNumberPicker.kt @@ -20,4 +20,3 @@ class MinMaxNumberPicker @JvmOverloads constructor(context: Context, attrs: Attr } } } - diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/NegativeSeekBar.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/NegativeSeekBar.kt index 30e0eac7c..9ab0cc9c1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/NegativeSeekBar.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/NegativeSeekBar.kt @@ -7,7 +7,6 @@ import android.widget.SeekBar import eu.kanade.tachiyomi.R import kotlin.math.abs - class NegativeSeekBar @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : SeekBar(context, attrs) { @@ -66,5 +65,4 @@ class NegativeSeekBar @JvmOverloads constructor(context: Context, attrs: Attribu super.onRestoreInstanceState(state) super.setProgress(origProgress) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/OutlineSpan.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/OutlineSpan.kt index 79b205777..b7ab3a82f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/OutlineSpan.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/OutlineSpan.kt @@ -12,30 +12,30 @@ import androidx.annotation.Dimension * A class that draws the outlines of a text when given a stroke color and stroke width. */ class OutlineSpan( - @ColorInt private val strokeColor: Int, - @Dimension private val strokeWidth: Float + @ColorInt private val strokeColor: Int, + @Dimension private val strokeWidth: Float ) : ReplacementSpan() { override fun getSize( - paint: Paint, - text: CharSequence, - start: Int, - end: Int, - fm: Paint.FontMetricsInt? + paint: Paint, + text: CharSequence, + start: Int, + end: Int, + fm: Paint.FontMetricsInt? ): Int { return paint.measureText(text.toString().substring(start until end)).toInt() } override fun draw( - canvas: Canvas, - text: CharSequence, - start: Int, - end: Int, - x: Float, - top: Int, - y: Int, - bottom: Int, - paint: Paint + canvas: Canvas, + text: CharSequence, + start: Int, + end: Int, + x: Float, + top: Int, + y: Int, + bottom: Int, + paint: Paint ) { val originTextColor = paint.color @@ -53,5 +53,4 @@ class OutlineSpan( canvas.drawText(text, start, end, x, y.toFloat(), paint) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/PTSansTextView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/PTSansTextView.kt index 20095ffe9..09eb9ab69 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/PTSansTextView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/PTSansTextView.kt @@ -8,7 +8,6 @@ import android.widget.TextView import eu.kanade.tachiyomi.R import java.util.HashMap - class PTSansTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : TextView(context, attrs) { @@ -43,5 +42,4 @@ class PTSansTextView @JvmOverloads constructor(context: Context, attrs: Attribut super.onDraw(canvas) super.onDraw(canvas) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt index e862c29f9..b08acbf32 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/PreCachingLayoutManager.kt @@ -22,5 +22,4 @@ class PreCachingLayoutManager(context: Context) : LinearLayoutManager(context) { } return DEFAULT_EXTRA_LAYOUT_SPACE } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/RecyclerViewPagerAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/RecyclerViewPagerAdapter.kt index 12fe2e0d6..2e1d51c2f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/RecyclerViewPagerAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/RecyclerViewPagerAdapter.kt @@ -31,6 +31,4 @@ abstract class RecyclerViewPagerAdapter : ViewStatePagerAdapter() { recycleView(view, position) if (recycle) pool.push(view) } - - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/RevealAnimationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/RevealAnimationView.kt index a78a67803..9a79b0c68 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/RevealAnimationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/RevealAnimationView.kt @@ -64,5 +64,4 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att anim.start() return true } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleAnimationListener.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleAnimationListener.kt index 12a2b4ef2..853e8ba0b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleAnimationListener.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleAnimationListener.kt @@ -8,4 +8,4 @@ open class SimpleAnimationListener : Animation.AnimationListener { override fun onAnimationEnd(animation: Animation) {} override fun onAnimationStart(animation: Animation) {} -} \ No newline at end of file +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt index f196df450..f76ec127e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt @@ -13,17 +13,18 @@ import androidx.recyclerview.widget.RecyclerView import com.google.android.material.R import com.google.android.material.internal.ScrimInsetsFrameLayout import com.google.android.material.textfield.TextInputLayout +import eu.kanade.tachiyomi.R as TR import eu.kanade.tachiyomi.util.view.inflate import kotlin.math.min -import eu.kanade.tachiyomi.R as TR @Suppress("LeakingThis") @SuppressLint("PrivateResource", "RestrictedApi") open class SimpleNavigationView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0) - : ScrimInsetsFrameLayout(context, attrs, defStyleAttr) { + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : + ScrimInsetsFrameLayout(context, attrs, defStyleAttr) { /** * Max width of the navigation view. @@ -83,19 +84,18 @@ open class SimpleNavigationView @JvmOverloads constructor( /** * Separator view holder. */ - class SeparatorHolder(parent: ViewGroup) - : Holder(parent.inflate(R.layout.design_navigation_item_separator)) + class SeparatorHolder(parent: ViewGroup) : + Holder(parent.inflate(R.layout.design_navigation_item_separator)) /** * Header view holder. */ - class HeaderHolder(parent: ViewGroup) - : Holder(parent.inflate(TR.layout.navigation_view_group)) { + class HeaderHolder(parent: ViewGroup) : + Holder(parent.inflate(TR.layout.navigation_view_group)) { val title: TextView = itemView.findViewById(TR.id.title) } - /** * Clickable view holder. */ @@ -108,8 +108,8 @@ open class SimpleNavigationView @JvmOverloads constructor( /** * Radio view holder. */ - class RadioHolder(parent: ViewGroup, listener: View.OnClickListener?) - : ClickableHolder(parent.inflate(TR.layout.navigation_view_radio), listener) { + class RadioHolder(parent: ViewGroup, listener: View.OnClickListener?) : + ClickableHolder(parent.inflate(TR.layout.navigation_view_radio), listener) { val radio: RadioButton = itemView.findViewById(TR.id.nav_view_item) } @@ -117,8 +117,8 @@ open class SimpleNavigationView @JvmOverloads constructor( /** * Checkbox view holder. */ - class CheckboxHolder(parent: ViewGroup, listener: View.OnClickListener?) - : ClickableHolder(parent.inflate(TR.layout.navigation_view_checkbox), listener) { + class CheckboxHolder(parent: ViewGroup, listener: View.OnClickListener?) : + ClickableHolder(parent.inflate(TR.layout.navigation_view_checkbox), listener) { val check: CheckBox = itemView.findViewById(TR.id.nav_view_item) } @@ -126,21 +126,21 @@ open class SimpleNavigationView @JvmOverloads constructor( /** * Multi state view holder. */ - class MultiStateHolder(parent: ViewGroup, listener: View.OnClickListener?) - : ClickableHolder(parent.inflate(TR.layout.navigation_view_checkedtext), listener) { + class MultiStateHolder(parent: ViewGroup, listener: View.OnClickListener?) : + ClickableHolder(parent.inflate(TR.layout.navigation_view_checkedtext), listener) { val text: CheckedTextView = itemView.findViewById(TR.id.nav_view_item) } - class SpinnerHolder(parent: ViewGroup, listener: OnClickListener? = null) - : ClickableHolder(parent.inflate(TR.layout.navigation_view_spinner), listener) { + class SpinnerHolder(parent: ViewGroup, listener: OnClickListener? = null) : + ClickableHolder(parent.inflate(TR.layout.navigation_view_spinner), listener) { val text: TextView = itemView.findViewById(TR.id.nav_view_item_text) val spinner: Spinner = itemView.findViewById(TR.id.nav_view_item) } - class EditTextHolder(parent: ViewGroup) - : Holder(parent.inflate(TR.layout.navigation_view_text)) { + class EditTextHolder(parent: ViewGroup) : + Holder(parent.inflate(TR.layout.navigation_view_text)) { val wrapper: TextInputLayout = itemView.findViewById(TR.id.nav_view_item_wrapper) val edit: EditText = itemView.findViewById(TR.id.nav_view_item) @@ -155,5 +155,4 @@ open class SimpleNavigationView @JvmOverloads constructor( const val VIEW_TYPE_TEXT = 105 const val VIEW_TYPE_LIST = 106 } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/StateImageViewTarget.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/StateImageViewTarget.kt index 6bae31e25..0613e330b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/StateImageViewTarget.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/StateImageViewTarget.kt @@ -21,10 +21,12 @@ import eu.kanade.tachiyomi.util.view.visible * @param errorDrawableRes the error drawable resource to show. * @param errorScaleType the scale type for the error drawable, [ScaleType.CENTER] by default. */ -class StateImageViewTarget(view: ImageView, - val progress: View? = null, - val errorDrawableRes: Int = R.drawable.ic_broken_image_grey_24dp, - val errorScaleType: ScaleType = ScaleType.CENTER) : +class StateImageViewTarget( + view: ImageView, + val progress: View? = null, + val errorDrawableRes: Int = R.drawable.ic_broken_image_grey_24dp, + val errorScaleType: ScaleType = ScaleType.CENTER +) : ImageViewTarget(view) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/ViewPagerAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/ViewPagerAdapter.kt index 981b5500b..4e35f4c86 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/ViewPagerAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/ViewPagerAdapter.kt @@ -30,5 +30,4 @@ abstract class ViewPagerAdapter : PagerAdapter() { interface PositionableView { val item: Any } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginCheckBoxPreference.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginCheckBoxPreference.kt index b304d1825..d80ffaa86 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginCheckBoxPreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginCheckBoxPreference.kt @@ -15,9 +15,9 @@ import kotlinx.android.synthetic.main.pref_item_source.view.login import kotlinx.android.synthetic.main.pref_item_source.view.login_frame class LoginCheckBoxPreference @JvmOverloads constructor( - context: Context, - val source: HttpSource, - attrs: AttributeSet? = null + context: Context, + val source: HttpSource, + attrs: AttributeSet? = null ) : CheckBoxPreference(context, attrs) { init { @@ -54,5 +54,4 @@ class LoginCheckBoxPreference @JvmOverloads constructor( public override fun notifyChanged() { super.notifyChanged() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt index 1e8d7a58b..d52c64d1a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginDialogPreference.kt @@ -62,7 +62,6 @@ abstract class LoginDialogPreference(bundle: Bundle? = null) : DialogController( } }) } - } override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) { @@ -79,5 +78,4 @@ abstract class LoginDialogPreference(bundle: Bundle? = null) : DialogController( protected abstract fun checkLogin() protected abstract fun setCredentialsOnView(view: View) - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginPreference.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginPreference.kt index 7cb0e4ec8..a0fa99dd7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginPreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginPreference.kt @@ -26,5 +26,4 @@ class LoginPreference @JvmOverloads constructor(context: Context, attrs: Attribu public override fun notifyChanged() { super.notifyChanged() } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SourceLoginDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SourceLoginDialog.kt index 0aa7c3828..7bd1cdf13 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SourceLoginDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SourceLoginDialog.kt @@ -68,5 +68,4 @@ class SourceLoginDialog(bundle: Bundle? = null) : LoginDialogPreference(bundle) interface Listener { fun loginDialogClosed(source: LoginSource) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt index c39edd628..e5f759581 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt @@ -16,9 +16,10 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.getResourceColor class SwitchPreferenceCategory @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null) - : PreferenceCategory( + context: Context, + attrs: AttributeSet? = null +) : + PreferenceCategory( context, attrs, R.attr.switchPreferenceCompatStyle), @@ -121,5 +122,4 @@ class SwitchPreferenceCategory @JvmOverloads constructor( else defaultValue as Boolean) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLoginDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLoginDialog.kt index e6c6a32cb..0743c2e02 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLoginDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLoginDialog.kt @@ -60,5 +60,4 @@ class TrackLoginDialog(bundle: Bundle? = null) : LoginDialogPreference(bundle) { interface Listener { fun trackLoginDialogClosed(service: TrackService) } - } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLogoutDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLogoutDialog.kt index a42a08c1d..7f50caad3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLogoutDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/TrackLogoutDialog.kt @@ -33,5 +33,4 @@ class TrackLogoutDialog(bundle: Bundle? = null) : DialogController(bundle) { interface Listener { fun trackLogoutDialogClosed(service: TrackService) } - } diff --git a/app/src/test/java/eu/kanade/tachiyomi/CustomRobolectricGradleTestRunner.kt b/app/src/test/java/eu/kanade/tachiyomi/CustomRobolectricGradleTestRunner.kt index e3885a8c7..3b334be41 100644 --- a/app/src/test/java/eu/kanade/tachiyomi/CustomRobolectricGradleTestRunner.kt +++ b/app/src/test/java/eu/kanade/tachiyomi/CustomRobolectricGradleTestRunner.kt @@ -9,4 +9,4 @@ class CustomRobolectricGradleTestRunner(klass: Class<*>) : RobolectricTestRunner override fun getAppManifest(config: Config): AndroidManifest { return super.getAppManifest(config).apply { packageName = "eu.kanade.tachiyomi" } } -} \ No newline at end of file +} diff --git a/app/src/test/java/eu/kanade/tachiyomi/data/backup/BackupTest.kt b/app/src/test/java/eu/kanade/tachiyomi/data/backup/BackupTest.kt index 748dc30da..06ffb78bd 100644 --- a/app/src/test/java/eu/kanade/tachiyomi/data/backup/BackupTest.kt +++ b/app/src/test/java/eu/kanade/tachiyomi/data/backup/BackupTest.kt @@ -228,7 +228,6 @@ class BackupTest { val manga = getSingleManga("One Piece") manga.id = backupManager.databaseHelper.insertManga(manga).executeAsBlocking().insertedId() - // Create restore list val chapters = ArrayList() for (i in 1..8) { @@ -323,7 +322,7 @@ class BackupTest { // Check parser and restore already in database var trackList = listOf(track) - //Check parser + // Check parser var trackListJson = backupManager.parser.toJsonTree(trackList) var trackListRestore = backupManager.parser.fromJson>(trackListJson) backupManager.restoreTrackForManga(manga, trackListRestore) @@ -346,7 +345,7 @@ class BackupTest { // Check parser and restore, track not in database trackList = listOf(track2) - //Check parser + // Check parser trackListJson = backupManager.parser.toJsonTree(trackList) trackListRestore = backupManager.parser.fromJson>(trackListJson) backupManager.restoreTrackForManga(manga2, trackListRestore) diff --git a/app/src/test/java/eu/kanade/tachiyomi/data/database/CategoryTest.kt b/app/src/test/java/eu/kanade/tachiyomi/data/database/CategoryTest.kt index 61057b440..6e12314ea 100644 --- a/app/src/test/java/eu/kanade/tachiyomi/data/database/CategoryTest.kt +++ b/app/src/test/java/eu/kanade/tachiyomi/data/database/CategoryTest.kt @@ -106,5 +106,4 @@ class CategoryTest { c.name = name db.insertCategory(c).executeAsBlocking() } - } diff --git a/app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt b/app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt index 35715bf8c..33a0f2d17 100644 --- a/app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt +++ b/app/src/test/java/eu/kanade/tachiyomi/data/database/ChapterRecognitionTest.kt @@ -471,7 +471,6 @@ class ChapterRecognitionTest { assertThat(chapter.chapter_number).isEqualTo(7f) } - /** * Test for chapters in format sx - chapter xx */ diff --git a/app/src/test/java/eu/kanade/tachiyomi/data/library/LibraryUpdateServiceTest.kt b/app/src/test/java/eu/kanade/tachiyomi/data/library/LibraryUpdateServiceTest.kt index bfd87f5af..a32e7c41c 100644 --- a/app/src/test/java/eu/kanade/tachiyomi/data/library/LibraryUpdateServiceTest.kt +++ b/app/src/test/java/eu/kanade/tachiyomi/data/library/LibraryUpdateServiceTest.kt @@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.data.database.models.LibraryManga import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.online.HttpSource +import java.util.ArrayList import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test @@ -26,7 +27,6 @@ import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.InjektModule import uy.kohesive.injekt.api.InjektRegistrar import uy.kohesive.injekt.api.addSingleton -import java.util.ArrayList @Config(constants = BuildConfig::class, sdk = intArrayOf(Build.VERSION_CODES.LOLLIPOP)) @RunWith(CustomRobolectricGradleTestRunner::class)