-
-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move useExternalPlayer and getPlaybackActivityClass functions to new …
…PlaybackLauncher interface (#1064) * Move useExternalPlayer and getPlaybackActivityClass functions to new PlaybackLauncher interface * Add toggle to enable new playback module * Add BuildConfig.DEVELOPMENT
- Loading branch information
1 parent
5177800
commit fe75e4b
Showing
13 changed files
with
125 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/src/main/java/org/jellyfin/androidtv/ui/playback/PlaybackLauncher.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<out Activity> | ||
} | ||
|
||
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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.