enhancement on tags and player controls

This commit is contained in:
Xilin Jia 2024-02-29 14:48:38 +01:00
parent a6f83b71c0
commit 4fd63fd7da
11 changed files with 19 additions and 33 deletions

View File

@ -6,10 +6,12 @@ This is based on a fork from the popular project AntennaPod (<https://github.com
Differing from the forked project, this project is purely Kotlin based, relies on the most recent dependencies, and most importantly has migrated the media player to androidx.media3, and added mechanism of AudioOffloadMode which is supposed to be kind to device battery. Efficiencies are also sought on running the app. App build is also upgraded to target Android 14. Differing from the forked project, this project is purely Kotlin based, relies on the most recent dependencies, and most importantly has migrated the media player to androidx.media3, and added mechanism of AudioOffloadMode which is supposed to be kind to device battery. Efficiencies are also sought on running the app. App build is also upgraded to target Android 14.
## Version 4.0 ## Version 4
Some drastic changes are made in the project since version 4.0. There is now a whole new interface of the Subscriptions page showing only the feeds with tags as filters, no longer having tags as folders in the page. And the default page of the app is changed to the Subscriptions page. Alongside, the Home and Echo pages are removed from the project. Also, the project becomes mono-module, with only the app module. Some drastic changes are made in the project since version 4.0. There is now a whole new interface of the Subscriptions page showing only the feeds with tags as filters, no longer having tags as folders in the page. And the default page of the app is changed to the Subscriptions page. Alongside, the Home and Echo pages are removed from the project. Also, the project becomes mono-module, with only the app module.
Version 4.1 brings a more convenient player control and tags enhancements, while also enables view binding for most views in the codebase.
## Screenshots ## 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_drawer1.jpg" width="238" /> <img src="./images/2_setting.jpg" width="238" /> <img src="./images/3_setting.jpg" width="238" />

View File

@ -22,8 +22,8 @@ android {
// Version code schema: // Version code schema:
// "1.2.3-beta4" -> 1020304 // "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395 // "1.2.3" -> 1020395
versionCode 3020101 versionCode 3020102
versionName "4.0.1" versionName "4.1.0"
def commit = "" def commit = ""
try { try {

View File

@ -9,25 +9,13 @@ class NavDrawerData(@JvmField val items: List<FeedDrawerItem>,
val feedCounters: Map<Long, Int>, val feedCounters: Map<Long, Int>,
val reclaimableSpace: Int val reclaimableSpace: Int
) { ) {
abstract class DrawerItem(val type: Type, var id: Long) { class FeedDrawerItem(val feed: Feed, val id: Long, val counter: Int) {
enum class Type {
FEED
}
var layer: Int = 0 var layer: Int = 0
abstract val title: String? val title: String?
open val producer: String = ""
abstract val counter: Int
}
class FeedDrawerItem(val feed: Feed, id: Long, override val counter: Int) : DrawerItem(Type.FEED, id) {
override val title: String?
get() = feed.title get() = feed.title
override val producer: String val producer: String
get() = feed.author?:"" get() = feed.author?:""
} }
} }

View File

@ -179,11 +179,7 @@ class NavListAdapter(private val itemAccess: ItemAccess, context: Activity) :
val item = itemAccess.getItem(itemPos) val item = itemAccess.getItem(itemPos)
if (item != null) { if (item != null) {
bindListItem(item, holder as FeedHolder) bindListItem(item, holder as FeedHolder)
if (item.type == DrawerItem.Type.FEED) {
bindFeedView(item as FeedDrawerItem, holder) bindFeedView(item as FeedDrawerItem, holder)
} else {
// bindTagView(item as TagDrawerItem, holder)
}
} }
holder.itemView.setOnCreateContextMenuListener(itemAccess) holder.itemView.setOnCreateContextMenuListener(itemAccess)
} }
@ -276,7 +272,7 @@ class NavListAdapter(private val itemAccess: ItemAccess, context: Activity) :
} }
} }
private fun bindListItem(item: DrawerItem, holder: FeedHolder) { private fun bindListItem(item: FeedDrawerItem, holder: FeedHolder) {
if (item.counter > 0) { if (item.counter > 0) {
holder.count.visibility = View.VISIBLE holder.count.visibility = View.VISIBLE
holder.count.text = NumberFormat.getInstance().format(item.counter.toLong()) holder.count.text = NumberFormat.getInstance().format(item.counter.toLong())
@ -348,7 +344,7 @@ class NavListAdapter(private val itemAccess: ItemAccess, context: Activity) :
interface ItemAccess : OnCreateContextMenuListener { interface ItemAccess : OnCreateContextMenuListener {
val count: Int val count: Int
fun getItem(position: Int): DrawerItem? fun getItem(position: Int): FeedDrawerItem?
fun isSelected(position: Int): Boolean fun isSelected(position: Int): Boolean

View File

@ -169,7 +169,9 @@ open class SubscriptionsRecyclerAdapter(mainActivity: MainActivity) :
producer.text = drawerItem.producer producer.text = drawerItem.producer
coverImage.contentDescription = drawerItem.title coverImage.contentDescription = drawerItem.title
if (drawerItem.counter > 0) { if (drawerItem.counter > 0) {
count.text = NumberFormat.getInstance().format(drawerItem.feed.items.size.toLong()) + " episodes" // TODO: need to use more specific number
count.text = NumberFormat.getInstance().format(drawerItem.counter.toLong()) + " episodes"
// count.text = NumberFormat.getInstance().format(drawerItem.feed.items.size.toLong()) + " episodes"
count.visibility = View.VISIBLE count.visibility = View.VISIBLE
} else { } else {
count.visibility = View.GONE count.visibility = View.GONE

View File

@ -2,10 +2,9 @@ package ac.mdiq.podcini.ui.dialog
import ac.mdiq.podcini.R import ac.mdiq.podcini.R
import ac.mdiq.podcini.databinding.EditTextDialogBinding import ac.mdiq.podcini.databinding.EditTextDialogBinding
import ac.mdiq.podcini.storage.model.feed.Feed
import ac.mdiq.podcini.storage.model.feed.FeedPreferences
import ac.mdiq.podcini.storage.DBWriter import ac.mdiq.podcini.storage.DBWriter
import ac.mdiq.podcini.storage.NavDrawerData.* import ac.mdiq.podcini.storage.NavDrawerData.FeedDrawerItem
import ac.mdiq.podcini.storage.model.feed.Feed
import android.app.Activity import android.app.Activity
import android.content.DialogInterface import android.content.DialogInterface
import android.util.Log import android.util.Log
@ -20,14 +19,14 @@ import java.lang.ref.WeakReference
class RenameItemDialog { class RenameItemDialog {
private val activityRef: WeakReference<Activity> private val activityRef: WeakReference<Activity>
private var feed: Feed? = null private var feed: Feed? = null
private var drawerItem: DrawerItem? = null private var drawerItem: FeedDrawerItem? = null
constructor(activity: Activity, feed: Feed?) { constructor(activity: Activity, feed: Feed?) {
this.activityRef = WeakReference(activity) this.activityRef = WeakReference(activity)
this.feed = feed this.feed = feed
} }
constructor(activity: Activity, drawerItem: DrawerItem?) { constructor(activity: Activity, drawerItem: FeedDrawerItem?) {
this.activityRef = WeakReference(activity) this.activityRef = WeakReference(activity)
this.drawerItem = drawerItem this.drawerItem = drawerItem
} }

View File

@ -269,7 +269,6 @@ class ExternalPlayerFragment : Fragment(), SeekBar.OnSeekBarChangeListener {
txtvFF.text = NumberFormat.getInstance().format(UserPreferences.fastForwardSecs.toLong()) txtvFF.text = NumberFormat.getInstance().format(UserPreferences.fastForwardSecs.toLong())
val media = controller?.getMedia() val media = controller?.getMedia()
if (media != null) updatePlaybackSpeedButton(SpeedChangedEvent(PlaybackSpeedUtils.getCurrentPlaybackSpeed(media))) if (media != null) updatePlaybackSpeedButton(SpeedChangedEvent(PlaybackSpeedUtils.getCurrentPlaybackSpeed(media)))
} }
@UnstableApi @UnstableApi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 230 KiB