minor bugfix subscription title display

This commit is contained in:
Xilin Jia 2024-02-25 22:29:02 +01:00
parent 993da21461
commit f903a57920
4 changed files with 14 additions and 25 deletions

View File

@ -11,8 +11,8 @@
# Without this, methods only used in tests are removed and break tests. # Without this, methods only used in tests are removed and break tests.
-keep class ac.mdiq.podcini** -keep class ac.mdiq.podcini**
-keepclassmembers class ac.mdiq.podcini** {*;} -keepclassmembers class ac.mdiq.podcini** {*;}
-keep class de.test.podcini** # -keep class de.test.podcini**
-keepclassmembers class de.test.podcini** {*;} # -keepclassmembers class de.test.podcini** {*;}
# Keep methods used in tests. # Keep methods used in tests.
# This is only needed when running tests with proguard enabled. # This is only needed when running tests with proguard enabled.

View File

@ -861,7 +861,8 @@ object UserPreferences {
@JvmStatic @JvmStatic
fun shouldShowSubscriptionTitle(): Boolean { fun shouldShowSubscriptionTitle(): Boolean {
return prefs.getBoolean(PREF_SUBSCRIPTION_TITLE, true) return true
// return prefs.getBoolean(PREF_SUBSCRIPTION_TITLE, true)
} }
@JvmStatic @JvmStatic

View File

@ -33,7 +33,6 @@ open class SubscriptionsRecyclerAdapter(mainActivity: MainActivity) :
private var listItems: List<NavDrawerData.DrawerItem> private var listItems: List<NavDrawerData.DrawerItem>
private var selectedItem: NavDrawerData.DrawerItem? = null private var selectedItem: NavDrawerData.DrawerItem? = null
private var longPressedPosition: Int = 0 // used to init actionMode private var longPressedPosition: Int = 0 // used to init actionMode
private var columnCount = 1
init { init {
this.listItems = ArrayList() this.listItems = ArrayList()
@ -49,9 +48,8 @@ open class SubscriptionsRecyclerAdapter(mainActivity: MainActivity) :
} }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionViewHolder {
val itemView: View = val itemView: View = LayoutInflater.from(mainActivityRef.get()).inflate(R.layout.subscription_item, parent, false)
LayoutInflater.from(mainActivityRef.get()).inflate(R.layout.subscription_item, parent, false) // itemView.findViewById<View>(R.id.titleLabel).visibility = if (viewType == COVER_WITH_TITLE) View.VISIBLE else View.GONE
itemView.findViewById<View>(R.id.titleLabel).visibility = if (viewType == COVER_WITH_TITLE) View.VISIBLE else View.GONE
return SubscriptionViewHolder(itemView) return SubscriptionViewHolder(itemView)
} }
@ -178,7 +176,8 @@ open class SubscriptionsRecyclerAdapter(mainActivity: MainActivity) :
} }
override fun getItemViewType(position: Int): Int { override fun getItemViewType(position: Int): Int {
return if (UserPreferences.shouldShowSubscriptionTitle()) COVER_WITH_TITLE else 0 return 0
// return if (UserPreferences.shouldShowSubscriptionTitle()) COVER_WITH_TITLE else 0
} }
inner class SubscriptionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class SubscriptionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
@ -247,7 +246,7 @@ open class SubscriptionsRecyclerAdapter(mainActivity: MainActivity) :
} }
companion object { companion object {
private const val COVER_WITH_TITLE = 1 // private const val COVER_WITH_TITLE = 1
fun convertDpToPixel(context: Context, dp: Float): Float { fun convertDpToPixel(context: Context, dp: Float): Float {
return dp * context.resources.displayMetrics.density return dp * context.resources.displayMetrics.density

View File

@ -7,7 +7,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="4dp"
tools:layout_width="150dp"> tools:layout_width="400dp">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/outerContainer" android:id="@+id/outerContainer"
@ -45,8 +45,7 @@
android:textStyle="bold" android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:lines="1" android:lines="1"
android:importantForAccessibility="no" android:text="Title" />
tools:text="@sample/episodes.json/data/title" />
<TextView <TextView
android:id="@+id/producerLabel" android:id="@+id/producerLabel"
@ -54,8 +53,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:lines="1" android:lines="1"
android:importantForAccessibility="no" android:text="Author" />
tools:text="@sample/episodes.json/data/title" />
<TextView <TextView
android:id="@+id/countLabel" android:id="@+id/countLabel"
@ -63,28 +61,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:lines="1" android:lines="1"
android:importantForAccessibility="no" android:text="number episodes" />
tools:text="@sample/episodes.json/data/title" />
</LinearLayout> </LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView <ImageView
android:id="@+id/errorIcon" android:id="@+id/errorIcon"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_margin="8dp" android:layout_margin="8dp"
android:visibility="gone" android:visibility="gone"
android:contentDescription="@string/refresh_failed_msg" android:contentDescription="@string/refresh_failed_msg"
app:srcCompat="@drawable/ic_error" app:srcCompat="@drawable/ic_error"
tools:visibility="visible" /> tools:visibility="visible" />
</RelativeLayout> </LinearLayout>
<FrameLayout <FrameLayout
android:id="@+id/selectContainer" android:id="@+id/selectContainer"