Skip to content

Commit

Permalink
fix artist page, codec info fade
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Jan 3, 2025
1 parent a3f11ea commit b15a76e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ class AudioFormatDetector {
val isLossless: Boolean,
val sourceChannels: Int,
val deviceChannels: Int,
val isDownMixing: Boolean,
val bitrate: Int?,
val mimeType: String?,
val spatialFormat: SpatialFormat,
val encoderPadding: Int?,
val encoderDelay: Int?
) : Parcelable {
val isDownMixing: Boolean
get() = sourceChannels > deviceChannels
override fun toString(): String {
val outputStr = if (isDownMixing) {
"(Down mixed to $deviceChannels channels)"
Expand Down Expand Up @@ -102,8 +103,6 @@ class AudioFormatDetector {
val spatialFormat = detectSpatialFormat(format)
val sourceChannels = format.channelCount

val isDownMixing = sourceChannels > deviceChannels

val quality = determineQualityTier(
sampleRate = sampleRate,
bitDepth = bitDepth,
Expand All @@ -117,7 +116,6 @@ class AudioFormatDetector {
isLossless = isLossless,
sourceChannels = sourceChannels,
deviceChannels = deviceChannels,
isDownMixing = isDownMixing,
bitrate = bitrate,
mimeType = format.sampleMimeType,
spatialFormat = spatialFormat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.ViewPropertyAnimator
import android.view.WindowInsets
import android.widget.ImageView
import android.widget.SeekBar
Expand Down Expand Up @@ -74,6 +75,7 @@ import org.akanework.gramophone.logic.GramophonePlaybackService
import org.akanework.gramophone.logic.clone
import org.akanework.gramophone.logic.dpToPx
import org.akanework.gramophone.logic.fadInAnimation
import org.akanework.gramophone.logic.fadOutAnimation
import org.akanework.gramophone.logic.getAudioFormat
import org.akanework.gramophone.logic.getBooleanStrict
import org.akanework.gramophone.logic.getFile
Expand Down Expand Up @@ -657,12 +659,24 @@ class FullBottomSheet
}

private fun updateQualityIndicators(info: AudioFormatInfo?) {
if (info == null) {
bottomSheetFullQualityDetails.visibility = View.GONE
return
(bottomSheetFullQualityDetails.getTag(R.id.fade_in_animation) as ViewPropertyAnimator?)?.cancel()
(bottomSheetFullQualityDetails.getTag(R.id.fade_out_animation) as ViewPropertyAnimator?)?.cancel()
if (info == null && bottomSheetFullQualityDetails.visibility == INVISIBLE) return
val oldInfo = (bottomSheetFullQualityDetails.getTag(R.id.quality_details) as AudioFormatInfo?)
if (oldInfo != null)
applyQualityInfo(oldInfo)
if (oldInfo != null || info != null)
bottomSheetFullQualityDetails.setTag(R.id.quality_details, info)
bottomSheetFullQualityDetails.fadOutAnimation(300) {
bottomSheetFullQualityDetails.setTag(R.id.quality_details, null)
if (info == null)
return@fadOutAnimation
applyQualityInfo(info)
bottomSheetFullQualityDetails.fadInAnimation(300)
}
bottomSheetFullQualityDetails.visibility = View.VISIBLE
}

private fun applyQualityInfo(info: AudioFormatInfo) {
val icon = when (info.spatialFormat) {
SpatialFormat.SURROUND_5_0,
SpatialFormat.SURROUND_5_1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ArtistSubFragment : BaseFragment(true), PopupTextProvider {
== Configuration.ORIENTATION_PORTRAIT
) 2 else 4
albumAdapter = AlbumAdapter(
this, item.map { it.albumList }, true,
this, item.map { it.albumList }, ownsView = false, isSubFragment = true,
fallbackSpans = spans
)
albumAdapter.decorAdapter.jumpDownPos = albumAdapter.concatAdapter.itemCount
Expand Down

0 comments on commit b15a76e

Please sign in to comment.