Skip to content

Commit

Permalink
feed search and swipe telltales etc
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Mar 21, 2024
1 parent d5b5734 commit e9c0e24
Show file tree
Hide file tree
Showing 95 changed files with 1,061 additions and 700 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ Version 4.1 brings a more convenient player control and tags enhancements, while

## Screenshots

<img src="./images/1_drawer1.jpg" width="238" /> <img src="./images/2_setting.jpg" width="238" /> <img src="./images/3_setting.jpg" width="238" />
<img src="./images/1_drawer.jpg" width="238" /> <img src="./images/2_setting.jpg" width="238" /> <img src="./images/2_setting1.jpg" width="238" />

<img src="./images/4_subscriptions.jpg" width="238" /> <img src="./images/5_queue.jpg" width="238" />
<img src="./images/3_subscriptions.jpg" width="238" /> <img src="./images/4_queue.jpg" width="238" />

<img src="./images/6_podcast.jpg" width="238" /> <img src="./images/7_podcast.jpg" width="238" /> <img src="./images/8_episode.jpg" width="238" />
<img src="./images/5_podcast.jpg" width="238" /> <img src="./images/5_podcast1.jpg" width="238" /> <img src="./images/6_episode.jpg" width="238" />

<img src="./images/9_speed.jpg" width="238" /> <img src="./images/10_player.jpg" width="238" />
<img src="./images/7_speed.jpg" width="238" /> <img src="./images/8_player.jpg" width="238" />

<img src="./images/9_swipe_setting.jpg" width="238" /> <img src="./images/9_swipe_setting1.jpg" width="238" /> <img src="./images/91_feed_search.jpg" width="238" />

## Changelogs

Expand Down
4 changes: 2 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 3020110
versionName "4.2.7"
versionCode 3020111
versionName "4.3.0"

def commit = ""
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,21 @@ import ac.mdiq.podcini.net.sync.gpoddernet.model.GpodnetPodcast
import de.mfietz.fyydlin.SearchHit
import org.json.JSONException
import org.json.JSONObject
import java.text.SimpleDateFormat
import java.util.*

class PodcastSearchResult private constructor(
/**
* The name of the podcast
*/
val title: String,
/**
* URL of the podcast image
*/
val imageUrl: String?,
/**
* URL of the podcast feed
*/
val feedUrl: String?,
/**
* artistName of the podcast feed
*/
val author: String?
val author: String?,
val count: Int?,
val update: String?,
val source: String
) {
companion object {
fun dummy(): PodcastSearchResult {
return PodcastSearchResult("", "", "", "")
return PodcastSearchResult("", "", "", "", 0, "", "dummy")
}

/**
Expand All @@ -39,7 +32,7 @@ class PodcastSearchResult private constructor(
val imageUrl: String? = json.optString("artworkUrl100").takeIf { it.isNotEmpty() }
val feedUrl: String? = json.optString("feedUrl").takeIf { it.isNotEmpty() }
val author: String? = json.optString("artistName").takeIf { it.isNotEmpty() }
return PodcastSearchResult(title, imageUrl, feedUrl, author)
return PodcastSearchResult(title, imageUrl, feedUrl, author, null, null, "Itunes")
}

/**
Expand Down Expand Up @@ -71,29 +64,31 @@ class PodcastSearchResult private constructor(
} catch (e: Exception) {
// Some feeds have empty artist
}
return PodcastSearchResult(title, imageUrl, feedUrl, author)
return PodcastSearchResult(title, imageUrl, feedUrl, author, null, null, "Toplist")
}

fun fromFyyd(searchHit: SearchHit): PodcastSearchResult {
return PodcastSearchResult(searchHit.title,
searchHit.thumbImageURL,
searchHit.xmlUrl,
searchHit.author)
return PodcastSearchResult(searchHit.title, searchHit.thumbImageURL, searchHit.xmlUrl, searchHit.author, null, null, "Fyyd")
}

fun fromGpodder(searchHit: GpodnetPodcast): PodcastSearchResult {
return PodcastSearchResult(searchHit.title,
searchHit.logoUrl,
searchHit.url,
searchHit.author)
return PodcastSearchResult(searchHit.title, searchHit.logoUrl, searchHit.url, searchHit.author, null, null, "GPodder")
}

fun fromPodcastIndex(json: JSONObject): PodcastSearchResult {
val title = json.optString("title", "")
val imageUrl: String? = json.optString("image").takeIf { it.isNotEmpty() }
val feedUrl: String? = json.optString("url").takeIf { it.isNotEmpty() }
val author: String? = json.optString("author").takeIf { it.isNotEmpty() }
return PodcastSearchResult(title, imageUrl, feedUrl, author)
var count: Int? = json.optInt("episodeCount", -1)
if (count != null && count < 0) count = null
val updateInt: Int = json.optInt("lastUpdateTime", -1)
var update: String? = null
if (updateInt > 0) {
val format = SimpleDateFormat("yyyy-MM-dd", Locale.US)
update = format.format(updateInt.toLong() * 1000)
}
return PodcastSearchResult(title, imageUrl, feedUrl, author, count, update, "PodcastIndex")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ class PlaybackPreferences private constructor() : OnSharedPreferenceChangeListen
@JvmStatic
fun init(context: Context) {
instance = PlaybackPreferences()
prefs = PreferenceManager.getDefaultSharedPreferences(
context!!)
prefs = PreferenceManager.getDefaultSharedPreferences(context)
prefs?.registerOnSharedPreferenceChangeListener(instance)
}

Expand Down Expand Up @@ -143,10 +142,9 @@ class PlaybackPreferences private constructor() : OnSharedPreferenceChangeListen
editor.putLong(PREF_CURRENTLY_PLAYING_MEDIA_TYPE, playable.getPlayableType().toLong())
editor.putBoolean(PREF_CURRENT_EPISODE_IS_VIDEO, playable.getMediaType() == MediaType.VIDEO)
if (playable is FeedMedia) {
val feedMedia = playable
val itemId = feedMedia.getItem()?.feed?.id
val itemId = playable.getItem()?.feed?.id
if (itemId != null) editor.putLong(PREF_CURRENTLY_PLAYING_FEED_ID, itemId)
editor.putLong(PREF_CURRENTLY_PLAYING_FEEDMEDIA_ID, feedMedia.id)
editor.putLong(PREF_CURRENTLY_PLAYING_FEEDMEDIA_ID, playable.id)
} else {
editor.putLong(PREF_CURRENTLY_PLAYING_FEED_ID, NO_MEDIA_PLAYING)
editor.putLong(PREF_CURRENTLY_PLAYING_FEEDMEDIA_ID, NO_MEDIA_PLAYING)
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/ac/mdiq/podcini/preferences/UserPreferences.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package ac.mdiq.podcini.preferences

import ac.mdiq.podcini.storage.model.download.ProxyConfig
import ac.mdiq.podcini.storage.model.feed.FeedCounter
import ac.mdiq.podcini.storage.model.feed.FeedPreferences.NewEpisodesAction
import ac.mdiq.podcini.storage.model.feed.SortOrder
import ac.mdiq.podcini.storage.model.feed.SubscriptionsFilter
import ac.mdiq.podcini.storage.model.playback.MediaType
import android.content.Context
import android.content.SharedPreferences
import android.os.Build
Expand All @@ -9,12 +15,6 @@ import android.view.KeyEvent
import androidx.annotation.VisibleForTesting
import androidx.core.app.NotificationCompat
import androidx.preference.PreferenceManager
import ac.mdiq.podcini.storage.model.download.ProxyConfig
import ac.mdiq.podcini.storage.model.feed.FeedCounter
import ac.mdiq.podcini.storage.model.feed.FeedPreferences.NewEpisodesAction
import ac.mdiq.podcini.storage.model.feed.SortOrder
import ac.mdiq.podcini.storage.model.feed.SubscriptionsFilter
import ac.mdiq.podcini.storage.model.playback.MediaType
import org.json.JSONArray
import org.json.JSONException
import java.io.File
Expand Down Expand Up @@ -847,7 +847,7 @@ object UserPreferences {
// prefs.edit().putString(PREF_INBOX_SORTED_ORDER, "" + sortOrder!!.code).apply()
// }

@JvmStatic
// @JvmStatic
var subscriptionsFilter: SubscriptionsFilter
get() {
val value = prefs.getString(PREF_FILTER_FEED, "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class ExoPlayerWrapper internal constructor(private val context: Context) {

@Throws(IllegalStateException::class)
fun prepare() {
if (mediaSource == null) return
exoPlayer.setMediaSource(mediaSource!!, false)
exoPlayer.prepare()
}
Expand Down Expand Up @@ -320,18 +321,12 @@ class ExoPlayerWrapper internal constructor(private val context: Context) {

val videoWidth: Int
get() {
if (exoPlayer.videoFormat == null) {
return 0
}
return exoPlayer.videoFormat!!.width
return exoPlayer.videoFormat?.width ?: 0
}

val videoHeight: Int
get() {
if (exoPlayer.videoFormat == null) {
return 0
}
return exoPlayer.videoFormat!!.height
return exoPlayer.videoFormat?.height ?: 0
}

fun setOnBufferingUpdateListener(bufferingUpdateListener: Consumer<Int>?) {
Expand Down
33 changes: 19 additions & 14 deletions app/src/main/java/ac/mdiq/podcini/service/playback/LocalPSMP.kt
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,27 @@ class LocalPSMP(context: Context, callback: PSMPCallback) : PlaybackServiceMedia
callback.onMediaChanged(false)
// TODO: speed
setPlaybackParams(PlaybackSpeedUtils.getCurrentPlaybackSpeed(media), UserPreferences.isSkipSilence)
if (stream) {
if (media!!.getStreamUrl() != null) {
if (playable is FeedMedia && playable.getItem()?.feed?.preferences != null) {
val preferences = playable.getItem()!!.feed!!.preferences!!
mediaPlayer?.setDataSource(
media!!.getStreamUrl()!!,
preferences.username,
preferences.password)
} else {
mediaPlayer?.setDataSource(media!!.getStreamUrl()!!)
when {
stream -> {
val streamurl = media!!.getStreamUrl()
if (streamurl != null) {
if (playable is FeedMedia && playable.getItem()?.feed?.preferences != null) {
val preferences = playable.getItem()!!.feed!!.preferences!!
mediaPlayer?.setDataSource(
streamurl,
preferences.username,
preferences.password)
} else {
mediaPlayer?.setDataSource(streamurl)
}
}
}
} else if (media!!.getLocalMediaUrl() != null && File(media!!.getLocalMediaUrl()!!).canRead()) {
mediaPlayer?.setDataSource(media!!.getLocalMediaUrl()!!)
} else {
throw IOException("Unable to read local file " + media!!.getLocalMediaUrl())
else -> {
val localMediaurl = media!!.getLocalMediaUrl()
if (localMediaurl != null && File(localMediaurl).canRead()) {
mediaPlayer?.setDataSource(localMediaurl)
} else throw IOException("Unable to read local file $localMediaurl")
}
}
val uiModeManager = context.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
if (uiModeManager.currentModeType != Configuration.UI_MODE_TYPE_CAR) {
Expand Down
Loading

0 comments on commit e9c0e24

Please sign in to comment.