From 3f9b628a675565d3a1d4eb1edad8b8d0c78b80e2 Mon Sep 17 00:00:00 2001 From: Maksim V Date: Wed, 15 Jul 2020 23:32:34 +0300 Subject: [PATCH] Revert "Moving" This reverts commit dc92c11f4b0c1adf3dbb212a38d6e0724ee9b939. --- .../release/details/ReleaseInfoPresenter.kt | 31 +++++++++---------- .../release/details/ReleaseInfoView.kt | 16 +++++----- .../release/detail/ReleaseEpisodeDelegate.kt | 13 +++----- .../release/details/ReleaseInfoFragment.kt | 24 +++++++------- 4 files changed, 40 insertions(+), 44 deletions(-) diff --git a/app-mobile/src/main/java/ru/radiationx/anilibria/presentation/release/details/ReleaseInfoPresenter.kt b/app-mobile/src/main/java/ru/radiationx/anilibria/presentation/release/details/ReleaseInfoPresenter.kt index 4ec2d3388..f38b230d6 100644 --- a/app-mobile/src/main/java/ru/radiationx/anilibria/presentation/release/details/ReleaseInfoPresenter.kt +++ b/app-mobile/src/main/java/ru/radiationx/anilibria/presentation/release/details/ReleaseInfoPresenter.kt @@ -1,24 +1,23 @@ package ru.radiationx.anilibria.presentation.release.details import android.util.Log -import com.arellomobile.mvp.InjectViewState -import ru.radiationx.anilibria.entity.app.release.ReleaseFull -import ru.radiationx.anilibria.entity.app.release.ReleaseItem -import ru.radiationx.anilibria.entity.app.vital.VitalItem -import ru.radiationx.anilibria.entity.common.AuthState -import ru.radiationx.anilibria.model.data.remote.Api -import ru.radiationx.anilibria.model.data.remote.address.ApiConfig -import ru.radiationx.anilibria.model.data.remote.api.PageApi -import ru.radiationx.anilibria.model.interactors.ReleaseInteractor -import ru.radiationx.anilibria.model.repository.AuthRepository -import ru.radiationx.anilibria.model.repository.FavoriteRepository -import ru.radiationx.anilibria.model.repository.HistoryRepository -import ru.radiationx.anilibria.model.repository.VitalRepository +import moxy.InjectViewState import ru.radiationx.anilibria.navigation.Screens import ru.radiationx.anilibria.presentation.common.BasePresenter import ru.radiationx.anilibria.presentation.common.IErrorHandler import ru.radiationx.anilibria.presentation.common.ILinkHandler import ru.radiationx.anilibria.utils.Utils +import ru.radiationx.data.datasource.remote.address.ApiConfig +import ru.radiationx.data.datasource.remote.api.PageApi +import ru.radiationx.data.entity.app.release.ReleaseFull +import ru.radiationx.data.entity.app.release.ReleaseItem +import ru.radiationx.data.entity.app.vital.VitalItem +import ru.radiationx.data.entity.common.AuthState +import ru.radiationx.data.interactors.ReleaseInteractor +import ru.radiationx.data.repository.AuthRepository +import ru.radiationx.data.repository.FavoriteRepository +import ru.radiationx.data.repository.HistoryRepository +import ru.radiationx.data.repository.VitalRepository import ru.terrakok.cicerone.Router import javax.inject.Inject @@ -139,7 +138,7 @@ class ReleaseInfoPresenter @Inject constructor( fun onClickWatchWeb() { currentData?.let { release -> release.moonwalkLink?.let { - viewState.playWeb(it) + viewState.playWeb(it, release.code.orEmpty()) } } } @@ -179,7 +178,7 @@ class ReleaseInfoPresenter @Inject constructor( fun onClickDonate() { //router.navigateTo(Screens.StaticPage(PageApi.PAGE_ID_DONATE)) - Utils.externalLink("${apiConfig.baseUrl}/${PageApi.PAGE_ID_DONATE}") + Utils.externalLink("${apiConfig.siteUrl}/${PageApi.PAGE_PATH_DONATE}") } fun onClickFav() { @@ -243,7 +242,7 @@ class ReleaseInfoPresenter @Inject constructor( fun onDialogDonateClick() { //router.navigateTo(Screens.StaticPage(PageApi.PAGE_ID_DONATE)) - Utils.externalLink("${apiConfig.baseUrl}/${PageApi.PAGE_ID_DONATE}") + Utils.externalLink("${apiConfig.siteUrl}/${PageApi.PAGE_PATH_DONATE}") } fun onResetEpisodesHistoryClick() { diff --git a/app-mobile/src/main/java/ru/radiationx/anilibria/presentation/release/details/ReleaseInfoView.kt b/app-mobile/src/main/java/ru/radiationx/anilibria/presentation/release/details/ReleaseInfoView.kt index 6b00e3c6b..c193f978a 100644 --- a/app-mobile/src/main/java/ru/radiationx/anilibria/presentation/release/details/ReleaseInfoView.kt +++ b/app-mobile/src/main/java/ru/radiationx/anilibria/presentation/release/details/ReleaseInfoView.kt @@ -1,15 +1,15 @@ package ru.radiationx.anilibria.presentation.release.details -import com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy -import com.arellomobile.mvp.viewstate.strategy.SkipStrategy -import com.arellomobile.mvp.viewstate.strategy.StateStrategyType -import ru.radiationx.anilibria.entity.app.release.ReleaseFull -import ru.radiationx.anilibria.entity.app.release.TorrentItem -import ru.radiationx.anilibria.entity.app.vital.VitalItem +import moxy.viewstate.strategy.AddToEndSingleStrategy +import moxy.viewstate.strategy.SkipStrategy +import moxy.viewstate.strategy.StateStrategyType import ru.radiationx.anilibria.presentation.common.IBaseView +import ru.radiationx.data.entity.app.release.ReleaseFull +import ru.radiationx.data.entity.app.release.TorrentItem +import ru.radiationx.data.entity.app.vital.VitalItem @StateStrategyType(AddToEndSingleStrategy::class) -interface ReleaseInfoView: IBaseView { +interface ReleaseInfoView : IBaseView { fun showVitalItems(vital: List) fun updateFavCounter() @@ -29,7 +29,7 @@ interface ReleaseInfoView: IBaseView { fun playContinue(release: ReleaseFull, startWith: ReleaseFull.Episode) @StateStrategyType(SkipStrategy::class) - fun playWeb(link: String) + fun playWeb(link: String, code: String) @StateStrategyType(SkipStrategy::class) fun playEpisode(release: ReleaseFull, episode: ReleaseFull.Episode, playFlag: Int? = null, quality: Int? = null) diff --git a/app-mobile/src/main/java/ru/radiationx/anilibria/ui/adapters/release/detail/ReleaseEpisodeDelegate.kt b/app-mobile/src/main/java/ru/radiationx/anilibria/ui/adapters/release/detail/ReleaseEpisodeDelegate.kt index ec95ad559..9d874a3f1 100644 --- a/app-mobile/src/main/java/ru/radiationx/anilibria/ui/adapters/release/detail/ReleaseEpisodeDelegate.kt +++ b/app-mobile/src/main/java/ru/radiationx/anilibria/ui/adapters/release/detail/ReleaseEpisodeDelegate.kt @@ -1,20 +1,19 @@ package ru.radiationx.anilibria.ui.adapters.release.detail -import android.support.v7.widget.RecyclerView import android.util.Log import android.view.View +import androidx.recyclerview.widget.RecyclerView import kotlinx.android.extensions.LayoutContainer import kotlinx.android.synthetic.main.item_release_episode.* import ru.radiationx.anilibria.R -import ru.radiationx.anilibria.entity.app.release.ReleaseFull -import ru.radiationx.anilibria.extension.asTimeSecString import ru.radiationx.anilibria.extension.getColorFromAttr -import ru.radiationx.anilibria.extension.setTintColorAttr -import ru.radiationx.anilibria.extension.visible import ru.radiationx.anilibria.ui.adapters.ListItem import ru.radiationx.anilibria.ui.adapters.ReleaseEpisodeListItem import ru.radiationx.anilibria.ui.common.adapters.AppAdapterDelegate import ru.radiationx.anilibria.ui.common.adapters.OptimizeDelegate +import ru.radiationx.data.entity.app.release.ReleaseFull +import ru.radiationx.shared.ktx.android.visible +import ru.radiationx.shared.ktx.asTimeSecString import java.util.* /** @@ -39,8 +38,6 @@ class ReleaseEpisodeDelegate( ) : RecyclerView.ViewHolder(containerView), LayoutContainer { private lateinit var currentItem: ReleaseFull.Episode - private val disableColor = R.attr.base_icon - private val enableColor = R.attr.colorAccent init { quality_sd.setOnClickListener { @@ -81,7 +78,7 @@ class ReleaseEpisodeDelegate( quality_full_hd.visible(item.urlFullHd != null) val bgColor = if (isEven) { - containerView.context.getColorFromAttr(R.attr.cardBackground) + containerView.context.getColorFromAttr(R.attr.colorSurface) } else { containerView.context.getColorFromAttr(R.attr.episode_even) } diff --git a/app-mobile/src/main/java/ru/radiationx/anilibria/ui/fragments/release/details/ReleaseInfoFragment.kt b/app-mobile/src/main/java/ru/radiationx/anilibria/ui/fragments/release/details/ReleaseInfoFragment.kt index 1c2720cf5..6a3013961 100644 --- a/app-mobile/src/main/java/ru/radiationx/anilibria/ui/fragments/release/details/ReleaseInfoFragment.kt +++ b/app-mobile/src/main/java/ru/radiationx/anilibria/ui/fragments/release/details/ReleaseInfoFragment.kt @@ -6,33 +6,32 @@ import android.content.ActivityNotFoundException import android.content.Intent import android.net.Uri import android.os.Bundle -import android.support.v7.app.AlertDialog -import android.support.v7.widget.LinearLayoutManager import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Toast -import com.arellomobile.mvp.presenter.InjectPresenter -import com.arellomobile.mvp.presenter.ProvidePresenter +import androidx.appcompat.app.AlertDialog +import androidx.recyclerview.widget.LinearLayoutManager import com.nostra13.universalimageloader.core.ImageLoader import kotlinx.android.synthetic.main.dialog_file_download.view.* import kotlinx.android.synthetic.main.fragment_list.* +import moxy.presenter.InjectPresenter +import moxy.presenter.ProvidePresenter import permissions.dispatcher.NeedsPermission import permissions.dispatcher.RuntimePermissions import ru.radiationx.anilibria.R -import ru.radiationx.anilibria.di.extensions.getDependency -import ru.radiationx.anilibria.di.extensions.injectDependencies -import ru.radiationx.anilibria.entity.app.release.ReleaseFull -import ru.radiationx.anilibria.entity.app.release.TorrentItem -import ru.radiationx.anilibria.entity.app.vital.VitalItem -import ru.radiationx.anilibria.model.data.holders.PreferencesHolder +import ru.radiationx.shared_app.di.injectDependencies import ru.radiationx.anilibria.presentation.release.details.ReleaseInfoPresenter import ru.radiationx.anilibria.presentation.release.details.ReleaseInfoView import ru.radiationx.anilibria.ui.activities.MyPlayerActivity import ru.radiationx.anilibria.ui.activities.WebPlayerActivity import ru.radiationx.anilibria.ui.fragments.BaseFragment import ru.radiationx.anilibria.utils.Utils +import ru.radiationx.data.datasource.holders.PreferencesHolder +import ru.radiationx.data.entity.app.release.ReleaseFull +import ru.radiationx.data.entity.app.release.TorrentItem +import ru.radiationx.data.entity.app.vital.VitalItem import java.net.URLConnection import java.text.DecimalFormat import java.util.regex.Pattern @@ -55,7 +54,7 @@ class ReleaseInfoFragment : BaseFragment(), ReleaseInfoView { lateinit var presenter: ReleaseInfoPresenter @ProvidePresenter - fun provideReleasePresenter(): ReleaseInfoPresenter = getDependency(screenScope, ReleaseInfoPresenter::class.java) + fun provideReleasePresenter(): ReleaseInfoPresenter = getDependency(ReleaseInfoPresenter::class.java, screenScope) override fun onCreate(savedInstanceState: Bundle?) { injectDependencies(screenScope) @@ -330,9 +329,10 @@ class ReleaseInfoFragment : BaseFragment(), ReleaseInfoView { } } - override fun playWeb(link: String) { + override fun playWeb(link: String, code: String) { startActivity(Intent(context, WebPlayerActivity::class.java).apply { putExtra(WebPlayerActivity.ARG_URL, link) + putExtra(WebPlayerActivity.ARG_RELEASE_CODE, code) }) }