diff --git a/app/build.gradle b/app/build.gradle
index 3df0e6da..7676a98a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,8 +13,8 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
- versionCode 360
- versionName '3.3.200'
+ versionCode 365
+ versionName '3.4.000-beta01'
multiDexEnabled true
@@ -100,19 +100,21 @@ static def getDate() {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
+
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.fragment:fragment:1.2.0-alpha02'
- implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
+ implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta03'
implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.palette:palette:1.0.0"
implementation 'androidx.annotation:annotation:1.1.0'
- implementation 'androidx.preference:preference:1.1.0-rc01'
+ implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha09'
+ implementation 'com.google.android.play:core:1.6.1'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 045de18e..70872001 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
@@ -22,7 +23,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.RetroMusic.Light"
- android:usesCleartextTraffic="false">
+ android:usesCleartextTraffic="false"
+ tools:ignore="AllowBackup,GoogleAppIndexingWarning">
@@ -248,13 +250,13 @@
+ android:resource="@xml/automotive_app_desc" />
+ android:resource="@drawable/ic_notification" />
-
+
diff --git a/app/src/main/assets/retro-changelog.html b/app/src/main/assets/retro-changelog.html
index 5b402e34..31c069fc 100644
--- a/app/src/main/assets/retro-changelog.html
+++ b/app/src/main/assets/retro-changelog.html
@@ -1 +1 @@
-
v3.3.200
- Fix fullscreen bottom tabs icons squash
- Improved tiny theme colors
- Android auto support
- New notification icon
- Favorite icon in mini player
v.3.3.100
- Improved Now playing controls alignment
- Lot internal changes to improve performance
- Fix playlist adding crash
- Fix color corrections
- Fix file editing crash
v3.3.000
- SD card support for deleting and editing
v3.2.240
- Improved options dialog with selected color and title icon
- Fix dialog color on dark theme
v3.2.220
- Fix Notification SeekBar position (Need Android Q test)
- Rolled back settings tint icons
- Changed preference category title style according Android Q
- Fix tabs options not working
v3.2.203
- Carousel effect improved
- Settings icons are now tint accent color
- Settings title, back arrow and icons are now tint accent color
- Equalizer is removed
- Fix keyboard not popping on Search
- Curated the main options
- Folder toolbar outlined, folder icon background fix and separate line removed
- Edit text input handles are colored
v3.2.135
- Fix crashing on sharing song
v3.2.125
- Fix crashing on selecting profile picture
- Semi transparent color fix(s) on now playing themes
v3.2.120
- Fix crashing on choosing a theme
- Fix color theme selection without pro enabled
- Fix icon tint some places
v3.2.105
v3.2.100
- Fix crashing on Sleep timer
- Toolbar elevation removed added stroke instead
- Show empty indication for home
v3.2.000
- Implemented Artist image loading all thanks to VinylMusicPlayer
- Fixed buttons in Genre details
- Fixed color buttons in Album and Artist details screen
v3.1.900
- Added Play and Shuffle buttons on Songs list, Album Details, Artist Details, Playlist
Details etc.
- Home toolbar is semi transparent in Banner mode
- Added new Buy Retro Music pro in settings
- Improved dark color in Dark theme
v3.1.850
- Toolbar will be clickable for Search
v3.1.800
- Search bar CardView background
- Improve volume zero
- Now playing and Album theme picker rollback to dialog
- Fix sharing app link
- Fix scanning dialog
- Added settings icons for options
v3.1.700
- Cleaned internal code
- Removed full screen option
- Added Toolbar elevation
- To access menu either tap on Toolbar or Hamburger icon
- Fix back button not working on playing queue
- Fix crashing on What's New screen
- Fix lyrics dialog
- Changed toggles to line icons
- Custom UserImageView for loading user profile image
- Fix crashing on artist list for number format error
- Fix blacklist dialog crashing
- Rearranged icons and main menu access
- Fix some crashes when device is locked or background
- Folder screen have main options access
- Dialogs are now using Material Dialogs v3(BottomSheet)
- Fix Shuffle icon for Artist, Album, Genre and Playlist details
v3.1.400
- Removed sync lyrics for Android 5
- Fix Seek-bar color in settings
- Added keyboard to popup on search
- Added keyboard to popup on search
- Improved lock-screen behavior and UI
- Improved text appearance
- Fix bio text not showing in settings
- Fix not showing slider(blur, filter song) amount in settings
- Fix setting ringtone
- Fix file sharing crash
- Fix some crashes
- Fix playlist icon on small devices
- Fix empty lyrics text color
- Fix album cover background purple color in color theme
v3.1.300
- Fix rename playlist text color
- Fix same album showing in details page
- Fix lyrics text alignment on sync and lyrics reading improved
- Improved home sections loading
- Removed library options which are duplicated (it's available from profile menu)
- Replaced collapsing Fab with Android Floating Extended Fab
- Replaced home with for you
- Fixed profile image not loading in about
- Improved selecting user profile image
- Added bio to enter custom message
- Improved some UI screens
v3.1.240
- Fix Search not showing from home screen
- Fix Volume controls color issue
- Fix Seek bar alignment
- Added tiny theme
- Improved full theme appearances
- Now playing theme preview updated
- Fix composer error
- Bottom Options improved(internal)
v3.1.200
- Added composer sort and editing
- Fix Crash in Album tag editor while selecting options
- Added Filter song length
- Added Favourites playlist icon will be accent color
- Added Colorful settings icons
- Added Corners for dialog
v3.0.570
- Fix Album/Artist square image
- Fix Delete dialog text format
- Fix Profile picture not showing after coming back from folders
- Fix Play button color i Simple and Plain themes
- Fix Sleep timer dialog crashing
- Fix Share song dialog title and text
If you see entire app white or dark or black select same theme in settings to fix
FAQ's
*If you face any UI related issues you clear app data and cache, if its
not working try to
uninstall and install again.
\ No newline at end of file
+
v3.4.000
- Removed color theme as material design guidelines
- Fix remaining time in playing queue
- Fix font error
- Performance improved
- Updated internal libraries
v3.3.200
- Fix fullscreen bottom tabs icons squash
- Improved tiny theme colors
- Android auto support
- New notification icon
- Favorite icon in mini player
v.3.3.100
- Improved Now playing controls alignment
- Lot internal changes to improve performance
- Fix playlist adding crash
- Fix color corrections
- Fix file editing crash
v3.3.000
- SD card support for deleting and editing
v3.2.240
- Improved options dialog with selected color and title icon
- Fix dialog color on dark theme
v3.2.220
- Fix Notification SeekBar position (Need Android Q test)
- Rolled back settings tint icons
- Changed preference category title style according Android Q
- Fix tabs options not working
v3.2.203
- Carousel effect improved
- Settings icons are now tint accent color
- Settings title, back arrow and icons are now tint accent color
- Equalizer is removed
- Fix keyboard not popping on Search
- Curated the main options
- Folder toolbar outlined, folder icon background fix and separate line removed
- Edit text input handles are colored
v3.2.135
- Fix crashing on sharing song
v3.2.125
- Fix crashing on selecting profile picture
- Semi transparent color fix(s) on now playing themes
v3.2.120
- Fix crashing on choosing a theme
- Fix color theme selection without pro enabled
- Fix icon tint some places
v3.2.105
v3.2.100
- Fix crashing on Sleep timer
- Toolbar elevation removed added stroke instead
- Show empty indication for home
v3.2.000
- Implemented Artist image loading all thanks to VinylMusicPlayer
- Fixed buttons in Genre details
- Fixed color buttons in Album and Artist details screen
v3.1.900
- Added Play and Shuffle buttons on Songs list, Album Details, Artist Details, Playlist
Details etc.
- Home toolbar is semi transparent in Banner mode
- Added new Buy Retro Music pro in settings
- Improved dark color in Dark theme
v3.1.850
- Toolbar will be clickable for Search
v3.1.800
- Search bar CardView background
- Improve volume zero
- Now playing and Album theme picker rollback to dialog
- Fix sharing app link
- Fix scanning dialog
- Added settings icons for options
v3.1.700
- Cleaned internal code
- Removed full screen option
- Added Toolbar elevation
- To access menu either tap on Toolbar or Hamburger icon
- Fix back button not working on playing queue
- Fix crashing on What's New screen
- Fix lyrics dialog
- Changed toggles to line icons
- Custom UserImageView for loading user profile image
- Fix crashing on artist list for number format error
- Fix blacklist dialog crashing
- Rearranged icons and main menu access
- Fix some crashes when device is locked or background
- Folder screen have main options access
- Dialogs are now using Material Dialogs v3(BottomSheet)
- Fix Shuffle icon for Artist, Album, Genre and Playlist details
v3.1.400
- Removed sync lyrics for Android 5
- Fix Seek-bar color in settings
- Added keyboard to popup on search
- Added keyboard to popup on search
- Improved lock-screen behavior and UI
- Improved text appearance
- Fix bio text not showing in settings
- Fix not showing slider(blur, filter song) amount in settings
- Fix setting ringtone
- Fix file sharing crash
- Fix some crashes
- Fix playlist icon on small devices
- Fix empty lyrics text color
- Fix album cover background purple color in color theme
v3.1.300
- Fix rename playlist text color
- Fix same album showing in details page
- Fix lyrics text alignment on sync and lyrics reading improved
- Improved home sections loading
- Removed library options which are duplicated (it's available from profile menu)
- Replaced collapsing Fab with Android Floating Extended Fab
- Replaced home with for you
- Fixed profile image not loading in about
- Improved selecting user profile image
- Added bio to enter custom message
- Improved some UI screens
v3.1.240
- Fix Search not showing from home screen
- Fix Volume controls color issue
- Fix Seek bar alignment
- Added tiny theme
- Improved full theme appearances
- Now playing theme preview updated
- Fix composer error
- Bottom Options improved(internal)
v3.1.200
- Added composer sort and editing
- Fix Crash in Album tag editor while selecting options
- Added Filter song length
- Added Favourites playlist icon will be accent color
- Added Colorful settings icons
- Added Corners for dialog
v3.0.570
- Fix Album/Artist square image
- Fix Delete dialog text format
- Fix Profile picture not showing after coming back from folders
- Fix Play button color i Simple and Plain themes
- Fix Sleep timer dialog crashing
- Fix Share song dialog title and text
If you see entire app white or dark or black select same theme in settings to fix
FAQ's
*If you face any UI related issues you clear app data and cache, if its
not working try to
uninstall and install again.
\ No newline at end of file
diff --git a/app/src/main/java/code/name/monkey/retromusic/App.kt b/app/src/main/java/code/name/monkey/retromusic/App.kt
index 90967174..3fca1efa 100644
--- a/app/src/main/java/code/name/monkey/retromusic/App.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/App.kt
@@ -14,7 +14,6 @@
package code.name.monkey.retromusic
-import android.content.Context
import android.widget.Toast
import androidx.multidex.MultiDexApplication
import code.name.monkey.appthemehelper.ThemeStore
@@ -25,6 +24,7 @@ import code.name.monkey.retromusic.dagger.MusicComponent
import code.name.monkey.retromusic.dagger.module.AppModule
import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.TransactionDetails
+import com.google.android.play.core.missingsplits.MissingSplitsManagerFactory
class App : MultiDexApplication() {
@@ -32,10 +32,11 @@ class App : MultiDexApplication() {
lateinit var billingProcessor: BillingProcessor
override fun onCreate() {
+ if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
+ return
+ }
super.onCreate()
instance = this
-
-
musicComponent = DaggerMusicComponent.builder()
.appModule(AppModule(this))
.build()
@@ -72,19 +73,25 @@ class App : MultiDexApplication() {
}
companion object {
+ private var instance: App? = null
+ fun getContext(): App {
+ return instance!!
+ }
+
+ fun isProVersion(): Boolean {
+ return BuildConfig.DEBUG || instance?.billingProcessor!!.isPurchased(PRO_VERSION_PRODUCT_ID)
+ }
lateinit var musicComponent: MusicComponent
const val PRO_VERSION_PRODUCT_ID = "pro_version"
- lateinit var instance: App
- private set
- val context: Context
- get() = instance.applicationContext
+ /*val context: Context
+ get() = (instance as App).applicationContext*/
- val isProVersion: Boolean
- get() = BuildConfig.DEBUG || instance.billingProcessor.isPurchased(PRO_VERSION_PRODUCT_ID)
+ /*val isProVersion: Boolean
+ get() = BuildConfig.DEBUG || instance.billingProcessor.isPurchased(PRO_VERSION_PRODUCT_ID)*/
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/Injection.kt b/app/src/main/java/code/name/monkey/retromusic/Injection.kt
deleted file mode 100644
index 8023706e..00000000
--- a/app/src/main/java/code/name/monkey/retromusic/Injection.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2019 Hemanth Savarala.
- *
- * 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
-
-import code.name.monkey.retromusic.providers.RepositoryImpl
-import code.name.monkey.retromusic.providers.interfaces.Repository
-import code.name.monkey.retromusic.util.schedulers.BaseSchedulerProvider
-import code.name.monkey.retromusic.util.schedulers.SchedulerProvider
-
-object Injection {
-
- fun provideRepository(): Repository {
- return RepositoryImpl.instance
- }
-
- fun provideSchedulerProvider(): BaseSchedulerProvider {
- return SchedulerProvider.getInstance()
- }
-}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
index d553dea2..c665ae98 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
@@ -58,7 +58,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
private lateinit var album: Album
private val savedSortOrder: String
- get() = PreferenceUtil.getInstance().albumDetailSongSortOrder
+ get() = PreferenceUtil.getInstance(this).albumDetailSongSortOrder
override fun createContentView(): View {
return wrapSlidingMusicPanel(R.layout.activity_album)
@@ -101,7 +101,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
setOnClickListener { MusicPlayerRemote.openAndShuffleQueue(album.songs!!, true) }
}
- App.musicComponent.inject(this)
+ App.musicComponent?.inject(this)
albumDetailsPresenter.attachView(this)
if (intent.extras!!.containsKey(EXTRA_ALBUM_ID)) {
@@ -137,7 +137,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp)
- if (toolbar != null && !PreferenceUtil.getInstance().fullScreenMode) {
+ if (toolbar != null && !PreferenceUtil.getInstance(this).fullScreenMode) {
val params = toolbar.layoutParams as ViewGroup.MarginLayoutParams
params.topMargin = RetroUtil.getStatusBarHeight()
toolbar.layoutParams = params
@@ -256,13 +256,13 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
}
private fun setColors(color: Int) {
- val themeColor = if (PreferenceUtil.getInstance().adaptiveColor) color
+ val themeColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color
else ThemeStore.accentColor(this)
songTitle.setTextColor(themeColor)
moreTitle.setTextColor(themeColor)
- val buttonColor = if (PreferenceUtil.getInstance().adaptiveColor) color
+ val buttonColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color
else ATHUtil.resolveColor(this, R.attr.cardBackgroundColor)
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
@@ -340,7 +340,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
}
private fun setSaveSortOrder(sortOrder: String?) {
- PreferenceUtil.getInstance().albumDetailSongSortOrder = sortOrder
+ PreferenceUtil.getInstance(this).albumDetailSongSortOrder = sortOrder
reload()
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
index 06cd0c27..b576f55e 100755
--- a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
@@ -81,7 +81,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
ActivityCompat.postponeEnterTransition(this)
- App.musicComponent.inject(this)
+ App.musicComponent?.inject(this)
artistDetailsPresenter.attachView(this)
if (intent.extras!!.containsKey(EXTRA_ARTIST_ID)) {
@@ -137,7 +137,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
supportActionBar?.title = null
- if (toolbar != null && !PreferenceUtil.getInstance().fullScreenMode) {
+ if (toolbar != null && !PreferenceUtil.getInstance(this).fullScreenMode) {
val params = toolbar!!.layoutParams as ViewGroup.MarginLayoutParams
params.topMargin = RetroUtil.getStatusBarHeight()
toolbar!!.layoutParams = params
@@ -279,13 +279,13 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
private fun setColors(color: Int) {
- val textColor = if (PreferenceUtil.getInstance().adaptiveColor) color else ThemeStore.accentColor(this)
+ val textColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color else ThemeStore.accentColor(this)
albumTitle.setTextColor(textColor)
songTitle.setTextColor(textColor)
biographyTitle.setTextColor(textColor)
- val buttonColor = if (PreferenceUtil.getInstance().adaptiveColor) color
+ val buttonColor = if (PreferenceUtil.getInstance(this).adaptiveColor) color
else ATHUtil.resolveColor(this, R.attr.cardBackgroundColor)
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt
index 995c6f98..0851a793 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt
@@ -65,7 +65,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
setUpToolBar()
setupRecyclerView()
- App.musicComponent.inject(this)
+ App.musicComponent?.inject(this)
genreDetailsPresenter.attachView(this)
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
index ed2c4f1a..23ef2c57 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
@@ -61,7 +61,7 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
}
override fun onPageSelected(position: Int) {
- PreferenceUtil.getInstance().lyricsOptions = position
+ PreferenceUtil.getInstance(this).lyricsOptions = position
if (position == 0) fab.text = getString(R.string.synced_lyrics)
else if (position == 1) fab.text = getString(R.string.lyrics)
}
@@ -110,7 +110,7 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
viewPager.apply {
adapter = PagerAdapter(supportFragmentManager)
- currentItem = PreferenceUtil.getInstance().lyricsOptions
+ currentItem = PreferenceUtil.getInstance(this@LyricsActivity).lyricsOptions
addOnPageChangeListener(this@LyricsActivity)
}
@@ -234,7 +234,7 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
}
override fun getPageTitle(position: Int): CharSequence? {
- return App.context.getString(tabs[position].title)
+ return App.getContext().getString(tabs[position].title)
}
override fun getCount(): Int {
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt
index ed25ec1a..660ff156 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.kt
@@ -1,13 +1,11 @@
package code.name.monkey.retromusic.activities
-import android.annotation.SuppressLint
import android.content.*
import android.content.pm.PackageManager
import android.os.Bundle
import android.provider.MediaStore
import android.util.Log
import android.view.View
-import android.view.ViewGroup
import androidx.core.app.ActivityCompat
import androidx.fragment.app.Fragment
import code.name.monkey.retromusic.R
@@ -37,7 +35,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
override fun onReceive(context: Context, intent: Intent) {
val action = intent.action
if (action != null && action == Intent.ACTION_SCREEN_OFF) {
- if (PreferenceUtil.getInstance().lockScreen && MusicPlayerRemote.isPlaying) {
+ if (PreferenceUtil.getInstance(this@MainActivity).lockScreen && MusicPlayerRemote.isPlaying) {
val activity = Intent(context, LockScreenActivity::class.java)
activity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
activity.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
@@ -57,16 +55,16 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
- getBottomNavigationView().selectedItemId = PreferenceUtil.getInstance().lastPage
+ getBottomNavigationView().selectedItemId = PreferenceUtil.getInstance(this).lastPage
getBottomNavigationView().setOnNavigationItemSelectedListener {
- PreferenceUtil.getInstance().lastPage = it.itemId
+ PreferenceUtil.getInstance(this).lastPage = it.itemId
selectedFragment(it.itemId)
true
}
if (savedInstanceState == null) {
- selectedFragment(PreferenceUtil.getInstance().lastPage)
+ selectedFragment(PreferenceUtil.getInstance(this).lastPage)
} else {
restoreCurrentFragment();
}
@@ -82,7 +80,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
try {
val pInfo = packageManager.getPackageInfo(packageName, 0)
val currentVersion = pInfo.versionCode
- if (currentVersion != PreferenceUtil.getInstance().lastChangelogVersion) {
+ if (currentVersion != PreferenceUtil.getInstance(this).lastChangelogVersion) {
startActivityForResult(Intent(this, WhatsNewActivity::class.java), APP_INTRO_REQUEST)
}
} catch (e: PackageManager.NameNotFoundException) {
@@ -97,7 +95,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
screenOnOff.addAction(Intent.ACTION_SCREEN_OFF)
registerReceiver(broadcastReceiver, screenOnOff)
- PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this)
+ PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this)
if (intent.hasExtra("expand")) {
if (intent.getBooleanExtra("expand", false)) {
@@ -111,7 +109,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), SharedPreferences.OnSharedP
super.onDestroy()
disposable.clear()
unregisterReceiver(broadcastReceiver)
- PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this)
+ PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this)
}
private fun setCurrentFragment(fragment: Fragment, b: Boolean = false) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt
index 67eeafa1..0a28f42d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt
@@ -64,7 +64,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
finish()
}
- App.musicComponent.inject(this)
+ App.musicComponent?.inject(this)
playlistSongsPresenter.attachView(this)
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt
index 525eb168..eb9ac0be 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/PurchaseActivity.kt
@@ -74,7 +74,7 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
}
override fun onPurchaseHistoryRestored() {
- if (App.isProVersion) {
+ if (App.isProVersion()) {
Toast.makeText(this, R.string.restored_previous_purchase_please_restart, Toast.LENGTH_LONG).show()
setResult(RESULT_OK)
} else {
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/SearchActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/SearchActivity.kt
index 2f35e284..cf35da35 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/SearchActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/SearchActivity.kt
@@ -45,7 +45,7 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_search)
- App.musicComponent.inject(this)
+ App.musicComponent?.inject(this)
searchPresenter.attachView(this)
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/SettingsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/SettingsActivity.kt
index 301a48d3..739ddf77 100755
--- a/app/src/main/java/code/name/monkey/retromusic/activities/SettingsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/SettingsActivity.kt
@@ -8,7 +8,6 @@ import androidx.fragment.app.Fragment
import androidx.transition.TransitionManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
-import code.name.monkey.retromusic.App.Companion.context
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
@@ -41,7 +40,7 @@ class SettingsActivity : AbsBaseActivity(), SharedPreferences.OnSharedPreference
setSupportActionBar(toolbar)
setTitle(R.string.action_settings)
toolbar.apply {
- setTitleTextColor( ThemeStore.textColorPrimary(context))
+ setTitleTextColor(ThemeStore.textColorPrimary(context))
setBackgroundColor(ThemeStore.primaryColor(context))
setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.textColorSecondary(context))
@@ -87,12 +86,12 @@ class SettingsActivity : AbsBaseActivity(), SharedPreferences.OnSharedPreference
public override fun onPause() {
super.onPause()
- PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this)
+ PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this)
}
public override fun onResume() {
super.onResume()
- PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this)
+ PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this)
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/UserInfoActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/UserInfoActivity.kt
index 5030e32d..4c0a7234 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/UserInfoActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/UserInfoActivity.kt
@@ -55,14 +55,14 @@ class UserInfoActivity : AbsBaseActivity() {
MaterialUtil.setTint(nameContainer, false)
MaterialUtil.setTint(bioContainer, false)
- name.setText(PreferenceUtil.getInstance().userName)
- bio.setText(PreferenceUtil.getInstance().userBio)
+ name.setText(PreferenceUtil.getInstance(this).userName)
+ bio.setText(PreferenceUtil.getInstance(this).userBio)
- if (PreferenceUtil.getInstance().profileImage.isNotEmpty()) {
- loadImageFromStorage(PreferenceUtil.getInstance().profileImage)
+ if (PreferenceUtil.getInstance(this).profileImage.isNotEmpty()) {
+ loadImageFromStorage(PreferenceUtil.getInstance(this).profileImage)
}
- if (PreferenceUtil.getInstance().bannerImage.isNotEmpty()) {
- loadBannerFromStorage(PreferenceUtil.getInstance().bannerImage)
+ if (PreferenceUtil.getInstance(this).bannerImage.isNotEmpty()) {
+ loadBannerFromStorage(PreferenceUtil.getInstance(this).bannerImage)
}
userImage.setOnClickListener {
MaterialDialog(this, BottomSheet()).show {
@@ -70,7 +70,7 @@ class UserInfoActivity : AbsBaseActivity() {
listItems(items = listOf(getString(R.string.new_profile_photo), getString(R.string.remove_profile_photo))) { _, position, _ ->
when (position) {
0 -> pickNewPhoto()
- 1 -> PreferenceUtil.getInstance().saveProfileImage("")
+ 1 -> PreferenceUtil.getInstance(this@UserInfoActivity).saveProfileImage("")
}
}
}
@@ -90,7 +90,7 @@ class UserInfoActivity : AbsBaseActivity() {
return@setOnClickListener
}*/
- PreferenceUtil.getInstance().userName = nameString
+ PreferenceUtil.getInstance(this).userName = nameString
//PreferenceUtil.getInstance().userBio = bioString
setResult(Activity.RESULT_OK)
finish()
@@ -122,7 +122,7 @@ class UserInfoActivity : AbsBaseActivity() {
{ _, position, _ ->
when (position) {
0 -> selectBannerImage()
- 1 -> PreferenceUtil.getInstance().setBannerImagePath("")
+ 1 -> PreferenceUtil.getInstance(this@UserInfoActivity).setBannerImagePath("")
}
}
}
@@ -130,7 +130,7 @@ class UserInfoActivity : AbsBaseActivity() {
private fun selectBannerImage() {
- if (TextUtils.isEmpty(PreferenceUtil.getInstance().bannerImage)) {
+ if (TextUtils.isEmpty(PreferenceUtil.getInstance(this).bannerImage)) {
val pickImageIntent = Intent(Intent.ACTION_PICK, Media.EXTERNAL_CONTENT_URI)
pickImageIntent.type = "image/*"
//pickImageIntent.putExtra("crop", "true")
@@ -142,7 +142,7 @@ class UserInfoActivity : AbsBaseActivity() {
//intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(pickImageIntent, "Select Picture"), PICK_BANNER_REQUEST)
} else {
- PreferenceUtil.getInstance().setBannerImagePath("")
+ PreferenceUtil.getInstance(this).setBannerImagePath("")
bannerImage.setImageResource(android.R.color.transparent)
}
}
@@ -169,7 +169,7 @@ class UserInfoActivity : AbsBaseActivity() {
data.data?.let {
val bitmap = getResizedBitmap(getBitmap(contentResolver, it), PROFILE_ICON_SIZE)
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
- PreferenceUtil.getInstance().saveProfileImage(profileImagePath)
+ PreferenceUtil.getInstance(this).saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
}
@@ -182,7 +182,7 @@ class UserInfoActivity : AbsBaseActivity() {
data.data?.let {
val bitmap = getBitmap(contentResolver, it)
val profileImagePath = saveToInternalStorage(bitmap, USER_BANNER)
- PreferenceUtil.getInstance().setBannerImagePath(profileImagePath)
+ PreferenceUtil.getInstance(this).setBannerImagePath(profileImagePath)
loadBannerFromStorage(profileImagePath)
}
} catch (e: IOException) {
@@ -199,7 +199,7 @@ class UserInfoActivity : AbsBaseActivity() {
if (aUri == null) {
return imagePath
}
- if (DocumentsContract.isDocumentUri(App.context, aUri)) {
+ if (DocumentsContract.isDocumentUri(App.getContext(), aUri)) {
val documentId = DocumentsContract.getDocumentId(aUri)
if ("com.android.providers.media.documents" == aUri.authority) {
val id = documentId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
@@ -220,7 +220,7 @@ class UserInfoActivity : AbsBaseActivity() {
private fun getImagePath(aUri: Uri, aSelection: String?): String? {
var path: String? = null
- val cursor = App.context.contentResolver.query(aUri, null, aSelection, null, null)
+ val cursor = App.getContext().contentResolver.query(aUri, null, aSelection, null, null)
if (cursor != null) {
if (cursor.moveToFirst()) {
path = cursor.getString(cursor.getColumnIndex(Media.DATA))
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.java b/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.java
index 114e538d..ff154927 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.java
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.java
@@ -37,7 +37,7 @@ public class WhatsNewActivity extends AbsBaseActivity {
try {
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
int currentVersion = pInfo.versionCode;
- PreferenceUtil.getInstance().setLastChangeLogVersion(currentVersion);
+ PreferenceUtil.getInstance(context).setLastChangeLogVersion(currentVersion);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
index be972cc7..17d18b8e 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt
@@ -67,7 +67,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
override fun onResume() {
super.onResume()
- if (currentNowPlayingScreen != PreferenceUtil.getInstance().nowPlayingScreen) {
+ if (currentNowPlayingScreen != PreferenceUtil.getInstance(this).nowPlayingScreen) {
postRecreate()
}
}
@@ -181,7 +181,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
}
private fun chooseFragmentForTheme() {
- currentNowPlayingScreen = PreferenceUtil.getInstance().nowPlayingScreen
+ currentNowPlayingScreen = PreferenceUtil.getInstance(this).nowPlayingScreen
val fragment: Fragment = when (currentNowPlayingScreen) {
BLUR -> BlurPlayerFragment()
@@ -262,7 +262,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
val isColorLight = ColorUtil.isColorLight(paletteColor)
- if (PreferenceUtil.getInstance().adaptiveColor &&
+ if (PreferenceUtil.getInstance(this).adaptiveColor &&
(currentNowPlayingScreen == NORMAL || currentNowPlayingScreen == FLAT)) {
super.setLightNavigationBar(true)
super.setLightStatusbar(isColorLight)
@@ -314,7 +314,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
private fun updateTabs() {
bottomNavigationView.menu.clear()
- val currentTabs = PreferenceUtil.getInstance().libraryCategoryInfos
+ val currentTabs = PreferenceUtil.getInstance(this).libraryCategoryInfos
for (tab in currentTabs) {
if (tab.visible) {
val menu = tab.category;
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt
index 006e4214..333198a9 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt
@@ -25,7 +25,7 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
private val handler = Handler()
override fun onCreate(savedInstanceState: Bundle?) {
- setTheme(PreferenceUtil.getInstance().generalTheme)
+ setTheme(PreferenceUtil.getInstance(this).generalTheme)
hideStatusBar()
super.onCreate(savedInstanceState)
//MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this)
@@ -37,7 +37,7 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
}
private fun toggleScreenOn() {
- if (PreferenceUtil.getInstance().isScreenOnEnabled) {
+ if (PreferenceUtil.getInstance(this).isScreenOnEnabled) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
@@ -56,7 +56,7 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
}
fun hideStatusBar() {
- hideStatusBar(PreferenceUtil.getInstance().fullScreenMode)
+ hideStatusBar(PreferenceUtil.getInstance(this).fullScreenMode)
}
private fun hideStatusBar(fullscreen: Boolean) {
@@ -68,7 +68,7 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
private fun changeBackgroundShape() {
- var background: Drawable? = if (PreferenceUtil.getInstance().isRoundCorners)
+ var background: Drawable? = if (PreferenceUtil.getInstance(this).isRoundCorners)
ContextCompat.getDrawable(this, R.drawable.round_window)
else
ContextCompat.getDrawable(this, R.drawable.square_window)
@@ -168,7 +168,7 @@ abstract class AbsThemeActivity : ATHActivity(), Runnable {
or View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
- if (PreferenceUtil.getInstance().fullScreenMode) {
+ if (PreferenceUtil.getInstance(this).fullScreenMode) {
window.decorView.systemUiVisibility = flags
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/bugreport/model/DeviceInfo.java b/app/src/main/java/code/name/monkey/retromusic/activities/bugreport/model/DeviceInfo.java
index dd5d5463..ec6c4a7a 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/bugreport/model/DeviceInfo.java
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/bugreport/model/DeviceInfo.java
@@ -54,9 +54,9 @@ public class DeviceInfo {
versionCode = -1;
versionName = null;
}
- baseTheme = PreferenceUtil.getInstance().getBaseTheme();
- nowPlayingTheme = context.getString(PreferenceUtil.getInstance().getNowPlayingScreen().getTitleRes());
- isAdaptive = PreferenceUtil.getInstance().getAdaptiveColor();
+ baseTheme = PreferenceUtil.getInstance(context).getBaseTheme();
+ nowPlayingTheme = context.getString(PreferenceUtil.getInstance(context).getNowPlayingScreen().getTitleRes());
+ isAdaptive = PreferenceUtil.getInstance(context).getAdaptiveColor();
}
public String toMarkdown() {
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/ContributorAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/ContributorAdapter.kt
index 657e241e..eb2ec84f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/ContributorAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/ContributorAdapter.kt
@@ -12,10 +12,28 @@ import code.name.monkey.retromusic.model.Contributor
import code.name.monkey.retromusic.util.RetroUtil.openUrl
import code.name.monkey.retromusic.views.CircularImageView
-class ContributorAdapter(private var contributors: List) : RecyclerView.Adapter() {
+class ContributorAdapter(
+ private var contributors: List
+) : RecyclerView.Adapter() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
- return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_contributor, parent, false))
+ return if (viewType == HEADER) {
+ ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_contributor_header, parent, false))
+ } else
+ ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_contributor, parent, false))
+ }
+
+ companion object {
+ const val HEADER: Int = 0
+ const val ITEM: Int = 1
+ }
+
+ override fun getItemViewType(position: Int): Int {
+ return if (position == 0) {
+ HEADER
+ } else {
+ ITEM
+ }
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/GenreAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/GenreAdapter.kt
index e4d6febb..8ea1cf20 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/GenreAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/GenreAdapter.kt
@@ -15,7 +15,11 @@ import java.util.*
* @author Hemanth S (h4h13).
*/
-class GenreAdapter(private val mActivity: Activity, dataSet: ArrayList, private val mItemLayoutRes: Int) : RecyclerView.Adapter() {
+class GenreAdapter(
+ private val mActivity: Activity,
+ dataSet: ArrayList,
+ private val mItemLayoutRes: Int
+) : RecyclerView.Adapter() {
var dataSet = ArrayList()
private set
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt
index 9da4a7ea..b6eb3800 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/HomeAdapter.kt
@@ -8,7 +8,6 @@ import android.view.ViewGroup
import androidx.annotation.IntDef
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
-import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
@@ -16,13 +15,19 @@ import code.name.monkey.retromusic.adapter.album.AlbumFullWidthAdapter
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
import code.name.monkey.retromusic.adapter.song.SongAdapter
import code.name.monkey.retromusic.loaders.PlaylistSongsLoader
-import code.name.monkey.retromusic.model.*
+import code.name.monkey.retromusic.model.Album
+import code.name.monkey.retromusic.model.Artist
+import code.name.monkey.retromusic.model.Home
+import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.util.PreferenceUtil
import com.google.android.material.chip.Chip
-class HomeAdapter(private val activity: AppCompatActivity, private var homes: List, private val displayMetrics: DisplayMetrics) : RecyclerView.Adapter() {
-
+class HomeAdapter(
+ private val activity: AppCompatActivity,
+ private var homes: List,
+ private val displayMetrics: DisplayMetrics
+) : RecyclerView.Adapter() {
override fun getItemViewType(position: Int): Int {
return homes[position].homeSection
@@ -96,13 +101,14 @@ class HomeAdapter(private val activity: AppCompatActivity, private var homes: Li
fun bindView(home: Home) {
recyclerView.apply {
layoutManager = GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false)
- val artistAdapter = ArtistAdapter(activity, home.arrayList as ArrayList, PreferenceUtil.getInstance().getHomeGridStyle(context!!), false, null)
+ val artistAdapter = ArtistAdapter(activity, home.arrayList as ArrayList, PreferenceUtil.getInstance(activity).getHomeGridStyle(context!!), false, null)
adapter = artistAdapter
}
chip.text = activity.getString(home.title)
chip.setChipIconResource(home.icon)
}
}
+
private inner class PlaylistViewHolder(view: View) : AbsHomeViewItem(view) {
fun bindView(home: Home) {
val songs = PlaylistSongsLoader.getPlaylistSongList(activity, home.arrayList[0] as Playlist)
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/SearchAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/SearchAdapter.kt
index b359575d..0d3e12be 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/SearchAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/SearchAdapter.kt
@@ -8,6 +8,7 @@ import androidx.core.util.Pair
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
+import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.glide.GlideApp
import code.name.monkey.retromusic.glide.RetroGlideExtension
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@@ -15,13 +16,15 @@ import code.name.monkey.retromusic.helper.menu.SongMenuHelper
import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.model.Song
-import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.NavigationUtil
import java.util.*
-class SearchAdapter(private val activity: AppCompatActivity, private var dataSet: List?) : RecyclerView.Adapter() {
+class SearchAdapter(
+ private val activity: AppCompatActivity,
+ private var dataSet: List?
+) : RecyclerView.Adapter() {
fun swapDataSet(dataSet: MutableList) {
this.dataSet = dataSet
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/SongFileAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/SongFileAdapter.kt
index 3d2db5cc..6576b058 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/SongFileAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/SongFileAdapter.kt
@@ -31,7 +31,8 @@ class SongFileAdapter(
private var dataSet: List?,
private val itemLayoutRes: Int,
private val callbacks: Callbacks?,
- cabHolder: CabHolder?) : AbsMultiSelectAdapter(activity, cabHolder, R.menu.menu_media_selection), FastScrollRecyclerView.SectionedAdapter {
+ cabHolder: CabHolder?
+) : AbsMultiSelectAdapter(activity, cabHolder, R.menu.menu_media_selection), FastScrollRecyclerView.SectionedAdapter {
init {
this.setHasStableIds(true)
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt
index 46617d3a..e1ccba4d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt
@@ -166,7 +166,7 @@ open class AlbumAdapter(protected val activity: AppCompatActivity,
override fun getSectionName(position: Int): String {
var sectionName: String? = null
- when (PreferenceUtil.getInstance().albumSortOrder) {
+ when (PreferenceUtil.getInstance(activity).albumSortOrder) {
SortOrder.AlbumSortOrder.ALBUM_A_Z, SortOrder.AlbumSortOrder.ALBUM_Z_A -> sectionName = dataSet[position].title
SortOrder.AlbumSortOrder.ALBUM_ARTIST -> sectionName = dataSet[position].artistName
SortOrder.AlbumSortOrder.ALBUM_YEAR -> return MusicUtil.getYearString(dataSet[position].year)
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt
index a7e99635..93d038b3 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt
@@ -71,7 +71,7 @@ class AlbumCoverPagerAdapter(fm: FragmentManager, private val dataSet: ArrayList
private val layout: Int
get() {
- return when (PreferenceUtil.getInstance().albumCoverStyle) {
+ return when (PreferenceUtil.getInstance(activity).albumCoverStyle) {
AlbumCoverStyle.NORMAL -> R.layout.fragment_album_cover
AlbumCoverStyle.FLAT -> R.layout.fragment_album_flat_cover
AlbumCoverStyle.CIRCLE -> R.layout.fragment_album_circle_cover
@@ -92,8 +92,8 @@ class AlbumCoverPagerAdapter(fm: FragmentManager, private val dataSet: ArrayList
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val finalLayout = when {
- PreferenceUtil.getInstance().nowPlayingScreen == NowPlayingScreen.CLASSIC -> R.layout.fragment_album_full_cover
- PreferenceUtil.getInstance().carouselEffect() -> R.layout.fragment_album_carousel_cover
+ PreferenceUtil.getInstance(activity).nowPlayingScreen == NowPlayingScreen.CLASSIC -> R.layout.fragment_album_full_cover
+ PreferenceUtil.getInstance(activity).carouselEffect() -> R.layout.fragment_album_carousel_cover
else -> layout
}
val view = inflater.inflate(finalLayout, container, false)
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt
index 2b1eafce..8b39ca1f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt
@@ -150,7 +150,7 @@ open class SongAdapter @JvmOverloads constructor(protected val activity: AppComp
if (!showSectionName) {
return ""
}
- val sectionName: String? = when (PreferenceUtil.getInstance().songSortOrder) {
+ val sectionName: String? = when (PreferenceUtil.getInstance(activity).songSortOrder) {
SortOrder.SongSortOrder.SONG_A_Z, SortOrder.SongSortOrder.SONG_Z_A -> dataSet[position].title
SortOrder.SongSortOrder.SONG_ALBUM -> dataSet[position].albumName
SortOrder.SongSortOrder.SONG_ARTIST -> dataSet[position].artistName
diff --git a/app/src/main/java/code/name/monkey/retromusic/appshortcuts/AppShortcutIconGenerator.kt b/app/src/main/java/code/name/monkey/retromusic/appshortcuts/AppShortcutIconGenerator.kt
index c467858f..5660d585 100644
--- a/app/src/main/java/code/name/monkey/retromusic/appshortcuts/AppShortcutIconGenerator.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/appshortcuts/AppShortcutIconGenerator.kt
@@ -32,7 +32,7 @@ import code.name.monkey.retromusic.util.RetroUtil
@RequiresApi(Build.VERSION_CODES.N_MR1)
object AppShortcutIconGenerator {
fun generateThemedIcon(context: Context, iconId: Int): Icon {
- return if (PreferenceUtil.getInstance().coloredAppShortcuts()) {
+ return if (PreferenceUtil.getInstance(context).coloredAppShortcuts()) {
generateUserThemedIcon(context, iconId)
} else {
generateDefaultThemedIcon(context, iconId)
diff --git a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetText.kt b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetText.kt
index 73fc3b34..251bcb15 100644
--- a/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetText.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/appwidgets/AppWidgetText.kt
@@ -22,7 +22,7 @@ import android.text.TextUtils
import android.view.View
import android.widget.RemoteViews
import androidx.core.content.ContextCompat
-import code.name.monkey.retromusic.App.Companion.context
+import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.MainActivity
import code.name.monkey.retromusic.appwidgets.base.BaseAppWidget
@@ -95,9 +95,9 @@ class AppWidgetText : BaseAppWidget() {
R.drawable.ic_pause_white_24dp
else
R.drawable.ic_play_arrow_white_32dp
- appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(context, playPauseRes, ContextCompat.getColor(context, R.color.md_white_1000))!!, 1f))
- appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000))!!, 1f))
- appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, ContextCompat.getColor(context, R.color.md_white_1000))!!, 1f))
+ appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(RetroUtil.getTintedVectorDrawable(App.getContext(), playPauseRes, ContextCompat.getColor(App.getContext(), R.color.md_white_1000))!!, 1f))
+ appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(RetroUtil.getTintedVectorDrawable(App.getContext(), R.drawable.ic_skip_next_white_24dp, ContextCompat.getColor(App.getContext(), R.color.md_white_1000))!!, 1f))
+ appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(RetroUtil.getTintedVectorDrawable(App.getContext(), R.drawable.ic_skip_previous_white_24dp, ContextCompat.getColor(App.getContext(), R.color.md_white_1000))!!, 1f))
diff --git a/app/src/main/java/code/name/monkey/retromusic/appwidgets/base/BaseAppWidget.kt b/app/src/main/java/code/name/monkey/retromusic/appwidgets/base/BaseAppWidget.kt
index 53fd79e9..a810e2cd 100644
--- a/app/src/main/java/code/name/monkey/retromusic/appwidgets/base/BaseAppWidget.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/appwidgets/base/BaseAppWidget.kt
@@ -97,7 +97,7 @@ abstract class BaseAppWidget : AppWidgetProvider() {
protected fun getAlbumArtDrawable(resources: Resources, bitmap: Bitmap?): Drawable {
return if (bitmap == null) {
- ContextCompat.getDrawable(App.context, R.drawable.default_album_art)!!
+ ContextCompat.getDrawable(App.getContext(), R.drawable.default_album_art)!!
} else {
BitmapDrawable(resources, bitmap)
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt
index ad5acafa..84f801ff 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt
@@ -34,7 +34,7 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
val mainActivity = activity as MainActivity? ?: return
when (view.id) {
R.id.actionFolders -> mainActivity.selectedFragment(R.id.action_folder)
- R.id.actionLibrary -> mainActivity.selectedFragment(PreferenceUtil.getInstance().lastPage)
+ R.id.actionLibrary -> mainActivity.selectedFragment(PreferenceUtil.getInstance(requireContext()).lastPage)
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
R.id.actionRate -> NavigationUtil.goToPlayStore(mainActivity)
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt
index c3121071..d1ba375b 100755
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt
@@ -60,14 +60,14 @@ class SleepTimerDialog : DialogFragment() {
materialDialog = MaterialDialog(activity!!, BottomSheet())
.title(R.string.action_sleep_timer)
.positiveButton(R.string.action_set) {
- PreferenceUtil.getInstance().sleepTimerFinishMusic = shouldFinishLastSong.isChecked
+ PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic = shouldFinishLastSong.isChecked
val minutes = seekArcProgress
val pi = makeTimerPendingIntent(PendingIntent.FLAG_CANCEL_CURRENT)
val nextSleepTimerElapsedTime = SystemClock.elapsedRealtime() + minutes * 60 * 1000
- PreferenceUtil.getInstance().setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime)
+ PreferenceUtil.getInstance(requireContext()).setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime)
val am = activity!!.getSystemService(Context.ALARM_SERVICE) as AlarmManager
am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextSleepTimerElapsedTime, pi)
@@ -109,11 +109,11 @@ class SleepTimerDialog : DialogFragment() {
timerDisplay = materialDialog.getCustomView().findViewById(R.id.timerDisplay)
- val finishMusic = PreferenceUtil.getInstance().sleepTimerFinishMusic
+ val finishMusic = PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic
shouldFinishLastSong.isChecked = finishMusic
- seekArcProgress = PreferenceUtil.getInstance().lastSleepTimerValue
+ seekArcProgress = PreferenceUtil.getInstance(requireContext()).lastSleepTimerValue
updateTimeDisplayTime()
seekBar.progress = seekArcProgress
@@ -134,7 +134,7 @@ class SleepTimerDialog : DialogFragment() {
}
override fun onStopTrackingTouch(seekBar: SeekBar) {
- PreferenceUtil.getInstance().lastSleepTimerValue = seekArcProgress
+ PreferenceUtil.getInstance(requireContext()).lastSleepTimerValue = seekArcProgress
}
})
@@ -167,7 +167,7 @@ class SleepTimerDialog : DialogFragment() {
}
}
- private inner class TimerUpdater internal constructor() : CountDownTimer(PreferenceUtil.getInstance().nextSleepTimerElapsedRealTime - SystemClock.elapsedRealtime(), 1000) {
+ private inner class TimerUpdater internal constructor() : CountDownTimer(PreferenceUtil.getInstance(requireContext()).nextSleepTimerElapsedRealTime - SystemClock.elapsedRealtime(), 1000) {
override fun onTick(millisUntilFinished: Long) {
materialDialog.getActionButton(WhichButton.NEGATIVE).text =
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt
index af98f3f2..0bd4ef02 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/MiniPlayerFragment.kt
@@ -61,9 +61,9 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
actionPrevious.visibility = View.VISIBLE
actionPlayingQueue.visibility = View.VISIBLE
} else {
- actionNext.visibility = if (PreferenceUtil.getInstance().isExtraMiniExtraControls) View.VISIBLE else View.GONE
- actionPlayingQueue.visibility = if (PreferenceUtil.getInstance().isExtraMiniExtraControls) View.GONE else View.VISIBLE
- actionPrevious.visibility = if (PreferenceUtil.getInstance().isExtraMiniExtraControls) View.VISIBLE else View.GONE
+ actionNext.visibility = if (PreferenceUtil.getInstance(requireContext()).isExtraMiniExtraControls) View.VISIBLE else View.GONE
+ actionPlayingQueue.visibility = if (PreferenceUtil.getInstance(requireContext()).isExtraMiniExtraControls) View.GONE else View.VISIBLE
+ actionPrevious.visibility = if (PreferenceUtil.getInstance(requireContext()).isExtraMiniExtraControls) View.VISIBLE else View.GONE
}
actionPlayingQueue.setOnClickListener(this)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/VolumeFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/VolumeFragment.kt
index 69674fae..067e79c2 100755
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/VolumeFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/VolumeFragment.kt
@@ -118,7 +118,7 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum
}
private fun setPauseWhenZeroVolume(pauseWhenZeroVolume: Boolean) {
- if (PreferenceUtil.getInstance().pauseOnZeroVolume())
+ if (PreferenceUtil.getInstance(requireContext()).pauseOnZeroVolume())
if (MusicPlayerRemote.isPlaying && pauseWhenZeroVolume) {
MusicPlayerRemote.pauseSong()
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerControlsFragment.kt
index b89f73c8..bbc79bfe 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerControlsFragment.kt
@@ -61,7 +61,7 @@ abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(), MusicProgr
protected var volumeFragment: VolumeFragment? = null
private fun hideVolumeIfAvailable() {
- if (PreferenceUtil.getInstance().volumeToggle) {
+ if (PreferenceUtil.getInstance(requireContext()).volumeToggle) {
requireFragmentManager().beginTransaction().replace(R.id.volumeFragmentContainer, VolumeFragment()).commit()
requireFragmentManager().executePendingTransactions()
volumeFragment = requireFragmentManager().findFragmentById(R.id.volumeFragmentContainer) as VolumeFragment?
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerFragment.kt
index 90d2a7f4..e78329fe 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsPlayerFragment.kt
@@ -248,7 +248,7 @@ abstract class AbsPlayerFragment : AbsMusicServiceFragment(),
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(ThemeStore.primaryColor(requireActivity()))
- if (PreferenceUtil.getInstance().fullScreenMode &&
+ if (PreferenceUtil.getInstance(requireContext()).fullScreenMode &&
view.findViewById(R.id.status_bar) != null) {
view.findViewById(R.id.status_bar).visibility = View.GONE
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/AlbumsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/AlbumsFragment.kt
index 69753814..ee4fc1d1 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/AlbumsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/AlbumsFragment.kt
@@ -31,14 +31,14 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment) {
- adapter!!.swapDataSet(list)
+ override fun playlists(playlists: ArrayList) {
+ adapter!!.swapDataSet(playlists)
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt
index d06b73fa..3ed294fa 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt
@@ -25,7 +25,7 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment bannerImage.setImageBitmap(bitmap) })
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt
index 072707c3..8bfa8a6f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt
@@ -48,17 +48,17 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
viewPager.addOnPageChangeListener(this)
//noinspection ConstantConditions
- if (PreferenceUtil.getInstance().carouselEffect() &&
- !((PreferenceUtil.getInstance().nowPlayingScreen == NowPlayingScreen.FULL) ||
- (PreferenceUtil.getInstance().nowPlayingScreen == NowPlayingScreen.ADAPTIVE)
- || (PreferenceUtil.getInstance().nowPlayingScreen == NowPlayingScreen.FIT))) {
+ if (PreferenceUtil.getInstance(requireContext()).carouselEffect() &&
+ !((PreferenceUtil.getInstance(requireContext()).nowPlayingScreen == NowPlayingScreen.FULL) ||
+ (PreferenceUtil.getInstance(requireContext()).nowPlayingScreen == NowPlayingScreen.ADAPTIVE)
+ || (PreferenceUtil.getInstance(requireContext()).nowPlayingScreen == NowPlayingScreen.FIT))) {
viewPager.clipToPadding = false
viewPager.setPadding(40, 40, 40, 0)
viewPager.pageMargin = 0
viewPager.setPageTransformer(false, CarousalPagerTransformer(requireContext()))
} else {
viewPager.offscreenPageLimit = 2
- viewPager.setPageTransformer(true, PreferenceUtil.getInstance().albumCoverTransform)
+ viewPager.setPageTransformer(true, PreferenceUtil.getInstance(requireContext()).albumCoverTransform)
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt
index efa306d1..d68cb7e5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt
@@ -98,7 +98,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
updatePrevNextColor()
updatePlayPauseColor()
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(context!!)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt
index 923cef51..3132362d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/card/CardPlaybackControlsFragment.kt
@@ -125,7 +125,7 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
updateProgressTextColor()
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(context!!).ripAlpha()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitPlaybackControlsFragment.kt
index 8c42f337..9f899b7a 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/fit/FitPlaybackControlsFragment.kt
@@ -110,7 +110,7 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
}
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(context!!).ripAlpha()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt
index 3c56b1d5..61783828 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlaybackControlsFragment.kt
@@ -100,7 +100,7 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
}
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(context!!).ripAlpha()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt
index 0e60378e..7371d676 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/flat/FlatPlayerFragment.kt
@@ -89,7 +89,7 @@ class FlatPlayerFragment : AbsPlayerFragment() {
override fun toolbarIconColor(): Int {
val isLight = ColorUtil.isColorLight(paletteColor)
- return if (PreferenceUtil.getInstance().adaptiveColor)
+ return if (PreferenceUtil.getInstance(requireContext()).adaptiveColor)
MaterialValueHelper.getPrimaryTextColor(context, isLight)
else
ATHUtil.resolveColor(context, R.attr.iconColor)
@@ -103,12 +103,12 @@ class FlatPlayerFragment : AbsPlayerFragment() {
val isLight = ColorUtil.isColorLight(color)
//TransitionManager.beginDelayedTransition(mToolbar);
- val iconColor = if (PreferenceUtil.getInstance().adaptiveColor)
+ val iconColor = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor)
MaterialValueHelper.getPrimaryTextColor(context!!, isLight)
else
ATHUtil.resolveColor(context!!, R.attr.iconColor)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, iconColor, activity)
- if (PreferenceUtil.getInstance().adaptiveColor) {
+ if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
colorize(color)
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt
index 46e00d13..5492f4b5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/full/FullPlaybackControlsFragment.kt
@@ -109,7 +109,7 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(), PopupMenu.OnMe
lastPlaybackControlsColor = Color.WHITE
lastDisabledPlaybackControlsColor = ContextCompat.getColor(context!!, R.color.md_grey_500)
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(context!!).ripAlpha()
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
index 7e01865c..19a2cd97 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/lockscreen/LockScreenPlayerControlsFragment.kt
@@ -120,7 +120,7 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
}
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.textColorSecondary(requireContext())
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
index 21e7f95a..eb889b6e 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt
@@ -112,7 +112,7 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
updateRepeatState()
updateShuffleState()
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
lastPlaybackControlsColor = color
color
} else {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt
index 7715ab09..4bac8e84 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerFragment.kt
@@ -69,7 +69,7 @@ class PlayerFragment : AbsPlayerFragment() {
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
- if (PreferenceUtil.getInstance().adaptiveColor) {
+ if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
colorize(color)
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt
index 88f2d75d..0c426bc5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/normal/PlayerPlaybackControlsFragment.kt
@@ -69,7 +69,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
}
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(requireContext())
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt
index 3bcfd003..a083153b 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/plain/PlainPlaybackControlsFragment.kt
@@ -129,7 +129,7 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
}
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(context!!)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt
index ced7c6f0..00abf55e 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/simple/SimplePlaybackControlsFragment.kt
@@ -187,7 +187,7 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false)
}
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(context!!)
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt
index 432f90f8..bb78b82b 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/tiny/TinyPlayerFragment.kt
@@ -71,7 +71,7 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
override fun onColorChanged(color: Int) {
- val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) {
+ val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
color
} else {
ThemeStore.accentColor(requireContext())
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AudioSettings.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AudioSettings.kt
index a947409c..43a4245d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AudioSettings.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AudioSettings.kt
@@ -29,7 +29,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
class AudioSettings : AbsSettingsFragment() {
override fun invalidateSettings() {
val findPreference: Preference = findPreference("equalizer")!!
- if (!hasEqualizer() && PreferenceUtil.getInstance().selectedEqualizer != "retro") {
+ if (!hasEqualizer() && PreferenceUtil.getInstance(requireContext()).selectedEqualizer != "retro") {
findPreference.isEnabled = false
findPreference.summary = resources.getString(R.string.no_equalizer)
} else {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/MainSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/MainSettingsFragment.kt
index 890a8681..ebf5d833 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/MainSettingsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/MainSettingsFragment.kt
@@ -66,7 +66,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
aboutSettings.setOnClickListener(this)
buyProContainer.apply {
- if (!App.isProVersion) show() else hide()
+ if (!App.isProVersion()) show() else hide()
setOnClickListener {
NavigationUtil.goToProVersion(context)
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NotificationSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NotificationSettingsFragment.kt
index 866b26f0..6d6bf422 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NotificationSettingsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NotificationSettingsFragment.kt
@@ -34,10 +34,10 @@ class NotificationSettingsFragment : AbsSettingsFragment() {
classicNotification?.isVisible = false
} else {
classicNotification?.apply {
- isChecked = PreferenceUtil.getInstance().classicNotification()
+ isChecked = PreferenceUtil.getInstance(requireContext()).classicNotification()
setOnPreferenceChangeListener { _, newValue ->
// Save preference
- PreferenceUtil.getInstance().setClassicNotification(newValue as Boolean)
+ PreferenceUtil.getInstance(requireContext()).setClassicNotification(newValue as Boolean)
invalidateSettings()
true
}
@@ -46,12 +46,12 @@ class NotificationSettingsFragment : AbsSettingsFragment() {
val coloredNotification: TwoStatePreference? = findPreference("colored_notification")
if (VERSION.SDK_INT >= VERSION_CODES.O) {
- coloredNotification?.isEnabled = PreferenceUtil.getInstance().classicNotification()
+ coloredNotification?.isEnabled = PreferenceUtil.getInstance(requireContext()).classicNotification()
} else {
coloredNotification?.apply {
- isChecked = PreferenceUtil.getInstance().coloredNotification()
+ isChecked = PreferenceUtil.getInstance(requireContext()).coloredNotification()
setOnPreferenceChangeListener { _, newValue ->
- PreferenceUtil.getInstance().setColoredNotification(newValue as Boolean)
+ PreferenceUtil.getInstance(requireContext()).setColoredNotification(newValue as Boolean)
true
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt
index 492f2d97..b596729b 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt
@@ -35,7 +35,7 @@ class NowPlayingSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
val carouselEffect: TwoStatePreference = findPreference("carousel_effect")!!
carouselEffect.setOnPreferenceChangeListener { _, newValue ->
- if (newValue as Boolean && !App.isProVersion) {
+ if (newValue as Boolean && !App.isProVersion()) {
showProToastAndNavigate(activity!!.getString(R.string.pref_title_toggle_carousel_effect))
return@setOnPreferenceChangeListener false
}
@@ -49,24 +49,24 @@ class NowPlayingSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
private fun updateAlbumCoverStyleSummary() {
val preference: Preference = findPreference(ALBUM_COVER_STYLE)!!
- preference.setSummary(getInstance().albumCoverStyle.titleRes)
+ preference.setSummary(getInstance(requireContext()).albumCoverStyle.titleRes)
}
private fun updateNowPlayingScreenSummary() {
val preference: Preference = findPreference(NOW_PLAYING_SCREEN_ID)!!
- preference.setSummary(getInstance().nowPlayingScreen.titleRes)
+ preference.setSummary(getInstance(requireContext()).nowPlayingScreen.titleRes)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- getInstance().registerOnSharedPreferenceChangedListener(this)
+ getInstance(requireContext()).registerOnSharedPreferenceChangedListener(this)
val preference: Preference = findPreference("album_cover_transform")!!
setSummary(preference)
}
override fun onDestroyView() {
super.onDestroyView()
- getInstance().unregisterOnSharedPreferenceChangedListener(this)
+ getInstance(requireContext()).unregisterOnSharedPreferenceChangedListener(this)
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/PersonaizeSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/PersonaizeSettingsFragment.kt
index ee8a997f..5534b0bd 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/PersonaizeSettingsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/PersonaizeSettingsFragment.kt
@@ -29,7 +29,7 @@ class PersonaizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
override fun invalidateSettings() {
val cornerWindow: TwoStatePreference = findPreference("corner_window")!!
cornerWindow.setOnPreferenceChangeListener { _, newValue ->
- if (newValue as Boolean && !App.isProVersion) {
+ if (newValue as Boolean && !App.isProVersion()) {
showProToastAndNavigate(activity!!.getString(R.string.pref_title_round_corners))
return@setOnPreferenceChangeListener false
}
@@ -51,7 +51,7 @@ class PersonaizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this)
+ PreferenceUtil.getInstance(requireContext()).registerOnSharedPreferenceChangedListener(this)
var preference: Preference? = findPreference("album_grid_style")
setSummary(preference!!)
@@ -65,7 +65,7 @@ class PersonaizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
override fun onDestroyView() {
super.onDestroyView()
- PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this)
+ PreferenceUtil.getInstance(requireContext()).unregisterOnSharedPreferenceChangedListener(this)
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ThemeSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ThemeSettingsFragment.kt
index 411aef0b..10e03160 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ThemeSettingsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ThemeSettingsFragment.kt
@@ -54,14 +54,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
setSummary(it)
it.setOnPreferenceChangeListener { _, newValue ->
val theme = newValue as String
- println(newValue)
- if (theme == "color" && !App.isProVersion) {
- showProToastAndNavigate("Color theme")
- return@setOnPreferenceChangeListener false
- }
-
setSummary(generalTheme, newValue)
-
val color = when (theme) {
"light" -> Color.WHITE
"black" -> Color.BLACK
@@ -107,10 +100,10 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
if (!VersionUtils.hasNougatMR()) {
colorAppShortcuts.isVisible = false
} else {
- colorAppShortcuts.isChecked = PreferenceUtil.getInstance().coloredAppShortcuts()
+ colorAppShortcuts.isChecked = PreferenceUtil.getInstance(requireContext()).coloredAppShortcuts()
colorAppShortcuts.setOnPreferenceChangeListener { _, newValue ->
// Save preference
- PreferenceUtil.getInstance().setColoredAppShortcuts(newValue as Boolean)
+ PreferenceUtil.getInstance(requireContext()).setColoredAppShortcuts(newValue as Boolean)
DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
true
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/glide/RetroGlideExtension.java b/app/src/main/java/code/name/monkey/retromusic/glide/RetroGlideExtension.java
index 5cb16ef2..86b2108c 100644
--- a/app/src/main/java/code/name/monkey/retromusic/glide/RetroGlideExtension.java
+++ b/app/src/main/java/code/name/monkey/retromusic/glide/RetroGlideExtension.java
@@ -103,7 +103,7 @@ public final class RetroGlideExtension {
@NonNull
public static Object getSongModel(@NonNull Song song) {
- return getSongModel(song, PreferenceUtil.getInstance().ignoreMediaStoreArtwork());
+ return getSongModel(song, PreferenceUtil.getInstance(App.Companion.getContext()).ignoreMediaStoreArtwork());
}
@NonNull
diff --git a/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicColoredTarget.kt b/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicColoredTarget.kt
index ec49787f..e9226e33 100644
--- a/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicColoredTarget.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicColoredTarget.kt
@@ -45,7 +45,7 @@ abstract class RetroMusicColoredTarget(view: ImageView) : BitmapPaletteTarget(vi
val defaultColor = defaultFooterColor
- onColorReady(if (PreferenceUtil.getInstance().isDominantColor)
+ onColorReady(if (PreferenceUtil.getInstance(getView().context).isDominantColor)
getDominantColor(resource.bitmap, defaultColor)
else
getColor(resource.palette, defaultColor))
diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/LastChanceHandler.kt b/app/src/main/java/code/name/monkey/retromusic/helper/LastChanceHandler.kt
index c9439c94..67b38756 100644
--- a/app/src/main/java/code/name/monkey/retromusic/helper/LastChanceHandler.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/helper/LastChanceHandler.kt
@@ -45,7 +45,7 @@ class TopExceptionHandler() : Thread.UncaughtExceptionHandler {
}
}
report += "-------------------------------\n\n"
- ActivityCompat.startActivity(App.context, Intent(App.context, ErrorHandlerActivity::class.java)
+ ActivityCompat.startActivity(App.getContext(), Intent(App.getContext(), ErrorHandlerActivity::class.java)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra("error", report), null)
defaultUEH.uncaughtException(t, e)
diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.kt b/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.kt
index a2ea4e1c..cfabadad 100644
--- a/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.kt
@@ -209,7 +209,7 @@ object MusicPlayerRemote {
fun openQueue(queue: ArrayList, startPosition: Int, startPlaying: Boolean) {
if (!tryToHandleOpenPlayingQueue(queue, startPosition, startPlaying) && musicService != null) {
musicService!!.openQueue(queue, startPosition, startPlaying)
- if (PreferenceUtil.getInstance().isShuffleModeOn)
+ if (PreferenceUtil.getInstance(musicService).isShuffleModeOn)
setShuffleMode(MusicService.SHUFFLE_MODE_NONE)
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/menu/PlaylistMenuHelper.kt b/app/src/main/java/code/name/monkey/retromusic/helper/menu/PlaylistMenuHelper.kt
index c776d837..082500dc 100644
--- a/app/src/main/java/code/name/monkey/retromusic/helper/menu/PlaylistMenuHelper.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/helper/menu/PlaylistMenuHelper.kt
@@ -87,8 +87,8 @@ object PlaylistMenuHelper {
private class SavePlaylistAsyncTask internal constructor(context: Context) : WeakContextAsyncTask(context) {
override fun doInBackground(vararg params: Playlist): String {
- return String.format(App.instance.applicationContext.getString(R.string
- .saved_playlist_to), PlaylistsUtil.savePlaylist(App.instance.applicationContext, params[0]))
+ return String.format(App.getContext().getString(R.string
+ .saved_playlist_to), PlaylistsUtil.savePlaylist(App.getContext(), params[0]))
}
override fun onPostExecute(string: String) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.kt b/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.kt
index db1f770d..68396d54 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.kt
@@ -35,7 +35,7 @@ object AlbumLoader {
val songs = SongLoader.getSongsFlowable(
SongLoader.makeSongCursor(
context, null, null,
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
)
return splitIntoAlbumsFlowable(songs)
@@ -50,7 +50,7 @@ object AlbumLoader {
context,
AudioColumns.ALBUM + " LIKE ?",
arrayOf("%$query%"),
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
)
return splitIntoAlbumsFlowable(songs)
}
@@ -63,7 +63,7 @@ object AlbumLoader {
context,
AudioColumns.ALBUM + " LIKE ?",
arrayOf("%$query%"),
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
)
return splitIntoAlbums(songs)
}
@@ -78,7 +78,7 @@ object AlbumLoader {
context,
AudioColumns.ALBUM_ID + "=?",
arrayOf(albumId.toString()),
- getSongLoaderSortOrder()
+ getSongLoaderSortOrder(context)
)
)
songs.subscribe { songs1 ->
@@ -97,7 +97,7 @@ object AlbumLoader {
context,
AudioColumns.ALBUM_ID + "=?",
arrayOf(albumId.toString()),
- getSongLoaderSortOrder()))
+ getSongLoaderSortOrder(context)))
val album = Album(songs)
sortSongsByTrackNumber(album)
return album
@@ -129,7 +129,7 @@ object AlbumLoader {
val songs = SongLoader.getSongs(
SongLoader.makeSongCursor(
context, null, null,
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
)
return splitIntoAlbums(songs)
@@ -189,8 +189,8 @@ object AlbumLoader {
album.songs?.sortWith(Comparator { o1, o2 -> o1.trackNumber - o2.trackNumber })
}
- private fun getSongLoaderSortOrder(): String {
- return PreferenceUtil.getInstance().albumSortOrder + ", " +
- PreferenceUtil.getInstance().albumDetailSongSortOrder
+ private fun getSongLoaderSortOrder(context: Context): String {
+ return PreferenceUtil.getInstance(context).albumSortOrder + ", " +
+ PreferenceUtil.getInstance(context).albumDetailSongSortOrder
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistLoader.kt b/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistLoader.kt
index d1610663..9b52211f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistLoader.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistLoader.kt
@@ -23,11 +23,11 @@ import io.reactivex.Observable
object ArtistLoader {
- private fun getSongLoaderSortOrder(): String {
- return PreferenceUtil.getInstance().artistSortOrder + ", " +
- PreferenceUtil.getInstance().artistAlbumSortOrder + ", " +
- PreferenceUtil.getInstance().albumDetailSongSortOrder + ", " +
- PreferenceUtil.getInstance().artistDetailSongSortOrder
+ private fun getSongLoaderSortOrder(context: Context): String {
+ return PreferenceUtil.getInstance(context).artistSortOrder + ", " +
+ PreferenceUtil.getInstance(context).artistAlbumSortOrder + ", " +
+ PreferenceUtil.getInstance(context).albumDetailSongSortOrder + ", " +
+ PreferenceUtil.getInstance(context).artistDetailSongSortOrder
}
fun getAllArtistsFlowable(
@@ -36,7 +36,7 @@ object ArtistLoader {
return Observable.create { e ->
SongLoader.getSongsFlowable(SongLoader.makeSongCursor(
context, null, null,
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
).subscribe { songs ->
e.onNext(splitIntoArtists(AlbumLoader.splitIntoAlbums(songs)))
e.onComplete()
@@ -48,7 +48,7 @@ object ArtistLoader {
val songs = SongLoader.getSongs(SongLoader.makeSongCursor(
context,
null, null,
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
)
return splitIntoArtists(AlbumLoader.splitIntoAlbums(songs))
}
@@ -59,7 +59,7 @@ object ArtistLoader {
context,
AudioColumns.ARTIST + " LIKE ?",
arrayOf("%$query%"),
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
).subscribe { songs ->
e.onNext(splitIntoArtists(AlbumLoader.splitIntoAlbums(songs)))
e.onComplete()
@@ -72,7 +72,7 @@ object ArtistLoader {
context,
AudioColumns.ARTIST + " LIKE ?",
arrayOf("%$query%"),
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
)
return splitIntoArtists(AlbumLoader.splitIntoAlbums(songs))
}
@@ -117,7 +117,7 @@ object ArtistLoader {
return Observable.create { e ->
SongLoader.getSongsFlowable(SongLoader.makeSongCursor(context, AudioColumns.ARTIST_ID + "=?",
arrayOf(artistId.toString()),
- getSongLoaderSortOrder()))
+ getSongLoaderSortOrder(context)))
.subscribe { songs ->
val artist = Artist(AlbumLoader.splitIntoAlbums(songs))
e.onNext(artist)
@@ -131,7 +131,7 @@ object ArtistLoader {
context,
AudioColumns.ARTIST_ID + "=?",
arrayOf(artistId.toString()),
- getSongLoaderSortOrder())
+ getSongLoaderSortOrder(context))
)
return Artist(AlbumLoader.splitIntoAlbums(songs))
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/GenreLoader.kt b/app/src/main/java/code/name/monkey/retromusic/loaders/GenreLoader.kt
index 23a0793e..4f0e79fb 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/GenreLoader.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/GenreLoader.kt
@@ -105,7 +105,7 @@ object GenreLoader {
try {
return context.contentResolver.query(
Genres.Members.getContentUri("external", genreId.toLong()),
- baseProjection, BASE_SELECTION, null, PreferenceUtil.getInstance().songSortOrder)
+ baseProjection, BASE_SELECTION, null, PreferenceUtil.getInstance(context).songSortOrder)
} catch (e: SecurityException) {
return null
}
@@ -172,7 +172,7 @@ object GenreLoader {
try {
return context.contentResolver.query(
Genres.EXTERNAL_CONTENT_URI,
- projection, null, null, PreferenceUtil.getInstance().genreSortOrder)
+ projection, null, null, PreferenceUtil.getInstance(context).genreSortOrder)
} catch (e: SecurityException) {
return null
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/LastAddedSongsLoader.kt b/app/src/main/java/code/name/monkey/retromusic/loaders/LastAddedSongsLoader.kt
index e9cd9821..998ab703 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/LastAddedSongsLoader.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/LastAddedSongsLoader.kt
@@ -41,7 +41,7 @@ object LastAddedSongsLoader {
}
private fun makeLastAddedCursor(context: Context): Cursor? {
- val cutoff = PreferenceUtil.getInstance().lastAddedCutoff
+ val cutoff = PreferenceUtil.getInstance(context).lastAddedCutoff
return SongLoader.makeSongCursor(
context,
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/SongLoader.kt b/app/src/main/java/code/name/monkey/retromusic/loaders/SongLoader.kt
index 3b375dbd..2c0c0461 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/SongLoader.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/SongLoader.kt
@@ -176,7 +176,7 @@ object SongLoader {
context: Context,
selection: String?,
selectionValues: Array?,
- sortOrder: String = PreferenceUtil.getInstance().songSortOrder
+ sortOrder: String = PreferenceUtil.getInstance(context).songSortOrder
): Cursor? {
var selectionFinal = selection
var selectionValuesFinal = selectionValues
@@ -195,7 +195,7 @@ object SongLoader {
try {
return context.contentResolver.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
- baseProjection, selectionFinal + " AND " + MediaStore.Audio.Media.DURATION + ">= " + (PreferenceUtil.getInstance().filterLength * 1000), selectionValuesFinal, sortOrder)
+ baseProjection, selectionFinal + " AND " + MediaStore.Audio.Media.DURATION + ">= " + (PreferenceUtil.getInstance(context).filterLength * 1000), selectionValuesFinal, sortOrder)
} catch (e: SecurityException) {
return null
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/GenrePresenter.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/GenrePresenter.kt
index afc25c5f..addd7773 100644
--- a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/GenrePresenter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/GenrePresenter.kt
@@ -18,7 +18,6 @@ import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.mvp.BaseView
import code.name.monkey.retromusic.mvp.Presenter
import code.name.monkey.retromusic.mvp.PresenterImpl
-import code.name.monkey.retromusic.providers.RepositoryImpl
import code.name.monkey.retromusic.providers.interfaces.Repository
import io.reactivex.disposables.Disposable
import java.util.*
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
index c6f92d92..a2dd738f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
@@ -72,13 +72,13 @@ class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPa
viewPager.adapter = AlbumCoverStyleAdapter(activity!!)
viewPager.addOnPageChangeListener(this)
viewPager.pageMargin = ViewUtil.convertDpToPixel(32f, resources).toInt()
- viewPager.currentItem = PreferenceUtil.getInstance().albumCoverStyle.ordinal
+ viewPager.currentItem = PreferenceUtil.getInstance(requireContext()).albumCoverStyle.ordinal
return MaterialDialog(activity!!).show {
title(R.string.pref_title_album_cover_style)
positiveButton(R.string.set) {
val nowPlayingScreen = AlbumCoverStyle.values()[viewPagerPosition]
- PreferenceUtil.getInstance().albumCoverStyle = nowPlayingScreen
+ PreferenceUtil.getInstance(requireContext()).albumCoverStyle = nowPlayingScreen
}
negativeButton(android.R.string.cancel)
customView(view = view, scrollable = false, noVerticalPadding = false)
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
index 449321ea..eaa457a5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
@@ -63,7 +63,7 @@ class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
if (savedInstanceState != null) {
categoryInfos = savedInstanceState.getParcelableArrayList(PreferenceUtil.LIBRARY_CATEGORIES)!!
} else {
- categoryInfos = PreferenceUtil.getInstance().libraryCategoryInfos
+ categoryInfos = PreferenceUtil.getInstance(requireContext()).libraryCategoryInfos
}
adapter = CategoryInfoAdapter(categoryInfos)
@@ -84,7 +84,7 @@ class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
dismiss()
}
.neutralButton(code.name.monkey.retromusic.R.string.reset_action) {
- adapter.categoryInfos = PreferenceUtil.getInstance().defaultLibraryCategoryInfos
+ adapter.categoryInfos = PreferenceUtil.getInstance(requireContext()).defaultLibraryCategoryInfos
}
.noAutoDismiss()
}
@@ -100,7 +100,7 @@ class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
Toast.makeText(context, "Not more than 5 items", Toast.LENGTH_SHORT).show()
return
}
- PreferenceUtil.getInstance().libraryCategoryInfos = categories
+ PreferenceUtil.getInstance(requireContext()).libraryCategoryInfos = categories
}
private fun getSelected(categories: List): Int {
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
index 4feceb65..1e1ca372 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
@@ -88,7 +88,7 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP
viewPager.adapter = NowPlayingScreenAdapter(activity!!)
viewPager.addOnPageChangeListener(this)
viewPager.pageMargin = ViewUtil.convertDpToPixel(32f, resources).toInt()
- viewPager.currentItem = PreferenceUtil.getInstance().nowPlayingScreen.ordinal
+ viewPager.currentItem = PreferenceUtil.getInstance(requireContext()).nowPlayingScreen.ordinal
return MaterialDialog(activity!!).show {
@@ -100,7 +100,7 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP
Toast.makeText(context, result, Toast.LENGTH_SHORT).show()
NavigationUtil.goToProVersion(activity!!)
} else {
- PreferenceUtil.getInstance().nowPlayingScreen = nowPlayingScreen
+ PreferenceUtil.getInstance(requireContext()).nowPlayingScreen = nowPlayingScreen
}
}
negativeButton(android.R.string.cancel)
@@ -110,8 +110,8 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP
private fun isNowPlayingThemes(nowPlayingScreen: NowPlayingScreen): Boolean {
if (nowPlayingScreen == NowPlayingScreen.BLUR_CARD) {
- PreferenceUtil.getInstance().resetCarouselEffect()
- PreferenceUtil.getInstance().resetCircularAlbumArt()
+ PreferenceUtil.getInstance(requireContext()).resetCarouselEffect()
+ PreferenceUtil.getInstance(requireContext()).resetCircularAlbumArt()
}
return (nowPlayingScreen == NowPlayingScreen.FULL ||
@@ -122,7 +122,7 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP
nowPlayingScreen == NowPlayingScreen.SIMPLE ||
nowPlayingScreen == NowPlayingScreen.BLUR_CARD ||
nowPlayingScreen == NowPlayingScreen.ADAPTIVE)
- && !App.isProVersion
+ && !App.isProVersion()
}
companion object {
diff --git a/app/src/main/java/code/name/monkey/retromusic/providers/BlacklistStore.java b/app/src/main/java/code/name/monkey/retromusic/providers/BlacklistStore.java
index 4e3ac52e..8efe5259 100644
--- a/app/src/main/java/code/name/monkey/retromusic/providers/BlacklistStore.java
+++ b/app/src/main/java/code/name/monkey/retromusic/providers/BlacklistStore.java
@@ -47,13 +47,13 @@ public class BlacklistStore extends SQLiteOpenHelper {
public static synchronized BlacklistStore getInstance(@NonNull final Context context) {
if (sInstance == null) {
sInstance = new BlacklistStore(context.getApplicationContext());
- if (!PreferenceUtil.getInstance().initializedBlacklist()) {
+ if (!PreferenceUtil.getInstance(context).initializedBlacklist()) {
// blacklisted by default
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_ALARMS));
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_NOTIFICATIONS));
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES));
- PreferenceUtil.getInstance().setInitializedBlacklist();
+ PreferenceUtil.getInstance(context).setInitializedBlacklist();
}
}
return sInstance;
diff --git a/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt b/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt
index 389987de..8dc63688 100644
--- a/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/providers/RepositoryImpl.kt
@@ -26,6 +26,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
class RepositoryImpl(private val context: Context) : Repository {
+
override fun artistInfoFloable(
name: String,
lang: String?,
@@ -188,17 +189,4 @@ class RepositoryImpl(private val context: Context) : Repository {
return GenreLoader.getSongs(context, genreId)
}
-
-
- companion object {
- private var INSTANCE: RepositoryImpl? = null
-
- val instance: RepositoryImpl
- @Synchronized get() {
- if (INSTANCE == null) {
- INSTANCE = RepositoryImpl(App.instance)
- }
- return INSTANCE!!
- }
- }
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/service/MultiPlayer.java b/app/src/main/java/code/name/monkey/retromusic/service/MultiPlayer.java
index 8ea5ddd5..d8ecf574 100644
--- a/app/src/main/java/code/name/monkey/retromusic/service/MultiPlayer.java
+++ b/app/src/main/java/code/name/monkey/retromusic/service/MultiPlayer.java
@@ -129,7 +129,7 @@ public class MultiPlayer implements Playback, MediaPlayer.OnErrorListener, Media
if (path == null) {
return;
}
- if (PreferenceUtil.getInstance().gaplessPlayback()) {
+ if (PreferenceUtil.getInstance(context).gaplessPlayback()) {
mNextMediaPlayer = new MediaPlayer();
mNextMediaPlayer.setWakeMode(context, PowerManager.PARTIAL_WAKE_LOCK);
mNextMediaPlayer.setAudioSessionId(getAudioSessionId());
diff --git a/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java b/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java
index f7d55e52..147c5665 100644
--- a/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java
+++ b/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java
@@ -341,7 +341,7 @@ public class MusicService extends MediaBrowserServiceCompat implements SharedPre
getContentResolver().registerContentObserver(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, true, mediaStoreObserver);
- PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this);
+ PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this);
restoreState();
@@ -477,7 +477,7 @@ public class MusicService extends MediaBrowserServiceCompat implements SharedPre
quit();
releaseResources();
getContentResolver().unregisterContentObserver(mediaStoreObserver);
- PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this);
+ PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
wakeLock.release();
sendBroadcast(new Intent("code.name.monkey.retromusic.RETRO_MUSIC_SERVICE_DESTROYED"));
@@ -676,7 +676,7 @@ public class MusicService extends MediaBrowserServiceCompat implements SharedPre
}
public void initNotification() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !PreferenceUtil.getInstance().classicNotification()) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !PreferenceUtil.getInstance(this).classicNotification()) {
playingNotification = new PlayingNotificationImpl24();
} else {
playingNotification = new PlayingNotificationOreo();
@@ -745,14 +745,14 @@ public class MusicService extends MediaBrowserServiceCompat implements SharedPre
metaData.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, getPlayingQueue().size());
}
- if (PreferenceUtil.getInstance().albumArtOnLockscreen()) {
+ if (PreferenceUtil.getInstance(this).albumArtOnLockscreen()) {
final Point screenSize = RetroUtil.getScreenSize(MusicService.this);
GlideRequest request = GlideApp.with(MusicService.this)
.asBitmap()
.load(RetroGlideExtension.getSongModel(song))
.transition(RetroGlideExtension.getDefaultTransition())
.songOptions(song);
- if (PreferenceUtil.getInstance().blurredAlbumArt()) {
+ if (PreferenceUtil.getInstance(this).blurredAlbumArt()) {
request.transform(new BlurTransformation.Builder(MusicService.this).build());
}
runOnUiThread(new Runnable() {
@@ -1271,7 +1271,7 @@ public class MusicService extends MediaBrowserServiceCompat implements SharedPre
}
private void registerHeadsetEvents() {
- if (!headsetReceiverRegistered && PreferenceUtil.getInstance().getHeadsetPlugged()) {
+ if (!headsetReceiverRegistered && PreferenceUtil.getInstance(this).getHeadsetPlugged()) {
registerReceiver(headsetReceiver, headsetReceiverIntentFilter);
headsetReceiverRegistered = true;
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/service/PlaybackHandler.java b/app/src/main/java/code/name/monkey/retromusic/service/PlaybackHandler.java
index d86bc2c2..243965dc 100644
--- a/app/src/main/java/code/name/monkey/retromusic/service/PlaybackHandler.java
+++ b/app/src/main/java/code/name/monkey/retromusic/service/PlaybackHandler.java
@@ -51,7 +51,7 @@ class PlaybackHandler extends Handler {
switch (msg.what) {
case MusicService.DUCK:
- if (PreferenceUtil.getInstance().audioDucking()) {
+ if (PreferenceUtil.getInstance(service).audioDucking()) {
currentDuckVolume -= .05f;
if (currentDuckVolume > .2f) {
sendEmptyMessageDelayed(DUCK, 10);
@@ -65,7 +65,7 @@ class PlaybackHandler extends Handler {
break;
case MusicService.UNDUCK:
- if (PreferenceUtil.getInstance().audioDucking()) {
+ if (PreferenceUtil.getInstance(service).audioDucking()) {
currentDuckVolume += .03f;
if (currentDuckVolume < 1f) {
sendEmptyMessageDelayed(MusicService.UNDUCK, 10);
diff --git a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt
index 2b53cb30..e798c12b 100644
--- a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt
@@ -113,7 +113,7 @@ class PlayingNotificationImpl : PlayingNotification() {
bigNotificationImageSize) {
override fun onResourceReady(resource: BitmapPaletteWrapper, transition: Transition?) {
update(resource.bitmap,
- if (PreferenceUtil.getInstance().isDominantColor)
+ if (PreferenceUtil.getInstance(service).isDominantColor)
RetroColorUtil.getDominantColor(resource.bitmap, Color.TRANSPARENT)
else
RetroColorUtil.getColor(resource.palette, Color.TRANSPARENT))
@@ -135,7 +135,7 @@ class PlayingNotificationImpl : PlayingNotification() {
.setImageViewResource(R.id.image, R.drawable.default_album_art)
}
- if (!PreferenceUtil.getInstance().coloredNotification()) {
+ if (!PreferenceUtil.getInstance(service).coloredNotification()) {
bgColorFinal = Color.WHITE
}
setBackgroundColor(bgColorFinal)
diff --git a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl24.kt b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl24.kt
index d6c4d8d2..e90f9878 100644
--- a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl24.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl24.kt
@@ -84,7 +84,7 @@ class PlayingNotificationImpl24 : PlayingNotification() {
.into(object : RetroSimpleTarget(bigNotificationImageSize, bigNotificationImageSize) {
override fun onResourceReady(resource: BitmapPaletteWrapper, transition: Transition?) {
update(resource.bitmap, when {
- PreferenceUtil.getInstance().isDominantColor -> RetroColorUtil.getDominantColor(resource.bitmap, Color.TRANSPARENT)
+ PreferenceUtil.getInstance(service).isDominantColor -> RetroColorUtil.getDominantColor(resource.bitmap, Color.TRANSPARENT)
else -> RetroColorUtil.getColor(resource.palette, Color.TRANSPARENT)
})
}
@@ -146,7 +146,7 @@ class PlayingNotificationImpl24 : PlayingNotification() {
.setMediaSession(service.mediaSession.sessionToken)
.setShowActionsInCompactView( 1, 2, 3))
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O && PreferenceUtil.getInstance().coloredNotification()) {
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O && PreferenceUtil.getInstance(service).coloredNotification()) {
builder.color = color
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationOreo.kt b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationOreo.kt
index 36a7b784..825bcce8 100644
--- a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationOreo.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationOreo.kt
@@ -127,7 +127,7 @@ class PlayingNotificationOreo : PlayingNotification() {
notificationLayoutBig.setImageViewResource(R.id.largeIcon, R.drawable.default_album_art)
}
- if (!PreferenceUtil.getInstance().coloredNotification()) {
+ if (!PreferenceUtil.getInstance(service).coloredNotification()) {
bgColorFinal = Color.WHITE
}
setBackgroundColor(bgColorFinal)
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/CustomArtistImageUtil.kt b/app/src/main/java/code/name/monkey/retromusic/util/CustomArtistImageUtil.kt
index 559568b8..c5385c34 100644
--- a/app/src/main/java/code/name/monkey/retromusic/util/CustomArtistImageUtil.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/util/CustomArtistImageUtil.kt
@@ -44,7 +44,7 @@ class CustomArtistImageUtil private constructor(context: Context) {
}
fun setCustomArtistImage(artist: Artist, uri: Uri) {
- GlideApp.with(App.context)
+ GlideApp.with(App.getContext())
.asBitmap()
.load(uri)
.apply(RequestOptions()
@@ -57,7 +57,7 @@ class CustomArtistImageUtil private constructor(context: Context) {
object : AsyncTask() {
@SuppressLint("ApplySharedPref")
override fun doInBackground(vararg params: Void): Void? {
- val dir = File(App.context.filesDir, FOLDER_NAME)
+ val dir = File(App.getContext().filesDir, FOLDER_NAME)
println(dir.absolutePath)
if (!dir.exists()) {
if (!dir.mkdirs()) { // create the folder
@@ -72,13 +72,13 @@ class CustomArtistImageUtil private constructor(context: Context) {
succesful = ImageUtil.resizeBitmap(resource, 2048).compress(Bitmap.CompressFormat.JPEG, 100, os)
os.close()
} catch (e: IOException) {
- Toast.makeText(App.context, e.toString(), Toast.LENGTH_LONG).show()
+ Toast.makeText(App.getContext(), e.toString(), Toast.LENGTH_LONG).show()
}
if (succesful) {
mPreferences.edit().putBoolean(getFileName(artist), true).commit()
ArtistSignatureUtil.getInstance().updateArtistSignature(artist.name)
- App.context.contentResolver.notifyChange(Uri.parse("content://media"), null) // trigger media store changed to force artist image reload
+ App.getContext().contentResolver.notifyChange(Uri.parse("content://media"), null) // trigger media store changed to force artist image reload
}
return null
}
@@ -93,7 +93,7 @@ class CustomArtistImageUtil private constructor(context: Context) {
override fun doInBackground(vararg params: Void): Void? {
mPreferences.edit().putBoolean(getFileName(artist), false).commit()
ArtistSignatureUtil.getInstance().updateArtistSignature(artist.name)
- App.context.contentResolver.notifyChange(Uri.parse("content://media"), null) // trigger media store changed to force artist image reload
+ App.getContext().contentResolver.notifyChange(Uri.parse("content://media"), null) // trigger media store changed to force artist image reload
val file = getFile(artist)
if (!file.exists()) {
@@ -133,7 +133,7 @@ class CustomArtistImageUtil private constructor(context: Context) {
@JvmStatic
fun getFile(artist: Artist): File {
- val dir = File(App.context.filesDir, FOLDER_NAME)
+ val dir = File(App.getContext().filesDir, FOLDER_NAME)
return File(dir, getFileName(artist))
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java
index e6ce27da..304617e9 100644
--- a/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java
+++ b/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java
@@ -142,7 +142,8 @@ public final class PreferenceUtil {
mPreferences = PreferenceManager.getDefaultSharedPreferences(context);
}
- public static PreferenceUtil getInstance() {
+ @NonNull
+ public static PreferenceUtil getInstance(Context context) {
if (sInstance == null) {
sInstance = new PreferenceUtil(App.Companion.getContext());
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java
index 3d324d8d..9efea8f5 100755
--- a/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java
+++ b/app/src/main/java/code/name/monkey/retromusic/util/RetroUtil.java
@@ -26,7 +26,6 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Point;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@@ -37,15 +36,10 @@ import android.provider.BaseColumns;
import android.provider.MediaStore;
import android.util.DisplayMetrics;
import android.view.Display;
-import android.view.KeyCharacterMap;
-import android.view.KeyEvent;
import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
-import android.widget.FrameLayout;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
@@ -197,8 +191,8 @@ public class RetroUtil {
public static Drawable getTintedDrawable(@DrawableRes int id) {
return TintHelper
- .createTintedDrawable(ContextCompat.getDrawable(App.Companion.getInstance(), id),
- ThemeStore.Companion.accentColor(App.Companion.getInstance()));
+ .createTintedDrawable(ContextCompat.getDrawable(App.Companion.getContext(), id),
+ ThemeStore.Companion.accentColor(App.Companion.getContext()));
}
@NonNull
@@ -218,7 +212,7 @@ public class RetroUtil {
}
public static boolean isAllowedToDownloadMetadata(final @NonNull Context context) {
- switch (PreferenceUtil.getInstance().autoDownloadImagesPolicy()) {
+ switch (PreferenceUtil.getInstance(context).autoDownloadImagesPolicy()) {
case "always":
return true;
case "only_wifi":
@@ -291,10 +285,6 @@ public class RetroUtil {
}
}
- public static void statusBarHeight(View statusBar) {
- statusBar.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight()));
- }
-
public static int getStatusBarHeight() {
int result = 0;
int resourceId = App.Companion.getContext().getResources().getIdentifier("status_bar_height", "dimen", "android");
@@ -321,117 +311,4 @@ public class RetroUtil {
window.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
-
- public static int getSoftButtonsBarSizePort(Activity activity) {
- // getRealMetrics is only available with API 17 and +
- DisplayMetrics metrics = new DisplayMetrics();
- activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
- int usableHeight = metrics.heightPixels;
- activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
- int realHeight = metrics.heightPixels;
- if (realHeight > usableHeight)
- return realHeight - usableHeight;
- else
- return 0;
- }
-
- public static int getNavigationBarHeight(Activity activity) {
- /* int result = 0;
- int resourceId = App.getContext().getResources().getIdentifier("navigation_bar_height", "dimen", "android");
- if (resourceId > 0) {
- result = App.getContext().getResources().getDimensionPixelSize(resourceId);
- }
- return result;*/
- DisplayMetrics metrics = new DisplayMetrics();
- activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
- int usableHeight = metrics.heightPixels;
- activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
- int realHeight = metrics.heightPixels;
- if (realHeight > usableHeight)
- if (PreferenceUtil.getInstance().getFullScreenMode()) {
- return 0;
- } else
- return realHeight - usableHeight;
- else
- return 0;
- }
-
- public static int getNavBarHeight(Context c) {
- int result = 0;
- boolean hasMenuKey = ViewConfiguration.get(c).hasPermanentMenuKey();
- boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
-
- if (!hasMenuKey && !hasBackKey) {
- //The device has a navigation bar
- Resources resources = c.getResources();
-
- int orientation = resources.getConfiguration().orientation;
- int resourceId;
- if (isTablet(c)) {
- resourceId = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
- } else {
- resourceId = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_width", "dimen", "android");
- }
-
- if (resourceId > 0) {
- return resources.getDimensionPixelSize(resourceId);
- }
- }
- return result;
- }
-
-
- private static boolean isTablet(Context c) {
- return (c.getResources().getConfiguration().screenLayout
- & Configuration.SCREENLAYOUT_SIZE_MASK)
- >= Configuration.SCREENLAYOUT_SIZE_LARGE;
- }
-
- private static boolean hasNavBar(Resources resources) {
- int id = resources.getIdentifier("config_showNavigationBar", "bool", "android");
- if (id > 0)
- return resources.getBoolean(id);
- else
- return false;
- }
-
- public static int getNavigationBarHeight(Resources resources) {
- if (!hasNavBar(resources))
- return 0;
-
- int orientation = resources.getConfiguration().orientation;
-
- //Only phone between 0-599 has navigationbar can move
- boolean isSmartphone = resources.getConfiguration().smallestScreenWidthDp < 600;
- if (isSmartphone && Configuration.ORIENTATION_LANDSCAPE == orientation)
- return 0;
-
- int id = resources
- .getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
- if (id > 0)
- return resources.getDimensionPixelSize(id);
-
- return 0;
- }
-
- public static boolean checkNavigationBarHeight() {
- Resources resources = App.Companion.getContext().getResources();
- int orientation = resources.getConfiguration().orientation;
- if (!hasNavBar(resources)) {
- return false;
- }
- boolean isSmartPhone = resources.getConfiguration().smallestScreenWidthDp < 600;
- if (isSmartPhone && Configuration.ORIENTATION_LANDSCAPE == orientation)
- return false;
- int id = resources
- .getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
- return id > 0;
- }
-
- @NonNull
- public static Drawable resize(@NonNull Context context, @NonNull Drawable image) {
- Bitmap b = ((BitmapDrawable) image).getBitmap();
- Bitmap bitmapResized = Bitmap.createScaledBitmap(b, 50, 50, false);
- return new BitmapDrawable(context.getResources(), bitmapResized);
- }
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/SAFUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/SAFUtil.java
index 0fc91e19..d8d2af69 100644
--- a/app/src/main/java/code/name/monkey/retromusic/util/SAFUtil.java
+++ b/app/src/main/java/code/name/monkey/retromusic/util/SAFUtil.java
@@ -119,19 +119,19 @@ public class SAFUtil {
public static void saveTreeUri(Context context, Intent data) {
Uri uri = data.getData();
context.getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
- PreferenceUtil.getInstance().setSAFSDCardUri(uri);
+ PreferenceUtil.getInstance(context).setSAFSDCardUri(uri);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static boolean isTreeUriSaved(Context context) {
- return !TextUtils.isEmpty(PreferenceUtil.getInstance().getSAFSDCardUri());
+ return !TextUtils.isEmpty(PreferenceUtil.getInstance(context).getSAFSDCardUri());
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static boolean isSDCardAccessGranted(Context context) {
if (!isTreeUriSaved(context)) return false;
- String sdcardUri = PreferenceUtil.getInstance().getSAFSDCardUri();
+ String sdcardUri = PreferenceUtil.getInstance(context).getSAFSDCardUri();
List perms = context.getContentResolver().getPersistedUriPermissions();
for (UriPermission perm : perms) {
@@ -198,7 +198,7 @@ public class SAFUtil {
if (isTreeUriSaved(context)) {
List pathSegments = new ArrayList<>(Arrays.asList(audio.getFile().getAbsolutePath().split("/")));
- Uri sdcard = Uri.parse(PreferenceUtil.getInstance().getSAFSDCardUri());
+ Uri sdcard = Uri.parse(PreferenceUtil.getInstance(context).getSAFSDCardUri());
uri = findDocument(DocumentFile.fromTreeUri(context, sdcard), pathSegments);
}
@@ -271,7 +271,7 @@ public class SAFUtil {
if (isTreeUriSaved(context)) {
List pathSegments = new ArrayList<>(Arrays.asList(path.split("/")));
- Uri sdcard = Uri.parse(PreferenceUtil.getInstance().getSAFSDCardUri());
+ Uri sdcard = Uri.parse(PreferenceUtil.getInstance(context).getSAFSDCardUri());
uri = findDocument(DocumentFile.fromTreeUri(context, sdcard), pathSegments);
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt b/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
index cf21e164..0de814be 100644
--- a/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/views/BottomNavigationBarTinted.kt
@@ -31,9 +31,9 @@ class BottomNavigationBarTinted @JvmOverloads constructor(
) : BottomNavigationView(context, attrs, defStyleAttr) {
init {
- labelVisibilityMode = PreferenceUtil.getInstance().tabTitleMode
+ labelVisibilityMode = PreferenceUtil.getInstance(context).tabTitleMode
setBackgroundColor(ThemeStore.primaryColor(context))
- selectedItemId = PreferenceUtil.getInstance().lastPage
+ selectedItemId = PreferenceUtil.getInstance(context).lastPage
val iconColor = ATHUtil.resolveColor(context, R.attr.iconColor)
val accentColor = ThemeStore.accentColor(context)
diff --git a/app/src/main/java/code/name/monkey/retromusic/views/UserImageView.java b/app/src/main/java/code/name/monkey/retromusic/views/UserImageView.java
index 51df25eb..f5c643a2 100644
--- a/app/src/main/java/code/name/monkey/retromusic/views/UserImageView.java
+++ b/app/src/main/java/code/name/monkey/retromusic/views/UserImageView.java
@@ -62,7 +62,7 @@ public class UserImageView extends CircularImageView implements SharedPreference
.asDrawable()
.placeholder(R.drawable.ic_account_white_24dp)
.fallback(R.drawable.ic_account_white_24dp)
- .load(new File(PreferenceUtil.getInstance().getProfileImage(), USER_PROFILE))
+ .load(new File(PreferenceUtil.getInstance(context).getProfileImage(), USER_PROFILE))
.into(new Target() {
@Override
public void onLoadStarted(@Nullable Drawable placeholder) {
diff --git a/app/src/main/res/layout/item_contributor.xml b/app/src/main/res/layout/item_contributor.xml
index e1376a09..55e13fad 100644
--- a/app/src/main/res/layout/item_contributor.xml
+++ b/app/src/main/res/layout/item_contributor.xml
@@ -1,4 +1,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/preference_dialog_library_categories_listitem.xml b/app/src/main/res/layout/preference_dialog_library_categories_listitem.xml
index 58cc53cf..616fa366 100644
--- a/app/src/main/res/layout/preference_dialog_library_categories_listitem.xml
+++ b/app/src/main/res/layout/preference_dialog_library_categories_listitem.xml
@@ -37,7 +37,7 @@
android:focusable="false"
android:gravity="center_vertical" />
-
+
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 8ea9a3ca..420527be 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,6 +9,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath 'com.android.tools.build:bundletool:0.9.0'
}
}