Skip to content

Commit

Permalink
4.8.0 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Apr 13, 2024
1 parent 26115b4 commit 1f8bb95
Show file tree
Hide file tree
Showing 30 changed files with 1,123 additions and 735 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ Even so, the database remains backward compatible, and AntennaPod's db can be ea
* enabled intro- and end- skipping
* mark as played when finished
* streamed media is added to queue and is resumed after restart
* new video episode view, with video player on top and episode descriptions in portrait mode
* easy switches on video player to other video mode or audio only
* default video player mode setting in preferences
* when video mode is set to audio only, click on image on audio player on a video episode brings up the normal player detailed view

### Podcast/Episode list

Expand Down
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ android {
// Version code schema (not used):
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
versionCode 3020129
versionName "4.7.1"
versionCode 3020130
versionName "4.8.0"

def commit = ""
try {
Expand Down Expand Up @@ -238,6 +238,7 @@ dependencies {
implementation "androidx.work:work-runtime:2.9.0"
implementation "androidx.core:core-splashscreen:1.0.1"
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.webkit:webkit:1.9.0'

implementation "com.google.android.material:material:1.11.0"

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,12 @@
android:value="ac.mdiq.podcini.ui.activity.PreferenceActivity"/>
</activity>

<!-- android:screenOrientation="sensorLandscape"-->

<activity
android:name=".ui.activity.VideoplayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:supportsPictureInPicture="true"
android:screenOrientation="sensorLandscape"
android:exported="false">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ abstract class PlaybackController(private val activity: FragmentActivity) {
}
}

fun ensureService() {
if (media == null) return
if (playbackService == null) {
PlaybackServiceStarter(activity, media!!).start()
Log.w(TAG, "playbackservice was null, restarted!")
}
}

fun playPause() {
if (media == null) return
if (playbackService == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,7 @@ class PlaybackService : MediaBrowserServiceCompat() {
mediaPlayer?.setPlaybackParams(speed, isSkipSilence)
} else {
if (codeArray != null && codeArray.size == 3) {
Log.d(TAG, "setSpeed codeArray: ${codeArray[0]} ${codeArray[1]} ${codeArray[2]}")
if (codeArray[2]) setPlaybackSpeed(speed)
if (codeArray[1]) {
var item = (playable as? FeedMedia)?.item ?: currentitem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,21 @@ class PlaybackServiceNotificationBuilder(private val context: Context) {
val iconSize = (128 * context.resources.displayMetrics.density).toInt()
val options = RequestOptions().centerCrop()
try {
var imgLoc = playable?.getImageLocation()
when {
!imgLoc.isNullOrBlank() -> {
cachedIcon = Glide.with(context)
.asBitmap()
.load(imgLoc)
.apply(options)
.submit(iconSize, iconSize)
.get()
}
playable != null -> {
imgLoc = ImageResourceUtils.getFallbackImageLocation(playable!!)
if (!imgLoc.isNullOrBlank()) {
cachedIcon = Glide.with(context)
.asBitmap()
.load(imgLoc)
.apply(options)
.submit(iconSize, iconSize)
.get()
}
}
}
val imgLoc = playable?.getImageLocation()
val imgLoc1 = ImageResourceUtils.getFallbackImageLocation(playable!!)
Log.d(TAG, "loadIcon imgLoc $imgLoc $imgLoc1")
cachedIcon = Glide.with(context)
.asBitmap()
.load(imgLoc)
.error(Glide.with(context)
.asBitmap()
.load(imgLoc1)
.apply(options)
.submit(iconSize, iconSize)
.get())
.apply(options)
.submit(iconSize, iconSize)
.get()
} catch (ignore: InterruptedException) {
Log.e(TAG, "Media icon loader was interrupted")
} catch (tr: Throwable) {
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/java/ac/mdiq/podcini/preferences/UserPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ object UserPreferences {
private const val PREF_FAST_FORWARD_SECS = "prefFastForwardSecs"
private const val PREF_REWIND_SECS = "prefRewindSecs"
private const val PREF_QUEUE_LOCKED = "prefQueueLocked"
private const val PREF_VIDEO_MODE = "prefVideoPlaybackMode"

// Experimental
const val EPISODE_CLEANUP_QUEUE: Int = -1
Expand Down Expand Up @@ -410,6 +411,17 @@ object UserPreferences {
}
}

val videoPlayMode: Int
get() {
try {
return prefs.getString(PREF_VIDEO_MODE, "1")!!.toInt()
} catch (e: NumberFormatException) {
Log.e(TAG, Log.getStackTraceString(e))
setVideoMode(1)
return 1
}
}

@JvmStatic
var videoPlaybackSpeed: Float
get() {
Expand Down Expand Up @@ -661,6 +673,13 @@ object UserPreferences {
.apply()
}

@JvmStatic
fun setVideoMode(mode: Int) {
prefs.edit()
.putString(PREF_VIDEO_MODE, mode.toString())
.apply()
}

@JvmStatic
fun setAutodownloadSelectedNetworks(value: Array<String?>?) {
prefs.edit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import ac.mdiq.podcini.preferences.UsageStatistics
import ac.mdiq.podcini.preferences.UsageStatistics.doNotAskAgain
import ac.mdiq.podcini.preferences.UserPreferences
import ac.mdiq.podcini.ui.activity.PreferenceActivity
import ac.mdiq.podcini.ui.dialog.EditFallbackSpeedDialog
import ac.mdiq.podcini.ui.dialog.EditForwardSpeedDialog
import ac.mdiq.podcini.ui.dialog.SkipPreferenceDialog
import ac.mdiq.podcini.ui.dialog.VariableSpeedDialog
import ac.mdiq.podcini.ui.dialog.*
import ac.mdiq.podcini.util.event.UnreadItemsUpdateEvent
import android.app.Activity
import android.os.Build
Expand Down Expand Up @@ -47,6 +44,12 @@ class PlaybackPreferencesFragment : PreferenceFragmentCompat() {
SkipPreferenceDialog.showSkipPreference(requireContext(), SkipPreferenceDialog.SkipDirection.SKIP_REWIND, null)
true
}
findPreference<Preference>(PREF_PLAYBACK_VIDEO_MODE_LAUNCHER)?.onPreferenceClickListener =
Preference.OnPreferenceClickListener {
VideoModeDialog.showDialog(requireContext())
true
}

findPreference<Preference>(PREF_PLAYBACK_SPEED_FORWARD_LAUNCHER)!!.onPreferenceClickListener =
Preference.OnPreferenceClickListener {
EditForwardSpeedDialog(requireActivity()).show()
Expand Down Expand Up @@ -138,5 +141,6 @@ class PlaybackPreferencesFragment : PreferenceFragmentCompat() {
private const val PREF_PLAYBACK_SPEED_FORWARD_LAUNCHER = "prefPlaybackSpeedForwardLauncher"
private const val PREF_PLAYBACK_FAST_FORWARD_DELTA_LAUNCHER = "prefPlaybackFastForwardDeltaLauncher"
private const val PREF_PLAYBACK_PREFER_STREAMING = "prefStreamOverDownload"
private const val PREF_PLAYBACK_VIDEO_MODE_LAUNCHER = "prefPlaybackVideoModeLauncher"
}
}
3 changes: 3 additions & 0 deletions app/src/main/java/ac/mdiq/podcini/ui/activity/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ class MainActivity : CastEnabledActivity() {
}
override fun onSlide(view: View, slideOffset: Float) {
val audioPlayer = supportFragmentManager.findFragmentByTag(AudioPlayerFragment.TAG) as? AudioPlayerFragment ?: return
// if (slideOffset == 0.0f) { //STATE_COLLAPSED
// audioPlayer.scrollToTop()
// }
audioPlayer.fadePlayerToToolbar(slideOffset)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PlaybackSpeedDialogActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
setTheme(getTranslucentTheme(this))
super.onCreate(savedInstanceState)
val speedDialog: VariableSpeedDialog? = VariableSpeedDialog.newInstance(booleanArrayOf(false, false, true), 2)
val speedDialog: VariableSpeedDialog? = VariableSpeedDialog.newInstance(booleanArrayOf(true, true, true), 2)
speedDialog?.show(supportFragmentManager, null)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,13 @@ class SelectSubscriptionActivity : AppCompatActivity() {
.apply(RequestOptions.overrideOf(iconSize, iconSize))
.listener(object : RequestListener<Bitmap?> {
@UnstableApi override fun onLoadFailed(e: GlideException?, model: Any?,
target: Target<Bitmap?>, isFirstResource: Boolean
): Boolean {
target: Target<Bitmap?>, isFirstResource: Boolean): Boolean {
addShortcut(feed, null)
return true
}

@UnstableApi override fun onResourceReady(resource: Bitmap, model: Any,
target: Target<Bitmap?>, dataSource: DataSource, isFirstResource: Boolean
): Boolean {
target: Target<Bitmap?>, dataSource: DataSource, isFirstResource: Boolean): Boolean {
addShortcut(feed, resource)
return true
}
Expand Down
Loading

0 comments on commit 1f8bb95

Please sign in to comment.