diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bac13f8fbd..8a3ca4120f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -39,6 +39,8 @@ android { // Set flavored application name resValue("string", "app_name", "@string/app_name_release") + + buildConfigField("boolean", "DEVELOPMENT", "false") } val debug by getting { @@ -50,6 +52,8 @@ android { // Set flavored application name resValue("string", "app_name", "@string/app_name_debug") + + buildConfigField("boolean", "DEVELOPMENT", (defaultConfig.versionCode!! < 100).toString()) } } diff --git a/app/src/main/java/org/jellyfin/androidtv/TvApp.java b/app/src/main/java/org/jellyfin/androidtv/TvApp.java index e6246248b7..af8e5f7ed6 100644 --- a/app/src/main/java/org/jellyfin/androidtv/TvApp.java +++ b/app/src/main/java/org/jellyfin/androidtv/TvApp.java @@ -1,5 +1,7 @@ package org.jellyfin.androidtv; +import static org.koin.java.KoinJavaComponent.inject; + import android.app.Activity; import android.app.Application; @@ -8,17 +10,12 @@ import androidx.lifecycle.LiveData; import androidx.lifecycle.MediatorLiveData; -import org.jellyfin.androidtv.preference.UserPreferences; -import org.jellyfin.androidtv.preference.constant.PreferredVideoPlayer; import org.jellyfin.androidtv.ui.livetv.TvManager; -import org.jellyfin.androidtv.ui.playback.ExternalPlayerActivity; import org.jellyfin.androidtv.ui.playback.PlaybackController; -import org.jellyfin.androidtv.ui.playback.PlaybackOverlayActivity; import org.jellyfin.apiclient.interaction.ApiClient; import org.jellyfin.apiclient.interaction.EmptyResponse; import org.jellyfin.apiclient.interaction.Response; import org.jellyfin.apiclient.model.dto.BaseItemDto; -import org.jellyfin.apiclient.model.dto.BaseItemType; import org.jellyfin.apiclient.model.dto.UserDto; import org.jellyfin.apiclient.model.entities.DisplayPreferences; @@ -27,8 +24,6 @@ import kotlin.Lazy; import timber.log.Timber; -import static org.koin.java.KoinJavaComponent.inject; - public class TvApp extends Application { public static final String DISPLAY_PREFS_APP_NAME = "ATV"; @@ -48,7 +43,6 @@ public class TvApp extends Application { private Activity currentActivity; private Lazy apiClient = inject(ApiClient.class); - private Lazy userPreferences = inject(UserPreferences.class); @Override public void onCreate() { @@ -102,27 +96,6 @@ public void setPlaybackController(PlaybackController playbackController) { this.playbackController = playbackController; } - public boolean useExternalPlayer(BaseItemType itemType) { - switch (itemType) { - case Movie: - case Episode: - case Video: - case Series: - case Recording: - return userPreferences.getValue().get(UserPreferences.Companion.getVideoPlayer()) == PreferredVideoPlayer.EXTERNAL; - case TvChannel: - case Program: - return userPreferences.getValue().get(UserPreferences.Companion.getLiveTvVideoPlayer()) == PreferredVideoPlayer.EXTERNAL; - default: - return false; - } - } - - @NonNull - public Class getPlaybackActivityClass(BaseItemType itemType) { - return useExternalPlayer(itemType) ? ExternalPlayerActivity.class : PlaybackOverlayActivity.class; - } - @NonNull public boolean canManageRecordings() { UserDto currentUser = getCurrentUser(); diff --git a/app/src/main/java/org/jellyfin/androidtv/data/eventhandling/TvApiEventListener.java b/app/src/main/java/org/jellyfin/androidtv/data/eventhandling/TvApiEventListener.java index 9d459d8fb9..d3ec210c02 100644 --- a/app/src/main/java/org/jellyfin/androidtv/data/eventhandling/TvApiEventListener.java +++ b/app/src/main/java/org/jellyfin/androidtv/data/eventhandling/TvApiEventListener.java @@ -1,5 +1,7 @@ package org.jellyfin.androidtv.data.eventhandling; +import static org.koin.java.KoinJavaComponent.get; + import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -14,6 +16,7 @@ import org.jellyfin.androidtv.ui.itemhandling.ItemLauncher; import org.jellyfin.androidtv.ui.playback.MediaManager; import org.jellyfin.androidtv.ui.playback.PlaybackController; +import org.jellyfin.androidtv.ui.playback.PlaybackLauncher; import org.jellyfin.androidtv.ui.playback.PlaybackOverlayActivity; import org.jellyfin.androidtv.util.Utils; import org.jellyfin.androidtv.util.apiclient.PlaybackHelper; @@ -34,8 +37,6 @@ import timber.log.Timber; -import static org.koin.java.KoinJavaComponent.get; - public class TvApiEventListener extends ApiEventListener { private final DataRefreshService dataRefreshService; private final MediaManager mediaManager; @@ -179,8 +180,9 @@ public void onResponse(ItemsResult response) { //peek at first item to see what type it is switch (response.getItems()[0].getMediaType()) { case "Video": + Class activity = get(PlaybackLauncher.class).getPlaybackActivityClass(response.getItems()[0].getBaseItemType()); mediaManager.setCurrentVideoQueue(Arrays.asList(response.getItems())); - Intent intent = new Intent(TvApp.getApplication().getCurrentActivity(), TvApp.getApplication().getPlaybackActivityClass(response.getItems()[0].getBaseItemType())); + Intent intent = new Intent(TvApp.getApplication().getCurrentActivity(), activity); TvApp.getApplication().getCurrentActivity().startActivity(intent); break; case "Audio": diff --git a/app/src/main/java/org/jellyfin/androidtv/di/PlaybackModule.kt b/app/src/main/java/org/jellyfin/androidtv/di/PlaybackModule.kt index 424495f5fd..190dc8f4ed 100644 --- a/app/src/main/java/org/jellyfin/androidtv/di/PlaybackModule.kt +++ b/app/src/main/java/org/jellyfin/androidtv/di/PlaybackModule.kt @@ -1,6 +1,10 @@ package org.jellyfin.androidtv.di +import org.jellyfin.androidtv.BuildConfig +import org.jellyfin.androidtv.preference.UserPreferences +import org.jellyfin.androidtv.ui.playback.GarbagePlaybackLauncher import org.jellyfin.androidtv.ui.playback.PlaybackManager +import org.jellyfin.androidtv.ui.playback.RewritePlaybackLauncher import org.jellyfin.apiclient.interaction.AndroidDevice import org.jellyfin.apiclient.logging.AndroidLogger import org.koin.android.ext.koin.androidApplication @@ -13,4 +17,13 @@ val playbackModule = module { AndroidLogger("PlaybackManager") ) } + + factory { + val preferences = get() + val useRewrite = preferences[UserPreferences.playbackRewriteEnabled] && BuildConfig.DEVELOPMENT + + // TODO Inject PlaybackLauncher for playback rewrite here + if (useRewrite) RewritePlaybackLauncher() + else GarbagePlaybackLauncher(get()) + } } diff --git a/app/src/main/java/org/jellyfin/androidtv/preference/UserPreferences.kt b/app/src/main/java/org/jellyfin/androidtv/preference/UserPreferences.kt index 2cde018f8d..e679b2939a 100644 --- a/app/src/main/java/org/jellyfin/androidtv/preference/UserPreferences.kt +++ b/app/src/main/java/org/jellyfin/androidtv/preference/UserPreferences.kt @@ -43,11 +43,6 @@ class UserPreferences(context: Context) : SharedPreferenceStore( */ var seasonalGreetingsEnabled = Preference.boolean("pref_enable_themes", true) - /** - * Show additional debug information - */ - var debuggingEnabled = Preference.boolean("pref_enable_debug", false) - /* Playback - General*/ /** * Maximum bitrate in megabit for playback. A value of [MAX_BITRATE_AUTO] is used when @@ -139,6 +134,17 @@ class UserPreferences(context: Context) : SharedPreferenceStore( */ var shortcutSubtitleTrack = Preference.int("shortcut_subtitle_track", KeyEvent.KEYCODE_CAPTIONS) + /* Developer options */ + /** + * Show additional debug information + */ + var debuggingEnabled = Preference.boolean("pref_enable_debug", false) + + /** + * Use playback rewrite module + */ + var playbackRewriteEnabled = Preference.boolean("playback_new", false) + /* ACRA */ /** * Enable ACRA crash reporting diff --git a/app/src/main/java/org/jellyfin/androidtv/ui/itemdetail/FullDetailsActivity.java b/app/src/main/java/org/jellyfin/androidtv/ui/itemdetail/FullDetailsActivity.java index a725f91321..dd1c5fdb9d 100644 --- a/app/src/main/java/org/jellyfin/androidtv/ui/itemdetail/FullDetailsActivity.java +++ b/app/src/main/java/org/jellyfin/androidtv/ui/itemdetail/FullDetailsActivity.java @@ -1,5 +1,8 @@ package org.jellyfin.androidtv.ui.itemdetail; +import static org.koin.java.KoinJavaComponent.get; +import static org.koin.java.KoinJavaComponent.inject; + import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; @@ -53,6 +56,7 @@ import org.jellyfin.androidtv.ui.livetv.TvManager; import org.jellyfin.androidtv.ui.playback.ExternalPlayerActivity; import org.jellyfin.androidtv.ui.playback.MediaManager; +import org.jellyfin.androidtv.ui.playback.PlaybackLauncher; import org.jellyfin.androidtv.ui.presentation.CardPresenter; import org.jellyfin.androidtv.ui.presentation.CustomListRowPresenter; import org.jellyfin.androidtv.ui.presentation.InfoCardPresenter; @@ -104,9 +108,6 @@ import kotlin.Lazy; import timber.log.Timber; -import static org.koin.java.KoinJavaComponent.get; -import static org.koin.java.KoinJavaComponent.inject; - public class FullDetailsActivity extends BaseActivity implements IRecordingIndicatorView { private int BUTTON_SIZE; @@ -1566,7 +1567,8 @@ public void onResponse(List response) { if (item.getBaseItemType() == BaseItemType.MusicArtist) { mediaManager.getValue().playNow(response); } else { - Intent intent = new Intent(FullDetailsActivity.this, TvApp.getApplication().getPlaybackActivityClass(item.getBaseItemType())); + Class activity = get(PlaybackLauncher.class).getPlaybackActivityClass(item.getBaseItemType()); + Intent intent = new Intent(FullDetailsActivity.this, activity); mediaManager.getValue().setCurrentVideoQueue(response); intent.putExtra("Position", pos); startActivity(intent); @@ -1578,7 +1580,8 @@ public void onResponse(List response) { protected void play(final BaseItemDto[] items, final int pos, final boolean shuffle) { List itemsToPlay = Arrays.asList(items); - Intent intent = new Intent(this, TvApp.getApplication().getPlaybackActivityClass(items[0].getBaseItemType())); + Class activity = get(PlaybackLauncher.class).getPlaybackActivityClass(items[0].getBaseItemType()); + Intent intent = new Intent(this, activity); if (shuffle) Collections.shuffle(itemsToPlay); mediaManager.getValue().setCurrentVideoQueue(itemsToPlay); intent.putExtra("Position", pos); diff --git a/app/src/main/java/org/jellyfin/androidtv/ui/itemdetail/ItemListActivity.java b/app/src/main/java/org/jellyfin/androidtv/ui/itemdetail/ItemListActivity.java index 901cbcc566..20bc884ec4 100644 --- a/app/src/main/java/org/jellyfin/androidtv/ui/itemdetail/ItemListActivity.java +++ b/app/src/main/java/org/jellyfin/androidtv/ui/itemdetail/ItemListActivity.java @@ -1,5 +1,8 @@ package org.jellyfin.androidtv.ui.itemdetail; +import static org.koin.java.KoinJavaComponent.get; +import static org.koin.java.KoinJavaComponent.inject; + import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; @@ -38,6 +41,7 @@ import org.jellyfin.androidtv.ui.playback.AudioEventListener; import org.jellyfin.androidtv.ui.playback.MediaManager; import org.jellyfin.androidtv.ui.playback.PlaybackController; +import org.jellyfin.androidtv.ui.playback.PlaybackLauncher; import org.jellyfin.androidtv.util.ImageUtils; import org.jellyfin.androidtv.util.InfoLayoutHelper; import org.jellyfin.androidtv.util.MathUtils; @@ -65,8 +69,6 @@ import kotlin.Lazy; import timber.log.Timber; -import static org.koin.java.KoinJavaComponent.inject; - public class ItemListActivity extends FragmentActivity { private int BUTTON_SIZE; public static final String FAV_SONGS = "FAV_SONGS"; @@ -510,7 +512,8 @@ private void addGenres(TextView textView) { private void play(List items) { if ("Video".equals(mBaseItem.getMediaType())) { - Intent intent = new Intent(mActivity, TvApp.getApplication().getPlaybackActivityClass(mBaseItem.getBaseItemType())); + Class activity = get(PlaybackLauncher.class).getPlaybackActivityClass(mBaseItem.getBaseItemType()); + Intent intent = new Intent(mActivity, activity); //Resume first item if needed BaseItemDto first = items.size() > 0 ? items.get(0) : null; if (first != null && first.getUserData() != null) { diff --git a/app/src/main/java/org/jellyfin/androidtv/ui/itemhandling/ItemLauncher.java b/app/src/main/java/org/jellyfin/androidtv/ui/itemhandling/ItemLauncher.java index 42b4a2d566..6286b91d2f 100644 --- a/app/src/main/java/org/jellyfin/androidtv/ui/itemhandling/ItemLauncher.java +++ b/app/src/main/java/org/jellyfin/androidtv/ui/itemhandling/ItemLauncher.java @@ -25,6 +25,7 @@ import org.jellyfin.androidtv.ui.itemdetail.PhotoPlayerActivity; import org.jellyfin.androidtv.ui.livetv.LiveTvGuideActivity; import org.jellyfin.androidtv.ui.playback.MediaManager; +import org.jellyfin.androidtv.ui.playback.PlaybackLauncher; import org.jellyfin.androidtv.util.KeyProcessor; import org.jellyfin.androidtv.util.Utils; import org.jellyfin.androidtv.util.apiclient.PlaybackHelper; @@ -219,7 +220,8 @@ public void onResponse(DisplayPreferences response) { PlaybackHelper.getItemsToPlay(baseItem, baseItem.getBaseItemType() == BaseItemType.Movie, false, new Response>() { @Override public void onResponse(List response) { - Intent intent = new Intent(activity, TvApp.getApplication().getPlaybackActivityClass(baseItem.getBaseItemType())); + Class newActivity = get(PlaybackLauncher.class).getPlaybackActivityClass(baseItem.getBaseItemType()); + Intent intent = new Intent(activity, newActivity); get(MediaManager.class).setCurrentVideoQueue(response); intent.putExtra("Position", 0); activity.startActivity(intent); @@ -252,7 +254,8 @@ public void onResponse(BaseItemDto response) { List items = new ArrayList<>(); items.add(response); get(MediaManager.class).setCurrentVideoQueue(items); - Intent intent = new Intent(activity, TvApp.getApplication().getPlaybackActivityClass(response.getBaseItemType())); + Class newActivity = get(PlaybackLauncher.class).getPlaybackActivityClass(response.getBaseItemType()); + Intent intent = new Intent(activity, newActivity); Long start = chapter.getStartPositionTicks() / 10000; intent.putExtra("Position", start.intValue()); activity.startActivity(intent); @@ -326,7 +329,8 @@ public void onError(Exception exception) { public void onResponse(BaseItemDto response) { List items = new ArrayList<>(); items.add(response); - Intent intent = new Intent(activity, TvApp.getApplication().getPlaybackActivityClass(response.getBaseItemType())); + Class newActivity = get(PlaybackLauncher.class).getPlaybackActivityClass(response.getBaseItemType()); + Intent intent = new Intent(activity, newActivity); get(MediaManager.class).setCurrentVideoQueue(items); intent.putExtra("Position", 0); activity.startActivity(intent); @@ -349,7 +353,8 @@ public void onResponse(BaseItemDto response) { @Override public void onResponse(List response) { // TODO Check whether this usage of BaseItemType.valueOf is okay. - Intent intent = new Intent(activity, TvApp.getApplication().getPlaybackActivityClass(BaseItemType.valueOf(channel.getType()))); + Class newActivity = get(PlaybackLauncher.class).getPlaybackActivityClass(BaseItemType.valueOf(channel.getType())); + Intent intent = new Intent(activity, newActivity); get(MediaManager.class).setCurrentVideoQueue(response); intent.putExtra("Position", 0); activity.startActivity(intent); @@ -376,7 +381,8 @@ public void onResponse(List response) { get(ApiClient.class).GetItemAsync(rowItem.getRecordingInfo().getId(), TvApp.getApplication().getCurrentUser().getId(), new Response() { @Override public void onResponse(BaseItemDto response) { - Intent intent = new Intent(activity, TvApp.getApplication().getPlaybackActivityClass(rowItem.getBaseItemType())); + Class newActivity = get(PlaybackLauncher.class).getPlaybackActivityClass(rowItem.getBaseItemType()); + Intent intent = new Intent(activity, newActivity); List items = new ArrayList<>(); items.add(response); get(MediaManager.class).setCurrentVideoQueue(items); diff --git a/app/src/main/java/org/jellyfin/androidtv/ui/playback/PlaybackLauncher.kt b/app/src/main/java/org/jellyfin/androidtv/ui/playback/PlaybackLauncher.kt new file mode 100644 index 0000000000..43ead5e2c6 --- /dev/null +++ b/app/src/main/java/org/jellyfin/androidtv/ui/playback/PlaybackLauncher.kt @@ -0,0 +1,39 @@ +package org.jellyfin.androidtv.ui.playback + +import android.app.Activity +import org.jellyfin.androidtv.preference.UserPreferences +import org.jellyfin.androidtv.preference.constant.PreferredVideoPlayer +import org.jellyfin.apiclient.model.dto.BaseItemType + +interface PlaybackLauncher { + fun useExternalPlayer(itemType: BaseItemType?): Boolean + fun getPlaybackActivityClass(itemType: BaseItemType?): Class +} + +class GarbagePlaybackLauncher( + private val userPreferences: UserPreferences +) : PlaybackLauncher { + override fun useExternalPlayer(itemType: BaseItemType?) = when (itemType) { + BaseItemType.Movie, + BaseItemType.Episode, + BaseItemType.Video, + BaseItemType.Series, + BaseItemType.Recording, + -> userPreferences[UserPreferences.videoPlayer] === PreferredVideoPlayer.EXTERNAL + BaseItemType.TvChannel, + BaseItemType.Program, + -> userPreferences[UserPreferences.liveTvVideoPlayer] === PreferredVideoPlayer.EXTERNAL + else -> false + } + + override fun getPlaybackActivityClass(itemType: BaseItemType?) = when { + useExternalPlayer(itemType) -> ExternalPlayerActivity::class.java + else -> PlaybackOverlayActivity::class.java + } +} + +// TODO: Move to playback module +class RewritePlaybackLauncher : PlaybackLauncher { + override fun useExternalPlayer(itemType: BaseItemType?) = false + override fun getPlaybackActivityClass(itemType: BaseItemType?) = TODO("Not yet implemented") +} diff --git a/app/src/main/java/org/jellyfin/androidtv/ui/preference/screen/DeveloperPreferencesScreen.kt b/app/src/main/java/org/jellyfin/androidtv/ui/preference/screen/DeveloperPreferencesScreen.kt index 8602567c68..63eeb1b559 100644 --- a/app/src/main/java/org/jellyfin/androidtv/ui/preference/screen/DeveloperPreferencesScreen.kt +++ b/app/src/main/java/org/jellyfin/androidtv/ui/preference/screen/DeveloperPreferencesScreen.kt @@ -1,5 +1,6 @@ package org.jellyfin.androidtv.ui.preference.screen +import org.jellyfin.androidtv.BuildConfig import org.jellyfin.androidtv.R import org.jellyfin.androidtv.preference.UserPreferences import org.jellyfin.androidtv.ui.preference.dsl.OptionsFragment @@ -21,6 +22,16 @@ class DeveloperPreferencesScreen : OptionsFragment() { setContent(R.string.desc_debug) bind(userPreferences, UserPreferences.debuggingEnabled) } + + // Only show in debug mode + if (BuildConfig.DEVELOPMENT) { + checkbox { + setTitle(R.string.enable_playback_module_title) + setContent(R.string.enable_playback_module_description) + + bind(userPreferences, UserPreferences.playbackRewriteEnabled) + } + } } } } diff --git a/app/src/main/java/org/jellyfin/androidtv/util/KeyProcessor.java b/app/src/main/java/org/jellyfin/androidtv/util/KeyProcessor.java index 7cfc0955f7..2b483b78b2 100644 --- a/app/src/main/java/org/jellyfin/androidtv/util/KeyProcessor.java +++ b/app/src/main/java/org/jellyfin/androidtv/util/KeyProcessor.java @@ -1,5 +1,7 @@ package org.jellyfin.androidtv.util; +import static org.koin.java.KoinJavaComponent.get; + import android.app.Activity; import android.content.Intent; import android.view.Gravity; @@ -18,6 +20,7 @@ import org.jellyfin.androidtv.ui.itemhandling.BaseRowItem; import org.jellyfin.androidtv.ui.playback.AudioNowPlayingActivity; import org.jellyfin.androidtv.ui.playback.MediaManager; +import org.jellyfin.androidtv.ui.playback.PlaybackLauncher; import org.jellyfin.androidtv.ui.shared.BaseActivity; import org.jellyfin.androidtv.util.apiclient.BaseItemUtils; import org.jellyfin.androidtv.util.apiclient.PlaybackHelper; @@ -34,8 +37,6 @@ import timber.log.Timber; -import static org.koin.java.KoinJavaComponent.get; - public class KeyProcessor { public static final int MENU_MARK_FAVORITE = 0; @@ -153,7 +154,8 @@ public static boolean HandleKey(int key, BaseRowItem rowItem, Activity activity) if (rowItem.getGridButton().getId() == TvApp.VIDEO_QUEUE_OPTION_ID) { //Queue already there - just kick off playback BaseItemType itemType = get(MediaManager.class).getCurrentVideoQueue().size() > 0 ? get(MediaManager.class).getCurrentVideoQueue().get(0).getBaseItemType() : null; - Intent intent = new Intent(activity, TvApp.getApplication().getPlaybackActivityClass(itemType)); + Class newActivity = get(PlaybackLauncher.class).getPlaybackActivityClass(itemType); + Intent intent = new Intent(activity, newActivity); activity.startActivity(intent); } break; diff --git a/app/src/main/java/org/jellyfin/androidtv/util/apiclient/PlaybackHelper.java b/app/src/main/java/org/jellyfin/androidtv/util/apiclient/PlaybackHelper.java index 0f354c6d5b..0bd840351f 100644 --- a/app/src/main/java/org/jellyfin/androidtv/util/apiclient/PlaybackHelper.java +++ b/app/src/main/java/org/jellyfin/androidtv/util/apiclient/PlaybackHelper.java @@ -1,5 +1,7 @@ package org.jellyfin.androidtv.util.apiclient; +import static org.koin.java.KoinJavaComponent.get; + import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -9,6 +11,7 @@ import org.jellyfin.androidtv.preference.UserPreferences; import org.jellyfin.androidtv.ui.itemdetail.ItemListActivity; import org.jellyfin.androidtv.ui.playback.MediaManager; +import org.jellyfin.androidtv.ui.playback.PlaybackLauncher; import org.jellyfin.androidtv.util.Utils; import org.jellyfin.apiclient.interaction.ApiClient; import org.jellyfin.apiclient.interaction.Response; @@ -32,8 +35,6 @@ import timber.log.Timber; -import static org.koin.java.KoinJavaComponent.get; - public class PlaybackHelper { private static final int ITEM_QUERY_LIMIT = 150; // limit the number of items retrieved for playback @@ -228,7 +229,7 @@ public void onResponse(ChannelInfoDto response) { break; default: - if (allowIntros && !TvApp.getApplication().useExternalPlayer(mainItem.getBaseItemType()) && get(UserPreferences.class).get(UserPreferences.Companion.getCinemaModeEnabled())) { + if (allowIntros && !get(PlaybackLauncher.class).useExternalPlayer(mainItem.getBaseItemType()) && get(UserPreferences.class).get(UserPreferences.Companion.getCinemaModeEnabled())) { //Intros get(ApiClient.class).GetIntrosAsync(mainItem.getId(), currentUser.getId(), new Response() { @Override @@ -274,7 +275,8 @@ public void onResponse(List response) { } else { BaseItemType itemType = response.size() > 0 ? response.get(0).getBaseItemType() : null; - Intent intent = new Intent(activity, TvApp.getApplication().getPlaybackActivityClass(itemType)); + Class newActivity = get(PlaybackLauncher.class).getPlaybackActivityClass(itemType); + Intent intent = new Intent(activity, newActivity); get(MediaManager.class).setCurrentVideoQueue(response); intent.putExtra("Position", pos); if (!(activity instanceof Activity)) @@ -289,7 +291,8 @@ public void onResponse(List response) { break; default: - Intent intent = new Intent(activity, TvApp.getApplication().getPlaybackActivityClass(item.getBaseItemType())); + Class newActivity = get(PlaybackLauncher.class).getPlaybackActivityClass(item.getBaseItemType()); + Intent intent = new Intent(activity, newActivity); get(MediaManager.class).setCurrentVideoQueue(response); intent.putExtra("Position", pos); if (!(activity instanceof Activity)) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index abff3e73d8..6dca897ad9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -436,4 +436,6 @@ 1 Song %1$s (%2$s) %1$s–%2$s + Enable new playback module + This is an experimental feature. No support is provided.