diff --git a/.editorconfig b/.editorconfig index 98e140b3ab..a92a685aef 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,6 +4,7 @@ end_of_line=lf insert_final_newline=true indent_style=space indent_size=2 +disabled_rules=import-ordering [{*.sht,*.html,*.shtm,*.shtml,*.htm}] indent_style=space diff --git a/app/src/androidTest/java/DebugFunctions.kt b/app/src/androidTest/java/DebugFunctions.kt index 88ec5cbd88..e44fba6a9c 100644 --- a/app/src/androidTest/java/DebugFunctions.kt +++ b/app/src/androidTest/java/DebugFunctions.kt @@ -24,8 +24,8 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry import androidx.test.runner.lifecycle.Stage.RESUMED import androidx.viewpager.widget.ViewPager -import org.kiwix.kiwixmobile.BaseRobot import java.io.File +import org.kiwix.kiwixmobile.BaseRobot inline fun T.applyWithViewHierarchyPrinting( crossinline function: T.() -> Unit diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/KiwixMockServer.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/KiwixMockServer.kt index 41a3ce8953..42151c171b 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/KiwixMockServer.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/KiwixMockServer.kt @@ -18,13 +18,13 @@ package org.kiwix.kiwixmobile +import java.io.StringWriter import okhttp3.mockwebserver.Dispatcher import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import okhttp3.mockwebserver.RecordedRequest import org.kiwix.sharedFunctions.TEST_PORT import org.simpleframework.xml.core.Persister -import java.io.StringWriter class KiwixMockServer { diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/core/di/components/TestComponent.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/core/di/components/TestComponent.kt index 64f134931b..c04bc6fb09 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/core/di/components/TestComponent.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/core/di/components/TestComponent.kt @@ -20,6 +20,7 @@ package org.kiwix.kiwixmobile.core.di.components import android.content.Context import dagger.BindsInstance import dagger.Component +import javax.inject.Singleton import org.kiwix.kiwixmobile.NetworkTest import org.kiwix.kiwixmobile.ZimTest import org.kiwix.kiwixmobile.core.bookmark.BookmarksModule @@ -30,7 +31,6 @@ import org.kiwix.kiwixmobile.core.di.modules.JNIModule import org.kiwix.kiwixmobile.core.di.modules.SearchModule import org.kiwix.kiwixmobile.core.di.modules.TestNetworkModule import org.kiwix.kiwixmobile.core.history.HistoryModule -import javax.inject.Singleton /** * Created by mhutti1 on 13/04/17. diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivityTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivityTest.kt index 7da8ba922a..ce5c22908f 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivityTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivityTest.kt @@ -21,6 +21,7 @@ package org.kiwix.kiwixmobile.zim_manager import android.os.Build import androidx.test.filters.SdkSuppress import attempt +import java.util.concurrent.TimeUnit.SECONDS import okhttp3.mockwebserver.MockResponse import org.junit.Ignore import org.junit.Test @@ -33,7 +34,6 @@ import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil import org.kiwix.sharedFunctions.book import org.kiwix.sharedFunctions.libraryNetworkEntity import org.kiwix.sharedFunctions.metaLinkNetworkEntity -import java.util.concurrent.TimeUnit.SECONDS @SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN_MR2) class ZimManageActivityTest : BaseActivityTest() { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/KiwixViewModelFactory.kt b/app/src/main/java/org/kiwix/kiwixmobile/KiwixViewModelFactory.kt index 8d52be3e2e..242876c9fe 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/KiwixViewModelFactory.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/KiwixViewModelFactory.kt @@ -18,10 +18,10 @@ package org.kiwix.kiwixmobile import androidx.lifecycle.ViewModel -import org.kiwix.kiwixmobile.core.ViewModelFactory -import org.kiwix.kiwixmobile.di.KiwixScope import javax.inject.Inject import javax.inject.Provider +import org.kiwix.kiwixmobile.core.ViewModelFactory +import org.kiwix.kiwixmobile.di.KiwixScope @KiwixScope class KiwixViewModelFactory @Inject constructor( diff --git a/app/src/main/java/org/kiwix/kiwixmobile/di/components/KiwixComponent.kt b/app/src/main/java/org/kiwix/kiwixmobile/di/components/KiwixComponent.kt index 48f8271fad..3b13af038e 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/di/components/KiwixComponent.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/di/components/KiwixComponent.kt @@ -19,8 +19,8 @@ package org.kiwix.kiwixmobile.di.components import dagger.Component -import org.kiwix.kiwixmobile.di.KiwixScope import org.kiwix.kiwixmobile.core.di.components.CoreComponent +import org.kiwix.kiwixmobile.di.KiwixScope import org.kiwix.kiwixmobile.di.components.ServiceComponent.Builder import org.kiwix.kiwixmobile.di.modules.KiwixModule import org.kiwix.kiwixmobile.di.modules.KiwixViewModelModule diff --git a/app/src/main/java/org/kiwix/kiwixmobile/language/LanguageActivity.kt b/app/src/main/java/org/kiwix/kiwixmobile/language/LanguageActivity.kt index af635378ea..43b311a6b4 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/language/LanguageActivity.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/language/LanguageActivity.kt @@ -27,6 +27,7 @@ import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import io.reactivex.disposables.CompositeDisposable +import javax.inject.Inject import kotlinx.android.synthetic.main.activity_language.language_progressbar import kotlinx.android.synthetic.main.activity_language.language_recycler_view import org.kiwix.kiwixmobile.R @@ -46,7 +47,6 @@ import org.kiwix.kiwixmobile.language.viewmodel.State import org.kiwix.kiwixmobile.language.viewmodel.State.Content import org.kiwix.kiwixmobile.language.viewmodel.State.Loading import org.kiwix.kiwixmobile.language.viewmodel.State.Saving -import javax.inject.Inject class LanguageActivity : BaseActivity() { override fun injection(coreComponent: CoreComponent) { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/language/adapter/LanguageDelegate.kt b/app/src/main/java/org/kiwix/kiwixmobile/language/adapter/LanguageDelegate.kt index 1d4019e6f6..8cbc9dab1d 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/language/adapter/LanguageDelegate.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/language/adapter/LanguageDelegate.kt @@ -20,8 +20,8 @@ package org.kiwix.kiwixmobile.language.adapter import android.view.ViewGroup import org.kiwix.kiwixmobile.R -import org.kiwix.kiwixmobile.core.extensions.ViewGroupExtensions.inflate import org.kiwix.kiwixmobile.core.base.adapter.AbsDelegateAdapter +import org.kiwix.kiwixmobile.core.extensions.ViewGroupExtensions.inflate import org.kiwix.kiwixmobile.language.adapter.LanguageListItem.HeaderItem import org.kiwix.kiwixmobile.language.adapter.LanguageListItem.LanguageItem import org.kiwix.kiwixmobile.language.adapter.LanguageListViewHolder.HeaderViewHolder diff --git a/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/LanguageViewModel.kt b/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/LanguageViewModel.kt index 40cc8fd961..f0ccbce0ee 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/LanguageViewModel.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/LanguageViewModel.kt @@ -22,6 +22,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import io.reactivex.disposables.CompositeDisposable import io.reactivex.processors.PublishProcessor +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.dao.NewLanguagesDao import org.kiwix.kiwixmobile.language.adapter.LanguageListItem.LanguageItem @@ -32,7 +33,6 @@ import org.kiwix.kiwixmobile.language.viewmodel.Action.UpdateLanguages import org.kiwix.kiwixmobile.language.viewmodel.State.Content import org.kiwix.kiwixmobile.language.viewmodel.State.Loading import org.kiwix.kiwixmobile.language.viewmodel.State.Saving -import javax.inject.Inject class LanguageViewModel @Inject constructor( private val languageDao: NewLanguagesDao diff --git a/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/SaveLanguagesAndFinish.kt b/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/SaveLanguagesAndFinish.kt index d82369171f..08d668acf3 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/SaveLanguagesAndFinish.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/language/viewmodel/SaveLanguagesAndFinish.kt @@ -20,9 +20,9 @@ package org.kiwix.kiwixmobile.language.viewmodel import androidx.appcompat.app.AppCompatActivity import io.reactivex.Flowable import io.reactivex.schedulers.Schedulers +import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.dao.NewLanguagesDao import org.kiwix.kiwixmobile.core.zim_manager.Language -import org.kiwix.kiwixmobile.core.base.SideEffect data class SaveLanguagesAndFinish( val languages: List, diff --git a/app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt b/app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt index 801181bdde..c2aa74eeb0 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt @@ -24,6 +24,7 @@ import android.util.Log import android.widget.Toast import androidx.core.net.toFile import androidx.core.net.toUri +import java.io.File import org.json.JSONArray import org.kiwix.kiwixmobile.R import org.kiwix.kiwixmobile.core.di.components.CoreComponent @@ -45,7 +46,6 @@ import org.kiwix.kiwixmobile.core.utils.files.FileUtils import org.kiwix.kiwixmobile.kiwixActivityComponent import org.kiwix.kiwixmobile.webserver.ZimHostActivity import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity -import java.io.File class KiwixMainActivity : CoreMainActivity() { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/settings/KiwixPrefsFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/settings/KiwixPrefsFragment.kt index dcdcdcb0a7..0f53945609 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/settings/KiwixPrefsFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/settings/KiwixPrefsFragment.kt @@ -20,10 +20,10 @@ package org.kiwix.kiwixmobile.settings import android.os.Bundle import android.os.Environment +import java.io.File import org.kiwix.kiwixmobile.core.settings.CorePrefsFragment import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_LANG import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil.PREF_STORAGE -import java.io.File class KiwixPrefsFragment : CorePrefsFragment() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.kt b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.kt index a8f5e3cd23..a96183463d 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.kt @@ -31,6 +31,8 @@ import android.widget.TextView import android.widget.Toast import androidx.appcompat.widget.Toolbar import androidx.recyclerview.widget.RecyclerView +import java.util.ArrayList +import javax.inject.Inject import org.kiwix.kiwixmobile.R import org.kiwix.kiwixmobile.core.BuildConfig import org.kiwix.kiwixmobile.core.base.BaseActivity @@ -49,8 +51,6 @@ import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService.ACTION_CHECK_IP_ADDRESS import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService.ACTION_START_SERVER import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService.ACTION_STOP_SERVER -import java.util.ArrayList -import javax.inject.Inject class ZimHostActivity : BaseActivity(), ZimHostCallbacks, ZimHostContract.View { @Inject diff --git a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostPresenter.kt b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostPresenter.kt index 640380dd65..b91498a9a8 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostPresenter.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostPresenter.kt @@ -20,13 +20,13 @@ package org.kiwix.kiwixmobile.webserver import android.util.Log import io.reactivex.SingleObserver import io.reactivex.disposables.Disposable +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.BasePresenter import org.kiwix.kiwixmobile.core.data.DataSource import org.kiwix.kiwixmobile.core.di.ActivityScope import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem import org.kiwix.kiwixmobile.webserver.ZimHostContract.Presenter import org.kiwix.kiwixmobile.webserver.ZimHostContract.View -import javax.inject.Inject @ActivityScope class ZimHostPresenter @Inject internal constructor(private val dataSource: DataSource) : diff --git a/app/src/main/java/org/kiwix/kiwixmobile/webserver/wifi_hotspot/HotspotStateReceiver.kt b/app/src/main/java/org/kiwix/kiwixmobile/webserver/wifi_hotspot/HotspotStateReceiver.kt index 1b1e71e89e..e973ebfa80 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/webserver/wifi_hotspot/HotspotStateReceiver.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/webserver/wifi_hotspot/HotspotStateReceiver.kt @@ -19,9 +19,9 @@ package org.kiwix.kiwixmobile.webserver.wifi_hotspot import android.content.Context import android.content.Intent +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.BaseBroadcastReceiver import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotStateReceiver.HotspotState.DISABLED -import javax.inject.Inject const val EXTRA_WIFI_AP_STATE = "wifi_state" const val ACTION_WIFI_AP_STATE = "android.net.wifi.WIFI_AP_STATE_CHANGED" diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ConnectivityBroadcastReceiver.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ConnectivityBroadcastReceiver.kt index 43f8f0b8af..a779ce341a 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ConnectivityBroadcastReceiver.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ConnectivityBroadcastReceiver.kt @@ -23,9 +23,9 @@ import android.content.Intent import android.net.ConnectivityManager import io.reactivex.Flowable import io.reactivex.processors.BehaviorProcessor +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.BaseBroadcastReceiver import org.kiwix.kiwixmobile.networkState -import javax.inject.Inject class ConnectivityBroadcastReceiver @Inject constructor( private val connectivityManager: ConnectivityManager diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/DefaultLanguageProvider.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/DefaultLanguageProvider.kt index 9e3c9dd3f2..592eed8ccc 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/DefaultLanguageProvider.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/DefaultLanguageProvider.kt @@ -19,8 +19,8 @@ package org.kiwix.kiwixmobile.zim_manager import android.content.Context -import org.kiwix.kiwixmobile.core.zim_manager.Language import javax.inject.Inject +import org.kiwix.kiwixmobile.core.zim_manager.Language class DefaultLanguageProvider @Inject constructor(private val context: Context) { fun provide() = Language( diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/Fat32Checker.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/Fat32Checker.kt index ebda4d01be..600d738db2 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/Fat32Checker.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/Fat32Checker.kt @@ -22,6 +22,7 @@ import io.reactivex.Flowable import io.reactivex.functions.BiFunction import io.reactivex.processors.BehaviorProcessor import io.reactivex.schedulers.Schedulers +import java.io.File import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil import org.kiwix.kiwixmobile.zim_manager.Fat32Checker.FileSystemState.CanWrite4GbFile import org.kiwix.kiwixmobile.zim_manager.Fat32Checker.FileSystemState.CannotWrite4GbFile @@ -30,7 +31,6 @@ import org.kiwix.kiwixmobile.zim_manager.Fat32Checker.FileSystemState.Unknown import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.CANNOT_WRITE_4GB import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.CAN_WRITE_4GB import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.INCONCLUSIVE -import java.io.File class Fat32Checker constructor( sharedPreferenceUtil: SharedPreferenceUtil, diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/FileWritingFileSystemChecker.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/FileWritingFileSystemChecker.kt index 769ade2857..c601ef3668 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/FileWritingFileSystemChecker.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/FileWritingFileSystemChecker.kt @@ -19,10 +19,10 @@ package org.kiwix.kiwixmobile.zim_manager import android.util.Log -import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.CANNOT_WRITE_4GB -import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.CAN_WRITE_4GB import java.io.File import java.io.RandomAccessFile +import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.CANNOT_WRITE_4GB +import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.CAN_WRITE_4GB class FileWritingFileSystemChecker : FileSystemChecker { override fun checkFilesystemSupports4GbFiles(path: String): FileSystemCapability { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/MountFileSystemChecker.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/MountFileSystemChecker.kt index dd5a9bf107..47afde9b18 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/MountFileSystemChecker.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/MountFileSystemChecker.kt @@ -18,10 +18,10 @@ package org.kiwix.kiwixmobile.zim_manager +import java.io.File import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.CANNOT_WRITE_4GB import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.CAN_WRITE_4GB import org.kiwix.kiwixmobile.zim_manager.FileSystemCapability.INCONCLUSIVE -import java.io.File class MountFileSystemChecker : FileSystemChecker { override fun checkFilesystemSupports4GbFiles(path: String) = diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/SectionsPagerAdapter.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/SectionsPagerAdapter.kt index d14cf10e0a..e08f48019a 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/SectionsPagerAdapter.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/SectionsPagerAdapter.kt @@ -20,11 +20,11 @@ package org.kiwix.kiwixmobile.zim_manager import android.content.Context import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentPagerAdapter +import kotlin.reflect.KFunction0 import org.kiwix.kiwixmobile.core.R.string import org.kiwix.kiwixmobile.core.base.BaseFragment import org.kiwix.kiwixmobile.zim_manager.fileselect_view.ZimFileSelectFragment import org.kiwix.kiwixmobile.zim_manager.library_view.LibraryFragment -import kotlin.reflect.KFunction0 class SectionsPagerAdapter( private val context: Context, diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivity.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivity.kt index 60fda79f9e..e970b7bc83 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivity.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ZimManageActivity.kt @@ -24,6 +24,7 @@ import android.view.MenuItem import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.Toolbar import androidx.lifecycle.ViewModelProvider +import javax.inject.Inject import kotlinx.android.synthetic.main.zim_manager.manageViewPager import kotlinx.android.synthetic.main.zim_manager.tabs import org.kiwix.kiwixmobile.R @@ -37,7 +38,6 @@ import org.kiwix.kiwixmobile.core.utils.SimpleTextListener import org.kiwix.kiwixmobile.kiwixActivityComponent import org.kiwix.kiwixmobile.language.LanguageActivity import org.kiwix.kiwixmobile.local_file_transfer.LocalFileTransferActivity -import javax.inject.Inject class ZimManageActivity : BaseActivity() { override fun injection(coreComponent: CoreComponent) { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ZimManageViewModel.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ZimManageViewModel.kt index 0156bc3bc2..3d6873cd33 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ZimManageViewModel.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/ZimManageViewModel.kt @@ -30,6 +30,11 @@ import io.reactivex.functions.Function6 import io.reactivex.processors.BehaviorProcessor import io.reactivex.processors.PublishProcessor import io.reactivex.schedulers.Schedulers +import java.util.LinkedList +import java.util.Locale +import java.util.concurrent.TimeUnit.MILLISECONDS +import java.util.concurrent.TimeUnit.SECONDS +import javax.inject.Inject import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.StorageObserver import org.kiwix.kiwixmobile.core.base.SideEffect @@ -68,11 +73,6 @@ import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryListItem import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryListItem.BookItem import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryListItem.DividerItem import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryListItem.LibraryDownloadItem -import java.util.LinkedList -import java.util.Locale -import java.util.concurrent.TimeUnit.MILLISECONDS -import java.util.concurrent.TimeUnit.SECONDS -import javax.inject.Inject class ZimManageViewModel @Inject constructor( private val downloadDao: FetchDownloadDao, diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectFragment.kt index 25190eecbf..d765f335eb 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectFragment.kt @@ -105,9 +105,9 @@ class ZimFileSelectFragment : BaseFragment() { layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false) setHasFixedSize(true) } - zimManageViewModel.fileSelectListStates.observe(this, Observer(::render)) + zimManageViewModel.fileSelectListStates.observe(viewLifecycleOwner, Observer(::render)) disposable.add(sideEffects()) - zimManageViewModel.deviceListIsRefreshing.observe(this, Observer { + zimManageViewModel.deviceListIsRefreshing.observe(viewLifecycleOwner, Observer { zim_swiperefresh.isRefreshing = it!! }) if (savedInstanceState != null && savedInstanceState.getBoolean(WAS_IN_ACTION_MODE)) { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/DeleteFiles.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/DeleteFiles.kt index 190372a54e..2d229f251e 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/DeleteFiles.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/effects/DeleteFiles.kt @@ -19,6 +19,7 @@ package org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects import androidx.appcompat.app.AppCompatActivity +import javax.inject.Inject import org.kiwix.kiwixmobile.R import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.dao.NewBookDao @@ -29,7 +30,6 @@ import org.kiwix.kiwixmobile.core.utils.KiwixDialog.DeleteZim import org.kiwix.kiwixmobile.core.utils.files.FileUtils import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity -import javax.inject.Inject data class DeleteFiles(private val booksOnDiskListItem: List) : SideEffect { diff --git a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/LibraryFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/LibraryFragment.kt index a4d9fa111d..6f4efc1668 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/LibraryFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/zim_manager/library_view/LibraryFragment.kt @@ -116,11 +116,11 @@ class LibraryFragment : BaseFragment() { layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false) setHasFixedSize(true) } - zimManageViewModel.libraryItems.observe(this, Observer(::onLibraryItemsChange)) + zimManageViewModel.libraryItems.observe(viewLifecycleOwner, Observer(::onLibraryItemsChange)) zimManageViewModel.libraryListIsRefreshing.observe( - this, Observer(::onRefreshStateChange) + viewLifecycleOwner, Observer(::onRefreshStateChange) ) - zimManageViewModel.networkStates.observe(this, Observer(::onNetworkStateChange)) + zimManageViewModel.networkStates.observe(viewLifecycleOwner, Observer(::onNetworkStateChange)) } private fun onRefreshStateChange(isRefreshing: Boolean?) { diff --git a/app/src/test/java/org/kiwix/kiwixmobile/language/viewmodel/LanguageViewModelTest.kt b/app/src/test/java/org/kiwix/kiwixmobile/language/viewmodel/LanguageViewModelTest.kt index bc19cbc44b..045c07d88a 100644 --- a/app/src/test/java/org/kiwix/kiwixmobile/language/viewmodel/LanguageViewModelTest.kt +++ b/app/src/test/java/org/kiwix/kiwixmobile/language/viewmodel/LanguageViewModelTest.kt @@ -39,9 +39,9 @@ import org.kiwix.kiwixmobile.language.viewmodel.State.Content import org.kiwix.kiwixmobile.language.viewmodel.State.Loading import org.kiwix.kiwixmobile.language.viewmodel.State.Saving import org.kiwix.sharedFunctions.InstantExecutorExtension +import org.kiwix.sharedFunctions.language import org.kiwix.sharedFunctions.resetSchedulers import org.kiwix.sharedFunctions.setScheduler -import org.kiwix.sharedFunctions.language fun languageItem(language: Language = language()) = LanguageListItem.LanguageItem(language) diff --git a/app/src/test/java/org/kiwix/kiwixmobile/zim_manager/ZimManageViewModelTest.kt b/app/src/test/java/org/kiwix/kiwixmobile/zim_manager/ZimManageViewModelTest.kt index ec7eb8ef25..e7e9f6d373 100644 --- a/app/src/test/java/org/kiwix/kiwixmobile/zim_manager/ZimManageViewModelTest.kt +++ b/app/src/test/java/org/kiwix/kiwixmobile/zim_manager/ZimManageViewModelTest.kt @@ -28,6 +28,8 @@ import io.reactivex.Single import io.reactivex.processors.BehaviorProcessor import io.reactivex.processors.PublishProcessor import io.reactivex.schedulers.TestScheduler +import java.util.Locale +import java.util.concurrent.TimeUnit.MILLISECONDS import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Nested @@ -75,8 +77,6 @@ import org.kiwix.sharedFunctions.language import org.kiwix.sharedFunctions.libraryNetworkEntity import org.kiwix.sharedFunctions.resetSchedulers import org.kiwix.sharedFunctions.setScheduler -import java.util.Locale -import java.util.concurrent.TimeUnit.MILLISECONDS @ExtendWith(InstantExecutorExtension::class) class ZimManageViewModelTest { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 8e99d93562..9e547ad46d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -11,12 +11,12 @@ repositories { } dependencies { - implementation("com.android.tools.build:gradle:3.5.2") + implementation("com.android.tools.build:gradle:3.5.3") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61") implementation("com.dicedmelon.gradle:jacoco-android:0.1.4") - implementation("org.jlleitschuh.gradle:ktlint-gradle:8.2.0") + implementation("org.jlleitschuh.gradle:ktlint-gradle:9.2.1") implementation("com.google.apis:google-api-services-androidpublisher:v3-rev129-1.25.0") - implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.2.2") + implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.5.1") implementation(gradleApi()) implementation(localGroovy()) diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt index 1c554bc47e..b74dba16da 100644 --- a/buildSrc/src/main/kotlin/Libs.kt +++ b/buildSrc/src/main/kotlin/Libs.kt @@ -135,6 +135,26 @@ object Libs { const val butterknife_gradle_plugin: String = "com.jakewharton:butterknife-gradle-plugin:" + Versions.com_jakewharton + /** + * https://developer.android.com/testing + */ + const val androidx_test_core: String = "androidx.test:core:" + Versions.androidx_test + + /** + * https://developer.android.com/testing + */ + const val orchestrator: String = "androidx.test:orchestrator:" + Versions.androidx_test + + /** + * https://developer.android.com/testing + */ + const val androidx_test_rules: String = "androidx.test:rules:" + Versions.androidx_test + + /** + * https://developer.android.com/testing + */ + const val androidx_test_runner: String = "androidx.test:runner:" + Versions.androidx_test + /** * https://objectbox.io */ @@ -199,21 +219,6 @@ object Libs { const val com_android_tools_build_gradle: String = "com.android.tools.build:gradle:" + Versions.com_android_tools_build_gradle - /** - * https://developer.android.com/testing - */ - const val androidx_test_runner: String = "androidx.test:runner:" + Versions.androidx_test_runner - - /** - * https://developer.android.com/testing - */ - const val androidx_test_rules: String = "androidx.test:rules:" + Versions.androidx_test_rules - - /** - * https://developer.android.com/testing - */ - const val androidx_test_core: String = "androidx.test:core:" + Versions.androidx_test_core - const val de_fayard_buildsrcversions_gradle_plugin: String = "de.fayard.buildSrcVersions:de.fayard.buildSrcVersions.gradle.plugin:" + Versions.de_fayard_buildsrcversions_gradle_plugin @@ -298,11 +303,6 @@ object Libs { */ const val fragment_ktx: String = "androidx.fragment:fragment-ktx:" + Versions.fragment_ktx - /** - * https://developer.android.com/testing - */ - const val orchestrator: String = "androidx.test:orchestrator:" + Versions.orchestrator - /** * https://developer.android.com/studio */ @@ -349,7 +349,7 @@ object Libs { const val cardview: String = "androidx.cardview:cardview:" + Versions.cardview /** - * http://developer.android.com/tools/extras/support-library.html + * https://developer.android.com/jetpack/androidx */ const val core_ktx: String = "androidx.core:core-ktx:" + Versions.core_ktx diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index be17ca61d7..23b0f917fa 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,4 +1,3 @@ -import kotlin.String import org.gradle.plugin.use.PluginDependenciesSpec import org.gradle.plugin.use.PluginDependencySpec @@ -14,77 +13,71 @@ import org.gradle.plugin.use.PluginDependencySpec object Versions { const val androidx_test_espresso: String = "3.1.1" // available: "3.2.0" - const val com_squareup_retrofit2: String = "2.5.0" // available: "2.7.0" + const val com_squareup_retrofit2: String = "2.5.0" // available: "2.7.1" const val org_jetbrains_kotlin: String = "1.3.61" - const val com_google_dagger: String = "2.21" // available: "2.25.2" + const val com_google_dagger: String = "2.26" const val com_yahoo_squidb: String = "2.0.0" // available: "3.2.3" - const val com_jakewharton: String = "10.2.0" + const val com_jakewharton: String = "10.2.1" - const val io_objectbox: String = "2.3.4" // available: "2.4.1" + const val androidx_test: String = "1.2.0" + + const val io_objectbox: String = "2.3.4" // available: "2.5.1" const val org_jacoco: String = "0.7.9" - const val io_mockk: String = "1.9" // available: "1.9.3" + const val io_mockk: String = "1.9.3" const val android_arch_lifecycle_extensions: String = "1.1.1" - const val com_android_tools_build_gradle: String = "3.5.2" // available: "3.5.3" - - const val androidx_test_runner: String = "1.2.0" - - const val androidx_test_rules: String = "1.2.0" - - const val androidx_test_core: String = "1.2.0" + const val com_android_tools_build_gradle: String = "3.5.3" const val de_fayard_buildsrcversions_gradle_plugin: String = "0.7.0" - const val com_github_triplet_play_gradle_plugin: String = "2.5.0" // available: "2.6.1" + const val com_github_triplet_play_gradle_plugin: String = "2.5.0" // available: "2.6.2" const val multidex_instrumentation: String = "2.0.0" - const val detekt_gradle_plugin: String = "1.2.2" + const val detekt_gradle_plugin: String = "1.5.1" const val javax_annotation_api: String = "1.3.2" - const val logging_interceptor: String = "3.12.1" // available: "4.2.2" + const val logging_interceptor: String = "3.12.1" // available: "4.3.1" const val ink_page_indicator: String = "1.3.0" - const val leakcanary_android: String = "2.0" + const val leakcanary_android: String = "2.2" const val constraintlayout: String = "1.1.3" - const val mockito_android: String = "2.24.5" // available: "3.2.0" + const val mockito_android: String = "2.24.5" // available: "3.2.4" const val collection_ktx: String = "1.1.0" const val jacoco_android: String = "0.1.4" - const val junit_jupiter: String = "5.4.2" // available: "5.5.2" + const val junit_jupiter: String = "5.4.2" // available: "5.6.0" - const val ktlint_gradle: String = "9.1.1" + const val ktlint_gradle: String = "9.2.1" - const val mockwebserver: String = "3.6.0" // available: "4.2.2" + const val mockwebserver: String = "3.6.0" // available: "4.3.1" const val xfetch2okhttp: String = "3.1.4" - const val assertj_core: String = "3.11.1" // available: "3.14.0" - - const val core_testing: String = "2.0.1" // available: "2.1.0" + const val assertj_core: String = "3.11.1" // available: "3.15.0" - const val fragment_ktx: String = "1.1.0" + const val core_testing: String = "2.1.0" - const val orchestrator: String = "1.2.0" + const val fragment_ktx: String = "1.2.1" - const val lint_gradle: String = "26.5.2" // available: "26.5.3" + const val lint_gradle: String = "26.5.3" const val testing_ktx: String = "1.1.1" - const val threetenabp: String = "1.1.1" // available: "1.2.1" + const val threetenabp: String = "1.1.1" // available: "1.2.2" const val uiautomator: String = "2.2.0" @@ -98,11 +91,11 @@ object Versions { const val cardview: String = "1.0.0" - const val core_ktx: String = "1.1.0" + const val core_ktx: String = "1.2.0" const val kiwixlib: String = "8.2.1" // available: "8.2.2" - const val material: String = "1.1.0-beta02" + const val material: String = "1.1.0-beta02" // available: "1.1.0" const val multidex: String = "2.0.1" @@ -112,11 +105,11 @@ object Versions { const val jsr305: String = "3.0.2" - const val ktlint: String = "0.33.0" // available: "0.36.0" + const val ktlint: String = "0.36.0" - const val okhttp: String = "3.12.1" // available: "4.2.2" + const val okhttp: String = "3.12.1" // available: "4.3.1" - const val rxjava: String = "2.2.5" // available: "2.2.15" + const val rxjava: String = "2.2.5" // available: "2.2.17" const val aapt2: String = "3.5.2-5435860" // available: "3.5.3-5435860" @@ -127,7 +120,7 @@ object Versions { * See issue 19: How to update Gradle itself? * https://github.com/jmfayard/buildSrcVersions/issues/19 */ - const val gradleLatestVersion: String = "6.0.1" + const val gradleLatestVersion: String = "6.1.1" } /** @@ -136,4 +129,4 @@ object Versions { */ val PluginDependenciesSpec.buildSrcVersions: PluginDependencySpec inline get() = - id("de.fayard.buildSrcVersions").version(Versions.de_fayard_buildsrcversions_gradle_plugin) + id("de.fayard.buildSrcVersions").version(Versions.de_fayard_buildsrcversions_gradle_plugin) diff --git a/buildSrc/src/main/kotlin/plugin/AllProjectConfigurer.kt b/buildSrc/src/main/kotlin/plugin/AllProjectConfigurer.kt index 4465793fe7..741a9338db 100644 --- a/buildSrc/src/main/kotlin/plugin/AllProjectConfigurer.kt +++ b/buildSrc/src/main/kotlin/plugin/AllProjectConfigurer.kt @@ -30,6 +30,7 @@ import org.gradle.kotlin.dsl.dependencies import org.gradle.testing.jacoco.plugins.JacocoPluginExtension import org.gradle.testing.jacoco.plugins.JacocoTaskExtension import org.jetbrains.kotlin.gradle.internal.AndroidExtensionsExtension +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jlleitschuh.gradle.ktlint.KtlintExtension class AllProjectConfigurer { @@ -65,6 +66,9 @@ class AllProjectConfigurer { sourceCompatibility = Config.javaVersion targetCompatibility = Config.javaVersion } + target.tasks.withType(KotlinCompile::class.java) { + kotlinOptions.jvmTarget = "1.8" + } testOptions { execution = "ANDROIDX_TEST_ORCHESTRATOR" diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 3545f2f29e..f5c46ccd30 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -1,5 +1,6 @@ build: - maxIssues: 10 + maxIssues: 0 + excludeCorrectable: false weights: # complexity: 2 # LongParameterList: 1 @@ -14,7 +15,7 @@ config: processors: active: true exclude: - # - 'DetektProgressListener' + - 'DetektProgressListener' # - 'FunctionCountProcessor' # - 'PropertyCountProcessor' # - 'ClassCountProcessor' @@ -24,12 +25,11 @@ processors: console-reports: active: true exclude: - # - 'ProjectStatisticsReport' - # - 'ComplexityReport' - # - 'NotificationReport' + - 'ProjectStatisticsReport' + - 'ComplexityReport' + - 'NotificationReport' # - 'FindingsReport' - 'FileBasedFindingsReport' - # - 'BuildFailureReport' comments: active: true @@ -106,6 +106,13 @@ complexity: ignorePrivate: false ignoreOverridden: false +coroutines: + active: true + GlobalCoroutineUsage: + active: false + RedundantSuspendModifier: + active: false + empty-blocks: active: true EmptyCatchBlock: @@ -125,7 +132,7 @@ empty-blocks: active: true EmptyFunctionBlock: active: true - ignoreOverriddenFunctions: false + ignoreOverridden: false EmptyIfBlock: active: true EmptyInitBlock: @@ -203,6 +210,9 @@ formatting: CommentSpacing: active: true autoCorrect: true + EnumEntryNameCase: + active: false + autoCorrect: true Filename: active: true FinalNewline: @@ -234,6 +244,9 @@ formatting: NoEmptyClassBody: active: true autoCorrect: true + NoEmptyFirstLineInMethodBlock: + active: false + autoCorrect: true NoLineBreakAfterElse: active: true autoCorrect: true @@ -332,7 +345,7 @@ naming: excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" parameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverriddenFunctions: true + ignoreOverridden: true InvalidPackageDeclaration: active: false rootPackage: '' @@ -340,7 +353,7 @@ naming: active: true MemberNameEqualsClassName: active: true - ignoreOverriddenFunction: true + ignoreOverridden: true ObjectPropertyNaming: active: true excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" @@ -413,6 +426,8 @@ potential-bugs: excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludeAnnotatedProperties: "" ignoreOnClassesPattern: "" + MapGetWithNotNullAssertionOperator: + active: false MissingWhenCase: active: true RedundantElseInWhen: @@ -443,6 +458,8 @@ style: active: true EqualsOnSignatureLine: active: false + ExplicitCollectionElementAccessMethod: + active: false ExplicitItLambdaParameter: active: false ExpressionBodySyntax: @@ -456,6 +473,12 @@ style: active: false imports: '' forbiddenPatterns: "" + ForbiddenMethodCall: + active: false + methods: '' + ForbiddenPublicDataClass: + active: false + ignorePackages: '*.internal,*.internal.*' ForbiddenVoid: active: false ignoreOverridden: false @@ -539,6 +562,8 @@ style: UnnecessaryAbstractClass: active: true excludeAnnotatedClasses: "dagger.Module" + UnnecessaryAnnotationUseSiteTarget: + active: false UnnecessaryApply: active: false UnnecessaryInheritance: diff --git a/core/src/main/java/eu/mhutti1/utils/storage/StorageSelectDialog.kt b/core/src/main/java/eu/mhutti1/utils/storage/StorageSelectDialog.kt index 1884c3d572..94d451f7ec 100644 --- a/core/src/main/java/eu/mhutti1/utils/storage/StorageSelectDialog.kt +++ b/core/src/main/java/eu/mhutti1/utils/storage/StorageSelectDialog.kt @@ -31,12 +31,12 @@ import eu.mhutti1.utils.storage.adapter.StorageDelegate import io.reactivex.Flowable import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers +import javax.inject.Inject import kotlinx.android.synthetic.main.storage_select_dialog.device_list import kotlinx.android.synthetic.main.storage_select_dialog.title import org.kiwix.kiwixmobile.core.CoreApp import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.settings.StorageCalculator -import javax.inject.Inject class StorageSelectDialog : DialogFragment() { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/NightModeConfig.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/NightModeConfig.kt index 669efaa115..e201bbd326 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/NightModeConfig.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/NightModeConfig.kt @@ -20,9 +20,9 @@ package org.kiwix.kiwixmobile.core import android.content.Context import android.content.res.Configuration import androidx.appcompat.app.AppCompatDelegate +import javax.inject.Inject import org.kiwix.kiwixmobile.core.NightModeConfig.Mode.SYSTEM import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import javax.inject.Inject class NightModeConfig @Inject constructor( val sharedPreferenceUtil: SharedPreferenceUtil, diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/StorageObserver.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/StorageObserver.kt index fb50615fde..0187f18fe2 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/StorageObserver.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/StorageObserver.kt @@ -21,13 +21,13 @@ package org.kiwix.kiwixmobile.core import io.reactivex.Flowable import io.reactivex.functions.BiFunction import io.reactivex.schedulers.Schedulers +import java.io.File +import javax.inject.Inject import org.kiwix.kiwixmobile.core.dao.FetchDownloadDao import org.kiwix.kiwixmobile.core.downloader.model.DownloadModel import org.kiwix.kiwixmobile.core.reader.ZimFileReader import org.kiwix.kiwixmobile.core.utils.files.FileSearch import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk -import java.io.File -import javax.inject.Inject class StorageObserver @Inject constructor( private val downloadDao: FetchDownloadDao, diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/base/BaseActivity.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/base/BaseActivity.kt index 6dde829cf4..a849e680f4 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/base/BaseActivity.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/base/BaseActivity.kt @@ -24,11 +24,11 @@ import androidx.annotation.LayoutRes import androidx.appcompat.app.AppCompatActivity import butterknife.ButterKnife import butterknife.Unbinder +import javax.inject.Inject import org.kiwix.kiwixmobile.core.CoreApp import org.kiwix.kiwixmobile.core.di.components.CoreComponent import org.kiwix.kiwixmobile.core.utils.LanguageUtils import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import javax.inject.Inject abstract class BaseActivity : AppCompatActivity() { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/FetchDownloadDao.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/FetchDownloadDao.kt index 84acad0a03..3d82fcfcf8 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/FetchDownloadDao.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/FetchDownloadDao.kt @@ -23,6 +23,7 @@ import io.objectbox.Box import io.objectbox.kotlin.equal import io.objectbox.kotlin.query import io.reactivex.Flowable +import javax.inject.Inject import org.kiwix.kiwixmobile.core.dao.entities.FetchDownloadEntity import org.kiwix.kiwixmobile.core.dao.entities.FetchDownloadEntity_ import org.kiwix.kiwixmobile.core.downloader.DownloadRequester @@ -30,7 +31,6 @@ import org.kiwix.kiwixmobile.core.downloader.model.DownloadModel import org.kiwix.kiwixmobile.core.downloader.model.DownloadRequest import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk -import javax.inject.Inject class FetchDownloadDao @Inject constructor( private val box: Box, diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/HistoryDao.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/HistoryDao.kt index 7b6b93069d..4d76f18349 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/HistoryDao.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/HistoryDao.kt @@ -19,10 +19,10 @@ package org.kiwix.kiwixmobile.core.dao import io.objectbox.Box import io.objectbox.kotlin.query -import org.kiwix.kiwixmobile.core.history.HistoryListItem.HistoryItem +import javax.inject.Inject import org.kiwix.kiwixmobile.core.dao.entities.HistoryEntity import org.kiwix.kiwixmobile.core.dao.entities.HistoryEntity_ -import javax.inject.Inject +import org.kiwix.kiwixmobile.core.history.HistoryListItem.HistoryItem class HistoryDao @Inject constructor(val box: Box) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewBookDao.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewBookDao.kt index aa388a2c8c..7d4d966e9a 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewBookDao.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewBookDao.kt @@ -20,13 +20,13 @@ package org.kiwix.kiwixmobile.core.dao import io.objectbox.Box import io.objectbox.kotlin.inValues import io.objectbox.kotlin.query +import java.util.ArrayList +import javax.inject.Inject import org.kiwix.kiwixmobile.core.dao.entities.BookOnDiskEntity import org.kiwix.kiwixmobile.core.dao.entities.BookOnDiskEntity_ import org.kiwix.kiwixmobile.core.data.local.entity.Bookmark import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk -import java.util.ArrayList -import javax.inject.Inject class NewBookDao @Inject constructor(private val box: Box) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewBookmarksDao.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewBookmarksDao.kt index 3da9f48e41..1b68f772fa 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewBookmarksDao.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewBookmarksDao.kt @@ -21,12 +21,12 @@ import io.objectbox.Box import io.objectbox.kotlin.query import io.reactivex.Flowable import io.reactivex.schedulers.Schedulers +import javax.inject.Inject import org.kiwix.kiwixmobile.core.bookmark.BookmarkItem import org.kiwix.kiwixmobile.core.dao.entities.BookmarkEntity import org.kiwix.kiwixmobile.core.dao.entities.BookmarkEntity_ import org.kiwix.kiwixmobile.core.data.local.entity.Bookmark import org.kiwix.kiwixmobile.core.reader.ZimFileReader -import javax.inject.Inject class NewBookmarksDao @Inject constructor(val box: Box) { fun getBookmarks( diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewLanguagesDao.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewLanguagesDao.kt index 0ea78ceecb..d7a709a2bc 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewLanguagesDao.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewLanguagesDao.kt @@ -23,10 +23,10 @@ import io.objectbox.query.Query import io.objectbox.rx.RxQuery import io.reactivex.BackpressureStrategy import io.reactivex.BackpressureStrategy.LATEST -import org.kiwix.kiwixmobile.core.dao.entities.LanguageEntity -import org.kiwix.kiwixmobile.core.zim_manager.Language import javax.inject.Inject import javax.inject.Singleton +import org.kiwix.kiwixmobile.core.dao.entities.LanguageEntity +import org.kiwix.kiwixmobile.core.zim_manager.Language @Singleton class NewLanguagesDao @Inject constructor(private val box: Box) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewRecentSearchDao.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewRecentSearchDao.kt index 1b5a01b9a1..3e67cd0472 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewRecentSearchDao.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/NewRecentSearchDao.kt @@ -19,11 +19,11 @@ package org.kiwix.kiwixmobile.core.dao import io.objectbox.Box import io.objectbox.kotlin.query +import javax.inject.Inject import org.kiwix.kiwixmobile.core.dao.entities.RecentSearchEntity import org.kiwix.kiwixmobile.core.dao.entities.RecentSearchEntity_ import org.kiwix.kiwixmobile.core.data.local.entity.RecentSearch import org.kiwix.kiwixmobile.core.search.adapter.SearchListItem.RecentSearchListItem -import javax.inject.Inject class NewRecentSearchDao @Inject constructor( val box: Box diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/entities/BookOnDiskEntity.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/entities/BookOnDiskEntity.kt index 4d0218c0b3..de17a9d815 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/entities/BookOnDiskEntity.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/entities/BookOnDiskEntity.kt @@ -22,9 +22,9 @@ import io.objectbox.annotation.Convert import io.objectbox.annotation.Entity import io.objectbox.annotation.Id import io.objectbox.converter.PropertyConverter +import java.io.File import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk -import java.io.File @Entity data class BookOnDiskEntity( diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/entities/LanguageEntity.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/entities/LanguageEntity.kt index c1c146f3f5..25377d92be 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/dao/entities/LanguageEntity.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/dao/entities/LanguageEntity.kt @@ -22,8 +22,8 @@ import io.objectbox.annotation.Convert import io.objectbox.annotation.Entity import io.objectbox.annotation.Id import io.objectbox.converter.PropertyConverter -import org.kiwix.kiwixmobile.core.zim_manager.Language import java.util.Locale +import org.kiwix.kiwixmobile.core.zim_manager.Language @Entity data class LanguageEntity( diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/data/Repository.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/data/Repository.kt index 001a1879d0..a752bb7ef9 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/data/Repository.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/data/Repository.kt @@ -22,24 +22,24 @@ import io.reactivex.Completable import io.reactivex.Flowable import io.reactivex.Scheduler import io.reactivex.Single +import javax.inject.Inject +import javax.inject.Singleton import org.kiwix.kiwixmobile.core.bookmark.BookmarkItem -import org.kiwix.kiwixmobile.core.di.qualifiers.IO -import org.kiwix.kiwixmobile.core.di.qualifiers.MainThread -import org.kiwix.kiwixmobile.core.history.HistoryListItem -import org.kiwix.kiwixmobile.core.history.HistoryListItem.DateItem -import org.kiwix.kiwixmobile.core.history.HistoryListItem.HistoryItem import org.kiwix.kiwixmobile.core.dao.HistoryDao import org.kiwix.kiwixmobile.core.dao.NewBookDao import org.kiwix.kiwixmobile.core.dao.NewBookmarksDao import org.kiwix.kiwixmobile.core.dao.NewLanguagesDao import org.kiwix.kiwixmobile.core.dao.NewRecentSearchDao -import org.kiwix.kiwixmobile.core.zim_manager.Language +import org.kiwix.kiwixmobile.core.di.qualifiers.IO +import org.kiwix.kiwixmobile.core.di.qualifiers.MainThread +import org.kiwix.kiwixmobile.core.history.HistoryListItem +import org.kiwix.kiwixmobile.core.history.HistoryListItem.DateItem +import org.kiwix.kiwixmobile.core.history.HistoryListItem.HistoryItem import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer +import org.kiwix.kiwixmobile.core.zim_manager.Language import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.LanguageItem -import javax.inject.Inject -import javax.inject.Singleton /** * A central repository of data which should provide the presenters with the required data. diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt index a540956b39..c4678ed44c 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/components/CoreComponent.kt @@ -24,6 +24,7 @@ import android.net.ConnectivityManager import dagger.BindsInstance import dagger.Component import eu.mhutti1.utils.storage.StorageSelectDialog +import javax.inject.Singleton import org.kiwix.kiwixmobile.core.CoreApp import org.kiwix.kiwixmobile.core.StorageObserver import org.kiwix.kiwixmobile.core.bookmark.BookmarksActivity @@ -58,7 +59,6 @@ import org.kiwix.kiwixmobile.core.settings.CorePrefsFragment import org.kiwix.kiwixmobile.core.settings.CoreSettingsActivity import org.kiwix.kiwixmobile.core.utils.BookUtils import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import javax.inject.Singleton @Singleton @Component( diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt index 469127f41c..75ecb8c08b 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/ApplicationModule.kt @@ -27,6 +27,7 @@ import dagger.Provides import io.reactivex.Scheduler import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers +import javax.inject.Singleton import org.kiwix.kiwixmobile.core.NightModeConfig import org.kiwix.kiwixmobile.core.di.qualifiers.Computation import org.kiwix.kiwixmobile.core.di.qualifiers.IO @@ -35,7 +36,6 @@ import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor import org.kiwix.kiwixmobile.core.downloader.fetch.FetchDownloadMonitor import org.kiwix.kiwixmobile.core.reader.ZimFileReader import org.kiwix.kiwixmobile.core.utils.BookUtils -import javax.inject.Singleton @Module( includes = [ diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/CoreViewModelModule.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/CoreViewModelModule.kt index 15636bf440..8c8a272d42 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/CoreViewModelModule.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/CoreViewModelModule.kt @@ -23,10 +23,10 @@ import androidx.lifecycle.ViewModelProvider import dagger.Binds import dagger.Module import dagger.multibindings.IntoMap +import javax.inject.Singleton import org.kiwix.kiwixmobile.core.ViewModelFactory import org.kiwix.kiwixmobile.core.di.ViewModelKey import org.kiwix.kiwixmobile.core.search.viewmodel.SearchViewModel -import javax.inject.Singleton @Module abstract class CoreViewModelModule { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/DatabaseModule.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/DatabaseModule.kt index d1adf88780..00b0121124 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/DatabaseModule.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/DatabaseModule.kt @@ -22,6 +22,7 @@ import dagger.Module import dagger.Provides import io.objectbox.BoxStore import io.objectbox.kotlin.boxFor +import javax.inject.Singleton import org.kiwix.kiwixmobile.core.dao.FetchDownloadDao import org.kiwix.kiwixmobile.core.dao.HistoryDao import org.kiwix.kiwixmobile.core.dao.NewBookDao @@ -29,7 +30,6 @@ import org.kiwix.kiwixmobile.core.dao.NewBookmarksDao import org.kiwix.kiwixmobile.core.dao.NewLanguagesDao import org.kiwix.kiwixmobile.core.dao.NewRecentSearchDao import org.kiwix.kiwixmobile.core.dao.entities.MyObjectBox -import javax.inject.Singleton @Module open class DatabaseModule { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/DownloaderModule.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/DownloaderModule.kt index 32d83660be..814021d403 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/DownloaderModule.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/di/modules/DownloaderModule.kt @@ -25,6 +25,7 @@ import com.tonyodev.fetch2.FetchNotificationManager import com.tonyodev.fetch2okhttp.OkHttpDownloader import dagger.Module import dagger.Provides +import javax.inject.Singleton import okhttp3.OkHttpClient import org.kiwix.kiwixmobile.core.BuildConfig import org.kiwix.kiwixmobile.core.dao.FetchDownloadDao @@ -35,7 +36,6 @@ import org.kiwix.kiwixmobile.core.downloader.DownloaderImpl import org.kiwix.kiwixmobile.core.downloader.fetch.FetchDownloadNotificationManager import org.kiwix.kiwixmobile.core.downloader.fetch.FetchDownloadRequester import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import javax.inject.Singleton @Module object DownloaderModule { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/DownloaderImpl.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/DownloaderImpl.kt index 7483d0be05..2d7c148baf 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/DownloaderImpl.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/DownloaderImpl.kt @@ -19,11 +19,11 @@ package org.kiwix.kiwixmobile.core.downloader import io.reactivex.Observable +import javax.inject.Inject import org.kiwix.kiwixmobile.core.dao.FetchDownloadDao import org.kiwix.kiwixmobile.core.data.remote.KiwixService import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book -import javax.inject.Inject class DownloaderImpl @Inject constructor( private val downloadRequester: DownloadRequester, diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/fetch/FetchDownloadMonitor.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/fetch/FetchDownloadMonitor.kt index 1bf34b1fab..464efd4a90 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/fetch/FetchDownloadMonitor.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/fetch/FetchDownloadMonitor.kt @@ -24,9 +24,9 @@ import com.tonyodev.fetch2.FetchListener import com.tonyodev.fetch2core.DownloadBlock import io.reactivex.schedulers.Schedulers import io.reactivex.subjects.PublishSubject +import javax.inject.Inject import org.kiwix.kiwixmobile.core.dao.FetchDownloadDao import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor -import javax.inject.Inject class FetchDownloadMonitor @Inject constructor(fetch: Fetch, fetchDownloadDao: FetchDownloadDao) : DownloadMonitor { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/fetch/FetchDownloadRequester.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/fetch/FetchDownloadRequester.kt index b53d77e520..b7b24479a8 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/fetch/FetchDownloadRequester.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/fetch/FetchDownloadRequester.kt @@ -21,10 +21,10 @@ import com.tonyodev.fetch2.Fetch import com.tonyodev.fetch2.NetworkType.ALL import com.tonyodev.fetch2.NetworkType.WIFI_ONLY import com.tonyodev.fetch2.Request +import javax.inject.Inject import org.kiwix.kiwixmobile.core.downloader.DownloadRequester import org.kiwix.kiwixmobile.core.downloader.model.DownloadRequest import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import javax.inject.Inject class FetchDownloadRequester @Inject constructor( private val fetch: Fetch, diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/model/DownloadModel.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/model/DownloadModel.kt index eb514ed806..6c1c518e39 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/model/DownloadModel.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/model/DownloadModel.kt @@ -19,8 +19,8 @@ package org.kiwix.kiwixmobile.core.downloader.model import com.tonyodev.fetch2.Error import com.tonyodev.fetch2.Status -import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.dao.entities.FetchDownloadEntity +import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.utils.StorageUtils data class DownloadModel( diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/model/Seconds.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/model/Seconds.kt index 2d660216c0..2b9de48d85 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/model/Seconds.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/model/Seconds.kt @@ -18,10 +18,10 @@ package org.kiwix.kiwixmobile.core.downloader.model -import org.kiwix.kiwixmobile.core.CoreApp -import org.kiwix.kiwixmobile.core.R import java.util.Locale import kotlin.math.roundToLong +import org.kiwix.kiwixmobile.core.CoreApp +import org.kiwix.kiwixmobile.core.R inline class Seconds(val seconds: Long) { fun toHumanReadableTime(): String { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ContextExtensions.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ContextExtensions.kt index a6fee171fa..2808c0b420 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ContextExtensions.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/ContextExtensions.kt @@ -26,8 +26,8 @@ import android.os.Build.VERSION_CODES import android.util.TypedValue import android.widget.Toast import androidx.annotation.AttrRes -import org.kiwix.kiwixmobile.core.base.BaseBroadcastReceiver import java.util.Locale +import org.kiwix.kiwixmobile.core.base.BaseBroadcastReceiver fun Context?.toast( stringId: Int, diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreSearchWidget.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreSearchWidget.kt index 95367e8b29..8cc5707966 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreSearchWidget.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreSearchWidget.kt @@ -23,8 +23,8 @@ import android.appwidget.AppWidgetProvider import android.content.Context import android.content.Intent import android.widget.RemoteViews -import org.kiwix.kiwixmobile.core.R import kotlin.reflect.KClass +import org.kiwix.kiwixmobile.core.R abstract class CoreSearchWidget : AppWidgetProvider() { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt index acb01b2ed0..7b635cc314 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt @@ -26,6 +26,12 @@ import android.webkit.MimeTypeMap import androidx.core.net.toUri import io.reactivex.Single import io.reactivex.schedulers.Schedulers +import java.io.File +import java.io.FileDescriptor +import java.io.FileOutputStream +import java.io.IOException +import java.io.RandomAccessFile +import javax.inject.Inject import org.kiwix.kiwixlib.JNIKiwixException import org.kiwix.kiwixlib.JNIKiwixInt import org.kiwix.kiwixlib.JNIKiwixReader @@ -37,12 +43,6 @@ import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.reader.ZimFileReader.Companion.CONTENT_URI import org.kiwix.kiwixmobile.core.search.SearchSuggestion import org.kiwix.kiwixmobile.core.utils.files.FileUtils -import java.io.File -import java.io.FileDescriptor -import java.io.FileOutputStream -import java.io.IOException -import java.io.RandomAccessFile -import javax.inject.Inject private const val TAG = "ZimFileReader" diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimReaderContainer.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimReaderContainer.kt index 242e08ab15..86249cbff1 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimReaderContainer.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/reader/ZimReaderContainer.kt @@ -18,11 +18,11 @@ package org.kiwix.kiwixmobile.core.reader import android.net.Uri -import org.kiwix.kiwixlib.JNIKiwixSearcher -import org.kiwix.kiwixmobile.core.reader.ZimFileReader.Factory import java.io.File import javax.inject.Inject import javax.inject.Singleton +import org.kiwix.kiwixlib.JNIKiwixSearcher +import org.kiwix.kiwixmobile.core.reader.ZimFileReader.Factory @Singleton class ZimReaderContainer @Inject constructor( diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/search/SearchActivity.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/search/SearchActivity.kt index 5075ce0d86..c52512afa5 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/search/SearchActivity.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/search/SearchActivity.kt @@ -29,6 +29,7 @@ import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import io.reactivex.disposables.CompositeDisposable +import javax.inject.Inject import kotlinx.android.synthetic.main.activity_search.searchViewAnimator import kotlinx.android.synthetic.main.activity_search.search_list import kotlinx.android.synthetic.main.layout_toolbar.toolbar @@ -56,7 +57,6 @@ import org.kiwix.kiwixmobile.core.search.viewmodel.State.Empty import org.kiwix.kiwixmobile.core.search.viewmodel.State.Initialising import org.kiwix.kiwixmobile.core.search.viewmodel.State.Results import org.kiwix.kiwixmobile.core.utils.SimpleTextListener -import javax.inject.Inject class SearchActivity : BaseActivity() { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchResultGenerator.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchResultGenerator.kt index e249e54954..f9037c3913 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchResultGenerator.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchResultGenerator.kt @@ -18,11 +18,11 @@ package org.kiwix.kiwixmobile.core.search.viewmodel +import javax.inject.Inject import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer import org.kiwix.kiwixmobile.core.search.adapter.SearchListItem import org.kiwix.kiwixmobile.core.search.adapter.SearchListItem.ZimSearchResultListItem import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import javax.inject.Inject interface SearchResultGenerator { fun generateSearchResults(searchTerm: String): List diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchViewModel.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchViewModel.kt index 66dcc24da3..5880436966 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchViewModel.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchViewModel.kt @@ -26,6 +26,8 @@ import io.reactivex.functions.Function3 import io.reactivex.processors.BehaviorProcessor import io.reactivex.processors.PublishProcessor import io.reactivex.schedulers.Schedulers +import java.util.concurrent.TimeUnit.MILLISECONDS +import javax.inject.Inject import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.R.string import org.kiwix.kiwixmobile.core.base.SideEffect @@ -55,8 +57,6 @@ import org.kiwix.kiwixmobile.core.search.viewmodel.effects.SearchIntentProcessin import org.kiwix.kiwixmobile.core.search.viewmodel.effects.ShowDeleteSearchDialog import org.kiwix.kiwixmobile.core.search.viewmodel.effects.ShowToast import org.kiwix.kiwixmobile.core.search.viewmodel.effects.StartSpeechInput -import java.util.concurrent.TimeUnit.MILLISECONDS -import javax.inject.Inject class SearchViewModel @Inject constructor( private val recentSearchDao: NewRecentSearchDao, diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/ShowDeleteSearchDialog.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/ShowDeleteSearchDialog.kt index 6076a1021d..86d570086d 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/ShowDeleteSearchDialog.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/ShowDeleteSearchDialog.kt @@ -20,13 +20,13 @@ package org.kiwix.kiwixmobile.core.search.viewmodel.effects import androidx.appcompat.app.AppCompatActivity import io.reactivex.processors.PublishProcessor +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.search.SearchActivity import org.kiwix.kiwixmobile.core.search.adapter.SearchListItem import org.kiwix.kiwixmobile.core.search.viewmodel.Action import org.kiwix.kiwixmobile.core.utils.DialogShower import org.kiwix.kiwixmobile.core.utils.KiwixDialog.DeleteSearch -import javax.inject.Inject data class ShowDeleteSearchDialog( private val searchListItem: SearchListItem, diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/StartSpeechInput.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/StartSpeechInput.kt index e0dbe7c730..ee0c71da80 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/StartSpeechInput.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/StartSpeechInput.kt @@ -23,11 +23,11 @@ import android.content.Intent import android.speech.RecognizerIntent import androidx.appcompat.app.AppCompatActivity import io.reactivex.processors.PublishProcessor +import java.util.Locale import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.search.viewmodel.Action import org.kiwix.kiwixmobile.core.search.viewmodel.Action.StartSpeechInputFailed -import java.util.Locale data class StartSpeechInput(private val actions: PublishProcessor) : SideEffect { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/splash/CoreSplashActivity.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/splash/CoreSplashActivity.kt index f135ac2380..b43404f917 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/splash/CoreSplashActivity.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/splash/CoreSplashActivity.kt @@ -20,10 +20,10 @@ package org.kiwix.kiwixmobile.core.splash import android.content.Intent import android.os.Bundle import android.os.Process +import kotlin.system.exitProcess import org.kiwix.kiwixmobile.core.BuildConfig import org.kiwix.kiwixmobile.core.base.BaseActivity import org.kiwix.kiwixmobile.core.error.ErrorActivity -import kotlin.system.exitProcess abstract class CoreSplashActivity : BaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/AlertDialogShower.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/AlertDialogShower.kt index 8cf6c7f1f9..5aff7d77bb 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/AlertDialogShower.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/AlertDialogShower.kt @@ -20,8 +20,8 @@ package org.kiwix.kiwixmobile.core.utils import android.app.Activity import androidx.appcompat.app.AlertDialog -import org.kiwix.kiwixmobile.core.utils.KiwixDialog.StartHotspotManually import javax.inject.Inject +import org.kiwix.kiwixmobile.core.utils.KiwixDialog.StartHotspotManually class AlertDialogShower @Inject constructor(private val activity: Activity) : DialogShower { override fun show(dialog: KiwixDialog, vararg clickListeners: () -> Unit) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/LanguageUtils.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/LanguageUtils.kt index bb55a3ecde..e77e8df109 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/LanguageUtils.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/LanguageUtils.kt @@ -31,12 +31,12 @@ import android.view.LayoutInflater import android.view.View import android.widget.TextView import androidx.core.os.ConfigurationCompat -import org.kiwix.kiwixmobile.core.extensions.locale -import org.kiwix.kiwixmobile.core.utils.Constants.TAG_KIWIX -import org.kiwix.kiwixmobile.core.utils.files.FileUtils import java.text.Collator import java.util.Locale import java.util.MissingResourceException +import org.kiwix.kiwixmobile.core.extensions.locale +import org.kiwix.kiwixmobile.core.utils.Constants.TAG_KIWIX +import org.kiwix.kiwixmobile.core.utils.files.FileUtils class LanguageUtils(private val context: Context) { private val localeLanguageCodes: List = languageCodesFromAssets() diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/UpdateUtils.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/UpdateUtils.kt index 62d00d38cf..90b03054f1 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/UpdateUtils.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/UpdateUtils.kt @@ -19,7 +19,6 @@ package org.kiwix.kiwixmobile.core.utils import org.kiwix.kiwixmobile.core.CoreApp - import org.kiwix.kiwixmobile.core.utils.Constants.OLD_PROVIDER_DOMAIN object UpdateUtils { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileSearch.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileSearch.kt index e939585673..577b43940a 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileSearch.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileSearch.kt @@ -26,10 +26,10 @@ import eu.mhutti1.utils.storage.StorageDeviceUtils import io.reactivex.Flowable import io.reactivex.functions.BiFunction import io.reactivex.schedulers.Schedulers -import org.kiwix.kiwixmobile.core.extensions.forEachRow -import org.kiwix.kiwixmobile.core.extensions.get import java.io.File import javax.inject.Inject +import org.kiwix.kiwixmobile.core.extensions.forEachRow +import org.kiwix.kiwixmobile.core.extensions.get class FileSearch @Inject constructor(private val context: Context) { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt index 315a4c6b98..828a6368eb 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/files/FileUtils.kt @@ -26,12 +26,12 @@ import android.os.Build.VERSION_CODES import android.os.Environment import android.provider.DocumentsContract import android.util.Log -import org.kiwix.kiwixmobile.core.downloader.ChunkUtils -import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book -import org.kiwix.kiwixmobile.core.extensions.get import java.io.File import java.io.IOException import java.util.ArrayList +import org.kiwix.kiwixmobile.core.downloader.ChunkUtils +import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book +import org.kiwix.kiwixmobile.core.extensions.get object FileUtils { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/Language.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/Language.kt index 516e50a8a3..5a6de692c2 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/Language.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/Language.kt @@ -19,8 +19,8 @@ package org.kiwix.kiwixmobile.core.zim_manager import android.os.Parcelable -import kotlinx.android.parcel.Parcelize import java.util.Locale +import kotlinx.android.parcel.Parcelize @Parcelize data class Language constructor( diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/ArticleCount.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/ArticleCount.kt index 9f87f16243..dd6f8ae2f5 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/ArticleCount.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/ArticleCount.kt @@ -20,10 +20,10 @@ package org.kiwix.kiwixmobile.core.zim_manager.fileselect_view import android.content.Context import android.util.Log -import org.kiwix.kiwixmobile.core.R.string import java.text.DecimalFormat import kotlin.math.log10 import kotlin.math.pow +import org.kiwix.kiwixmobile.core.R.string inline class ArticleCount(val articleCount: String) { fun toHumanReadable(context: Context): String = try { diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/adapter/BooksOnDiskListItem.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/adapter/BooksOnDiskListItem.kt index 73ce4cc039..e8e80c8c1c 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/adapter/BooksOnDiskListItem.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/adapter/BooksOnDiskListItem.kt @@ -18,13 +18,13 @@ package org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter +import java.io.File +import java.util.Locale import org.kiwix.kiwixmobile.core.dao.entities.BookOnDiskEntity import org.kiwix.kiwixmobile.core.dao.entities.FetchDownloadEntity import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.core.reader.ZimFileReader import org.kiwix.kiwixmobile.core.zim_manager.KiwixTag -import java.io.File -import java.util.Locale sealed class BooksOnDiskListItem { var isSelected: Boolean = false diff --git a/core/src/sharedTestFunctions/java/org/kiwix/sharedFunctions/TestModelFunctions.kt b/core/src/sharedTestFunctions/java/org/kiwix/sharedFunctions/TestModelFunctions.kt index 2831b5191d..e470acd608 100644 --- a/core/src/sharedTestFunctions/java/org/kiwix/sharedFunctions/TestModelFunctions.kt +++ b/core/src/sharedTestFunctions/java/org/kiwix/sharedFunctions/TestModelFunctions.kt @@ -20,6 +20,8 @@ package org.kiwix.sharedFunctions import com.tonyodev.fetch2.Error import com.tonyodev.fetch2.Status import com.tonyodev.fetch2.Status.NONE +import java.io.File +import java.util.LinkedList import org.kiwix.kiwixmobile.core.downloader.model.Base64String import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem import org.kiwix.kiwixmobile.core.downloader.model.DownloadModel @@ -34,8 +36,6 @@ import org.kiwix.kiwixmobile.core.entity.MetaLinkNetworkEntity.Pieces import org.kiwix.kiwixmobile.core.entity.MetaLinkNetworkEntity.Url import org.kiwix.kiwixmobile.core.zim_manager.Language import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk -import java.io.File -import java.util.LinkedList fun bookOnDisk( databaseId: Long = 0L, diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/StorageObserverTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/StorageObserverTest.kt index 8e1a95e047..b0d1273e0c 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/StorageObserverTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/StorageObserverTest.kt @@ -24,6 +24,7 @@ import io.mockk.mockk import io.mockk.mockkStatic import io.reactivex.processors.PublishProcessor import io.reactivex.schedulers.Schedulers +import java.io.File import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -37,7 +38,6 @@ import org.kiwix.sharedFunctions.book import org.kiwix.sharedFunctions.bookOnDisk import org.kiwix.sharedFunctions.resetSchedulers import org.kiwix.sharedFunctions.setScheduler -import java.io.File class StorageObserverTest { diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchViewModelTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchViewModelTest.kt index b8abd51269..e0bf651d31 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchViewModelTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/SearchViewModelTest.kt @@ -25,6 +25,7 @@ import io.mockk.every import io.mockk.mockk import io.reactivex.processors.PublishProcessor import io.reactivex.schedulers.TestScheduler +import java.util.concurrent.TimeUnit.MILLISECONDS import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Nested @@ -63,7 +64,6 @@ import org.kiwix.kiwixmobile.core.search.viewmodel.effects.StartSpeechInput import org.kiwix.sharedFunctions.InstantExecutorExtension import org.kiwix.sharedFunctions.resetSchedulers import org.kiwix.sharedFunctions.setScheduler -import java.util.concurrent.TimeUnit.MILLISECONDS @ExtendWith(InstantExecutorExtension::class) internal class SearchViewModelTest { diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/StartSpeechInputTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/StartSpeechInputTest.kt index b15f26f3c4..5e39fb1c4e 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/StartSpeechInputTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/StartSpeechInputTest.kt @@ -27,11 +27,11 @@ import io.mockk.mockk import io.mockk.mockkConstructor import io.mockk.verify import io.reactivex.processors.PublishProcessor +import java.util.Locale import org.junit.jupiter.api.Test import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.search.viewmodel.Action import org.kiwix.kiwixmobile.core.search.viewmodel.Action.StartSpeechInputFailed -import java.util.Locale internal class StartSpeechInputTest { diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/settings/StorageCalculatorTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/settings/StorageCalculatorTest.kt index 245ad967a2..80b09de23d 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/settings/StorageCalculatorTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/settings/StorageCalculatorTest.kt @@ -20,9 +20,9 @@ package org.kiwix.kiwixmobile.core.settings import io.mockk.every import io.mockk.mockk +import java.io.File import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import java.io.File internal class StorageCalculatorTest { diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/utils/NetworkUtilsTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/utils/NetworkUtilsTest.kt index 61dd5709b6..6f2a99e7d2 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/utils/NetworkUtilsTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/utils/NetworkUtilsTest.kt @@ -26,14 +26,14 @@ import android.util.Log import io.mockk.every import io.mockk.mockk import io.mockk.verify +import java.lang.reflect.Field +import java.lang.reflect.Modifier +import java.util.regex.Pattern import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.jupiter.api.Test import org.kiwix.kiwixmobile.core.R -import java.lang.reflect.Field -import java.lang.reflect.Modifier -import java.util.regex.Pattern class NetworkUtilsTest { diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/utils/files/FileSearchTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/utils/files/FileSearchTest.kt index 0ddc091245..035a74795e 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/utils/files/FileSearchTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/utils/files/FileSearchTest.kt @@ -30,6 +30,7 @@ import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic import io.reactivex.schedulers.Schedulers +import java.io.File import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeEach @@ -37,7 +38,6 @@ import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test import org.kiwix.sharedFunctions.resetSchedulers import org.kiwix.sharedFunctions.setScheduler -import java.io.File class FileSearchTest { diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/utils/files/FileUtilsTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/utils/files/FileUtilsTest.kt index 0ab4a24462..591d501e45 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/utils/files/FileUtilsTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/utils/files/FileUtilsTest.kt @@ -22,12 +22,12 @@ import io.mockk.clearMocks import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic +import java.io.File import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.kiwix.kiwixmobile.core.CoreApp import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book -import java.io.File class FileUtilsTest { diff --git a/custom/build.gradle.kts b/custom/build.gradle.kts index acb1cb61e6..e70c0fb06d 100644 --- a/custom/build.gradle.kts +++ b/custom/build.gradle.kts @@ -4,9 +4,9 @@ import com.android.build.gradle.internal.dsl.ProductFlavor import custom.CustomApps import custom.createPublisher import custom.transactionWithCommit -import plugin.KiwixConfigurationPlugin import java.net.URI import java.net.URL +import plugin.KiwixConfigurationPlugin plugins { android diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/CustomViewModelFactory.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/CustomViewModelFactory.kt index 1f1d50023e..b1165ad104 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/CustomViewModelFactory.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/CustomViewModelFactory.kt @@ -18,10 +18,10 @@ package org.kiwix.kiwixmobile.custom import androidx.lifecycle.ViewModel -import org.kiwix.kiwixmobile.core.ViewModelFactory -import org.kiwix.kiwixmobile.custom.di.CustomScope import javax.inject.Inject import javax.inject.Provider +import org.kiwix.kiwixmobile.core.ViewModelFactory +import org.kiwix.kiwixmobile.custom.di.CustomScope @CustomScope class CustomViewModelFactory @Inject constructor( diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/di/CustomViewModelModule.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/di/CustomViewModelModule.kt index ddc32e54fa..20ca6eee87 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/di/CustomViewModelModule.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/di/CustomViewModelModule.kt @@ -23,9 +23,9 @@ import androidx.lifecycle.ViewModelProvider import dagger.Binds import dagger.Module import dagger.multibindings.IntoMap +import org.kiwix.kiwixmobile.core.di.ViewModelKey import org.kiwix.kiwixmobile.custom.CustomViewModelFactory import org.kiwix.kiwixmobile.custom.download.CustomDownloadViewModel -import org.kiwix.kiwixmobile.core.di.ViewModelKey @Module abstract class CustomViewModelModule { diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/CustomDownloadActivity.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/CustomDownloadActivity.kt index 241b597454..9a2011b96a 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/CustomDownloadActivity.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/CustomDownloadActivity.kt @@ -22,6 +22,7 @@ import android.os.Bundle import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import io.reactivex.disposables.CompositeDisposable +import javax.inject.Inject import kotlinx.android.synthetic.main.activity_custom_download.cd_view_animator import kotlinx.android.synthetic.main.layout_custom_download_error.cd_error_text import kotlinx.android.synthetic.main.layout_custom_download_error.cd_retry_button @@ -42,7 +43,6 @@ import org.kiwix.kiwixmobile.custom.download.State.DownloadComplete import org.kiwix.kiwixmobile.custom.download.State.DownloadFailed import org.kiwix.kiwixmobile.custom.download.State.DownloadInProgress import org.kiwix.kiwixmobile.custom.download.State.DownloadRequired -import javax.inject.Inject class CustomDownloadActivity : BaseActivity() { override fun injection(coreComponent: CoreComponent) { diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/CustomDownloadViewModel.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/CustomDownloadViewModel.kt index bd7150476e..08666c5769 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/CustomDownloadViewModel.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/CustomDownloadViewModel.kt @@ -22,6 +22,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import io.reactivex.disposables.CompositeDisposable import io.reactivex.processors.PublishProcessor +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.dao.FetchDownloadDao import org.kiwix.kiwixmobile.core.downloader.model.DownloadItem @@ -36,7 +37,6 @@ import org.kiwix.kiwixmobile.custom.download.State.DownloadRequired import org.kiwix.kiwixmobile.custom.download.effects.DownloadCustom import org.kiwix.kiwixmobile.custom.download.effects.FinishAndStartMain import org.kiwix.kiwixmobile.custom.download.effects.SetPreferredStorageWithMostSpace -import javax.inject.Inject class CustomDownloadViewModel @Inject constructor( downloadDao: FetchDownloadDao, diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/DownloadCustom.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/DownloadCustom.kt index 32f62966da..35819a5395 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/DownloadCustom.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/DownloadCustom.kt @@ -19,11 +19,11 @@ package org.kiwix.kiwixmobile.custom.download.effects import androidx.appcompat.app.AppCompatActivity +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.downloader.Downloader import org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity.Book import org.kiwix.kiwixmobile.custom.BuildConfig -import javax.inject.Inject data class DownloadCustom @Inject constructor(val downloader: Downloader) : SideEffect { override fun invokeWith(activity: AppCompatActivity) { diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/FinishAndStartMain.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/FinishAndStartMain.kt index 719ac8094d..cc0473882a 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/FinishAndStartMain.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/FinishAndStartMain.kt @@ -19,10 +19,10 @@ package org.kiwix.kiwixmobile.custom.download.effects import androidx.appcompat.app.AppCompatActivity +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start import org.kiwix.kiwixmobile.custom.main.CustomMainActivity -import javax.inject.Inject class FinishAndStartMain @Inject constructor() : SideEffect { override fun invokeWith(activity: AppCompatActivity) { diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpace.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpace.kt index ab81490456..343089f661 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpace.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpace.kt @@ -20,10 +20,10 @@ package org.kiwix.kiwixmobile.custom.download.effects import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat +import javax.inject.Inject import org.kiwix.kiwixmobile.core.base.SideEffect import org.kiwix.kiwixmobile.core.settings.StorageCalculator import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import javax.inject.Inject class SetPreferredStorageWithMostSpace @Inject constructor( private val storageCalculator: StorageCalculator, diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomFileValidator.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomFileValidator.kt index b5ee80ddd2..ff48153dfa 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomFileValidator.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomFileValidator.kt @@ -20,11 +20,11 @@ package org.kiwix.kiwixmobile.custom.main import android.content.Context import androidx.core.content.ContextCompat +import java.io.File +import javax.inject.Inject import org.kiwix.kiwixmobile.custom.main.ValidationState.HasBothFiles import org.kiwix.kiwixmobile.custom.main.ValidationState.HasFile import org.kiwix.kiwixmobile.custom.main.ValidationState.HasNothing -import java.io.File -import javax.inject.Inject class CustomFileValidator @Inject constructor(private val context: Context) { diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomMainActivity.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomMainActivity.kt index 12aa2f83f2..9aa5a61a5b 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomMainActivity.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomMainActivity.kt @@ -30,6 +30,8 @@ import android.util.Log import android.view.Menu import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat +import java.util.Locale +import javax.inject.Inject import org.kiwix.kiwixmobile.core.di.components.CoreComponent import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start import org.kiwix.kiwixmobile.core.main.CoreMainActivity @@ -44,8 +46,6 @@ import org.kiwix.kiwixmobile.custom.customActivityComponent import org.kiwix.kiwixmobile.custom.download.CustomDownloadActivity import org.kiwix.kiwixmobile.custom.main.ValidationState.HasBothFiles import org.kiwix.kiwixmobile.custom.main.ValidationState.HasFile -import java.util.Locale -import javax.inject.Inject const val REQUEST_READ_FOR_OBB = 5002 diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomWebViewClient.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomWebViewClient.kt index b95dbb8099..e180b7624d 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomWebViewClient.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/main/CustomWebViewClient.kt @@ -21,8 +21,8 @@ import android.util.Log import android.webkit.WebView import org.kiwix.kiwixmobile.core.main.CoreWebViewClient import org.kiwix.kiwixmobile.core.main.WebViewCallback -import org.kiwix.kiwixmobile.core.utils.Constants.TAG_KIWIX import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer +import org.kiwix.kiwixmobile.core.utils.Constants.TAG_KIWIX class CustomWebViewClient internal constructor( callback: WebViewCallback, diff --git a/custom/src/test/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpaceTest.kt b/custom/src/test/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpaceTest.kt index d0f5e43b2a..2d80c630bd 100644 --- a/custom/src/test/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpaceTest.kt +++ b/custom/src/test/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpaceTest.kt @@ -24,10 +24,10 @@ import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic import io.mockk.verify +import java.io.File import org.junit.jupiter.api.Test import org.kiwix.kiwixmobile.core.settings.StorageCalculator import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil -import java.io.File internal class SetPreferredStorageWithMostSpaceTest {