minor bug fixes

This commit is contained in:
Xilin Jia 2024-02-18 20:06:15 +01:00
parent 45abbd34b9
commit 14d823ad3d
7 changed files with 12 additions and 13 deletions

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 3020096 versionCode 3020097
versionName "3.2.1" versionName "3.2.2"
def commit = "" def commit = ""
try { try {

View File

@ -326,8 +326,8 @@ abstract class EpisodesListFragment : Fragment(), SelectableAdapter.OnSelectMode
@UnstableApi @Subscribe(threadMode = ThreadMode.MAIN) @UnstableApi @Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(event: PlaybackPositionEvent) { fun onEventMainThread(event: PlaybackPositionEvent) {
for (i in 0 until listAdapter.itemCount) { for (i in 0 until listAdapter.itemCount) {
val holder: EpisodeItemViewHolder = recyclerView.findViewHolderForAdapterPosition(i) as EpisodeItemViewHolder val holder: EpisodeItemViewHolder? = recyclerView.findViewHolderForAdapterPosition(i) as? EpisodeItemViewHolder
if (holder.isCurrentlyPlayingItem) { if (holder != null && holder.isCurrentlyPlayingItem) {
holder.notifyPlaybackPositionUpdated(event) holder.notifyPlaybackPositionUpdated(event)
break break
} }

View File

@ -336,7 +336,7 @@ class FeedItemlistFragment : Fragment(), AdapterView.OnItemClickListener, Toolba
fun onEventMainThread(event: PlaybackPositionEvent) { fun onEventMainThread(event: PlaybackPositionEvent) {
for (i in 0 until adapter.itemCount) { for (i in 0 until adapter.itemCount) {
val holder: EpisodeItemViewHolder? = val holder: EpisodeItemViewHolder? =
viewBinding.recyclerView.findViewHolderForAdapterPosition(i) as EpisodeItemViewHolder? viewBinding.recyclerView.findViewHolderForAdapterPosition(i) as? EpisodeItemViewHolder
if (holder != null && holder.isCurrentlyPlayingItem) { if (holder != null && holder.isCurrentlyPlayingItem) {
holder.notifyPlaybackPositionUpdated(event) holder.notifyPlaybackPositionUpdated(event)
break break

View File

@ -286,9 +286,9 @@ class SearchFragment : Fragment(), SelectableAdapter.OnSelectModeListener {
@UnstableApi @Subscribe(threadMode = ThreadMode.MAIN) @UnstableApi @Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(event: PlaybackPositionEvent) { fun onEventMainThread(event: PlaybackPositionEvent) {
for (i in 0 until adapter.itemCount) { for (i in 0 until adapter.itemCount) {
val holder: EpisodeItemViewHolder = val holder: EpisodeItemViewHolder? =
recyclerView.findViewHolderForAdapterPosition(i) as EpisodeItemViewHolder recyclerView.findViewHolderForAdapterPosition(i) as? EpisodeItemViewHolder
if (holder.isCurrentlyPlayingItem) { if (holder != null && holder.isCurrentlyPlayingItem) {
holder.notifyPlaybackPositionUpdated(event) holder.notifyPlaybackPositionUpdated(event)
break break
} }

View File

@ -59,10 +59,10 @@ class SubscriptionFragment : Fragment(), Toolbar.OnMenuItemClickListener, Select
private lateinit var toolbar: MaterialToolbar private lateinit var toolbar: MaterialToolbar
private lateinit var swipeRefreshLayout: SwipeRefreshLayout private lateinit var swipeRefreshLayout: SwipeRefreshLayout
private lateinit var progressBar: ProgressBar private lateinit var progressBar: ProgressBar
private lateinit var displayedFolder: String
private lateinit var prefs: SharedPreferences private lateinit var prefs: SharedPreferences
private lateinit var speedDialView: SpeedDialView private lateinit var speedDialView: SpeedDialView
private var displayedFolder: String = ""
private var displayUpArrow = false private var displayUpArrow = false
private var disposable: Disposable? = null private var disposable: Disposable? = null

View File

@ -165,7 +165,6 @@ class PlaybackService : MediaBrowserServiceCompat() {
stateManager = PlaybackServiceStateManager(this) stateManager = PlaybackServiceStateManager(this)
notificationBuilder = PlaybackServiceNotificationBuilder(this) notificationBuilder = PlaybackServiceNotificationBuilder(this)
// TODO: this shit doesn't work
if (Build.VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) { if (Build.VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
registerReceiver(autoStateUpdated, IntentFilter("com.google.android.gms.car.media.STATUS"), RECEIVER_NOT_EXPORTED) registerReceiver(autoStateUpdated, IntentFilter("com.google.android.gms.car.media.STATUS"), RECEIVER_NOT_EXPORTED)
registerReceiver(shutdownReceiver, IntentFilter(PlaybackServiceInterface.ACTION_SHUTDOWN_PLAYBACK_SERVICE), RECEIVER_NOT_EXPORTED) registerReceiver(shutdownReceiver, IntentFilter(PlaybackServiceInterface.ACTION_SHUTDOWN_PLAYBACK_SERVICE), RECEIVER_NOT_EXPORTED)

View File

@ -48,9 +48,9 @@ object MediaSizeLoader {
try { try {
val response = client.newCall(httpReq.build()).execute() val response = client.newCall(httpReq.build()).execute()
if (response.isSuccessful) { if (response.isSuccessful) {
val contentLength = response.header("Content-Length") val contentLength = response.header("Content-Length")?:"0"
try { try {
size = contentLength!!.toInt().toLong() size = contentLength.toInt().toLong()
} catch (e: NumberFormatException) { } catch (e: NumberFormatException) {
Log.e(TAG, Log.getStackTraceString(e)) Log.e(TAG, Log.getStackTraceString(e))
} }