Skip to content

Commit

Permalink
1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Jun 1, 2024
1 parent b2f30d5 commit 9bbf794
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 83 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ android {
// keep support for it for a while.
minSdk = 21
targetSdk = 34
versionCode = 8
versionName = "1.0.6"
versionCode = 9
versionName = "1.0.7"
if (releaseType != "Release") {
versionNameSuffix = myVersionName
}
Expand Down Expand Up @@ -182,15 +182,15 @@ aboutLibraries {
dependencies {
val media3Version = "1.4.0-alpha01"
implementation("androidx.activity:activity-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.7.0-rc01")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.collection:collection-ktx:1.4.0")
implementation("androidx.concurrent:concurrent-futures-ktx:1.1.0")
implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha13")
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.core:core-splashscreen:1.0.1")
//implementation("androidx.datastore:datastore-preferences:1.1.0-rc01") TODO don't abuse shared prefs
implementation("androidx.fragment:fragment-ktx:1.8.0-beta01")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.0")
implementation("androidx.fragment:fragment-ktx:1.8.0-rc01")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.1")
implementation("androidx.media3:media3-exoplayer:$media3Version")
implementation("androidx.media3:media3-exoplayer-midi:$media3Version")
implementation("androidx.media3:media3-session:$media3Version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ object CalculationUtils {
return if (amount < low) low else amount.coerceAtMost(high)
}


fun lerp(start: Float, stop: Float, amount: Float): Float {
@Suppress("NOTHING_TO_INLINE")
inline fun lerp(start: Float, stop: Float, amount: Float): Float {
return start + (stop - start) * amount
}

Expand All @@ -85,7 +85,8 @@ object CalculationUtils {
*
* If `a == b`, then this function will return 0.
*/
fun lerpInv(a: Float, b: Float, value: Float): Float {
@Suppress("NOTHING_TO_INLINE")
inline fun lerpInv(a: Float, b: Float, value: Float): Float {
return if (a != b) (value - a) / (b - a) else 0.0f
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.akanework.gramophone.logic.utils

import android.content.Context
import android.content.res.Configuration
import androidx.core.graphics.ColorUtils
import kotlin.math.min

Expand All @@ -29,10 +30,8 @@ object ColorUtils {
var lighting: Float = 0f,
var lightingDark: Float = 0f
) {
COLOR_BACKGROUND_TINTED(1.5f, 1.0f, 1.02f, 0.9f),
COLOR_BACKGROUND_ELEVATED(1.2f, 1.2f, 0.99f, 0.99f),
COLOR_BACKGROUND(1.0f, 0.9f, 1.015f, 1.015f),
TOOLBAR_ELEVATED(0.6f, 0.6f, 0.97f, 1.5f),
COLOR_CONTRAST_FAINTED(0.7f, 0.8f, 0.97f, 0.5f)
}

Expand All @@ -44,7 +43,8 @@ object ColorUtils {
val hsl = FloatArray(3)
ColorUtils.colorToHSL(color, hsl)

if (EnvUtils.isDarkMode(context)) {
if ((context.resources.configuration.uiMode and
Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES) {
hsl[2] *= colorType.lightingDark
hsl[2] = min(hsl[2], 1f)
hsl[1] *= colorType.chromaDark
Expand Down

This file was deleted.

This file was deleted.

40 changes: 40 additions & 0 deletions app/src/main/kotlin/org/akanework/gramophone/ui/FileOpUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.akanework.gramophone.ui

import org.akanework.gramophone.ui.adapters.AlbumAdapter
import org.akanework.gramophone.ui.adapters.ArtistAdapter
import org.akanework.gramophone.ui.adapters.BaseAdapter
import org.akanework.gramophone.ui.adapters.DateAdapter
import org.akanework.gramophone.ui.adapters.GenreAdapter
import org.akanework.gramophone.ui.adapters.PlaylistAdapter
import org.akanework.gramophone.ui.adapters.SongAdapter

fun getAdapterType(adapter: BaseAdapter<*>) =
when (adapter) {
is AlbumAdapter -> {
0
}

is ArtistAdapter -> {
1
}

is DateAdapter -> {
2
}

is GenreAdapter -> {
3
}

is PlaylistAdapter -> {
4
}

is SongAdapter -> {
5
}

else -> {
throw IllegalArgumentException()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ import org.akanework.gramophone.logic.ui.DefaultItemHeightHelper
import org.akanework.gramophone.logic.ui.ItemHeightHelper
import org.akanework.gramophone.logic.ui.MyRecyclerView
import org.akanework.gramophone.logic.ui.placeholderScaleToFit
import org.akanework.gramophone.logic.utils.FileOpUtils
import org.akanework.gramophone.logic.utils.MediaStoreUtils
import org.akanework.gramophone.ui.MainActivity
import org.akanework.gramophone.ui.components.CustomGridLayoutManager
import org.akanework.gramophone.ui.components.GridPaddingDecoration
import org.akanework.gramophone.ui.components.NowPlayingDrawable
import org.akanework.gramophone.ui.fragments.AdapterFragment
import org.akanework.gramophone.ui.getAdapterType
import java.util.Collections

abstract class BaseAdapter<T>(
Expand Down Expand Up @@ -113,7 +113,7 @@ abstract class BaseAdapter<T>(
@Suppress("LeakingThis")
private var prefSortType: Sorter.Type = Sorter.Type.valueOf(
prefs.getStringStrict(
"S" + FileOpUtils.getAdapterType(this).toString(),
"S" + getAdapterType(this).toString(),
Sorter.Type.None.toString()
)!!
)
Expand All @@ -123,7 +123,7 @@ abstract class BaseAdapter<T>(
@Suppress("LeakingThis")
private var prefLayoutType: LayoutType = LayoutType.valueOf(
prefs.getStringStrict(
"L" + FileOpUtils.getAdapterType(this).toString(),
"L" + getAdapterType(this).toString(),
LayoutType.NONE.toString()
)!!
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import com.google.android.material.button.MaterialButton
import org.akanework.gramophone.R
import org.akanework.gramophone.logic.ui.ItemHeightHelper
import org.akanework.gramophone.logic.ui.MyRecyclerView
import org.akanework.gramophone.logic.utils.FileOpUtils
import org.akanework.gramophone.ui.getAdapterType
import kotlin.random.Random

open class BaseDecorAdapter<T : BaseAdapter<*>>(
Expand Down Expand Up @@ -125,7 +125,7 @@ open class BaseDecorAdapter<T : BaseAdapter<*>>(
if (!isSubFragment) {
prefs.edit {
putString(
"S" + FileOpUtils.getAdapterType(adapter).toString(),
"S" + getAdapterType(adapter).toString(),
buttonMap[menuItem.itemId].toString()
)
}
Expand All @@ -141,7 +141,7 @@ open class BaseDecorAdapter<T : BaseAdapter<*>>(
if (!isSubFragment) {
prefs.edit {
putString(
"L" + FileOpUtils.getAdapterType(adapter).toString(),
"L" + getAdapterType(adapter).toString(),
layoutMap[menuItem.itemId].toString()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,8 @@ class FullBottomSheet(context: Context, attrs: AttributeSet?, defStyleAttr: Int,
.getDimensionPixelSize(R.dimen.media_seekbar_progress_stroke_width)
.toFloat()

progressDrawable = SquigglyProgress()
bottomSheetFullSeekBar.progressDrawable = progressDrawable
progressDrawable.let {
bottomSheetFullSeekBar.progressDrawable = SquigglyProgress().also {
progressDrawable = it
it.waveLength = seekBarProgressWavelength
it.lineAmplitude = seekBarProgressAmplitude
it.phaseSpeed = seekBarProgressPhase
Expand Down Expand Up @@ -775,8 +774,8 @@ class FullBottomSheet(context: Context, attrs: AttributeSet?, defStyleAttr: Int,
colorSurface
)
bottomSheetFullLyricAdapter.updateTextColor(
colorOnSurfaceVariant,
colorContrastFainted,
androidx.core.graphics.ColorUtils.setAlphaComponent(colorOnSurfaceVariant, 170),
androidx.core.graphics.ColorUtils.setAlphaComponent(colorPrimary, 77),
colorPrimary
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import android.graphics.Rect
import android.graphics.Region
import android.graphics.drawable.Drawable
import androidx.annotation.ColorInt
import com.google.android.material.math.MathUtils
import org.akanework.gramophone.logic.utils.CalculationUtils.lerp
import kotlin.random.Random

private inline val padding
Expand Down Expand Up @@ -60,15 +60,15 @@ class NowPlayingDrawable : Drawable() {
val scale = ((System.currentTimeMillis() - ts) / animDuration).coerceAtMost(1f)

// Left bar
lc = MathUtils.lerp(li, lt, scale)
lc = lerp(li, lt, scale)
canvas.drawBar(0f, lc)

// Middle bar
mc = MathUtils.lerp(mi, mt, scale)
mc = lerp(mi, mt, scale)
canvas.drawBar(240f, mc)

// Right bar
rc = MathUtils.lerp(ri, rt, scale)
rc = lerp(ri, rt, scale)
canvas.drawBar(480f, rc)

if (level != 1 && lc == lt && mc == mt && rc == rt) ts = 0L
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/adapter_folder_card.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand Down Expand Up @@ -64,4 +64,4 @@

</LinearLayout>

</FrameLayout>
</LinearLayout>
10 changes: 10 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Highlights of this release:
- Support moving now playing queue items (thanks @topazrn)
- Fix various bugs in shuffle implementation
- Update lyric color system to make sure it always is readable
- Make sure lyric color is same in system-dark-app-light and system-light-app-system modes
- Some bug fixes
- Fixed reproducible builds (hopefully now back in F-Droid)

For more information about what the last release had to offer:
https://github.com/AkaneTan/Gramophone/releases/tag/1.0.6
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ org.gradle.caching=true
org.gradle.configureondemand=true
# https://github.com/mikepenz/AboutLibraries/issues/857
#org.gradle.configuration-cache=true
org.gradle.configuration-cache=true

0 comments on commit 9bbf794

Please sign in to comment.