Removed app context for PreferenceUtil class
This commit is contained in:
parent
5df5f6c93e
commit
2bbe39eab7
97 changed files with 397 additions and 456 deletions
|
@ -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'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="code.name.monkey.retromusic">
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
@ -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">
|
||||
<activity
|
||||
android:name=".activities.MainActivity"
|
||||
android:label="@string/app_name">
|
||||
|
@ -248,13 +250,13 @@
|
|||
<!-- Android Auto -->
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.car.application"
|
||||
android:resource="@xml/automotive_app_desc"/>
|
||||
android:resource="@xml/automotive_app_desc" />
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.car.application.theme"
|
||||
android:resource="@style/CarTheme" />
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.car.notification.SmallIcon"
|
||||
android:resource="@drawable/ic_notification"/>
|
||||
android:resource="@drawable/ic_notification" />
|
||||
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
|
@ -271,6 +273,8 @@
|
|||
<meta-data
|
||||
android:name="com.bumptech.glide.integration.okhttp3.OkHttpGlideModule"
|
||||
android:value="GlideModule" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.android.vending.splits.required"
|
||||
android:value="true" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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)*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -65,7 +65,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
|
|||
setUpToolBar()
|
||||
setupRecyclerView()
|
||||
|
||||
App.musicComponent.inject(this)
|
||||
App.musicComponent?.inject(this)
|
||||
genreDetailsPresenter.attachView(this)
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -64,7 +64,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
|
|||
finish()
|
||||
}
|
||||
|
||||
App.musicComponent.inject(this)
|
||||
App.musicComponent?.inject(this)
|
||||
|
||||
playlistSongsPresenter.attachView(this)
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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<Contributor>) : RecyclerView.Adapter<ContributorAdapter.ViewHolder>() {
|
||||
class ContributorAdapter(
|
||||
private var contributors: List<Contributor>
|
||||
) : RecyclerView.Adapter<ContributorAdapter.ViewHolder>() {
|
||||
|
||||
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) {
|
||||
|
|
|
@ -15,7 +15,11 @@ import java.util.*
|
|||
* @author Hemanth S (h4h13).
|
||||
*/
|
||||
|
||||
class GenreAdapter(private val mActivity: Activity, dataSet: ArrayList<Genre>, private val mItemLayoutRes: Int) : RecyclerView.Adapter<GenreAdapter.ViewHolder>() {
|
||||
class GenreAdapter(
|
||||
private val mActivity: Activity,
|
||||
dataSet: ArrayList<Genre>,
|
||||
private val mItemLayoutRes: Int
|
||||
) : RecyclerView.Adapter<GenreAdapter.ViewHolder>() {
|
||||
var dataSet = ArrayList<Genre>()
|
||||
private set
|
||||
|
||||
|
|
|
@ -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<Home>, private val displayMetrics: DisplayMetrics) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
class HomeAdapter(
|
||||
private val activity: AppCompatActivity,
|
||||
private var homes: List<Home>,
|
||||
private val displayMetrics: DisplayMetrics
|
||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
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<Artist>, PreferenceUtil.getInstance().getHomeGridStyle(context!!), false, null)
|
||||
val artistAdapter = ArtistAdapter(activity, home.arrayList as ArrayList<Artist>, 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)
|
||||
|
|
|
@ -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<Any>?) : RecyclerView.Adapter<SearchAdapter.ViewHolder>() {
|
||||
class SearchAdapter(
|
||||
private val activity: AppCompatActivity,
|
||||
private var dataSet: List<Any>?
|
||||
) : RecyclerView.Adapter<SearchAdapter.ViewHolder>() {
|
||||
|
||||
fun swapDataSet(dataSet: MutableList<Any>) {
|
||||
this.dataSet = dataSet
|
||||
|
|
|
@ -31,7 +31,8 @@ class SongFileAdapter(
|
|||
private var dataSet: List<File>?,
|
||||
private val itemLayoutRes: Int,
|
||||
private val callbacks: Callbacks?,
|
||||
cabHolder: CabHolder?) : AbsMultiSelectAdapter<SongFileAdapter.ViewHolder, File>(activity, cabHolder, R.menu.menu_media_selection), FastScrollRecyclerView.SectionedAdapter {
|
||||
cabHolder: CabHolder?
|
||||
) : AbsMultiSelectAdapter<SongFileAdapter.ViewHolder, File>(activity, cabHolder, R.menu.menu_media_selection), FastScrollRecyclerView.SectionedAdapter {
|
||||
|
||||
init {
|
||||
this.setHasStableIds(true)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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<View>(R.id.status_bar) != null) {
|
||||
view.findViewById<View>(R.id.status_bar).visibility = View.GONE
|
||||
}
|
||||
|
|
|
@ -31,14 +31,14 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
|
|||
var itemLayoutRes = itemLayoutRes
|
||||
notifyLayoutResChanged(itemLayoutRes)
|
||||
if (itemLayoutRes != R.layout.item_list) {
|
||||
itemLayoutRes = PreferenceUtil.getInstance().getAlbumGridStyle(requireContext())
|
||||
itemLayoutRes = PreferenceUtil.getInstance(requireContext()).getAlbumGridStyle(requireContext())
|
||||
}
|
||||
val dataSet = if (adapter == null) ArrayList() else adapter!!.dataSet
|
||||
return AlbumAdapter(libraryFragment.mainActivity, dataSet, itemLayoutRes, loadUsePalette(), libraryFragment)
|
||||
}
|
||||
|
||||
public override fun loadUsePalette(): Boolean {
|
||||
return PreferenceUtil.getInstance().albumColoredFooters()
|
||||
return PreferenceUtil.getInstance(requireContext()).albumColoredFooters()
|
||||
}
|
||||
|
||||
override fun setUsePalette(usePalette: Boolean) {
|
||||
|
@ -53,43 +53,43 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Al
|
|||
|
||||
override fun loadSortOrder(): String {
|
||||
|
||||
return PreferenceUtil.getInstance().albumSortOrder
|
||||
return PreferenceUtil.getInstance(requireContext()).albumSortOrder
|
||||
}
|
||||
|
||||
override fun saveSortOrder(sortOrder: String) {
|
||||
|
||||
PreferenceUtil.getInstance().albumSortOrder = sortOrder
|
||||
PreferenceUtil.getInstance(requireContext()).albumSortOrder = sortOrder
|
||||
}
|
||||
|
||||
override fun loadGridSize(): Int {
|
||||
|
||||
return PreferenceUtil.getInstance().getAlbumGridSize(activity!!)
|
||||
return PreferenceUtil.getInstance(requireContext()).getAlbumGridSize(activity!!)
|
||||
}
|
||||
|
||||
override fun saveGridSize(gridColumns: Int) {
|
||||
|
||||
PreferenceUtil.getInstance().setAlbumGridSize(gridColumns)
|
||||
PreferenceUtil.getInstance(requireContext()).setAlbumGridSize(gridColumns)
|
||||
}
|
||||
|
||||
override fun loadGridSizeLand(): Int {
|
||||
|
||||
return PreferenceUtil.getInstance().getAlbumGridSizeLand(activity!!)
|
||||
return PreferenceUtil.getInstance(requireContext()).getAlbumGridSizeLand(activity!!)
|
||||
}
|
||||
|
||||
override fun saveGridSizeLand(gridColumns: Int) {
|
||||
|
||||
PreferenceUtil.getInstance().setAlbumGridSizeLand(gridColumns)
|
||||
PreferenceUtil.getInstance(requireContext()).setAlbumGridSizeLand(gridColumns)
|
||||
}
|
||||
|
||||
override fun saveUsePalette(usePalette: Boolean) {
|
||||
|
||||
PreferenceUtil.getInstance().setAlbumColoredFooters(usePalette)
|
||||
PreferenceUtil.getInstance(requireContext()).setAlbumColoredFooters(usePalette)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
App.musicComponent.inject(this)
|
||||
App.musicComponent?.inject(this)
|
||||
albumsPresenter.attachView(this)
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
App.musicComponent.inject(this)
|
||||
App.musicComponent?.inject(this)
|
||||
artistsPresenter.attachView(this)
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
|||
var itemLayoutRes = itemLayoutRes
|
||||
notifyLayoutResChanged(itemLayoutRes)
|
||||
if (itemLayoutRes != R.layout.item_list) {
|
||||
itemLayoutRes = PreferenceUtil.getInstance().getArtistGridStyle(requireContext())
|
||||
itemLayoutRes = PreferenceUtil.getInstance(requireContext()).getArtistGridStyle(requireContext())
|
||||
}
|
||||
val dataSet = if (adapter == null) ArrayList() else adapter!!.dataSet
|
||||
return ArtistAdapter(libraryFragment.mainActivity, dataSet, itemLayoutRes, loadUsePalette(), libraryFragment)
|
||||
|
@ -60,27 +60,27 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
|||
|
||||
|
||||
override fun loadGridSize(): Int {
|
||||
return PreferenceUtil.getInstance().getArtistGridSize(activity!!)
|
||||
return PreferenceUtil.getInstance(requireContext()).getArtistGridSize(activity!!)
|
||||
}
|
||||
|
||||
override fun saveGridSize(gridColumns: Int) {
|
||||
PreferenceUtil.getInstance().setArtistGridSize(gridColumns)
|
||||
PreferenceUtil.getInstance(requireContext()).setArtistGridSize(gridColumns)
|
||||
}
|
||||
|
||||
override fun loadGridSizeLand(): Int {
|
||||
return PreferenceUtil.getInstance().getArtistGridSizeLand(activity!!)
|
||||
return PreferenceUtil.getInstance(requireContext()).getArtistGridSizeLand(activity!!)
|
||||
}
|
||||
|
||||
override fun saveGridSizeLand(gridColumns: Int) {
|
||||
PreferenceUtil.getInstance().setArtistGridSizeLand(gridColumns)
|
||||
PreferenceUtil.getInstance(requireContext()).setArtistGridSizeLand(gridColumns)
|
||||
}
|
||||
|
||||
override fun saveUsePalette(usePalette: Boolean) {
|
||||
PreferenceUtil.getInstance().setArtistColoredFooters(usePalette)
|
||||
PreferenceUtil.getInstance(requireContext()).setArtistColoredFooters(usePalette)
|
||||
}
|
||||
|
||||
public override fun loadUsePalette(): Boolean {
|
||||
return PreferenceUtil.getInstance().artistColoredFooters()
|
||||
return PreferenceUtil.getInstance(requireContext()).artistColoredFooters()
|
||||
}
|
||||
|
||||
override fun setUsePalette(usePalette: Boolean) {
|
||||
|
@ -94,11 +94,11 @@ class ArtistsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<Artist
|
|||
|
||||
|
||||
override fun loadSortOrder(): String {
|
||||
return PreferenceUtil.getInstance().artistSortOrder
|
||||
return PreferenceUtil.getInstance(requireContext()).artistSortOrder
|
||||
}
|
||||
|
||||
override fun saveSortOrder(sortOrder: String) {
|
||||
PreferenceUtil.getInstance().artistSortOrder = sortOrder
|
||||
PreferenceUtil.getInstance(requireContext()).artistSortOrder = sortOrder
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
|
|
@ -54,7 +54,7 @@ class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearL
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
App.musicComponent.inject(this)
|
||||
App.musicComponent?.inject(this)
|
||||
genresPresenter.attachView(this)
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
disposable.dispose();
|
||||
PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this);
|
||||
PreferenceUtil.getInstance(requireActivity()).unregisterOnSharedPreferenceChangedListener(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -93,7 +93,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
toolbarContainer = view.findViewById(R.id.toolbarContainer);
|
||||
appBarLayout = view.findViewById(R.id.appBarLayout);
|
||||
toolbar = view.findViewById(R.id.toolbar);
|
||||
PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this);
|
||||
PreferenceUtil.getInstance(requireActivity()).registerOnSharedPreferenceChangedListener(this);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, L
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
App.musicComponent.inject(this)
|
||||
App.musicComponent?.inject(this)
|
||||
playlistsPresenter.attachView(this)
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, L
|
|||
adapter!!.swapDataSet(ArrayList())
|
||||
}
|
||||
|
||||
override fun playlists(list: ArrayList<Playlist>) {
|
||||
adapter!!.swapDataSet(list)
|
||||
override fun playlists(playlists: ArrayList<Playlist>) {
|
||||
adapter!!.swapDataSet(playlists)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
|
|
|
@ -25,7 +25,7 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdap
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
App.musicComponent.inject(this)
|
||||
App.musicComponent?.inject(this)
|
||||
|
||||
songPresenter.attachView(this)
|
||||
}
|
||||
|
@ -55,27 +55,27 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdap
|
|||
}
|
||||
|
||||
override fun loadGridSize(): Int {
|
||||
return PreferenceUtil.getInstance().getSongGridSize(activity!!)
|
||||
return PreferenceUtil.getInstance(requireContext()).getSongGridSize(activity!!)
|
||||
}
|
||||
|
||||
override fun saveGridSize(gridColumns: Int) {
|
||||
PreferenceUtil.getInstance().setSongGridSize(gridColumns)
|
||||
PreferenceUtil.getInstance(requireContext()).setSongGridSize(gridColumns)
|
||||
}
|
||||
|
||||
override fun loadGridSizeLand(): Int {
|
||||
return PreferenceUtil.getInstance().getSongGridSizeLand(activity!!)
|
||||
return PreferenceUtil.getInstance(requireContext()).getSongGridSizeLand(activity!!)
|
||||
}
|
||||
|
||||
override fun saveGridSizeLand(gridColumns: Int) {
|
||||
PreferenceUtil.getInstance().setSongGridSizeLand(gridColumns)
|
||||
PreferenceUtil.getInstance(requireContext()).setSongGridSizeLand(gridColumns)
|
||||
}
|
||||
|
||||
public override fun saveUsePalette(usePalette: Boolean) {
|
||||
PreferenceUtil.getInstance().setSongColoredFooters(usePalette)
|
||||
PreferenceUtil.getInstance(requireContext()).setSongColoredFooters(usePalette)
|
||||
}
|
||||
|
||||
public override fun loadUsePalette(): Boolean {
|
||||
return PreferenceUtil.getInstance().songColoredFooters()
|
||||
return PreferenceUtil.getInstance(requireContext()).songColoredFooters()
|
||||
}
|
||||
|
||||
public override fun setUsePalette(usePalette: Boolean) {
|
||||
|
@ -104,11 +104,11 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdap
|
|||
}
|
||||
|
||||
override fun loadSortOrder(): String {
|
||||
return PreferenceUtil.getInstance().songSortOrder
|
||||
return PreferenceUtil.getInstance(requireContext()).songSortOrder
|
||||
}
|
||||
|
||||
override fun saveSortOrder(sortOrder: String) {
|
||||
PreferenceUtil.getInstance().songSortOrder = sortOrder
|
||||
PreferenceUtil.getInstance(requireContext()).songSortOrder = sortOrder
|
||||
}
|
||||
|
||||
override fun setSortOrder(sortOrder: String) {
|
||||
|
|
|
@ -109,7 +109,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
}
|
||||
|
||||
public static FoldersFragment newInstance(Context context) {
|
||||
return newInstance(PreferenceUtil.getInstance().getStartDirectory());
|
||||
return newInstance(PreferenceUtil.getInstance(context).getStartDirectory());
|
||||
}
|
||||
|
||||
public static FoldersFragment newInstance(File directory) {
|
||||
|
@ -328,7 +328,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_go_to_start_directory:
|
||||
setCrumb(new BreadCrumbLayout.Crumb(tryGetCanonicalFile(PreferenceUtil.getInstance().getStartDirectory())), true);
|
||||
setCrumb(new BreadCrumbLayout.Crumb(tryGetCanonicalFile(PreferenceUtil.getInstance(requireContext()).getStartDirectory())), true);
|
||||
return true;
|
||||
case R.id.action_scan:
|
||||
BreadCrumbLayout.Crumb crumb = getActiveCrumb();
|
||||
|
@ -415,7 +415,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
getFileComparator()));
|
||||
return true;
|
||||
case R.id.action_set_as_start_directory:
|
||||
PreferenceUtil.getInstance().setStartDirectory(file);
|
||||
PreferenceUtil.getInstance(requireContext()).setStartDirectory(file);
|
||||
Toast.makeText(getActivity(),
|
||||
String.format(getString(R.string.new_start_directory), file.getPath()),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
|
|
@ -68,7 +68,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
private lateinit var toolbar: Toolbar
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(if (PreferenceUtil.getInstance().isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home, viewGroup, false)
|
||||
return inflater.inflate(if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home, viewGroup, false)
|
||||
}
|
||||
|
||||
private fun loadImageFromStorage() {
|
||||
|
@ -77,17 +77,17 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
.setMaxWidth(300)
|
||||
.setQuality(75)
|
||||
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
||||
.compressToBitmapAsFlowable(File(PreferenceUtil.getInstance().profileImage, Constants.USER_PROFILE))
|
||||
.compressToBitmapAsFlowable(File(PreferenceUtil.getInstance(requireContext()).profileImage, Constants.USER_PROFILE))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
if (it != null) {
|
||||
userImage.setImageBitmap(it)
|
||||
} else {
|
||||
userImage.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat))
|
||||
userImage.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_person_flat))
|
||||
}
|
||||
}) {
|
||||
userImage.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat))
|
||||
userImage.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_person_flat))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
App.musicComponent.inject(this)
|
||||
App.musicComponent?.inject(this)
|
||||
homePresenter.attachView(this)
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
bannerImage?.setOnClickListener {
|
||||
NavigationUtil.goToUserInfo(requireActivity())
|
||||
}
|
||||
if (!PreferenceUtil.getInstance().isHomeBanner)
|
||||
if (!PreferenceUtil.getInstance(requireContext()).isHomeBanner)
|
||||
setStatusbarColorAuto(view)
|
||||
|
||||
lastAdded.setOnClickListener {
|
||||
|
@ -145,7 +145,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
NavigationUtil.goToUserInfo(requireActivity())
|
||||
}
|
||||
titleWelcome.setTextColor(ThemeStore.textColorPrimary(requireContext()))
|
||||
titleWelcome.text = String.format("%s", PreferenceUtil.getInstance().userName)
|
||||
titleWelcome.text = String.format("%s", PreferenceUtil.getInstance(requireContext()).userName)
|
||||
|
||||
homePresenter.loadSections()
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
}
|
||||
|
||||
private fun toolbarColor(): Int {
|
||||
return if (PreferenceUtil.getInstance().isHomeBanner) {
|
||||
return if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) {
|
||||
toolbarContainer.setBackgroundColor(Color.TRANSPARENT)
|
||||
ColorUtil.withAlpha(RetroColorUtil.toolbarColor(mainActivity), 0.85f)
|
||||
} else {
|
||||
|
@ -253,7 +253,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
|
||||
private fun loadTimeImage(day: String) {
|
||||
if (bannerImage != null) {
|
||||
if (PreferenceUtil.getInstance().bannerImage.isEmpty()) {
|
||||
if (PreferenceUtil.getInstance(requireContext()).bannerImage.isEmpty()) {
|
||||
GlideApp.with(requireActivity())
|
||||
.load(day)
|
||||
.placeholder(R.drawable.material_design_default)
|
||||
|
@ -263,7 +263,7 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
disposable.add(Compressor(requireActivity())
|
||||
.setQuality(100)
|
||||
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
||||
.compressToBitmapAsFlowable(File(PreferenceUtil.getInstance().bannerImage, USER_BANNER))
|
||||
.compressToBitmapAsFlowable(File(PreferenceUtil.getInstance(requireContext()).bannerImage, USER_BANNER))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { bitmap -> bannerImage.setImageBitmap(bitmap) })
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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!!)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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!!)
|
||||
|
|
|
@ -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!!)
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -209,7 +209,7 @@ object MusicPlayerRemote {
|
|||
fun openQueue(queue: ArrayList<Song>, 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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,8 +87,8 @@ object PlaylistMenuHelper {
|
|||
private class SavePlaylistAsyncTask internal constructor(context: Context) : WeakContextAsyncTask<Playlist, String, String>(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) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -176,7 +176,7 @@ object SongLoader {
|
|||
context: Context,
|
||||
selection: String?,
|
||||
selectionValues: Array<String>?,
|
||||
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
|
||||
}
|
||||
|
|
|
@ -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.*
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<CategoryInfo>): Int {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -113,7 +113,7 @@ class PlayingNotificationImpl : PlayingNotification() {
|
|||
bigNotificationImageSize) {
|
||||
override fun onResourceReady(resource: BitmapPaletteWrapper, transition: Transition<in BitmapPaletteWrapper>?) {
|
||||
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)
|
||||
|
|
|
@ -84,7 +84,7 @@ class PlayingNotificationImpl24 : PlayingNotification() {
|
|||
.into(object : RetroSimpleTarget<BitmapPaletteWrapper>(bigNotificationImageSize, bigNotificationImageSize) {
|
||||
override fun onResourceReady(resource: BitmapPaletteWrapper, transition: Transition<in BitmapPaletteWrapper>?) {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<Void, Void, Void>() {
|
||||
@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))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<UriPermission> perms = context.getContentResolver().getPersistedUriPermissions();
|
||||
for (UriPermission perm : perms) {
|
||||
|
@ -198,7 +198,7 @@ public class SAFUtil {
|
|||
|
||||
if (isTreeUriSaved(context)) {
|
||||
List<String> 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<String> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<Drawable>() {
|
||||
@Override
|
||||
public void onLoadStarted(@Nullable Drawable placeholder) {
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
|
59
app/src/main/res/layout/item_contributor_header.xml
Normal file
59
app/src/main/res/layout/item_contributor_header.xml
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/rectSelector"
|
||||
android:gravity="center_horizontal"
|
||||
android:minHeight="@dimen/md_listitem_height"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="24dp"
|
||||
tools:ignore="PrivateResource">
|
||||
|
||||
<code.name.monkey.retromusic.views.CircularImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_margin="8dp"
|
||||
app:civ_border="false"
|
||||
app:civ_shadow="false"
|
||||
app:srcCompat="@drawable/ic_person_flat" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textAppearance="@style/TextViewHeadline5" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.85"
|
||||
android:textAppearance="@style/TextViewBody2" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -37,7 +37,7 @@
|
|||
android:focusable="false"
|
||||
android:gravity="center_vertical" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -16,6 +16,13 @@
|
|||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
|
||||
android:key="category_color"
|
||||
android:title="@string/colors">
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEColorPreference
|
||||
android:key="accent_color"
|
||||
android:persistent="false"
|
||||
android:summary="@string/accent_color_desc"
|
||||
android:title="@string/accent_color"
|
||||
app:enableCopying="true"
|
||||
app:icon="@drawable/ic_colorize_white_24dp" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
|
||||
android:defaultValue="false"
|
||||
|
@ -38,13 +45,5 @@
|
|||
android:title="@string/pref_title_toggle_dominant_color"
|
||||
app:enableCopying="true" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEColorPreference
|
||||
android:key="accent_color"
|
||||
android:persistent="false"
|
||||
android:summary="@string/accent_color_desc"
|
||||
android:title="@string/accent_color"
|
||||
app:enableCopying="true"
|
||||
app:icon="@drawable/ic_colorize_white_24dp" />
|
||||
|
||||
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||
</androidx.preference.PreferenceScreen>
|
|
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue