From 231c8bb12f0da6d49b223d2611dcb898d40f9efa Mon Sep 17 00:00:00 2001 From: David Carver Date: Sun, 15 Dec 2024 18:28:12 -0500 Subject: [PATCH] chore: Remove old external player code and clean up unused imports --- serenity-app/build.gradle.kts | 2 - .../us/nineworlds/serenity/AboutDialog.java | 1 + .../us/nineworlds/serenity/AndroidTV.java | 1 + .../serenity/GalleryOnItemClickListener.java | 1 + .../serenity/GalleryOnItemSelectedListener.kt | 7 +- .../serenity/MainMenuTextViewAdapter.java | 5 +- .../us/nineworlds/serenity/MainPresenter.java | 6 +- .../serenity/core/RecommendationBuilder.java | 3 +- ...SerenityRecommendationContentProvider.java | 1 + .../serenity/core/ServerConfig.java | 2 + .../AbstractExternalPlayer.java | 68 -------- .../core/externalplayer/ExternalPlayer.java | 70 -------- .../externalplayer/ExternalPlayerFactory.java | 62 ------- .../core/externalplayer/MXPlayer.java | 107 ------------ .../core/externalplayer/MXPlayerPro.java | 46 ------ .../externalplayer/SystemDefaultPlayer.java | 75 --------- .../core/externalplayer/ViMuPlayer.java | 104 ------------ .../serenity/core/model/VideoContentInfo.java | 1 - .../model/impl/AbstractMediaContainer.java | 2 + .../model/impl/AbstractSeriesContentInfo.java | 1 + .../model/impl/AbstractVideoContentInfo.java | 2 + .../model/impl/CategoryMediaContainer.java | 1 + .../model/impl/EpisodeMediaContainer.java | 3 + .../core/model/impl/EpisodePosterInfo.java | 1 + .../core/model/impl/MenuMediaContainer.java | 4 +- .../core/model/impl/MovieMediaContainer.java | 1 + .../model/impl/SeasonsMediaContainer.java | 1 + .../impl/SecondaryCategoryMediaContainer.java | 1 + .../core/model/impl/SeriesMediaContainer.java | 1 + .../model/impl/SubtitleMediaContainer.java | 1 + .../model/impl/TVCategoryMediaContainer.java | 1 + .../AbstractPlexRESTIntentService.java | 2 + .../services/MovieSearchIntentService.java | 1 + .../MoviesRetrievalIntentService.java | 2 + .../core/services/UnWatchVideoAsyncTask.java | 3 + .../core/services/UpdateProgressRequest.java | 2 + .../core/services/WatchedVideoAsyncTask.java | 3 + .../serenity/core/util/AndroidHelper.java | 4 - .../serenity/events/users/AllUsersEvent.java | 2 + .../serenity/fragments/MainMenuFragment.kt | 27 ++- ...ainMenuVideoContentVerticalGridFragment.kt | 12 +- .../AutoConfigureHandlerRunnable.java | 3 + .../serenity/injection/BaseInjector.java | 1 + .../serenity/injection/InjectingActivity.java | 2 + .../injection/InjectingBaseAdapter.java | 1 + .../serenity/injection/InjectingFragment.java | 1 + .../injection/InjectingIntentService.java | 1 + .../InjectingRecyclerViewAdapter.java | 1 + .../injection/modules/AndroidModule.java | 6 +- .../modules/ExoplayerVideoModule.java | 2 - .../injection/modules/SerenityModule.java | 1 + .../providers/DataSourceFactoryProvider.kt | 3 - .../providers/EventLoggerProvider.java | 2 + .../HttpDataSourceFactoryProvider.java | 2 + .../ServerClientPreferenceProvider.java | 2 + .../VideoPlayerIntentUtilsProvider.java | 3 + .../providers/VideoQueueHelperProvider.java | 3 + .../serenity/jobs/EpisodesRetrievalJob.java | 6 +- .../serenity/jobs/GlideClearCacheJob.java | 2 + .../serenity/jobs/MovieCategoryJob.java | 6 +- .../serenity/jobs/MovieRetrievalJob.java | 6 +- .../jobs/MovieSecondaryCategoryJob.java | 6 +- .../serenity/jobs/RetrieveAllUsersJob.java | 7 +- .../serenity/jobs/SeasonsRetrievalJob.java | 6 +- .../nineworlds/serenity/jobs/SubtitleJob.java | 6 +- .../serenity/jobs/TVCategoryJob.java | 6 +- .../serenity/jobs/TVCategorySecondaryJob.java | 6 +- .../serenity/jobs/TVShowRetrievalJob.java | 6 +- .../serenity/jobs/video/StartPlaybackJob.java | 3 + .../serenity/jobs/video/StopPlaybackJob.java | 3 + .../jobs/video/UpdatePlaybackPostionJob.java | 3 + .../serenity/jobs/video/WatchedStatusJob.java | 3 + .../GridSpacingItemDecoration.java | 3 +- .../recyclerutils/ItemOffsetDecoration.java | 3 +- .../recyclerutils/SpaceItemDecoration.java | 3 +- .../ui/activity/OverscanSetupActivity.java | 1 + .../ui/activity/SerenityActivity.java | 5 +- .../ui/activity/SerenityVideoActivity.java | 13 +- .../AbstractPosterImageGalleryAdapter.java | 4 +- .../ui/adapters/MenuDrawerAdapter.java | 2 + .../ui/adapters/RecyclerViewDiffUtil.kt | 1 - .../ui/dialogs/DirectoryChooserDialog.java | 2 + .../ui/leanback/search/CardPresenter.kt | 8 +- .../leanback/search/MovieSearchFragment.java | 25 ++- .../ui/leanback/search/SearchActivity.java | 2 + .../AbstractVideoOnItemClickListener.java | 2 + .../AbstractVideoOnItemLongClickListener.java | 3 + .../AbstractVideoOnItemSelectedListener.java | 11 +- .../preferences/LeanbackSettingsActivity.java | 2 + .../ui/preferences/SettingsFragment.java | 8 +- .../ui/util/ExternalPlayerResultHandler.java | 145 ----------------- .../serenity/ui/util/ImageUtils.java | 1 + .../serenity/ui/util/PlayerResultHandler.java | 4 +- .../ui/util/VideoPlayerIntentUtils.java | 99 +---------- .../serenity/ui/util/VideoQueueHelper.java | 3 + .../serenity/ui/video/player/EventLogger.java | 8 +- .../serenity/ui/views/TextClock.java | 1 + .../serenity/ui/views/mvp/MvpFrameLayout.java | 6 +- .../StatusOverlayFrameLayout.java | 18 +- .../AbstractPosterImageViewHolder.java | 8 +- .../serenity/widgets/RoundedImageView.java | 1 + .../core/repository/CategoryRepository.kt | 5 +- .../core/repository/LoginRepository.kt | 2 +- .../core/repository/VideoRepository.kt | 1 - .../fragments/mainmenu/MainMenuPresenter.kt | 8 +- .../fragments/mainmenu/MainMenuView.kt | 1 - .../activity/leanback/details/DetailsView.kt | 1 - .../ui/activity/login/LoginUserViewHolder.kt | 6 +- .../presenters/ActionPresenterSelector.java | 2 + .../presenters/CategoryVideoPresenter.kt | 2 - .../DetailsOverviewLogoPresenter.java | 2 + .../FullWidthDetailsOverviewRowPresenter.java | 4 +- .../presenters/MoviePresenterViewHolder.kt | 9 +- .../presenters/SeriesPresenterViewHolder.kt | 23 +-- .../presenters/VideoContentInfoPresenter.kt | 1 - .../serenity/ui/util/ImageInfographicUtils.kt | 1 - .../ui/video/player/ExoplayerContract.kt | 1 - .../ui/video/player/ExoplayerVideoActivity.kt | 5 +- .../player/VideoKeyCodeHandlerDelegate.kt | 1 - .../main/res/color/item_selector_color.xml | 3 +- .../res/layout-large/activity_login_user.xml | 13 +- .../res/layout/movie_custom_actionbar.xml | 13 +- .../us/nineworlds/serenity/AndroidTVTest.java | 9 +- .../GalleryOnItemClickListenerTest.java | 12 +- .../nineworlds/serenity/MainActivityTest.java | 14 +- .../serenity/MainMenuTextViewAdapterTest.java | 15 +- .../StartupBroadcastReceiverTest.java | 14 +- .../serenity/TestSerenityApplication.java | 13 +- .../us/nineworlds/serenity/TestingModule.java | 3 + .../serenity/core/ServerConfigTest.java | 13 +- .../ExternalPlayerFactoryTest.java | 90 ---------- .../core/externalplayer/MXPlayerProTest.java | 154 ------------------ .../core/externalplayer/MXPlayerTest.java | 154 ------------------ .../SystemDefaultPlayerTest.java | 107 ------------ .../core/externalplayer/VimuPlayerTest.java | 140 ---------------- .../BackgroundBitmapDisplayerTest.java | 12 +- .../core/menus/DialogMenuItemTest.java | 4 +- .../core/menus/MenuDrawerItemImplTest.java | 4 +- .../serenity/core/menus/MenuItemTest.java | 4 +- .../impl/CategoryMediaContainerTest.java | 14 +- .../model/impl/EpisodeMediaContainerTest.java | 15 +- .../model/impl/MenuMediaContainerTest.java | 15 +- .../model/impl/MovieMediaContainerTest.java | 14 +- .../model/impl/SeasonsMediaContainerTest.java | 14 +- .../model/impl/SeriesMediaContainerTest.java | 14 +- .../MovieSearchIntentServiceTest.java | 10 +- .../serenity/core/util/TimeUtilsTest.java | 4 +- .../serenity/test/InjectingTest.java | 2 +- .../serenity/test/ShadowSubtitleView.java | 1 + .../DoNothingShadowSQLiteConnection.java | 1 + ...AbstractPosterImageGalleryAdapterTest.java | 14 +- .../ui/adapters/MenuDrawerAdapterTest.java | 7 +- .../StatusOverlayFrameLayoutTest.java | 5 +- .../serenity/jobs/EpisodesRetrievalJobTest.kt | 1 - .../serenity/jobs/MovieCategoryJobTest.kt | 1 - .../serenity/jobs/MovieRetrievalJobTest.kt | 1 - .../jobs/MovieSecondaryCategoryJobTest.kt | 1 - .../serenity/jobs/RetrieveAllUsersJobTest.kt | 1 - .../serenity/jobs/SeasonsRetrievalJobTest.kt | 3 - .../serenity/jobs/TVCategoryJobTest.kt | 1 - .../jobs/TVCategorySecondaryJobTest.kt | 1 - .../serenity/jobs/TVShowsRetrievalJobTest.kt | 1 - .../jobs/videos/AuthenticateUserJobTest.kt | 1 - .../jobs/videos/StartPlaybackJobTest.kt | 1 - .../jobs/videos/StopPlaybackJobTest.kt | 1 - .../videos/UpdatePlaybackPositionJobTest.kt | 1 - .../jobs/videos/WatchedStatusJobTest.kt | 1 - .../serenity/test/util/FragmentTestUtil.java | 4 +- .../activity/ServerSelectionActivityTest.kt | 4 +- .../ui/activity/login/LoginRepositoryTest.kt | 8 +- .../activity/login/LoginUserPresenterTest.kt | 7 +- .../manualentry/ManualServerActivityTest.kt | 2 - .../ManualServerSettingsFragmentTest.kt | 1 - .../ui/leanback/search/CardPresenterTest.kt | 4 +- .../util/ExternalPlayerResultHandlerTest.kt | 97 ----------- .../ui/util/VideoPlayerIntentUtilsTest.kt | 96 +---------- .../player/ExoplayerVideoActivityTest.kt | 1 - 177 files changed, 460 insertions(+), 1917 deletions(-) delete mode 100644 serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/AbstractExternalPlayer.java delete mode 100644 serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayer.java delete mode 100644 serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayerFactory.java delete mode 100644 serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/MXPlayer.java delete mode 100644 serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/MXPlayerPro.java delete mode 100644 serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/SystemDefaultPlayer.java delete mode 100644 serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ViMuPlayer.java delete mode 100644 serenity-app/src/main/java/us/nineworlds/serenity/ui/util/ExternalPlayerResultHandler.java delete mode 100644 serenity-app/src/test/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayerFactoryTest.java delete mode 100644 serenity-app/src/test/java/us/nineworlds/serenity/core/externalplayer/MXPlayerProTest.java delete mode 100644 serenity-app/src/test/java/us/nineworlds/serenity/core/externalplayer/MXPlayerTest.java delete mode 100644 serenity-app/src/test/java/us/nineworlds/serenity/core/externalplayer/SystemDefaultPlayerTest.java delete mode 100644 serenity-app/src/test/java/us/nineworlds/serenity/core/externalplayer/VimuPlayerTest.java delete mode 100644 serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/util/ExternalPlayerResultHandlerTest.kt diff --git a/serenity-app/build.gradle.kts b/serenity-app/build.gradle.kts index e037df8c8..02db005ba 100644 --- a/serenity-app/build.gradle.kts +++ b/serenity-app/build.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - plugins { id("com.android.application") id("project-report") diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/AboutDialog.java b/serenity-app/src/main/java/us/nineworlds/serenity/AboutDialog.java index d2326f976..f17c01260 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/AboutDialog.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/AboutDialog.java @@ -8,6 +8,7 @@ import android.text.Html; import android.text.method.ScrollingMovementMethod; import android.widget.TextView; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/AndroidTV.java b/serenity-app/src/main/java/us/nineworlds/serenity/AndroidTV.java index 14b4339a0..c8fa52fec 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/AndroidTV.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/AndroidTV.java @@ -24,6 +24,7 @@ package us.nineworlds.serenity; import android.content.Intent; + import us.nineworlds.serenity.ui.leanback.search.SearchActivity; public class AndroidTV extends MainActivity { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/GalleryOnItemClickListener.java b/serenity-app/src/main/java/us/nineworlds/serenity/GalleryOnItemClickListener.java index 4c3855414..989da917f 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/GalleryOnItemClickListener.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/GalleryOnItemClickListener.java @@ -27,6 +27,7 @@ import android.content.Intent; import android.view.View; import android.widget.Toast; + import us.nineworlds.serenity.core.menus.MenuItem; import us.nineworlds.serenity.ui.preferences.LeanbackSettingsActivity; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/GalleryOnItemSelectedListener.kt b/serenity-app/src/main/java/us/nineworlds/serenity/GalleryOnItemSelectedListener.kt index 30188d134..948dc9c88 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/GalleryOnItemSelectedListener.kt +++ b/serenity-app/src/main/java/us/nineworlds/serenity/GalleryOnItemSelectedListener.kt @@ -24,10 +24,8 @@ */ package us.nineworlds.serenity -import us.nineworlds.serenity.injection.BaseInjector -import javax.inject.Inject -import android.content.SharedPreferences import android.app.Activity +import android.content.SharedPreferences import android.view.View import android.view.animation.AnimationUtils import android.widget.ImageView @@ -35,7 +33,8 @@ import androidx.core.content.ContextCompat import com.bumptech.glide.Glide import us.nineworlds.serenity.core.menus.MenuItem import us.nineworlds.serenity.fragments.mainmenu.MainMenuPresenter -import javax.inject.Provider +import us.nineworlds.serenity.injection.BaseInjector +import javax.inject.Inject class GalleryOnItemSelectedListener(private val adapter: MainMenuTextViewAdapter, private val presenter: MainMenuPresenter) : BaseInjector(), IGalleryOnItemSelectedListener { @Inject diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/MainMenuTextViewAdapter.java b/serenity-app/src/main/java/us/nineworlds/serenity/MainMenuTextViewAdapter.java index fff99a88d..62bbb5b59 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/MainMenuTextViewAdapter.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/MainMenuTextViewAdapter.java @@ -22,15 +22,18 @@ */ package us.nineworlds.serenity; -import androidx.recyclerview.widget.RecyclerView; import android.text.TextUtils.TruncateAt; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.TextView; + +import androidx.recyclerview.widget.RecyclerView; + import java.util.ArrayList; import java.util.List; + import us.nineworlds.serenity.core.menus.MenuItem; import us.nineworlds.serenity.fragments.mainmenu.MainMenuPresenter; import us.nineworlds.serenity.injection.InjectingRecyclerViewAdapter; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/MainPresenter.java b/serenity-app/src/main/java/us/nineworlds/serenity/MainPresenter.java index 66d58c6f2..b8f45195b 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/MainPresenter.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/MainPresenter.java @@ -1,14 +1,14 @@ package us.nineworlds.serenity; import android.content.Context; + +import javax.inject.Inject; + import moxy.InjectViewState; import moxy.MvpPresenter; -import com.birbit.android.jobqueue.JobManager; -import javax.inject.Inject; import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; import us.nineworlds.serenity.common.rest.SerenityClient; -import us.nineworlds.serenity.jobs.GlideClearCacheJob; @InjectViewState public class MainPresenter extends MvpPresenter { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/RecommendationBuilder.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/RecommendationBuilder.java index 6b6816d1e..59b9c672a 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/RecommendationBuilder.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/RecommendationBuilder.java @@ -21,9 +21,10 @@ import android.content.Context; import android.graphics.Bitmap; import android.os.Bundle; -import androidx.core.app.NotificationCompat; import android.util.Log; +import androidx.core.app.NotificationCompat; + import com.bumptech.glide.Glide; import java.io.IOException; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/SerenityRecommendationContentProvider.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/SerenityRecommendationContentProvider.java index 8fb418357..57b1f55d2 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/SerenityRecommendationContentProvider.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/SerenityRecommendationContentProvider.java @@ -29,6 +29,7 @@ import android.net.Uri; import android.os.ParcelFileDescriptor; import android.util.Log; + import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/ServerConfig.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/ServerConfig.java index c48c70a56..bc63f30ae 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/ServerConfig.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/ServerConfig.java @@ -27,7 +27,9 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; + import javax.inject.Inject; + import us.nineworlds.serenity.injection.BaseInjector; /** diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/AbstractExternalPlayer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/AbstractExternalPlayer.java deleted file mode 100644 index 7700f48fa..000000000 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/AbstractExternalPlayer.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2012 David Carver - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - *

- * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package us.nineworlds.serenity.core.externalplayer; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import us.nineworlds.serenity.core.SerenityConstants; -import us.nineworlds.serenity.core.model.VideoContentInfo; - -/** - * @author dcarver - */ -public abstract class AbstractExternalPlayer { - - protected VideoContentInfo videoContent; - protected Context activity; - - /** - * - */ - public AbstractExternalPlayer(VideoContentInfo vc, Context ac) { - videoContent = vc; - activity = ac; - } - - /** - * Sets the class and package name for the activity to be launched. - */ - protected abstract void setClassAndPackagename(Intent vpIntent); - - protected void launchActivity(Intent vpIntent) { - Activity activity = (Activity) this.activity; - activity.startActivityForResult(vpIntent, SerenityConstants.BROWSER_RESULT_CODE); - } - - /** - * @return - */ - public Intent createIntent() { - Intent vpIntent = new Intent(Intent.ACTION_VIEW); - vpIntent.setDataAndType(Uri.parse(videoContent.getDirectPlayUrl()), "video/*"); - - return vpIntent; - } -} diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayer.java deleted file mode 100644 index 0ae24a6a8..000000000 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayer.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2013 David Carver - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - *

- * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package us.nineworlds.serenity.core.externalplayer; - -import android.content.Intent; - -/** - * Represents the capabilities of an external player. - * - * @author dcarver - */ -public interface ExternalPlayer { - - public void launch(); - - /** - * Whether the external player supports resume offset position for starting - * playback. - */ - public boolean supportsResume(); - - /** - * Whether the external player supports reporting that it will report it's - * last playback position or not. Not all players will pass this information - * back as an activity result. If a player doesn't support this feature then - * the Plex playback position can't be updated. - */ - public boolean supportsPlaybackPosition(); - - /** - * Whether subtitles can be passed into the player for playback. - */ - public boolean supportsSubtitleUrls(); - - /** - * Whether the title of the video can be passed to the external player or - * not. - */ - - public boolean hasTitleSupport(); - - public boolean hasHardwareDecodingSupport(); - - public void enableHardwareDecodinging(); - - public void disableHadwareDecoding(); - - public Intent createIntent(); -} diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayerFactory.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayerFactory.java deleted file mode 100644 index b3b2a8ba1..000000000 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ExternalPlayerFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2012 David Carver - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - *

- * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package us.nineworlds.serenity.core.externalplayer; - -import android.content.Context; -import us.nineworlds.serenity.core.model.VideoContentInfo; - -/** - * A factory that handles returning the selected video player. - * - * @author dcarver - */ -public class ExternalPlayerFactory { - - private final VideoContentInfo videoContent; - private final Context activity; - - /** - * - */ - public ExternalPlayerFactory(VideoContentInfo vc, Context ac) { - videoContent = vc; - activity = ac; - } - - public ExternalPlayer createExternalPlayer(String identifier) { - if ("mxplayer".equals(identifier)) { - return new MXPlayer(videoContent, activity); - } - - if ("mxplayerpro".equals(identifier)) { - return new MXPlayerPro(videoContent, activity); - } - - if ("vimu".equals(identifier)) { - return new ViMuPlayer(videoContent, activity); - } - - return new SystemDefaultPlayer(videoContent, activity); - } -} diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/MXPlayer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/MXPlayer.java deleted file mode 100644 index cb0ed399c..000000000 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/MXPlayer.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2012 David Carver - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - *

- * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package us.nineworlds.serenity.core.externalplayer; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import us.nineworlds.serenity.core.model.VideoContentInfo; -import us.nineworlds.serenity.core.model.impl.Subtitle; - -/** - * @author dcarver - */ -public class MXPlayer extends AbstractExternalPlayer implements ExternalPlayer { - - private static final String PLAYER_CLASS_NAME = "com.mxtech.videoplayer.ad.ActivityScreen"; - private static final String PLAYER_PACKAGE_NAME = "com.mxtech.videoplayer.ad"; - - private boolean hardwareDecoding; - - public MXPlayer(VideoContentInfo vc, Context ac) { - super(vc, ac); - } - - @Override public void launch() { - Intent vpIntent = createIntent(); - launchActivity(vpIntent); - } - - @Override public Intent createIntent() { - Intent vpIntent = super.createIntent(); - if (hardwareDecoding) { - vpIntent.putExtra("decode_mode", 1); - } - vpIntent.putExtra("title", videoContent.getTitle()); - vpIntent.putExtra("return_result", true); - if (videoContent.getSubtitle() != null) { - Subtitle subtitle = videoContent.getSubtitle(); - if (!"none".equals(subtitle.getFormat())) { - Uri[] subt = { Uri.parse(subtitle.getKey()) }; - vpIntent.putExtra("subs", subt); - vpIntent.putExtra("subs.enable", subt); - } - } - if (videoContent.getResumeOffset() != 0 && videoContent.isPartiallyWatched()) { - vpIntent.putExtra("position", videoContent.getResumeOffset()); - } - - setClassAndPackagename(vpIntent); - - return vpIntent; - } - - @Override protected void setClassAndPackagename(Intent vpIntent) { - vpIntent.setPackage(PLAYER_PACKAGE_NAME); - vpIntent.setClassName(PLAYER_PACKAGE_NAME, PLAYER_CLASS_NAME); - } - - @Override public boolean supportsResume() { - return true; - } - - @Override public boolean supportsPlaybackPosition() { - return true; - } - - @Override public boolean supportsSubtitleUrls() { - return true; - } - - @Override public boolean hasTitleSupport() { - return true; - } - - @Override public boolean hasHardwareDecodingSupport() { - return true; - } - - @Override public void enableHardwareDecodinging() { - hardwareDecoding = true; - } - - @Override public void disableHadwareDecoding() { - hardwareDecoding = false; - } -} diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/MXPlayerPro.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/MXPlayerPro.java deleted file mode 100644 index 998eb5a0e..000000000 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/MXPlayerPro.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2012 David Carver - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - *

- * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package us.nineworlds.serenity.core.externalplayer; - -import android.content.Context; -import android.content.Intent; -import us.nineworlds.serenity.core.model.VideoContentInfo; - -/** - * @author dcarver - */ -public class MXPlayerPro extends MXPlayer { - - private static final String PLAYER_CLASS_NAME = "com.mxtech.videoplayer.ActivityScreen"; - private static final String PLAYER_PACKAGENAME = "com.mxtech.videoplayer.pro"; - - public MXPlayerPro(VideoContentInfo vc, Context ac) { - super(vc, ac); - } - - @Override protected void setClassAndPackagename(Intent vpIntent) { - vpIntent.setPackage(PLAYER_PACKAGENAME); - vpIntent.setClassName(PLAYER_PACKAGENAME, PLAYER_CLASS_NAME); - } -} diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/SystemDefaultPlayer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/SystemDefaultPlayer.java deleted file mode 100644 index 31d757971..000000000 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/SystemDefaultPlayer.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2012 David Carver - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - *

- * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package us.nineworlds.serenity.core.externalplayer; - -import android.content.Context; -import android.content.Intent; -import us.nineworlds.serenity.core.model.VideoContentInfo; - -/** - * @author dcarver - */ -public class SystemDefaultPlayer extends AbstractExternalPlayer implements ExternalPlayer { - - public SystemDefaultPlayer(VideoContentInfo vc, Context ac) { - super(vc, ac); - } - - @Override public void launch() { - Intent vpIntent = createIntent(); - launchActivity(vpIntent); - } - - @Override public boolean supportsResume() { - return false; - } - - @Override public boolean supportsPlaybackPosition() { - return false; - } - - @Override public boolean supportsSubtitleUrls() { - return false; - } - - @Override public boolean hasTitleSupport() { - return false; - } - - @Override public boolean hasHardwareDecodingSupport() { - return false; - } - - @Override public void enableHardwareDecodinging() { - - } - - @Override public void disableHadwareDecoding() { - - } - - @Override protected void setClassAndPackagename(Intent vpIntent) { - - } -} diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ViMuPlayer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ViMuPlayer.java deleted file mode 100644 index 2a4750815..000000000 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/externalplayer/ViMuPlayer.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2012 David Carver - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - *

- * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package us.nineworlds.serenity.core.externalplayer; - -import android.content.Context; -import android.content.Intent; -import us.nineworlds.serenity.core.model.VideoContentInfo; -import us.nineworlds.serenity.core.model.impl.Subtitle; - -/** - * @author dcarver - */ -public class ViMuPlayer extends AbstractExternalPlayer implements ExternalPlayer { - - /** - * @param vc - * @param ac - */ - public ViMuPlayer(VideoContentInfo vc, Context ac) { - super(vc, ac); - } - - @Override public void launch() { - Intent vpIntent = createIntent(); - - setClassAndPackagename(vpIntent); - launchActivity(vpIntent); - } - - @Override public Intent createIntent() { - Intent vpIntent = super.createIntent(); - - vpIntent.putExtra("forcename", videoContent.getTitle()); - vpIntent.putExtra("forcedirect", true); - vpIntent.putExtra("startfrom", videoContent.getResumeOffset()); - if (videoContent.getSubtitle() != null) { - Subtitle subtitle = videoContent.getSubtitle(); - if (!"none".equals(subtitle.getFormat())) { - vpIntent.putExtra("forcedsrt", subtitle.getKey()); - } - } - return vpIntent; - } - - @Override public boolean supportsResume() { - return true; - } - - @Override public boolean supportsPlaybackPosition() { - return true; - } - - @Override public boolean supportsSubtitleUrls() { - return true; - } - - @Override public boolean hasTitleSupport() { - return true; - } - - /* - * (non-Javadoc) - * - * @see us.nineworlds.serenity.core.externalplayer.ExternalPlayer# - * hasHardwareDecodingSupport() - */ - @Override public boolean hasHardwareDecodingSupport() { - return true; - } - - @Override public void enableHardwareDecodinging() { - - } - - @Override public void disableHadwareDecoding() { - - } - - @Override protected void setClassAndPackagename(Intent vpIntent) { - vpIntent.setPackage("net.gtvbox.videoplayer"); - vpIntent.setClassName("net.gtvbox.videoplayer", "net.gtvbox.videoplayer.PlayerActivity"); - } -} diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/VideoContentInfo.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/VideoContentInfo.java index 0a31ec9fc..c72a1e99c 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/VideoContentInfo.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/VideoContentInfo.java @@ -25,7 +25,6 @@ import java.util.List; -import androidx.annotation.Nullable; import us.nineworlds.serenity.core.model.impl.Subtitle; /** diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractMediaContainer.java index ec7338986..d19ab1299 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractMediaContainer.java @@ -24,7 +24,9 @@ package us.nineworlds.serenity.core.model.impl; import java.util.List; + import javax.inject.Inject; + import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; import us.nineworlds.serenity.core.model.VideoContentInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractSeriesContentInfo.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractSeriesContentInfo.java index 14dcbf197..4c823a927 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractSeriesContentInfo.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractSeriesContentInfo.java @@ -25,6 +25,7 @@ import java.io.Serializable; import java.util.List; + import timber.log.Timber; import us.nineworlds.serenity.common.rest.Types; import us.nineworlds.serenity.core.model.SeriesContentInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractVideoContentInfo.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractVideoContentInfo.java index fe4d85bf1..20a8203ea 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractVideoContentInfo.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/AbstractVideoContentInfo.java @@ -24,8 +24,10 @@ package us.nineworlds.serenity.core.model.impl; import android.content.res.Resources; + import java.io.Serializable; import java.util.List; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.common.rest.Types; import us.nineworlds.serenity.core.SerenityConstants; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/CategoryMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/CategoryMediaContainer.java index 13a801a15..4d6571f8c 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/CategoryMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/CategoryMediaContainer.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; + import us.nineworlds.serenity.common.media.model.IDirectory; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.core.model.CategoryInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/EpisodeMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/EpisodeMediaContainer.java index 7c4c62cf3..bfb4b20c5 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/EpisodeMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/EpisodeMediaContainer.java @@ -24,9 +24,12 @@ package us.nineworlds.serenity.core.model.impl; import android.content.res.Resources; + import java.util.ArrayList; import java.util.List; + import javax.inject.Inject; + import us.nineworlds.serenity.common.media.model.IDirector; import us.nineworlds.serenity.common.media.model.IGenre; import us.nineworlds.serenity.common.media.model.IMedia; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/EpisodePosterInfo.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/EpisodePosterInfo.java index 5cf035786..cc93969e1 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/EpisodePosterInfo.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/EpisodePosterInfo.java @@ -24,6 +24,7 @@ package us.nineworlds.serenity.core.model.impl; import android.content.res.Resources; + import java.io.Serializable; public class EpisodePosterInfo extends AbstractVideoContentInfo implements Serializable { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/MenuMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/MenuMediaContainer.java index 9a1ece4f0..46280bf47 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/MenuMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/MenuMediaContainer.java @@ -25,15 +25,17 @@ import android.content.SharedPreferences; import android.content.res.Resources; + import java.util.ArrayList; import java.util.Collections; import java.util.List; + import javax.inject.Inject; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.common.media.model.IDirectory; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.core.menus.MenuItem; -import us.nineworlds.serenity.core.util.AndroidHelper; /** * Represents the meta data returned for the various libraries in media servers. Used to diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/MovieMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/MovieMediaContainer.java index fc3cca8f9..0b3f24133 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/MovieMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/MovieMediaContainer.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; + import us.nineworlds.serenity.common.media.model.IDirector; import us.nineworlds.serenity.common.media.model.IGenre; import us.nineworlds.serenity.common.media.model.IMedia; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SeasonsMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SeasonsMediaContainer.java index 6b405e7c7..4e499b022 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SeasonsMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SeasonsMediaContainer.java @@ -24,6 +24,7 @@ package us.nineworlds.serenity.core.model.impl; import java.util.List; + import us.nineworlds.serenity.common.media.model.IDirectory; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.core.model.SeriesContentInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SecondaryCategoryMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SecondaryCategoryMediaContainer.java index e68369804..0b41accba 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SecondaryCategoryMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SecondaryCategoryMediaContainer.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; + import us.nineworlds.serenity.common.media.model.IDirectory; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.core.model.SecondaryCategoryInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SeriesMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SeriesMediaContainer.java index 5b027411c..56abdff7f 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SeriesMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SeriesMediaContainer.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; + import us.nineworlds.serenity.common.media.model.IDirectory; import us.nineworlds.serenity.common.media.model.IGenre; import us.nineworlds.serenity.common.media.model.IMediaContainer; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SubtitleMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SubtitleMediaContainer.java index 72e373264..642fa8213 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SubtitleMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/SubtitleMediaContainer.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; + import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.media.model.IStream; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/TVCategoryMediaContainer.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/TVCategoryMediaContainer.java index eb630a1cb..fb9084f29 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/TVCategoryMediaContainer.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/model/impl/TVCategoryMediaContainer.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; + import us.nineworlds.serenity.common.media.model.IDirectory; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.core.model.CategoryInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/AbstractPlexRESTIntentService.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/AbstractPlexRESTIntentService.java index 29d871b8a..ee815a6f3 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/AbstractPlexRESTIntentService.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/AbstractPlexRESTIntentService.java @@ -24,7 +24,9 @@ package us.nineworlds.serenity.core.services; import android.content.Intent; + import javax.inject.Inject; + import us.nineworlds.serenity.common.rest.SerenityClient; import us.nineworlds.serenity.injection.InjectingIntentService; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/MovieSearchIntentService.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/MovieSearchIntentService.java index 2a8cd4285..52ebacb55 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/MovieSearchIntentService.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/MovieSearchIntentService.java @@ -26,6 +26,7 @@ import android.content.Intent; import android.os.Bundle; import android.util.Log; + import us.nineworlds.serenity.common.media.model.IMediaContainer; /** diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/MoviesRetrievalIntentService.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/MoviesRetrievalIntentService.java index 20e9fb61e..7eb04dbb3 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/MoviesRetrievalIntentService.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/MoviesRetrievalIntentService.java @@ -29,9 +29,11 @@ import android.os.Messenger; import android.os.RemoteException; import android.util.Log; + import java.io.IOException; import java.util.ArrayList; import java.util.List; + import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.Types; import us.nineworlds.serenity.core.model.VideoContentInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/UnWatchVideoAsyncTask.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/UnWatchVideoAsyncTask.java index eee61694b..87d1fcbb9 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/UnWatchVideoAsyncTask.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/UnWatchVideoAsyncTask.java @@ -24,8 +24,11 @@ package us.nineworlds.serenity.core.services; import android.os.AsyncTask; + import java.io.IOException; + import javax.inject.Inject; + import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/UpdateProgressRequest.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/UpdateProgressRequest.java index 742433410..4ce752f25 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/UpdateProgressRequest.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/UpdateProgressRequest.java @@ -1,7 +1,9 @@ package us.nineworlds.serenity.core.services; import android.os.AsyncTask; + import javax.inject.Inject; + import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/WatchedVideoAsyncTask.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/WatchedVideoAsyncTask.java index 424fc250b..561976dd2 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/services/WatchedVideoAsyncTask.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/services/WatchedVideoAsyncTask.java @@ -24,8 +24,11 @@ package us.nineworlds.serenity.core.services; import android.os.AsyncTask; + import java.io.IOException; + import javax.inject.Inject; + import timber.log.Timber; import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/core/util/AndroidHelper.java b/serenity-app/src/main/java/us/nineworlds/serenity/core/util/AndroidHelper.java index cb843537b..68664be3b 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/core/util/AndroidHelper.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/core/util/AndroidHelper.java @@ -26,10 +26,6 @@ import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; -import javax.inject.Inject; -import javax.inject.Singleton; -import us.nineworlds.serenity.common.android.injection.ApplicationContext; -import us.nineworlds.serenity.injection.BaseInjector; public class AndroidHelper { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/events/users/AllUsersEvent.java b/serenity-app/src/main/java/us/nineworlds/serenity/events/users/AllUsersEvent.java index 90f9274ad..3807db3b7 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/events/users/AllUsersEvent.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/events/users/AllUsersEvent.java @@ -1,7 +1,9 @@ package us.nineworlds.serenity.events.users; import androidx.annotation.NonNull; + import java.util.List; + import us.nineworlds.serenity.common.rest.SerenityUser; public class AllUsersEvent { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/fragments/MainMenuFragment.kt b/serenity-app/src/main/java/us/nineworlds/serenity/fragments/MainMenuFragment.kt index b36c948ce..5960d13fa 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/fragments/MainMenuFragment.kt +++ b/serenity-app/src/main/java/us/nineworlds/serenity/fragments/MainMenuFragment.kt @@ -24,30 +24,29 @@ */ package us.nineworlds.serenity.fragments -import us.nineworlds.serenity.fragments.mainmenu.MainMenuView -import javax.inject.Inject -import us.nineworlds.serenity.fragments.mainmenu.MainMenuPresenter -import us.nineworlds.serenity.R -import androidx.leanback.widget.HorizontalGridView -import android.view.LayoutInflater -import android.view.ViewGroup -import android.os.Bundle import android.app.Activity +import android.os.Bundle +import android.view.LayoutInflater import android.view.View +import android.view.ViewGroup import android.widget.FrameLayout import androidx.fragment.app.FragmentContainerView -import us.nineworlds.serenity.MainMenuTextViewAdapter -import us.nineworlds.serenity.core.menus.MenuItem -import us.nineworlds.serenity.events.MainMenuEvent -import us.nineworlds.serenity.core.model.impl.MenuMediaContainer -import java.util.ArrayList -import javax.inject.Provider +import androidx.leanback.widget.HorizontalGridView import moxy.ktx.moxyPresenter import us.nineworlds.serenity.MainActivity +import us.nineworlds.serenity.MainMenuTextViewAdapter +import us.nineworlds.serenity.R +import us.nineworlds.serenity.core.menus.MenuItem import us.nineworlds.serenity.core.model.CategoryInfo import us.nineworlds.serenity.core.model.CategoryVideoInfo import us.nineworlds.serenity.core.model.VideoCategory +import us.nineworlds.serenity.core.model.impl.MenuMediaContainer +import us.nineworlds.serenity.events.MainMenuEvent +import us.nineworlds.serenity.fragments.mainmenu.MainMenuPresenter +import us.nineworlds.serenity.fragments.mainmenu.MainMenuView import us.nineworlds.serenity.injection.InjectingMvpFragment +import javax.inject.Inject +import javax.inject.Provider class MainMenuFragment : InjectingMvpFragment(), MainMenuView { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/fragments/MainMenuVideoContentVerticalGridFragment.kt b/serenity-app/src/main/java/us/nineworlds/serenity/fragments/MainMenuVideoContentVerticalGridFragment.kt index 1ce86bdfd..16f597f42 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/fragments/MainMenuVideoContentVerticalGridFragment.kt +++ b/serenity-app/src/main/java/us/nineworlds/serenity/fragments/MainMenuVideoContentVerticalGridFragment.kt @@ -1,17 +1,21 @@ package us.nineworlds.serenity.fragments -import android.os.Bundle -import androidx.leanback.app.RowsSupportFragment -import androidx.leanback.widget.* -import us.nineworlds.serenity.core.model.CategoryInfo import android.content.Intent +import android.os.Bundle import android.widget.ImageView +import androidx.leanback.app.RowsSupportFragment +import androidx.leanback.widget.ArrayObjectAdapter +import androidx.leanback.widget.DiffCallback +import androidx.leanback.widget.HeaderItem +import androidx.leanback.widget.ListRow +import androidx.leanback.widget.ListRowPresenter import com.bumptech.glide.Glide import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import toothpick.Toothpick import us.nineworlds.serenity.R import us.nineworlds.serenity.common.annotations.InjectionConstants import us.nineworlds.serenity.common.rest.Types +import us.nineworlds.serenity.core.model.CategoryInfo import us.nineworlds.serenity.core.model.CategoryVideoInfo import us.nineworlds.serenity.core.model.VideoCategory import us.nineworlds.serenity.ui.activity.leanback.details.DetailsActivity diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/handlers/AutoConfigureHandlerRunnable.java b/serenity-app/src/main/java/us/nineworlds/serenity/handlers/AutoConfigureHandlerRunnable.java index 91a734122..669dfc6dc 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/handlers/AutoConfigureHandlerRunnable.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/handlers/AutoConfigureHandlerRunnable.java @@ -5,8 +5,11 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.widget.Toast; + import java.util.Map; + import javax.inject.Inject; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.common.Server; import us.nineworlds.serenity.injection.BaseInjector; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/BaseInjector.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/BaseInjector.java index 2aad9f8ad..d4cd02b76 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/BaseInjector.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/BaseInjector.java @@ -26,6 +26,7 @@ import android.app.Activity; import android.content.Context; import android.content.ContextWrapper; + import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; public abstract class BaseInjector { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingActivity.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingActivity.java index 8db7ad65d..04648ba40 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingActivity.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingActivity.java @@ -25,7 +25,9 @@ import android.app.Activity; import android.os.Bundle; + import androidx.annotation.Nullable; + import toothpick.Scope; import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingBaseAdapter.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingBaseAdapter.java index 4455a65f0..51e4e4469 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingBaseAdapter.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingBaseAdapter.java @@ -1,6 +1,7 @@ package us.nineworlds.serenity.injection; import android.widget.BaseAdapter; + import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingFragment.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingFragment.java index c90d4f10b..5f588cc4f 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingFragment.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingFragment.java @@ -24,6 +24,7 @@ package us.nineworlds.serenity.injection; import androidx.fragment.app.Fragment; + import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingIntentService.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingIntentService.java index 43983f912..e7b70bac8 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingIntentService.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingIntentService.java @@ -24,6 +24,7 @@ package us.nineworlds.serenity.injection; import android.app.IntentService; + import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingRecyclerViewAdapter.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingRecyclerViewAdapter.java index 34e3761e4..203177e24 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingRecyclerViewAdapter.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/InjectingRecyclerViewAdapter.java @@ -24,6 +24,7 @@ package us.nineworlds.serenity.injection; import androidx.recyclerview.widget.RecyclerView; + import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/AndroidModule.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/AndroidModule.java index 5be5a846a..c8090f458 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/AndroidModule.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/AndroidModule.java @@ -28,13 +28,17 @@ import android.content.SharedPreferences; import android.content.res.Resources; import android.preference.PreferenceManager; + import androidx.localbroadcastmanager.content.LocalBroadcastManager; + import com.birbit.android.jobqueue.JobManager; import com.birbit.android.jobqueue.config.Configuration; +import org.greenrobot.eventbus.EventBus; + import javax.inject.Inject; import javax.inject.Provider; -import org.greenrobot.eventbus.EventBus; + import toothpick.config.Module; import us.nineworlds.serenity.common.android.injection.ApplicationContext; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/ExoplayerVideoModule.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/ExoplayerVideoModule.java index 2d4929b00..c94271935 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/ExoplayerVideoModule.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/ExoplayerVideoModule.java @@ -2,9 +2,7 @@ import com.google.android.exoplayer2.trackselection.TrackSelector; import com.google.android.exoplayer2.upstream.DataSource; -import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; import com.google.android.exoplayer2.upstream.HttpDataSource; -import com.google.android.exoplayer2.upstream.cache.SimpleCache; import toothpick.config.Module; import us.nineworlds.serenity.injection.modules.providers.DataSourceFactoryProvider; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/SerenityModule.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/SerenityModule.java index b7eedd8af..42dc20d4b 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/SerenityModule.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/SerenityModule.java @@ -26,6 +26,7 @@ import java.util.LinkedList; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; + import okhttp3.OkHttpClient; import toothpick.config.Module; import us.nineworlds.serenity.common.Server; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/DataSourceFactoryProvider.kt b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/DataSourceFactoryProvider.kt index 52803ce34..e666e047a 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/DataSourceFactoryProvider.kt +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/DataSourceFactoryProvider.kt @@ -1,14 +1,11 @@ package us.nineworlds.serenity.injection.modules.providers import android.content.Context -import com.google.android.exoplayer2.database.ExoDatabaseProvider import com.google.android.exoplayer2.upstream.DataSource import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory import com.google.android.exoplayer2.upstream.HttpDataSource import com.google.android.exoplayer2.upstream.cache.CacheDataSource -import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor -import com.google.android.exoplayer2.upstream.cache.SimpleCache import us.nineworlds.serenity.SerenityApplication import us.nineworlds.serenity.common.android.injection.ApplicationContext import javax.inject.Inject diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/EventLoggerProvider.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/EventLoggerProvider.java index a1f8236ae..c277d7706 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/EventLoggerProvider.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/EventLoggerProvider.java @@ -1,8 +1,10 @@ package us.nineworlds.serenity.injection.modules.providers; import com.google.android.exoplayer2.trackselection.MappingTrackSelector; + import javax.inject.Inject; import javax.inject.Provider; + import us.nineworlds.serenity.ui.video.player.EventLogger; public class EventLoggerProvider implements Provider { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/HttpDataSourceFactoryProvider.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/HttpDataSourceFactoryProvider.java index d443731ce..4bf3c53f8 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/HttpDataSourceFactoryProvider.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/HttpDataSourceFactoryProvider.java @@ -2,8 +2,10 @@ import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory; import com.google.android.exoplayer2.upstream.HttpDataSource; + import javax.inject.Inject; import javax.inject.Provider; + import okhttp3.OkHttpClient; public class HttpDataSourceFactoryProvider implements Provider { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/ServerClientPreferenceProvider.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/ServerClientPreferenceProvider.java index 61f4f61b3..ce9982657 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/ServerClientPreferenceProvider.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/ServerClientPreferenceProvider.java @@ -1,8 +1,10 @@ package us.nineworlds.serenity.injection.modules.providers; import android.content.SharedPreferences; + import javax.inject.Inject; import javax.inject.Provider; + import us.nineworlds.serenity.core.util.StringPreference; public class ServerClientPreferenceProvider implements Provider { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/VideoPlayerIntentUtilsProvider.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/VideoPlayerIntentUtilsProvider.java index 9d58252ff..0f60669a2 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/VideoPlayerIntentUtilsProvider.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/VideoPlayerIntentUtilsProvider.java @@ -1,9 +1,12 @@ package us.nineworlds.serenity.injection.modules.providers; import android.content.SharedPreferences; + import java.util.LinkedList; + import javax.inject.Inject; import javax.inject.Provider; + import us.nineworlds.serenity.core.model.VideoContentInfo; import us.nineworlds.serenity.core.util.TimeUtil; import us.nineworlds.serenity.injection.ForVideoQueue; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/VideoQueueHelperProvider.java b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/VideoQueueHelperProvider.java index fa72003ac..b2584fcad 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/VideoQueueHelperProvider.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/injection/modules/providers/VideoQueueHelperProvider.java @@ -2,9 +2,12 @@ import android.content.Context; import android.content.SharedPreferences; + import java.util.LinkedList; + import javax.inject.Inject; import javax.inject.Provider; + import us.nineworlds.serenity.common.android.injection.ApplicationContext; import us.nineworlds.serenity.core.model.VideoContentInfo; import us.nineworlds.serenity.ui.util.VideoQueueHelper; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/EpisodesRetrievalJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/EpisodesRetrievalJob.java index 3fcceefa4..613423dbc 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/EpisodesRetrievalJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/EpisodesRetrievalJob.java @@ -2,9 +2,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/GlideClearCacheJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/GlideClearCacheJob.java index 509082397..d016f43d5 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/GlideClearCacheJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/GlideClearCacheJob.java @@ -1,8 +1,10 @@ package us.nineworlds.serenity.jobs; import android.content.Context; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.Job; import com.birbit.android.jobqueue.Params; import com.birbit.android.jobqueue.RetryConstraint; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieCategoryJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieCategoryJob.java index fe82746c1..57f69ffae 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieCategoryJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieCategoryJob.java @@ -2,9 +2,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieRetrievalJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieRetrievalJob.java index 45c2fc525..cf702bb00 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieRetrievalJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieRetrievalJob.java @@ -2,9 +2,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieSecondaryCategoryJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieSecondaryCategoryJob.java index e2df68522..7d5791e45 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieSecondaryCategoryJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/MovieSecondaryCategoryJob.java @@ -2,9 +2,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/RetrieveAllUsersJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/RetrieveAllUsersJob.java index 51e2a3a26..a5ce82cc2 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/RetrieveAllUsersJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/RetrieveAllUsersJob.java @@ -2,10 +2,15 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; + +import org.greenrobot.eventbus.EventBus; + import java.util.List; + import javax.inject.Inject; -import org.greenrobot.eventbus.EventBus; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.rest.SerenityClient; import us.nineworlds.serenity.common.rest.SerenityUser; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/SeasonsRetrievalJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/SeasonsRetrievalJob.java index ef8f551c0..7dc98c12a 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/SeasonsRetrievalJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/SeasonsRetrievalJob.java @@ -2,9 +2,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/SubtitleJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/SubtitleJob.java index 352c3168b..12635ed12 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/SubtitleJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/SubtitleJob.java @@ -2,9 +2,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVCategoryJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVCategoryJob.java index 7e3f68b43..1a2da8d77 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVCategoryJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVCategoryJob.java @@ -3,9 +3,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVCategorySecondaryJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVCategorySecondaryJob.java index 86320a99f..a09389497 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVCategorySecondaryJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVCategorySecondaryJob.java @@ -2,9 +2,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVShowRetrievalJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVShowRetrievalJob.java index 77254ef4a..4087d5288 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVShowRetrievalJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/TVShowRetrievalJob.java @@ -3,9 +3,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; + import com.birbit.android.jobqueue.RetryConstraint; -import javax.inject.Inject; + import org.greenrobot.eventbus.EventBus; + +import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.media.model.IMediaContainer; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/StartPlaybackJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/StartPlaybackJob.java index 917049785..d755883b6 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/StartPlaybackJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/StartPlaybackJob.java @@ -2,8 +2,11 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; + import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/StopPlaybackJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/StopPlaybackJob.java index 6bc35fd76..101b11682 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/StopPlaybackJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/StopPlaybackJob.java @@ -2,8 +2,11 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; + import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/UpdatePlaybackPostionJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/UpdatePlaybackPostionJob.java index d2d6ed96b..0890b04c5 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/UpdatePlaybackPostionJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/UpdatePlaybackPostionJob.java @@ -2,8 +2,11 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; + import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.rest.SerenityClient; import us.nineworlds.serenity.core.model.VideoContentInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/WatchedStatusJob.java b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/WatchedStatusJob.java index 81cdee4d0..c5ca72070 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/WatchedStatusJob.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/jobs/video/WatchedStatusJob.java @@ -2,8 +2,11 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.RetryConstraint; + import javax.inject.Inject; + import us.nineworlds.serenity.common.android.injection.InjectingJob; import us.nineworlds.serenity.common.rest.SerenityClient; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/GridSpacingItemDecoration.java b/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/GridSpacingItemDecoration.java index 0bb5c0af4..162208005 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/GridSpacingItemDecoration.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/GridSpacingItemDecoration.java @@ -1,9 +1,10 @@ package us.nineworlds.serenity.recyclerutils; import android.graphics.Rect; -import androidx.recyclerview.widget.RecyclerView; import android.view.View; +import androidx.recyclerview.widget.RecyclerView; + public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration { private int spanCount; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/ItemOffsetDecoration.java b/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/ItemOffsetDecoration.java index 154a318d8..e7107a184 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/ItemOffsetDecoration.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/ItemOffsetDecoration.java @@ -2,10 +2,11 @@ import android.content.Context; import android.graphics.Rect; +import android.view.View; + import androidx.annotation.DimenRes; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import android.view.View; public class ItemOffsetDecoration extends RecyclerView.ItemDecoration { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/SpaceItemDecoration.java b/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/SpaceItemDecoration.java index 92590ab90..a4fcb491e 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/SpaceItemDecoration.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/recyclerutils/SpaceItemDecoration.java @@ -1,9 +1,10 @@ package us.nineworlds.serenity.recyclerutils; import android.graphics.Rect; +import android.view.View; + import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import android.view.View; public class SpaceItemDecoration extends RecyclerView.ItemDecoration { private static final boolean DEFAULT_ADD_SPACE_ABOVE_FIRST_ITEM = false; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/OverscanSetupActivity.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/OverscanSetupActivity.java index 4cf7b1edd..634ae3212 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/OverscanSetupActivity.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/OverscanSetupActivity.java @@ -10,6 +10,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.Window; + import us.nineworlds.serenity.R; public class OverscanSetupActivity extends Activity diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/SerenityActivity.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/SerenityActivity.java index 087b6a027..b41630bef 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/SerenityActivity.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/SerenityActivity.java @@ -27,12 +27,13 @@ import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; - -import androidx.recyclerview.widget.RecyclerView; import android.view.KeyEvent; import android.view.View; +import androidx.recyclerview.widget.RecyclerView; + import com.google.firebase.analytics.FirebaseAnalytics; + import timber.log.Timber; import us.nineworlds.serenity.R; import us.nineworlds.serenity.injection.InjectingMvpActivity; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/SerenityVideoActivity.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/SerenityVideoActivity.java index 0569ca7d6..8b5ecb88f 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/SerenityVideoActivity.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/activity/SerenityVideoActivity.java @@ -26,17 +26,20 @@ import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import androidx.recyclerview.widget.RecyclerView; import android.view.View; import android.widget.Toast; + +import androidx.recyclerview.widget.RecyclerView; + import java.util.LinkedList; + import javax.inject.Inject; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.core.SerenityConstants; import us.nineworlds.serenity.core.model.VideoContentInfo; import us.nineworlds.serenity.injection.ForVideoQueue; import us.nineworlds.serenity.ui.adapters.AbstractPosterImageGalleryAdapter; -import us.nineworlds.serenity.ui.util.ExternalPlayerResultHandler; import us.nineworlds.serenity.ui.util.PlayerResultHandler; import us.nineworlds.serenity.ui.video.player.ExoplayerVideoActivity; @@ -76,16 +79,10 @@ public abstract class SerenityVideoActivity extends SerenityActivity { video = (VideoContentInfo) adapter.getItem(videoRecyclerView.getChildAdapterPosition(selectedView)); if (data != null) { - if (externalPlayer) { - ExternalPlayerResultHandler externalPlayerHandler = - new ExternalPlayerResultHandler(resultCode, data, this, adapter); - externalPlayerHandler.updatePlaybackPosition(video, selectedView); - } else { PlayerResultHandler playerResultHandler = new PlayerResultHandler(data, adapter); playerResultHandler.updateVideoPlaybackPosition(video, selectedView); - } } if (requestCode == SerenityConstants.EXIT_PLAYBACK_IMMEDIATELY) { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/AbstractPosterImageGalleryAdapter.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/AbstractPosterImageGalleryAdapter.java index 0ee91d459..4bd8e6448 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/AbstractPosterImageGalleryAdapter.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/AbstractPosterImageGalleryAdapter.java @@ -24,11 +24,13 @@ package us.nineworlds.serenity.ui.adapters; import android.os.Handler; -import androidx.core.content.ContextCompat; import android.view.KeyEvent; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; + +import androidx.core.content.ContextCompat; + import java.util.ArrayList; import java.util.List; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/MenuDrawerAdapter.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/MenuDrawerAdapter.java index 3b17f27f6..6594c8322 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/MenuDrawerAdapter.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/MenuDrawerAdapter.java @@ -30,7 +30,9 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; + import java.util.List; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.core.menus.MenuDrawerItem; import us.nineworlds.serenity.injection.InjectingBaseAdapter; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/RecyclerViewDiffUtil.kt b/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/RecyclerViewDiffUtil.kt index 72bb314f2..808a45c18 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/RecyclerViewDiffUtil.kt +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/adapters/RecyclerViewDiffUtil.kt @@ -1,7 +1,6 @@ package us.nineworlds.serenity.ui.adapters import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView import us.nineworlds.serenity.core.model.ContentInfo class RecyclerViewDiffUtil(private val oldList: List?, private val newList: List) : DiffUtil.Callback() { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/dialogs/DirectoryChooserDialog.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/dialogs/DirectoryChooserDialog.java index ee750356e..116639183 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/dialogs/DirectoryChooserDialog.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/dialogs/DirectoryChooserDialog.java @@ -19,12 +19,14 @@ import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; + import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; + import us.nineworlds.serenity.R; public class DirectoryChooserDialog { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/CardPresenter.kt b/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/CardPresenter.kt index b58297b05..9767c7e32 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/CardPresenter.kt +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/CardPresenter.kt @@ -28,13 +28,13 @@ package us.nineworlds.serenity.ui.leanback.search import android.app.Activity import android.content.Context import android.content.ContextWrapper -import androidx.annotation.VisibleForTesting -import androidx.leanback.widget.ImageCardView -import androidx.leanback.widget.Presenter -import androidx.core.content.ContextCompat import android.view.View import android.view.ViewGroup import android.widget.ImageView +import androidx.annotation.VisibleForTesting +import androidx.core.content.ContextCompat +import androidx.leanback.widget.ImageCardView +import androidx.leanback.widget.Presenter import com.bumptech.glide.Glide import us.nineworlds.serenity.R import us.nineworlds.serenity.core.model.VideoContentInfo diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/MovieSearchFragment.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/MovieSearchFragment.java index ddfc8d8eb..8bc4054b0 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/MovieSearchFragment.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/MovieSearchFragment.java @@ -30,19 +30,32 @@ import android.os.Handler; import android.os.Message; import android.os.Messenger; +import android.text.TextUtils; +import android.view.View; +import android.widget.Toast; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.leanback.app.SearchSupportFragment; import androidx.leanback.app.SearchSupportFragment.SearchResultProvider; -import androidx.leanback.widget.*; +import androidx.leanback.widget.ArrayObjectAdapter; +import androidx.leanback.widget.HeaderItem; +import androidx.leanback.widget.ListRow; +import androidx.leanback.widget.ListRowPresenter; +import androidx.leanback.widget.ObjectAdapter; +import androidx.leanback.widget.OnItemViewSelectedListener; import androidx.leanback.widget.Presenter.ViewHolder; -import android.text.TextUtils; -import android.view.View; -import android.widget.Toast; +import androidx.leanback.widget.Row; import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; + +import java.net.URLEncoder; +import java.util.List; + +import javax.inject.Inject; + import toothpick.Toothpick; import us.nineworlds.serenity.R; import us.nineworlds.serenity.common.annotations.InjectionConstants; @@ -54,10 +67,6 @@ import us.nineworlds.serenity.core.util.AndroidHelper; import us.nineworlds.serenity.ui.util.VideoPlayerIntentUtils; -import javax.inject.Inject; -import java.net.URLEncoder; -import java.util.List; - public class MovieSearchFragment extends SearchSupportFragment implements SearchResultProvider { private ArrayObjectAdapter rowsAdapter; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/SearchActivity.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/SearchActivity.java index a5d931ebf..198618b21 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/SearchActivity.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/leanback/search/SearchActivity.java @@ -25,7 +25,9 @@ import android.content.Intent; import android.os.Bundle; + import androidx.fragment.app.FragmentActivity; + import us.nineworlds.serenity.R; public class SearchActivity extends FragmentActivity { diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemClickListener.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemClickListener.java index 32581bbf1..722e68632 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemClickListener.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemClickListener.java @@ -25,7 +25,9 @@ import android.app.Activity; import android.view.View; + import javax.inject.Inject; + import us.nineworlds.serenity.core.model.VideoContentInfo; import us.nineworlds.serenity.injection.BaseInjector; import us.nineworlds.serenity.ui.adapters.AbstractPosterImageGalleryAdapter; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemLongClickListener.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemLongClickListener.java index 204c483a9..3caec7f8a 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemLongClickListener.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemLongClickListener.java @@ -33,9 +33,12 @@ import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; + import java.util.ArrayList; import java.util.LinkedList; + import javax.inject.Inject; + import timber.log.Timber; import us.nineworlds.serenity.R; import us.nineworlds.serenity.core.menus.DialogMenuItem; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemSelectedListener.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemSelectedListener.java index e1cc49283..447561c55 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemSelectedListener.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/listeners/AbstractVideoOnItemSelectedListener.java @@ -26,17 +26,22 @@ import android.app.Activity; import android.content.SharedPreferences; import android.graphics.Bitmap; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RatingBar; import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.birbit.android.jobqueue.JobManager; import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; + +import javax.inject.Inject; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.common.rest.SerenityClient; import us.nineworlds.serenity.core.imageloader.BackgroundBitmapDisplayer; @@ -45,8 +50,6 @@ import us.nineworlds.serenity.injection.BaseInjector; import us.nineworlds.serenity.ui.util.ImageInfographicUtils; -import javax.inject.Inject; - /** * Abstract class for handling video selection information. This can either be a * movie or a tv episode. This is primarily used in a detail view browsing diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/preferences/LeanbackSettingsActivity.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/preferences/LeanbackSettingsActivity.java index 912131d67..59b49e9a7 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/preferences/LeanbackSettingsActivity.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/preferences/LeanbackSettingsActivity.java @@ -1,7 +1,9 @@ package us.nineworlds.serenity.ui.preferences; import android.os.Bundle; + import androidx.annotation.Nullable; + import us.nineworlds.serenity.MainActivity; import us.nineworlds.serenity.R; import us.nineworlds.serenity.injection.InjectingActivity; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/preferences/SettingsFragment.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/preferences/SettingsFragment.java index 5232a32c8..1abfcde75 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/preferences/SettingsFragment.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/preferences/SettingsFragment.java @@ -5,20 +5,24 @@ import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; -import androidx.preference.PreferenceDialogFragment; -import androidx.preference.PreferenceFragment; + import androidx.leanback.preference.LeanbackPreferenceFragment; import androidx.leanback.preference.LeanbackSettingsFragment; import androidx.preference.DialogPreference; import androidx.preference.ListPreference; import androidx.preference.Preference; +import androidx.preference.PreferenceDialogFragment; +import androidx.preference.PreferenceFragment; import androidx.preference.PreferenceScreen; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; + import javax.inject.Inject; + import toothpick.Toothpick; import us.nineworlds.serenity.R; import us.nineworlds.serenity.common.Server; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/ExternalPlayerResultHandler.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/ExternalPlayerResultHandler.java deleted file mode 100644 index 0087d4efb..000000000 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/ExternalPlayerResultHandler.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2012 David Carver - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - *

- * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS - * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package us.nineworlds.serenity.ui.util; - -import android.app.Activity; -import android.content.Intent; -import android.content.SharedPreferences; -import android.view.View; -import android.widget.Toast; -import java.util.LinkedList; -import javax.inject.Inject; -import us.nineworlds.serenity.R; -import us.nineworlds.serenity.core.externalplayer.ExternalPlayer; -import us.nineworlds.serenity.core.externalplayer.ExternalPlayerFactory; -import us.nineworlds.serenity.core.externalplayer.MXPlayer; -import us.nineworlds.serenity.core.model.VideoContentInfo; -import us.nineworlds.serenity.injection.ForVideoQueue; -import us.nineworlds.serenity.ui.adapters.AbstractPosterImageGalleryAdapter; - -public class ExternalPlayerResultHandler extends PlayerResultHandler { - - Activity activity; - String externalPlayerValue; - boolean extPlayerVideoQueueEnabled; - int resultCode; - ExternalPlayer externalPlayer; - - @Inject protected VideoPlayerIntentUtils vpUtils; - - @Inject @ForVideoQueue protected LinkedList videoQueue; - - @Inject protected SharedPreferences preferences; - - public ExternalPlayerResultHandler(int resultCode, Intent data, Activity activity, - AbstractPosterImageGalleryAdapter adapter) { - super(data, adapter); - this.activity = activity; - externalPlayerValue = preferences.getString("serenity_external_player_filter", "default"); - extPlayerVideoQueueEnabled = - preferences.getBoolean("external_player_continuous_playback", false); - this.resultCode = resultCode; - } - - public void updatePlaybackPosition(VideoContentInfo video, View selectedView) { - ExternalPlayerFactory externalPlayerFactory = new ExternalPlayerFactory(video, activity); - externalPlayer = externalPlayerFactory.createExternalPlayer(externalPlayerValue); - - boolean mxPlayerCompleted = updateMXPlayerCompletedNormally(video); - if (shouldUpdatePlaybackPosition(mxPlayerCompleted)) { - updateVideoPlaybackPosition(video, selectedView); - } - - if (!extPlayerVideoQueueEnabled) { - return; - } - - playNextQueueEntry(); - return; - } - - private void playNextQueueEntry() { - if (videoQueue.isEmpty()) { - return; - } - - if (isVimuUserCancelResult(resultCode)) { - showQueueNotEmptyMessage(); - return; - } - - if (notMXPlayer(data)) { - externalPlayerPlayNext(); - return; - } - - String mxplayerEndedBy = data.getStringExtra("end_by"); - if ("user".equals(mxplayerEndedBy)) { - showQueueNotEmptyMessage(); - return; - } - - externalPlayerPlayNext(); - } - - private boolean shouldUpdatePlaybackPosition(boolean mxPlayerCompleted) { - return !mxPlayerCompleted && externalPlayer.supportsPlaybackPosition() && data.hasExtra( - "position"); - } - - private boolean updateMXPlayerCompletedNormally(VideoContentInfo video) { - if (externalPlayer instanceof MXPlayer && hasMXPlayerCompletedNormally(data)) { - if (video != null) { - video.setResumeOffset(video.getDuration()); - toggleWatched(video); - adapter.notifyDataSetChanged(); - } - return true; - } - return false; - } - - protected boolean hasMXPlayerCompletedNormally(Intent data) { - String mxplayerString = data.getStringExtra("end_by"); - return "playback_completion".equals(mxplayerString); - } - - protected boolean notMXPlayer(Intent data) { - return !data.hasExtra("end_by"); - } - - protected boolean isVimuUserCancelResult(int resultCode) { - return resultCode == 0 || resultCode == 4; - } - - protected void showQueueNotEmptyMessage() { - Toast.makeText(activity, R.string.there_are_still_videos_int_the_queue_, Toast.LENGTH_LONG) - .show(); - } - - protected void externalPlayerPlayNext() { - VideoContentInfo videoContentInfo = videoQueue.poll(); - vpUtils.launchExternalPlayer(videoContentInfo, activity, false); - } -} diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/ImageUtils.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/ImageUtils.java index 53bd98099..b96d6423d 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/ImageUtils.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/ImageUtils.java @@ -25,6 +25,7 @@ import android.view.View; import android.widget.ProgressBar; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.core.SerenityConstants; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/PlayerResultHandler.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/PlayerResultHandler.java index cfde72f2d..2559e575a 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/PlayerResultHandler.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/PlayerResultHandler.java @@ -24,8 +24,10 @@ package us.nineworlds.serenity.ui.util; import android.content.Intent; -import androidx.recyclerview.widget.RecyclerView; import android.view.View; + +import androidx.recyclerview.widget.RecyclerView; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.core.model.VideoContentInfo; import us.nineworlds.serenity.core.services.UpdateProgressRequest; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/VideoPlayerIntentUtils.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/VideoPlayerIntentUtils.java index 751b6227c..f6cae7b04 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/VideoPlayerIntentUtils.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/VideoPlayerIntentUtils.java @@ -24,17 +24,13 @@ package us.nineworlds.serenity.ui.util; import android.app.Activity; -import android.app.AlertDialog; -import android.content.ActivityNotFoundException; -import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.widget.Toast; + import java.util.LinkedList; -import us.nineworlds.serenity.R; + import us.nineworlds.serenity.core.SerenityConstants; -import us.nineworlds.serenity.core.externalplayer.ExternalPlayer; -import us.nineworlds.serenity.core.externalplayer.ExternalPlayerFactory; import us.nineworlds.serenity.core.model.VideoContentInfo; import us.nineworlds.serenity.core.util.TimeUtil; import us.nineworlds.serenity.ui.video.player.ExoplayerVideoActivity; @@ -49,103 +45,12 @@ public VideoPlayerIntentUtils(LinkedList videoQueue, SharedPre this.prefs = prefs; this.timeUtil = timeUtil; } - - /** - * This must run on a UI thread. - * - * Launches an external player based on the information provided. - */ - public void launchExternalPlayer(VideoContentInfo videoContent, Activity activity, boolean autoResume) { - - String externalPlayerValue = prefs.getString("serenity_external_player_filter", "default"); - - if ("default".equals(externalPlayerValue)) { - videoContent.setResumeOffset(0); - launchPlayer(videoContent, activity); - return; - } - - if (videoContent.isPartiallyWatched() && !autoResume) { - showResumeDialogQueue(activity, videoContent); - return; - } - - launchPlayer(videoContent, activity); - } - - protected void launchPlayer(VideoContentInfo videoContent, Activity activity) { - String externalPlayerValue = prefs.getString("serenity_external_player_filter", "default"); - - ExternalPlayerFactory factory = new ExternalPlayerFactory(videoContent, activity); - ExternalPlayer extplay = factory.createExternalPlayer(externalPlayerValue); - try { - extplay.launch(); - } catch (ActivityNotFoundException ex) { - extplay = factory.createExternalPlayer("default"); - extplay.launch(); - } - } - - /** - * Play all videos in the queue launching the appropriate player. - */ - public void playAllFromQueue(Activity context) { - if (!videoQueue.isEmpty()) { - boolean extplayer = prefs.getBoolean("external_player", false); - boolean extplayerVideoQueue = prefs.getBoolean("external_player_continuous_playback", false); - - if (extplayer) { - if (extplayerVideoQueue) { - VideoContentInfo videoContent = videoQueue.poll(); - launchExternalPlayer(videoContent, context, false); - } else { - Toast.makeText(context, - context.getResources().getString(R.string.external_player_video_queue_support_has_not_been_enabled_), - Toast.LENGTH_LONG).show(); - } - } else { - Intent vpIntent = new Intent(context, ExoplayerVideoActivity.class); - context.startActivityForResult(vpIntent, SerenityConstants.EXIT_PLAYBACK_IMMEDIATELY); - } - } else { - Toast.makeText(context, context.getResources().getString(R.string.queue_is_empty_), Toast.LENGTH_LONG).show(); - } - } - - protected void showResumeDialogQueue(Activity context, VideoContentInfo videoContent) { - final VideoContentInfo video = videoContent; - final Activity c = context; - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context, android.R.style.Theme_Holo_Dialog); - - alertDialogBuilder.setTitle(R.string.resume_video); - alertDialogBuilder.setMessage( - context.getResources().getText(R.string.resume_the_video_from_) + timeUtil.formatDuration( - video.getResumeOffset()) + context.getResources().getText(R.string._or_restart_)) - .setCancelable(false) - .setPositiveButton(R.string.resume, (dialog, which) -> launchPlayer(video, c)) - .setNegativeButton(R.string.restart, (dialog, which) -> { - video.setResumeOffset(0); - launchPlayer(video, c); - }); - - alertDialogBuilder.create(); - AlertDialog dialog = alertDialogBuilder.show(); - dialog.getButton(DialogInterface.BUTTON_POSITIVE).requestFocusFromTouch(); - } - public void playVideo(Activity activity, VideoContentInfo videoInfo, boolean autoResume) { if (!videoQueue.isEmpty()) { Toast.makeText(activity, "Cleared video queue before playback.", Toast.LENGTH_LONG).show(); videoQueue.clear(); } - boolean externalPlayer = prefs.getBoolean("external_player", false); - - if (externalPlayer) { - launchExternalPlayer(videoInfo, activity, autoResume); - return; - } - launchInternalPlayer(videoInfo, activity, autoResume); } diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/VideoQueueHelper.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/VideoQueueHelper.java index 35ec71171..36392d5de 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/VideoQueueHelper.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/util/VideoQueueHelper.java @@ -26,9 +26,12 @@ import android.content.Context; import android.content.SharedPreferences; import android.widget.Toast; + import java.util.LinkedList; + import javax.inject.Inject; import javax.inject.Singleton; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.common.android.injection.ApplicationContext; import us.nineworlds.serenity.core.model.VideoContentInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/video/player/EventLogger.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/video/player/EventLogger.java index 98842c4e1..e70a64c34 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/video/player/EventLogger.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/video/player/EventLogger.java @@ -17,9 +17,9 @@ import android.os.SystemClock; import android.util.Log; + import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.Format; -import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.audio.AudioRendererEventListener; import com.google.android.exoplayer2.decoder.DecoderCounters; @@ -34,14 +34,14 @@ import com.google.android.exoplayer2.metadata.id3.TextInformationFrame; import com.google.android.exoplayer2.metadata.id3.UrlLinkFrame; import com.google.android.exoplayer2.source.MediaSourceEventListener; -import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.trackselection.MappingTrackSelector; -import com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo; -import com.google.android.exoplayer2.trackselection.TrackSelectionArray; import com.google.android.exoplayer2.video.VideoRendererEventListener; + import java.text.NumberFormat; import java.util.Locale; + import javax.inject.Inject; + import toothpick.Toothpick; import us.nineworlds.serenity.common.annotations.InjectionConstants; import us.nineworlds.serenity.core.logger.Logger; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/TextClock.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/TextClock.java index 25f6ee6ee..24417dd12 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/TextClock.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/TextClock.java @@ -15,6 +15,7 @@ import android.util.AttributeSet; import android.view.ViewDebug; import android.widget.TextView; + import java.util.Calendar; import java.util.TimeZone; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/mvp/MvpFrameLayout.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/mvp/MvpFrameLayout.java index 8a258fe5f..4ab9c18a7 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/mvp/MvpFrameLayout.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/mvp/MvpFrameLayout.java @@ -4,12 +4,14 @@ import android.content.Context; import android.os.Build; import android.os.Parcelable; +import android.util.AttributeSet; +import android.widget.FrameLayout; + import androidx.annotation.AttrRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StyleRes; -import android.util.AttributeSet; -import android.widget.FrameLayout; + import moxy.MvpDelegate; import moxy.MvpPresenter; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/statusoverlayview/StatusOverlayFrameLayout.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/statusoverlayview/StatusOverlayFrameLayout.java index cc623fc1f..7ea4a7ad1 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/statusoverlayview/StatusOverlayFrameLayout.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/statusoverlayview/StatusOverlayFrameLayout.java @@ -4,12 +4,6 @@ import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.os.Build; -import androidx.annotation.AttrRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StyleRes; -import androidx.core.content.ContextCompat; -import androidx.recyclerview.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; import android.widget.ImageView; @@ -17,11 +11,19 @@ import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; -import moxy.MvpPresenter; -import moxy.presenter.InjectPresenter; + +import androidx.annotation.AttrRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StyleRes; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; + +import moxy.MvpPresenter; +import moxy.presenter.InjectPresenter; import us.nineworlds.serenity.R; import us.nineworlds.serenity.common.rest.Types; import us.nineworlds.serenity.core.model.VideoContentInfo; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/viewholders/AbstractPosterImageViewHolder.java b/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/viewholders/AbstractPosterImageViewHolder.java index 63de2d48b..30ec68ede 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/viewholders/AbstractPosterImageViewHolder.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/ui/views/viewholders/AbstractPosterImageViewHolder.java @@ -1,16 +1,18 @@ package us.nineworlds.serenity.ui.views.viewholders; import android.graphics.drawable.ColorDrawable; -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import androidx.recyclerview.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; +import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; + import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; + import us.nineworlds.serenity.R; import us.nineworlds.serenity.core.model.ContentInfo; import us.nineworlds.serenity.widgets.RoundedImageView; diff --git a/serenity-app/src/main/java/us/nineworlds/serenity/widgets/RoundedImageView.java b/serenity-app/src/main/java/us/nineworlds/serenity/widgets/RoundedImageView.java index 1ddfe718e..13e510762 100644 --- a/serenity-app/src/main/java/us/nineworlds/serenity/widgets/RoundedImageView.java +++ b/serenity-app/src/main/java/us/nineworlds/serenity/widgets/RoundedImageView.java @@ -11,6 +11,7 @@ import android.util.AttributeSet; import android.util.Log; import android.widget.ImageView; + import us.nineworlds.serenity.R; public class RoundedImageView extends ImageView { diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/CategoryRepository.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/CategoryRepository.kt index d5e9c47ab..e7e0f51b8 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/CategoryRepository.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/CategoryRepository.kt @@ -4,14 +4,15 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import toothpick.InjectConstructor import us.nineworlds.serenity.common.repository.Result -import us.nineworlds.serenity.common.repository.Result.* +import us.nineworlds.serenity.common.repository.Result.Error +import us.nineworlds.serenity.common.repository.Result.Success import us.nineworlds.serenity.common.rest.SerenityClient import us.nineworlds.serenity.common.rest.Types import us.nineworlds.serenity.core.model.CategoryInfo import us.nineworlds.serenity.core.model.VideoContentInfo import us.nineworlds.serenity.core.model.impl.CategoryMediaContainer -import us.nineworlds.serenity.events.MainMenuEvent import us.nineworlds.serenity.core.model.impl.MovieMediaContainer +import us.nineworlds.serenity.events.MainMenuEvent @InjectConstructor class CategoryRepository constructor(private val client: SerenityClient) { diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/LoginRepository.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/LoginRepository.kt index 05f40b0c1..9092f21c6 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/LoginRepository.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/LoginRepository.kt @@ -3,9 +3,9 @@ package us.nineworlds.serenity.core.repository import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import toothpick.InjectConstructor +import us.nineworlds.serenity.common.repository.Result import us.nineworlds.serenity.common.rest.SerenityClient import us.nineworlds.serenity.common.rest.SerenityUser -import us.nineworlds.serenity.common.repository.Result @InjectConstructor class LoginRepository(private val client: SerenityClient) { diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/VideoRepository.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/VideoRepository.kt index 30d49a1bc..23713f434 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/VideoRepository.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/core/repository/VideoRepository.kt @@ -8,7 +8,6 @@ import us.nineworlds.serenity.common.rest.SerenityClient import us.nineworlds.serenity.common.rest.Types import us.nineworlds.serenity.core.model.VideoContentInfo import us.nineworlds.serenity.core.model.impl.EpisodeMediaContainer -import us.nineworlds.serenity.events.SeasonsRetrievalEvent @InjectConstructor class VideoRepository constructor(private val client: SerenityClient) { diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/fragments/mainmenu/MainMenuPresenter.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/fragments/mainmenu/MainMenuPresenter.kt index 1040cbed3..99abd6079 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/fragments/mainmenu/MainMenuPresenter.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/fragments/mainmenu/MainMenuPresenter.kt @@ -1,6 +1,9 @@ package us.nineworlds.serenity.fragments.mainmenu -import kotlinx.coroutines.* +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import moxy.InjectViewState import moxy.MvpPresenter import moxy.presenterScope @@ -8,13 +11,12 @@ import moxy.viewstate.strategy.SkipStrategy import moxy.viewstate.strategy.StateStrategyType import toothpick.Toothpick import us.nineworlds.serenity.common.annotations.InjectionConstants -import us.nineworlds.serenity.core.repository.CategoryRepository import us.nineworlds.serenity.common.repository.Result import us.nineworlds.serenity.common.rest.Types import us.nineworlds.serenity.core.model.CategoryInfo import us.nineworlds.serenity.core.model.CategoryVideoInfo import us.nineworlds.serenity.core.model.VideoCategory - +import us.nineworlds.serenity.core.repository.CategoryRepository import javax.inject.Inject @InjectViewState diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/fragments/mainmenu/MainMenuView.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/fragments/mainmenu/MainMenuView.kt index 88904bce5..1fa23eea1 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/fragments/mainmenu/MainMenuView.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/fragments/mainmenu/MainMenuView.kt @@ -6,7 +6,6 @@ import moxy.viewstate.strategy.StateStrategyType import us.nineworlds.serenity.core.model.CategoryInfo import us.nineworlds.serenity.core.model.CategoryVideoInfo import us.nineworlds.serenity.core.model.VideoCategory -import us.nineworlds.serenity.core.model.VideoContentInfo import us.nineworlds.serenity.events.MainMenuEvent interface MainMenuView : MvpView { diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/activity/leanback/details/DetailsView.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/activity/leanback/details/DetailsView.kt index 682747b86..6bbdebf34 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/activity/leanback/details/DetailsView.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/activity/leanback/details/DetailsView.kt @@ -1,7 +1,6 @@ package us.nineworlds.serenity.ui.activity.leanback.details import moxy.MvpView -import moxy.viewstate.strategy.AddToEndStrategy import moxy.viewstate.strategy.OneExecutionStateStrategy import moxy.viewstate.strategy.StateStrategyType import us.nineworlds.serenity.core.model.ContentInfo diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/activity/login/LoginUserViewHolder.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/activity/login/LoginUserViewHolder.kt index a6196be2f..d14980eef 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/activity/login/LoginUserViewHolder.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/activity/login/LoginUserViewHolder.kt @@ -1,11 +1,11 @@ package us.nineworlds.serenity.ui.activity.login -import androidx.core.content.ContextCompat -import androidx.core.graphics.drawable.DrawableCompat -import androidx.recyclerview.widget.RecyclerView.ViewHolder import android.view.View import android.widget.ImageView import android.widget.TextView +import androidx.core.content.ContextCompat +import androidx.core.graphics.drawable.DrawableCompat +import androidx.recyclerview.widget.RecyclerView.ViewHolder import com.bumptech.glide.Glide import toothpick.Toothpick import us.nineworlds.serenity.R diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/ActionPresenterSelector.java b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/ActionPresenterSelector.java index f899fe842..632dda478 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/ActionPresenterSelector.java +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/ActionPresenterSelector.java @@ -12,12 +12,14 @@ * the License. */ package us.nineworlds.serenity.ui.leanback.presenters; + import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; + import androidx.leanback.R; import androidx.leanback.widget.Action; import androidx.leanback.widget.Presenter; diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/CategoryVideoPresenter.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/CategoryVideoPresenter.kt index 3b9db002b..b61efa15b 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/CategoryVideoPresenter.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/CategoryVideoPresenter.kt @@ -2,9 +2,7 @@ package us.nineworlds.serenity.ui.leanback.presenters import android.view.View import android.view.ViewGroup -import android.widget.ImageView import androidx.core.content.ContextCompat -import androidx.leanback.widget.ImageCardView import androidx.leanback.widget.Presenter import us.nineworlds.serenity.R import us.nineworlds.serenity.common.rest.Types diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/DetailsOverviewLogoPresenter.java b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/DetailsOverviewLogoPresenter.java index d47aea028..8043ccce2 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/DetailsOverviewLogoPresenter.java +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/DetailsOverviewLogoPresenter.java @@ -1,8 +1,10 @@ package us.nineworlds.serenity.ui.leanback.presenters; + import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; + import androidx.leanback.R; import androidx.leanback.widget.Presenter; diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/FullWidthDetailsOverviewRowPresenter.java b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/FullWidthDetailsOverviewRowPresenter.java index 37b7c7350..28e4c6c13 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/FullWidthDetailsOverviewRowPresenter.java +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/FullWidthDetailsOverviewRowPresenter.java @@ -12,8 +12,8 @@ * the License. */ package us.nineworlds.serenity.ui.leanback.presenters; + import android.annotation.SuppressLint; -import android.content.res.Resources; import android.graphics.Color; import android.graphics.Rect; import android.graphics.drawable.Drawable; @@ -23,10 +23,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.ViewGroup.MarginLayoutParams; import android.widget.FrameLayout; -import androidx.core.content.ContextCompat; import androidx.leanback.widget.Action; import androidx.leanback.widget.BaseGridView; import androidx.leanback.widget.HorizontalGridView; diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/MoviePresenterViewHolder.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/MoviePresenterViewHolder.kt index 4eb35c43c..bbc4151ca 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/MoviePresenterViewHolder.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/MoviePresenterViewHolder.kt @@ -3,16 +3,15 @@ package us.nineworlds.serenity.ui.leanback.presenters import android.graphics.Bitmap import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable +import android.view.ViewGroup +import android.widget.LinearLayout +import android.widget.RatingBar import androidx.leanback.widget.RowPresenter +import com.bumptech.glide.Glide import us.nineworlds.serenity.R import us.nineworlds.serenity.core.model.VideoContentInfo import us.nineworlds.serenity.databinding.LeanbackDetailsSummaryBinding import us.nineworlds.serenity.ui.util.ImageInfographicUtils -import android.widget.LinearLayout - -import android.widget.RatingBar -import android.view.ViewGroup -import com.bumptech.glide.Glide class MoviePresenterViewHolder(private val binding: LeanbackDetailsSummaryBinding) : RowPresenter.ViewHolder(binding.root) { diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/SeriesPresenterViewHolder.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/SeriesPresenterViewHolder.kt index 75293dc0e..a83905152 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/SeriesPresenterViewHolder.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/SeriesPresenterViewHolder.kt @@ -1,24 +1,17 @@ package us.nineworlds.serenity.ui.leanback.presenters -import androidx.leanback.widget.Presenter -import us.nineworlds.serenity.core.model.impl.TVShowSeriesInfo -import us.nineworlds.serenity.databinding.LeanbackDetailsSummaryBinding -import android.widget.LinearLayout - -import android.widget.RatingBar - -import android.widget.TextView - -import us.nineworlds.serenity.ui.util.ImageInfographicUtils - -import android.view.ViewGroup -import android.graphics.drawable.BitmapDrawable - import android.graphics.Bitmap - +import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable +import android.view.ViewGroup +import android.widget.LinearLayout +import android.widget.RatingBar +import androidx.leanback.widget.Presenter import com.bumptech.glide.Glide import us.nineworlds.serenity.R +import us.nineworlds.serenity.core.model.impl.TVShowSeriesInfo +import us.nineworlds.serenity.databinding.LeanbackDetailsSummaryBinding +import us.nineworlds.serenity.ui.util.ImageInfographicUtils open class SeriesPresenterViewHolder(private val binding: LeanbackDetailsSummaryBinding) : Presenter.ViewHolder(binding.root) { diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/VideoContentInfoPresenter.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/VideoContentInfoPresenter.kt index 52d473eef..f2ba9eebb 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/VideoContentInfoPresenter.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/leanback/presenters/VideoContentInfoPresenter.kt @@ -6,7 +6,6 @@ import androidx.core.content.ContextCompat import androidx.leanback.widget.Presenter import us.nineworlds.serenity.R import us.nineworlds.serenity.common.rest.Types -import us.nineworlds.serenity.core.model.ContentInfo import us.nineworlds.serenity.core.model.VideoContentInfo import us.nineworlds.serenity.ui.views.statusoverlayview.StatusOverlayFrameLayout diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/util/ImageInfographicUtils.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/util/ImageInfographicUtils.kt index 10229960b..269466664 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/util/ImageInfographicUtils.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/util/ImageInfographicUtils.kt @@ -37,7 +37,6 @@ import android.widget.ImageView.ScaleType import android.widget.LinearLayout import android.widget.TextView import com.bumptech.glide.Glide -import timber.log.Timber import us.nineworlds.serenity.R import us.nineworlds.serenity.common.rest.SerenityClient import us.nineworlds.serenity.core.model.VideoContentInfo diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerContract.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerContract.kt index 5a84fb127..6c78d7a67 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerContract.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerContract.kt @@ -4,7 +4,6 @@ import moxy.MvpView import moxy.viewstate.strategy.AddToEndSingleStrategy import moxy.viewstate.strategy.StateStrategyType import us.nineworlds.serenity.core.model.VideoContentInfo -import us.nineworlds.serenity.emby.model.Video interface ExoplayerContract { diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerVideoActivity.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerVideoActivity.kt index 6c3d6e82b..759642f45 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerVideoActivity.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerVideoActivity.kt @@ -12,7 +12,10 @@ import android.os.Looper import android.view.KeyEvent import android.view.View import android.widget.FrameLayout -import com.google.android.exoplayer2.* +import com.google.android.exoplayer2.DefaultLoadControl +import com.google.android.exoplayer2.ExoPlayer +import com.google.android.exoplayer2.MediaItem +import com.google.android.exoplayer2.Player import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory import com.google.android.exoplayer2.source.MediaSource import com.google.android.exoplayer2.source.ProgressiveMediaSource diff --git a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/VideoKeyCodeHandlerDelegate.kt b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/VideoKeyCodeHandlerDelegate.kt index 5c9c7e3b1..21593f0eb 100644 --- a/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/VideoKeyCodeHandlerDelegate.kt +++ b/serenity-app/src/main/kotlin/us/nineworlds/serenity/ui/video/player/VideoKeyCodeHandlerDelegate.kt @@ -5,7 +5,6 @@ import android.content.SharedPreferences import android.util.Log import android.view.KeyEvent import com.google.android.exoplayer2.ExoPlayer -import com.google.android.exoplayer2.SimpleExoPlayer import org.greenrobot.eventbus.EventBus import toothpick.Toothpick import us.nineworlds.serenity.common.annotations.InjectionConstants diff --git a/serenity-app/src/main/res/color/item_selector_color.xml b/serenity-app/src/main/res/color/item_selector_color.xml index 169a93cef..83f94b9fa 100644 --- a/serenity-app/src/main/res/color/item_selector_color.xml +++ b/serenity-app/src/main/res/color/item_selector_color.xml @@ -1,6 +1,5 @@ - + diff --git a/serenity-app/src/main/res/layout-large/activity_login_user.xml b/serenity-app/src/main/res/layout-large/activity_login_user.xml index 875357b33..d31afb7c4 100644 --- a/serenity-app/src/main/res/layout-large/activity_login_user.xml +++ b/serenity-app/src/main/res/layout-large/activity_login_user.xml @@ -1,12 +1,9 @@ - + - + () - - lateinit var resultHander: ExternalPlayerResultHandler - lateinit var activity: Activity - - @Before override fun setUp() { - super.setUp() - activity = Robolectric.buildActivity(Activity::class.java).create().get() - resultHander = ExternalPlayerResultHandler(0, mockIntent, activity, mockAbstractPosterImageGalleryAdapter) - } - - @After fun tearDown() { - activity.finish() - } - - @Test fun updatePlaybackPositionUpdatesPlaybackPositionForMxPlayer() { - resultHander.extPlayerVideoQueueEnabled = false - resultHander.externalPlayerValue = "mxplayer" - doReturn("playback_completion").whenever(mockIntent).getStringExtra("end_by") - doReturn(100).whenever(mockVideoContentInfo).duration - - resultHander.updatePlaybackPosition(mockVideoContentInfo, mockView) - - verify(mockVideoContentInfo).resumeOffset = 100 - verify(mockAbstractPosterImageGalleryAdapter).notifyDataSetChanged() - verify(mockIntent).getStringExtra("end_by") - } - - @Test - @Ignore - fun updatePlaysNextVideoInQueue() { - resultHander.extPlayerVideoQueueEnabled = true - resultHander.externalPlayerValue = "mxplayer" - resultHander.resultCode = 100 - doReturn("playback_completion").whenever(mockIntent).getStringExtra("end_by") - doReturn(100).whenever(mockVideoContentInfo).duration - - resultHander.updatePlaybackPosition(mockVideoContentInfo, mockView) - - verify(mockVideoContentInfo).resumeOffset = 100 - verify(mockAbstractPosterImageGalleryAdapter).notifyDataSetChanged() - verify(mockIntent).getStringExtra("end_by") - verify(mockVideoPlayerIntentUtils).launchExternalPlayer(mockVideoContentInfo, activity, false) - } - - override fun installTestModules() { - scope.installTestModules(TestingModule(), TestModule()) - } - - inner class TestModule : Module() { - init { - bind(VideoPlayerIntentUtils::class.java).toInstance(mockVideoPlayerIntentUtils) - bind(SharedPreferences::class.java).toInstance(mockSharedPreferences) - bind(LinkedList::class.java).withName(ForVideoQueue::class.java).toInstance(mockVideoQueue) - } - } - -} \ No newline at end of file diff --git a/serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/util/VideoPlayerIntentUtilsTest.kt b/serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/util/VideoPlayerIntentUtilsTest.kt index c3391fac4..3bc2ee41a 100644 --- a/serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/util/VideoPlayerIntentUtilsTest.kt +++ b/serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/util/VideoPlayerIntentUtilsTest.kt @@ -2,30 +2,24 @@ package us.nineworlds.serenity.ui.util import android.app.Activity import android.content.SharedPreferences -import com.nhaarman.mockitokotlin2.* import org.assertj.android.api.Assertions.assertThat -import org.assertj.core.api.Assertions import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import org.mockito.ArgumentMatchers.anyString import org.mockito.Mock import org.mockito.junit.MockitoJUnit import org.mockito.quality.Strictness import org.robolectric.Robolectric import org.robolectric.RobolectricTestRunner import org.robolectric.Shadows.shadowOf -import org.robolectric.shadows.ShadowActivity -import org.robolectric.shadows.ShadowAlertDialog -import org.robolectric.shadows.ShadowToast import us.nineworlds.serenity.TestingModule import us.nineworlds.serenity.core.model.VideoContentInfo import us.nineworlds.serenity.core.util.TimeUtil import us.nineworlds.serenity.test.InjectingTest import us.nineworlds.serenity.ui.video.player.ExoplayerVideoActivity -import java.util.* +import java.util.LinkedList @RunWith(RobolectricTestRunner::class) class VideoPlayerIntentUtilsTest : InjectingTest() { @@ -33,7 +27,7 @@ class VideoPlayerIntentUtilsTest : InjectingTest() { scope.installTestModules(TestingModule()) } - @Rule @JvmField public val rule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS) + @Rule @JvmField val rule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS) lateinit var videoPlayerIntentUtils: VideoPlayerIntentUtils @@ -59,55 +53,8 @@ class VideoPlayerIntentUtilsTest : InjectingTest() { activity = null } - @Test fun whenVideoQueueIsEmptyResumeOffsetIsNeverResetToZero() { - doReturn("http://www.example.com/example.mkv").whenever(mockVideoContentInfo).directPlayUrl - videoPlayerIntentUtils.launchExternalPlayer(mockVideoContentInfo, mockActivity, false ); - - verify(mockVideoContentInfo, never()).resumeOffset = 0 - } - - @Test fun whenVideoQueueIsNotEmptyAndExternalPlayerIsSetToDefaultResetVideoResumeOffset() { - videoQueue.add(mockVideoContentInfo) - doReturn("http://www.example.com/example.mkv").whenever(mockVideoContentInfo).directPlayUrl - doReturn("default").whenever(mockSharedPreferences).getString(anyString(), anyString()) - videoPlayerIntentUtils.launchExternalPlayer(mockVideoContentInfo, mockActivity, false) - - verify(mockVideoContentInfo).resumeOffset = 0 - verify(mockSharedPreferences, atLeastOnce()).getString("serenity_external_player_filter", "default") - } - - @Test fun showResumeDialogWhenVideoHasBeenPartiallyWatched() { - videoQueue.add(mockVideoContentInfo) - doReturn("mxplayer").whenever(mockSharedPreferences).getString(anyString(), anyString()) - doReturn(true).whenever(mockVideoContentInfo).isPartiallyWatched - - activity = Robolectric.setupActivity(Activity::class.java) - - videoPlayerIntentUtils.launchExternalPlayer(mockVideoContentInfo, activity, false) - - val latestAlertDialog = ShadowAlertDialog.getLatestAlertDialog() - - assertThat(latestAlertDialog).isNotNull.isShowing - verify(mockVideoContentInfo).isPartiallyWatched - } - - @Test fun playVideoClearsQueueAndDisplaysToastIfNotEmpty() { - videoQueue.add(mockVideoContentInfo) - doReturn(true).whenever(mockSharedPreferences).getBoolean("external_player", false) - doReturn("http://www.example.com/example.mkv").whenever(mockVideoContentInfo).directPlayUrl - doReturn("mxplayer").whenever(mockSharedPreferences).getString("serenity_external_player_filter", "default") - - activity = Robolectric.setupActivity(Activity::class.java) - - videoPlayerIntentUtils.playVideo(activity, mockVideoContentInfo, false) - - Assertions.assertThat(videoQueue).isEmpty() - assertThat(ShadowToast.getLatestToast()).isNotNull - } - @Test fun playVideoUsingInternalPlayerWhenExternalPlayerIsFalse() { videoQueue.add(mockVideoContentInfo) - doReturn(false).whenever(mockSharedPreferences).getBoolean("external_player", false) activity = Robolectric.setupActivity(Activity::class.java) @@ -118,43 +65,4 @@ class VideoPlayerIntentUtilsTest : InjectingTest() { assertThat(shadowActivity.nextStartedActivity).isNotNull.hasComponent(activity, ExoplayerVideoActivity::class.java) } - @Test fun playVideosFromQueueWhenNotEmpty() { - videoQueue.add(mockVideoContentInfo) - doReturn(false).whenever(mockSharedPreferences).getBoolean("external_player", false) - - activity = Robolectric.setupActivity(Activity::class.java) - - videoPlayerIntentUtils.playAllFromQueue(activity) - - val shadowActivity = shadowOf(activity) - assertThat(shadowActivity.nextStartedActivity).isNotNull.hasComponent(activity, ExoplayerVideoActivity::class.java) - } - - @Test fun playVideosFromQueueWhenNotEmptyLaunchesExternalPlayer() { - videoQueue.add(mockVideoContentInfo) - doReturn(true).whenever(mockSharedPreferences).getBoolean("external_player", false) - doReturn(true).whenever(mockSharedPreferences).getBoolean("external_player_continuous_playback", false) - doReturn("http://www.example.com/example.mkv").whenever(mockVideoContentInfo).directPlayUrl - - activity = Robolectric.setupActivity(Activity::class.java) - - videoPlayerIntentUtils.playAllFromQueue(activity) - - val shadowActivity = shadowOf(activity) - assertThat(shadowActivity.nextStartedActivity).isNotNull - } - - @Test fun playVideosFromQueueWhenNotEmptyShowsToastWhenExternalPlayerDoesNotSupportContinuousPlayback() { - videoQueue.add(mockVideoContentInfo) - doReturn(true).whenever(mockSharedPreferences).getBoolean("external_player", false) - doReturn(false).whenever(mockSharedPreferences).getBoolean("external_player_continuous_playback", false) - - activity = Robolectric.setupActivity(Activity::class.java) - - videoPlayerIntentUtils.playAllFromQueue(activity) - - assertThat(ShadowToast.getLatestToast()).isNotNull - } - - } \ No newline at end of file diff --git a/serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerVideoActivityTest.kt b/serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerVideoActivityTest.kt index d4a73dd92..b3882f72b 100644 --- a/serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerVideoActivityTest.kt +++ b/serenity-app/src/test/kotlin/us/nineworlds/serenity/ui/video/player/ExoplayerVideoActivityTest.kt @@ -8,7 +8,6 @@ import com.google.android.exoplayer2.source.MediaSource import com.google.android.exoplayer2.trackselection.TrackSelectionArray import com.google.android.exoplayer2.trackselection.TrackSelector import com.google.android.exoplayer2.upstream.DataSource -import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter import com.nhaarman.mockitokotlin2.anyOrNull import com.nhaarman.mockitokotlin2.whenever import org.assertj.android.api.Assertions