Skip to content

Commit

Permalink
minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Feb 18, 2024
1 parent 45abbd3 commit 14d823a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
// Version code schema:
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
versionCode 3020096
versionName "3.2.1"
versionCode 3020097
versionName "3.2.2"

def commit = ""
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ abstract class EpisodesListFragment : Fragment(), SelectableAdapter.OnSelectMode
@UnstableApi @Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(event: PlaybackPositionEvent) {
for (i in 0 until listAdapter.itemCount) {
val holder: EpisodeItemViewHolder = recyclerView.findViewHolderForAdapterPosition(i) as EpisodeItemViewHolder
if (holder.isCurrentlyPlayingItem) {
val holder: EpisodeItemViewHolder? = recyclerView.findViewHolderForAdapterPosition(i) as? EpisodeItemViewHolder
if (holder != null && holder.isCurrentlyPlayingItem) {
holder.notifyPlaybackPositionUpdated(event)
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class FeedItemlistFragment : Fragment(), AdapterView.OnItemClickListener, Toolba
fun onEventMainThread(event: PlaybackPositionEvent) {
for (i in 0 until adapter.itemCount) {
val holder: EpisodeItemViewHolder? =
viewBinding.recyclerView.findViewHolderForAdapterPosition(i) as EpisodeItemViewHolder?
viewBinding.recyclerView.findViewHolderForAdapterPosition(i) as? EpisodeItemViewHolder
if (holder != null && holder.isCurrentlyPlayingItem) {
holder.notifyPlaybackPositionUpdated(event)
break
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/ac/mdiq/podvinci/fragment/SearchFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ class SearchFragment : Fragment(), SelectableAdapter.OnSelectModeListener {
@UnstableApi @Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(event: PlaybackPositionEvent) {
for (i in 0 until adapter.itemCount) {
val holder: EpisodeItemViewHolder =
recyclerView.findViewHolderForAdapterPosition(i) as EpisodeItemViewHolder
if (holder.isCurrentlyPlayingItem) {
val holder: EpisodeItemViewHolder? =
recyclerView.findViewHolderForAdapterPosition(i) as? EpisodeItemViewHolder
if (holder != null && holder.isCurrentlyPlayingItem) {
holder.notifyPlaybackPositionUpdated(event)
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ class SubscriptionFragment : Fragment(), Toolbar.OnMenuItemClickListener, Select
private lateinit var toolbar: MaterialToolbar
private lateinit var swipeRefreshLayout: SwipeRefreshLayout
private lateinit var progressBar: ProgressBar
private lateinit var displayedFolder: String
private lateinit var prefs: SharedPreferences
private lateinit var speedDialView: SpeedDialView


private var displayedFolder: String = ""
private var displayUpArrow = false

private var disposable: Disposable? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ class PlaybackService : MediaBrowserServiceCompat() {
stateManager = PlaybackServiceStateManager(this)
notificationBuilder = PlaybackServiceNotificationBuilder(this)

// TODO: this shit doesn't work
if (Build.VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
registerReceiver(autoStateUpdated, IntentFilter("com.google.android.gms.car.media.STATUS"), RECEIVER_NOT_EXPORTED)
registerReceiver(shutdownReceiver, IntentFilter(PlaybackServiceInterface.ACTION_SHUTDOWN_PLAYBACK_SERVICE), RECEIVER_NOT_EXPORTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ object MediaSizeLoader {
try {
val response = client.newCall(httpReq.build()).execute()
if (response.isSuccessful) {
val contentLength = response.header("Content-Length")
val contentLength = response.header("Content-Length")?:"0"
try {
size = contentLength!!.toInt().toLong()
size = contentLength.toInt().toLong()
} catch (e: NumberFormatException) {
Log.e(TAG, Log.getStackTraceString(e))
}
Expand Down

0 comments on commit 14d823a

Please sign in to comment.