diff --git a/README.md b/README.md index fd6e3edb7..f745eed01 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,12 @@ ___ ## 📱 Screenshots ### App Themes -| | | | +| | | | |:---:|:---:|:---:| |Clearly white| Kinda dark | Just black| ### Player screen -| | | | | | +| | | | | | |:---:|:---:|:---:|:---:|:---:| | Home | Songs | Albums | Artists | Settings | @@ -58,7 +58,7 @@ ___ | Synced Replace Cover light | Synced Replace Cover dark | Synced Replace Cover black | ### 10+ Now playing themes -| || | | | +| || | | | |:-----: |:-----: |:-----: |:-----: |:-----: | | Normal | Fit | Flat | Color | Material | diff --git a/app/build.gradle b/app/build.gradle index cd599e2be..c044536b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { vectorDrawables.useSupportLibrary = true applicationId "code.name.monkey.retromusic" - versionCode 10590 - versionName '6.0.0-beta' + versionCode 10596 + versionName '6.0.2-beta' buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"") } @@ -41,6 +41,15 @@ android { versionNameSuffix ' DEBUG' } } + flavorDimensions "version" + productFlavors { + normal { + dimension "version" + } + fdroid { + dimension "version" + } + } buildFeatures{ viewBinding true @@ -88,44 +97,43 @@ dependencies { implementation "androidx.gridlayout:gridlayout:1.0.0" implementation "androidx.appcompat:appcompat:$appcompat_version" - implementation 'androidx.annotation:annotation:1.3.0' + implementation 'androidx.annotation:annotation:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation "androidx.preference:preference-ktx:$preference_version" - implementation 'androidx.core:core-ktx:1.8.0' + implementation "androidx.core:core-ktx:$core_version" implementation 'androidx.palette:palette-ktx:1.0.0' - //Cast Dependencies implementation 'androidx.mediarouter:mediarouter:1.3.0' - implementation 'com.google.android.gms:play-services-cast-framework:21.0.1' + //Cast Dependencies + normalImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1' //WebServer by NanoHttpd - implementation "org.nanohttpd:nanohttpd:2.3.1" + normalImplementation "org.nanohttpd:nanohttpd:2.3.1" implementation "androidx.navigation:navigation-runtime-ktx:$navigation_version" implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" implementation "androidx.navigation:navigation-ui-ktx:$navigation_version" - def room_version = '2.4.2' + def room_version = '2.5.0-alpha02' implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" kapt "androidx.room:room-compiler:$room_version" - def lifecycle_version = "2.5.0-rc01" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" implementation "androidx.core:core-splashscreen:1.0.0-rc01" - implementation 'com.google.android.play:feature-delivery:2.0.0' - implementation 'com.google.android.play:review:2.0.0' + normalImplementation 'com.google.android.play:feature-delivery:2.0.0' + normalImplementation 'com.google.android.play:review:2.0.0' implementation "com.google.android.material:material:$mdc_version" def retrofit_version = '2.9.0' implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-gson:$retrofit_version" - implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.7' + implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.9' def material_dialog_version = "3.3.0" implementation "com.afollestad.material-dialogs:core:$material_dialog_version" @@ -160,12 +168,11 @@ dependencies { implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5' implementation 'com.github.Adonai:jaudiotagger:2.3.15' - implementation 'com.anjlab.android.iab.v3:library:2.0.3' + normalImplementation 'com.anjlab.android.iab.v3:library:2.0.3' implementation 'com.r0adkll:slidableactivity:2.1.0' implementation 'com.heinrichreimersoftware:material-intro:2.0.0' implementation 'com.github.dhaval2404:imagepicker:2.1' implementation 'me.zhanghai.android.fastscroll:library:1.1.8' implementation 'cat.ereza:customactivityoncrash:2.4.0' implementation 'me.tankery.lib:circularSeekBar:1.4.0' - debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1' } \ No newline at end of file diff --git a/app/src/fdroid/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt b/app/src/fdroid/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt new file mode 100644 index 000000000..def9a7050 --- /dev/null +++ b/app/src/fdroid/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt @@ -0,0 +1,5 @@ +package code.name.monkey.retromusic.activities.base + + +abstract class AbsCastActivity : AbsSlidingMusicPanelActivity() { +} \ No newline at end of file diff --git a/app/src/fdroid/java/code/name/monkey/retromusic/billing/BillingManager.kt b/app/src/fdroid/java/code/name/monkey/retromusic/billing/BillingManager.kt new file mode 100644 index 000000000..51c350adc --- /dev/null +++ b/app/src/fdroid/java/code/name/monkey/retromusic/billing/BillingManager.kt @@ -0,0 +1,12 @@ +package code.name.monkey.retromusic.billing + +import android.content.Context + +@Suppress("UNUSED_PARAMETER") +class BillingManager(context: Context) { + + fun release() {} + + val isProVersion: Boolean + get() = true +} \ No newline at end of file diff --git a/app/src/fdroid/java/code/name/monkey/retromusic/cast/RetroWebServer.kt b/app/src/fdroid/java/code/name/monkey/retromusic/cast/RetroWebServer.kt new file mode 100644 index 000000000..03103dfb7 --- /dev/null +++ b/app/src/fdroid/java/code/name/monkey/retromusic/cast/RetroWebServer.kt @@ -0,0 +1,6 @@ +package code.name.monkey.retromusic.cast + +import android.content.Context + +@Suppress("UNUSED_PARAMETER") +class RetroWebServer(context: Context) \ No newline at end of file diff --git a/app/src/fdroid/java/code/name/monkey/retromusic/extensions/extensions.kt b/app/src/fdroid/java/code/name/monkey/retromusic/extensions/extensions.kt new file mode 100644 index 000000000..3d93f388c --- /dev/null +++ b/app/src/fdroid/java/code/name/monkey/retromusic/extensions/extensions.kt @@ -0,0 +1,15 @@ +@file:Suppress("UNUSED_PARAMETER", "unused") + +package code.name.monkey.retromusic.extensions + +import android.content.Context +import android.view.Menu +import androidx.fragment.app.FragmentActivity + +fun Context.setUpMediaRouteButton(menu: Menu) {} + +fun FragmentActivity.installLanguageAndRecreate(code: String) {} + +fun Context.goToProVersion() {} + +fun Context.installSplitCompat() {} \ No newline at end of file diff --git a/app/src/fdroid/java/code/name/monkey/retromusic/service/CastPlayer.kt b/app/src/fdroid/java/code/name/monkey/retromusic/service/CastPlayer.kt new file mode 100644 index 000000000..3a0eaca28 --- /dev/null +++ b/app/src/fdroid/java/code/name/monkey/retromusic/service/CastPlayer.kt @@ -0,0 +1,47 @@ +package code.name.monkey.retromusic.service + +import code.name.monkey.retromusic.model.Song +import code.name.monkey.retromusic.service.playback.Playback + +// Empty CastPlayer implementation +class CastPlayer : Playback { + override val isInitialized: Boolean + get() = true + override val isPlaying: Boolean + get() = true + override val audioSessionId: Int + get() = 0 + + override fun setDataSource( + song: Song, + force: Boolean, + completion: (success: Boolean) -> Unit, + ) { + } + + override fun setNextDataSource(path: String?) {} + + override var callbacks: Playback.PlaybackCallbacks? = null + + override fun start() = true + + override fun stop() {} + + override fun release() {} + + override fun pause(): Boolean = true + + override fun duration() = 0 + + override fun position() = 0 + + override fun seek(whereto: Int) = whereto + + override fun setVolume(vol: Float) = true + + override fun setAudioSessionId(sessionId: Int) = true + + override fun setCrossFadeDuration(duration: Int) {} + + override fun setPlaybackSpeedPitch(speed: Float, pitch: Float) {} +} \ No newline at end of file diff --git a/app/src/fdroid/java/code/name/monkey/retromusic/util/AppRater.kt b/app/src/fdroid/java/code/name/monkey/retromusic/util/AppRater.kt new file mode 100644 index 000000000..2691d70b2 --- /dev/null +++ b/app/src/fdroid/java/code/name/monkey/retromusic/util/AppRater.kt @@ -0,0 +1,8 @@ +package code.name.monkey.retromusic.util + +import android.content.Context + +@Suppress("UNUSED_PARAMETER") +object AppRater { + fun appLaunched(context: Context) {} +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dabe48036..987f89181 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ + android:maxSdkVersion="29" /> @@ -22,7 +22,6 @@ android:name="android.permission.WRITE_SETTINGS" tools:ignore="ProtectedPermissions" /> - - @@ -194,7 +192,7 @@ @@ -305,9 +303,6 @@ - - - - - - - - + + + diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt b/app/src/normal/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt similarity index 82% rename from app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt rename to app/src/normal/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt index accf2f880..b23e1d62d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt +++ b/app/src/normal/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt @@ -1,17 +1,3 @@ -/* - * Copyright (c) 2020 Hemanth Savarla. - * - * Licensed under the GNU General Public License v3 - * - * This is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - */ package code.name.monkey.retromusic.activities import android.content.res.ColorStateList @@ -22,7 +8,7 @@ import android.view.MenuItem import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.retromusic.App import code.name.monkey.retromusic.BuildConfig -import code.name.monkey.retromusic.Constants.PRO_VERSION_PRODUCT_ID +import code.name.monkey.retromusic.Constants import code.name.monkey.retromusic.R import code.name.monkey.retromusic.activities.base.AbsThemeActivity import code.name.monkey.retromusic.databinding.ActivityProVersionBinding @@ -58,7 +44,7 @@ class PurchaseActivity : AbsThemeActivity(), BillingProcessor.IBillingHandler { restorePurchase() } binding.purchaseButton.setOnClickListener { - billingProcessor.purchase(this@PurchaseActivity, PRO_VERSION_PRODUCT_ID) + billingProcessor.purchase(this@PurchaseActivity, Constants.PRO_VERSION_PRODUCT_ID) } binding.bannerContainer.backgroundTintList = ColorStateList.valueOf(accentColor()) @@ -116,4 +102,4 @@ class PurchaseActivity : AbsThemeActivity(), BillingProcessor.IBillingHandler { companion object { private const val TAG: String = "PurchaseActivity" } -} +} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt b/app/src/normal/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt similarity index 93% rename from app/src/main/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt rename to app/src/normal/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt index 23d668a53..4a2f3aaea 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt +++ b/app/src/normal/java/code/name/monkey/retromusic/activities/base/AbsCastActivity.kt @@ -3,6 +3,7 @@ package code.name.monkey.retromusic.activities.base import code.name.monkey.retromusic.cast.RetroSessionManagerListener import code.name.monkey.retromusic.cast.RetroWebServer import code.name.monkey.retromusic.helper.MusicPlayerRemote +import code.name.monkey.retromusic.service.CastPlayer import com.google.android.gms.cast.framework.CastContext import com.google.android.gms.cast.framework.CastSession import com.google.android.gms.common.ConnectionResult @@ -37,7 +38,7 @@ abstract class AbsCastActivity : AbsSlidingMusicPanelActivity() { override fun onSessionStarted(castSession: CastSession, p1: String) { invalidateOptionsMenu() mCastSession = castSession - MusicPlayerRemote.switchToRemotePlayback(castSession) + MusicPlayerRemote.switchToRemotePlayback(CastPlayer(castSession)) } override fun onSessionEnded(castSession: CastSession, p1: Int) { @@ -53,7 +54,7 @@ abstract class AbsCastActivity : AbsSlidingMusicPanelActivity() { invalidateOptionsMenu() mCastSession = castSession webServer.start() - MusicPlayerRemote.switchToRemotePlayback(castSession) + MusicPlayerRemote.switchToRemotePlayback(CastPlayer(castSession)) } override fun onSessionSuspended(castSession: CastSession, p1: Int) { diff --git a/app/src/normal/java/code/name/monkey/retromusic/billing/BillingManager.kt b/app/src/normal/java/code/name/monkey/retromusic/billing/BillingManager.kt new file mode 100644 index 000000000..445044e73 --- /dev/null +++ b/app/src/normal/java/code/name/monkey/retromusic/billing/BillingManager.kt @@ -0,0 +1,37 @@ +package code.name.monkey.retromusic.billing + +import android.content.Context +import code.name.monkey.retromusic.BuildConfig +import code.name.monkey.retromusic.Constants +import code.name.monkey.retromusic.R +import code.name.monkey.retromusic.extensions.showToast +import com.anjlab.android.iab.v3.BillingProcessor +import com.anjlab.android.iab.v3.PurchaseInfo + +class BillingManager(context: Context) { + private val billingProcessor: BillingProcessor + + init { + // automatically restores purchases + billingProcessor = BillingProcessor( + context, BuildConfig.GOOGLE_PLAY_LICENSING_KEY, + object : BillingProcessor.IBillingHandler { + override fun onProductPurchased(productId: String, details: PurchaseInfo?) {} + + override fun onPurchaseHistoryRestored() { + context.showToast(R.string.restored_previous_purchase_please_restart) + } + + override fun onBillingError(errorCode: Int, error: Throwable?) {} + + override fun onBillingInitialized() {} + }) + } + + fun release() { + billingProcessor.release() + } + + val isProVersion: Boolean + get() = billingProcessor.isPurchased(Constants.PRO_VERSION_PRODUCT_ID) +} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/cast/CastHelper.kt b/app/src/normal/java/code/name/monkey/retromusic/cast/CastHelper.kt similarity index 100% rename from app/src/main/java/code/name/monkey/retromusic/cast/CastHelper.kt rename to app/src/normal/java/code/name/monkey/retromusic/cast/CastHelper.kt diff --git a/app/src/normal/java/code/name/monkey/retromusic/cast/CastOptionsProvider.kt b/app/src/normal/java/code/name/monkey/retromusic/cast/CastOptionsProvider.kt new file mode 100644 index 000000000..6ebc71010 --- /dev/null +++ b/app/src/normal/java/code/name/monkey/retromusic/cast/CastOptionsProvider.kt @@ -0,0 +1,25 @@ +@file:Suppress("unused") + +package code.name.monkey.retromusic.cast + +import android.content.Context +import com.google.android.gms.cast.CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID +import com.google.android.gms.cast.framework.CastOptions +import com.google.android.gms.cast.framework.OptionsProvider +import com.google.android.gms.cast.framework.SessionProvider +import com.google.android.gms.cast.framework.media.CastMediaOptions + + +class CastOptionsProvider : OptionsProvider { + override fun getCastOptions(context: Context): CastOptions { + val mediaOptions = CastMediaOptions.Builder().setNotificationOptions(null).build() + return CastOptions.Builder() + .setReceiverApplicationId(DEFAULT_MEDIA_RECEIVER_APPLICATION_ID) + .setCastMediaOptions(mediaOptions) + .build() + } + + override fun getAdditionalSessionProviders(context: Context): MutableList? { + return null + } +} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/cast/RetroSessionManagerListener.kt b/app/src/normal/java/code/name/monkey/retromusic/cast/RetroSessionManagerListener.kt similarity index 100% rename from app/src/main/java/code/name/monkey/retromusic/cast/RetroSessionManagerListener.kt rename to app/src/normal/java/code/name/monkey/retromusic/cast/RetroSessionManagerListener.kt diff --git a/app/src/main/java/code/name/monkey/retromusic/cast/RetroWebServer.kt b/app/src/normal/java/code/name/monkey/retromusic/cast/RetroWebServer.kt similarity index 100% rename from app/src/main/java/code/name/monkey/retromusic/cast/RetroWebServer.kt rename to app/src/normal/java/code/name/monkey/retromusic/cast/RetroWebServer.kt diff --git a/app/src/normal/java/code/name/monkey/retromusic/extensions/extensions.kt b/app/src/normal/java/code/name/monkey/retromusic/extensions/extensions.kt new file mode 100644 index 000000000..59d05fb74 --- /dev/null +++ b/app/src/normal/java/code/name/monkey/retromusic/extensions/extensions.kt @@ -0,0 +1,59 @@ +package code.name.monkey.retromusic.extensions + +import android.content.Context +import android.content.Intent +import android.view.Menu +import androidx.fragment.app.FragmentActivity +import code.name.monkey.retromusic.R +import code.name.monkey.retromusic.activities.PurchaseActivity +import com.google.android.gms.cast.framework.CastButtonFactory +import com.google.android.play.core.splitcompat.SplitCompat +import com.google.android.play.core.splitinstall.SplitInstallManagerFactory +import com.google.android.play.core.splitinstall.SplitInstallRequest +import com.google.android.play.core.splitinstall.SplitInstallSessionState +import com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener +import java.util.* + +fun Context.setUpMediaRouteButton(menu: Menu) { + CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.action_cast) +} + +fun FragmentActivity.installLanguageAndRecreate(code: String) { + var mySessionId = 0 + + val manager = SplitInstallManagerFactory.create(this) + val listener = object: SplitInstallStateUpdatedListener{ + override fun onStateUpdate(state: SplitInstallSessionState) { + if (state.sessionId() == mySessionId) { + recreate() + manager.unregisterListener(this) + } + } + } + manager.registerListener(listener) + + if (code != "auto") { + // Try to download language resources + val request = + SplitInstallRequest.newBuilder().addLanguage(Locale.forLanguageTag(code)) + .build() + manager.startInstall(request) + // Recreate the activity on download complete + .addOnSuccessListener { + mySessionId = it + } + .addOnFailureListener { + showToast("Language download failed.") + } + } else { + recreate() + } +} + +fun Context.goToProVersion() { + startActivity(Intent(this, PurchaseActivity::class.java)) +} + +fun Context.installSplitCompat() { + SplitCompat.install(this) +} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/service/CastPlayer.kt b/app/src/normal/java/code/name/monkey/retromusic/service/CastPlayer.kt similarity index 91% rename from app/src/main/java/code/name/monkey/retromusic/service/CastPlayer.kt rename to app/src/normal/java/code/name/monkey/retromusic/service/CastPlayer.kt index e3404f24a..514612e33 100644 --- a/app/src/main/java/code/name/monkey/retromusic/service/CastPlayer.kt +++ b/app/src/normal/java/code/name/monkey/retromusic/service/CastPlayer.kt @@ -10,8 +10,7 @@ import com.google.android.gms.cast.MediaStatus import com.google.android.gms.cast.framework.CastSession import com.google.android.gms.cast.framework.media.RemoteMediaClient -class CastPlayer(castSession: CastSession) : Playback, - RemoteMediaClient.Callback() { +class CastPlayer(castSession: CastSession) : Playback, RemoteMediaClient.Callback() { override val isInitialized: Boolean = true @@ -33,15 +32,19 @@ class CastPlayer(castSession: CastSession) : Playback, override var callbacks: Playback.PlaybackCallbacks? = null - override fun setDataSource(song: Song, force: Boolean): Boolean { - return try { + override fun setDataSource( + song: Song, + force: Boolean, + completion: (success: Boolean) -> Unit, + ) { + try { val mediaLoadOptions = MediaLoadOptions.Builder().setPlayPosition(0).setAutoplay(true).build() remoteMediaClient?.load(song.toMediaInfo()!!, mediaLoadOptions) - true + completion(true) } catch (e: Exception) { e.printStackTrace() - false + completion(false) } } diff --git a/app/src/main/java/code/name/monkey/retromusic/util/AppRater.kt b/app/src/normal/java/code/name/monkey/retromusic/util/AppRater.kt similarity index 99% rename from app/src/main/java/code/name/monkey/retromusic/util/AppRater.kt rename to app/src/normal/java/code/name/monkey/retromusic/util/AppRater.kt index d6d47270e..1e3423478 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/AppRater.kt +++ b/app/src/normal/java/code/name/monkey/retromusic/util/AppRater.kt @@ -28,7 +28,6 @@ object AppRater { private const val DAYS_UNTIL_PROMPT = 3//Min number of days private const val LAUNCHES_UNTIL_PROMPT = 5//Min number of launches - @JvmStatic fun appLaunched(context: Activity) { val prefs = context.getSharedPreferences(APP_RATING, 0) if (prefs.getBoolean(DO_NOT_SHOW_AGAIN, false)) { diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/NavigationViewUtil.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/NavigationViewUtil.kt deleted file mode 100644 index ae29dd81c..000000000 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/NavigationViewUtil.kt +++ /dev/null @@ -1,52 +0,0 @@ -package code.name.monkey.appthemehelper.util - -import android.content.res.ColorStateList -import androidx.annotation.ColorInt -import code.name.monkey.appthemehelper.ThemeStore -import com.google.android.material.bottomnavigation.BottomNavigationView -import com.google.android.material.navigation.NavigationView - -/** - * @author Karim Abou Zeid (kabouzeid) - */ -object NavigationViewUtil { - - fun setItemIconColors(navigationView: NavigationView, @ColorInt normalColor: Int, @ColorInt selectedColor: Int) { - val iconSl = ColorStateList( - arrayOf( - intArrayOf(-android.R.attr.state_checked), - intArrayOf(android.R.attr.state_checked) - ), intArrayOf(normalColor, selectedColor) - ) - navigationView.itemIconTintList = iconSl - val drawable = navigationView.itemBackground - navigationView.itemBackground = TintHelper.createTintedDrawable( - drawable, - ColorUtil.withAlpha(ThemeStore.accentColor(navigationView.context), 0.2f) - ) - } - - fun setItemTextColors(navigationView: NavigationView, @ColorInt normalColor: Int, @ColorInt selectedColor: Int) { - val textSl = ColorStateList( - arrayOf(intArrayOf(-android.R.attr.state_checked), intArrayOf(android.R.attr.state_checked)), - intArrayOf(normalColor, selectedColor) - ) - navigationView.itemTextColor = textSl - } - - fun setItemIconColors(bottomNavigationView: BottomNavigationView, @ColorInt normalColor: Int, @ColorInt selectedColor: Int) { - val iconSl = ColorStateList( - arrayOf(intArrayOf(-android.R.attr.state_checked), intArrayOf(android.R.attr.state_checked)), - intArrayOf(normalColor, selectedColor) - ) - bottomNavigationView.itemIconTintList = iconSl - } - - fun setItemTextColors(bottomNavigationView: BottomNavigationView, @ColorInt normalColor: Int, @ColorInt selectedColor: Int) { - val textSl = ColorStateList( - arrayOf(intArrayOf(-android.R.attr.state_checked), intArrayOf(android.R.attr.state_checked)), - intArrayOf(normalColor, selectedColor) - ) - bottomNavigationView.itemTextColor = textSl - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index d1d3d8338..47d09a145 100644 --- a/build.gradle +++ b/build.gradle @@ -2,11 +2,13 @@ buildscript { ext { - kotlin_version = '1.6.21' - navigation_version = '2.5.0-rc01' + kotlin_version = '1.7.0' + lifecycle_version='2.5.0-rc02' + navigation_version = '2.5.0-rc02' mdc_version = '1.7.0-alpha02' preference_version = '1.2.0' appcompat_version = '1.4.2' + core_version='1.8.0' } repositories { diff --git a/fastlane/metadata/android/en-US/changelogs/10596.txt b/fastlane/metadata/android/en-US/changelogs/10596.txt new file mode 100644 index 000000000..d2297558d --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/10596.txt @@ -0,0 +1 @@ +Added lyrics downloading \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt new file mode 100644 index 000000000..a39bbf5e4 --- /dev/null +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -0,0 +1,20 @@ +Retro Music Player 🎵 + +📦 Included Features +
    +
  • Base 3 themes (Clearly White, Kinda Dark and Just Black)
  • +
  • Material You support on Android 12+
  • +
  • Gapless playback
  • +
  • Crossfade playback
  • +
  • Choose from 10+ now playing themes
  • +
  • Android auto support
  • +
  • Wallpaper accent picker on Android 8.1+
  • +
  • Home screen widgets
  • +
  • Lock screen playback controls
  • +
  • Sleep timer
  • +
  • Easy drag to sort playlist & play queue
  • +
  • Tag editor
  • +
  • Create, edit and import playlists
  • +
  • Browse and play your music by songs, albums, artists, playlists and genre
  • +
  • Smart Auto Playlists - Recently played, most played and history
  • +
\ No newline at end of file diff --git a/fastlane/metadata/android/en-US/images/logo.png b/fastlane/metadata/android/en-US/images/logo.png new file mode 100644 index 000000000..11a780e31 Binary files /dev/null and b/fastlane/metadata/android/en-US/images/logo.png differ diff --git a/screenshots/normal.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.jpg similarity index 100% rename from screenshots/normal.jpg rename to fastlane/metadata/android/en-US/images/phoneScreenshots/1.jpg diff --git a/screenshots/home_light.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.jpg similarity index 100% rename from screenshots/home_light.jpg rename to fastlane/metadata/android/en-US/images/phoneScreenshots/2.jpg diff --git a/screenshots/home_dark.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.jpg similarity index 100% rename from screenshots/home_dark.jpg rename to fastlane/metadata/android/en-US/images/phoneScreenshots/3.jpg diff --git a/screenshots/home_black.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.jpg similarity index 100% rename from screenshots/home_black.jpg rename to fastlane/metadata/android/en-US/images/phoneScreenshots/4.jpg diff --git a/screenshots/songs.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/5.jpg similarity index 100% rename from screenshots/songs.jpg rename to fastlane/metadata/android/en-US/images/phoneScreenshots/5.jpg diff --git a/screenshots/albums.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/6.jpg similarity index 100% rename from screenshots/albums.jpg rename to fastlane/metadata/android/en-US/images/phoneScreenshots/6.jpg diff --git a/screenshots/artists.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/7.jpg similarity index 100% rename from screenshots/artists.jpg rename to fastlane/metadata/android/en-US/images/phoneScreenshots/7.jpg diff --git a/screenshots/settings.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/8.jpg similarity index 100% rename from screenshots/settings.jpg rename to fastlane/metadata/android/en-US/images/phoneScreenshots/8.jpg diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt new file mode 100644 index 000000000..d0978749e --- /dev/null +++ b/fastlane/metadata/android/en-US/short_description.txt @@ -0,0 +1 @@ +Material You Design Music player for Android \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7a3265ee9..7454180f2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6308cc5cc..59250647c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Dec 03 19:20:35 IST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionSha256Sum=b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip diff --git a/gradlew b/gradlew index cccdd3d51..1b6c78733 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -89,84 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done fi +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f9553162f..107acd32c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell