Fixed UnnecessaryAbstractClass issue of detekt

This commit is contained in:
MohitMali 2023-07-04 19:22:30 +05:30 committed by Kelson
parent 1806495674
commit 7493b842b7
5 changed files with 11 additions and 4 deletions

View File

@ -560,6 +560,7 @@ class CustomPageIndicator @JvmOverloads constructor(
/** /**
* A [ValueAnimator] that starts once a given predicate returns true. * A [ValueAnimator] that starts once a given predicate returns true.
*/ */
@Suppress("UnnecessaryAbstractClass")
abstract inner class PendingStartAnimator(private var predicate: StartPredicate) : abstract inner class PendingStartAnimator(private var predicate: StartPredicate) :
ValueAnimator() { ValueAnimator() {
private var hasStarted = false private var hasStarted = false

View File

@ -32,6 +32,7 @@ import org.kiwix.kiwixmobile.core.downloader.DownloadMonitor
import org.kiwix.kiwixmobile.core.utils.files.FileLogger import org.kiwix.kiwixmobile.core.utils.files.FileLogger
import javax.inject.Inject import javax.inject.Inject
@Suppress("UnnecessaryAbstractClass")
abstract class CoreApp : Application() { abstract class CoreApp : Application() {
companion object { companion object {
@JvmStatic @JvmStatic

View File

@ -24,6 +24,7 @@ import org.kiwix.kiwixmobile.core.base.BaseContract.View
/** /**
* All presenters should inherit from this presenter. * All presenters should inherit from this presenter.
*/ */
@Suppress("UnnecessaryAbstractClass")
abstract class BasePresenter<T : View<*>?> : Presenter<T> { abstract class BasePresenter<T : View<*>?> : Presenter<T> {
@JvmField val compositeDisposable = CompositeDisposable() @JvmField val compositeDisposable = CompositeDisposable()
@JvmField var view: T? = null @JvmField var view: T? = null

View File

@ -40,6 +40,7 @@ import org.kiwix.kiwixmobile.core.main.CoreMainActivity
import org.kiwix.kiwixmobile.core.utils.CONTACT_EMAIL_ADDRESS import org.kiwix.kiwixmobile.core.utils.CONTACT_EMAIL_ADDRESS
import org.kiwix.kiwixmobile.core.utils.LanguageUtils.Companion.getCurrentLocale import org.kiwix.kiwixmobile.core.utils.LanguageUtils.Companion.getCurrentLocale
@Suppress("UnnecessaryAbstractClass")
abstract class HelpFragment : BaseFragment() { abstract class HelpFragment : BaseFragment() {
private var fragmentHelpBinding: FragmentHelpBinding? = null private var fragmentHelpBinding: FragmentHelpBinding? = null
protected open fun rawTitleDescriptionMap(): List<Pair<Int, Int>> = emptyList() protected open fun rawTitleDescriptionMap(): List<Pair<Int, Int>> = emptyList()

View File

@ -100,25 +100,28 @@ class CustomDownloadFragment : BaseFragment(), FragmentActivityExtensions {
activity?.finish() activity?.finish()
} }
private fun render(state: State) { private fun render(state: State): Unit? {
return when (state) { return when (state) {
DownloadRequired -> DownloadRequired ->
fragmentCustomDownloadBinding?.cdViewAnimator?.setDistinctDisplayedChild(0) fragmentCustomDownloadBinding?.cdViewAnimator?.setDistinctDisplayedChild(0)
is DownloadInProgress -> { is DownloadInProgress -> {
fragmentCustomDownloadBinding?.cdViewAnimator?.setDistinctDisplayedChild(1) fragmentCustomDownloadBinding?.cdViewAnimator?.setDistinctDisplayedChild(1)
render(state.downloads[0]) showDownloadingProgress(state.downloads[0])
} }
is DownloadFailed -> { is DownloadFailed -> {
fragmentCustomDownloadBinding?.cdViewAnimator?.setDistinctDisplayedChild(2) fragmentCustomDownloadBinding?.cdViewAnimator?.setDistinctDisplayedChild(2)
fragmentCustomDownloadBinding?.customDownloadError?.cdErrorText?.text = fragmentCustomDownloadBinding?.customDownloadError?.cdErrorText?.text =
context?.let(state.downloadState::toReadableState) context?.let(state.downloadState::toReadableState)
} }
DownloadComplete -> DownloadComplete ->
fragmentCustomDownloadBinding?.cdViewAnimator?.setDistinctDisplayedChild(3) fragmentCustomDownloadBinding?.cdViewAnimator?.setDistinctDisplayedChild(3)
}!! }
} }
private fun render(downloadItem: DownloadItem) { private fun showDownloadingProgress(downloadItem: DownloadItem) {
fragmentCustomDownloadBinding?.customDownloadInProgress?.apply { fragmentCustomDownloadBinding?.customDownloadInProgress?.apply {
cdDownloadState.text = downloadItem.readableEta cdDownloadState.text = downloadItem.readableEta
cdEta.text = context?.let(downloadItem.downloadState::toReadableState) cdEta.text = context?.let(downloadItem.downloadState::toReadableState)