Fix loading
This commit is contained in:
commit
0aba8c06d6
13 changed files with 47 additions and 90 deletions
|
@ -31,7 +31,7 @@ android {
|
|||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
applicationId "code.name.monkey.retromusic"
|
||||
versionCode 333
|
||||
versionCode 334
|
||||
versionName '3.1.900'
|
||||
|
||||
multiDexEnabled true
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package code.name.monkey.retromusic.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.transition.Slide
|
||||
|
@ -14,10 +13,7 @@ import androidx.recyclerview.widget.DefaultItemAnimator
|
|||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.appthemehelper.util.*
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
||||
import code.name.monkey.retromusic.activities.tageditor.AbsTagEditorActivity
|
||||
|
@ -245,19 +241,17 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsContrac
|
|||
}
|
||||
|
||||
private fun setColors(color: Int) {
|
||||
val themeColor = if (PreferenceUtil.getInstance().adaptiveColor) color else ThemeStore.accentColor(this)
|
||||
val themeColor = if (PreferenceUtil.getInstance().adaptiveColor) color
|
||||
else ThemeStore.accentColor(this)
|
||||
|
||||
songTitle.setTextColor(themeColor)
|
||||
moreTitle.setTextColor(themeColor)
|
||||
|
||||
playAction.backgroundTintList = ColorStateList.valueOf(themeColor)
|
||||
shuffleAction.backgroundTintList = ColorStateList.valueOf(themeColor)
|
||||
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(themeColor))).apply {
|
||||
playAction.setTextColor(this)
|
||||
playAction.iconTint = this
|
||||
val buttonColor = if (PreferenceUtil.getInstance().adaptiveColor) color
|
||||
else ATHUtil.resolveColor(this, R.attr.cardBackgroundColor)
|
||||
|
||||
shuffleAction.setTextColor(this)
|
||||
shuffleAction.iconTint = this
|
||||
}
|
||||
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
|
||||
MaterialUtil.setTint(button = playAction, color = buttonColor)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,10 +18,7 @@ import androidx.recyclerview.widget.DefaultItemAnimator
|
|||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.appthemehelper.util.*
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
||||
import code.name.monkey.retromusic.adapter.album.AlbumAdapter
|
||||
|
@ -40,7 +37,12 @@ import code.name.monkey.retromusic.rest.LastFMRestClient
|
|||
import code.name.monkey.retromusic.rest.model.LastFmArtist
|
||||
import code.name.monkey.retromusic.util.*
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import kotlinx.android.synthetic.main.activity_album_content.*
|
||||
import kotlinx.android.synthetic.main.activity_artist_content.*
|
||||
import kotlinx.android.synthetic.main.activity_artist_content.playAction
|
||||
import kotlinx.android.synthetic.main.activity_artist_content.recyclerView
|
||||
import kotlinx.android.synthetic.main.activity_artist_content.shuffleAction
|
||||
import kotlinx.android.synthetic.main.activity_artist_content.songTitle
|
||||
import kotlinx.android.synthetic.main.activity_artist_details.*
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
|
@ -291,17 +293,11 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailContrac
|
|||
songTitle.setTextColor(textColor)
|
||||
biographyTitle.setTextColor(textColor)
|
||||
|
||||
playAction.backgroundTintList = ColorStateList.valueOf(textColor)
|
||||
shuffleAction.backgroundTintList = ColorStateList.valueOf(textColor)
|
||||
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(textColor))).apply {
|
||||
playAction.setTextColor(this)
|
||||
playAction.iconTint = this
|
||||
val buttonColor = if (PreferenceUtil.getInstance().adaptiveColor) color
|
||||
else ATHUtil.resolveColor(this, R.attr.cardBackgroundColor)
|
||||
|
||||
shuffleAction.setTextColor(this)
|
||||
shuffleAction.iconTint = this
|
||||
}
|
||||
|
||||
findViewById<View>(R.id.root).setBackgroundColor(ThemeStore.primaryColor(this))
|
||||
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
|
||||
MaterialUtil.setTint(button = playAction, color = buttonColor)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
|||
import code.name.monkey.retromusic.adapter.SearchAdapter
|
||||
import code.name.monkey.retromusic.mvp.contract.SearchContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter
|
||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import kotlinx.android.synthetic.main.activity_search.*
|
||||
import java.util.*
|
||||
|
@ -59,7 +60,7 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, SearchCon
|
|||
back.setOnClickListener { onBackPressed() }
|
||||
voiceSearch.setOnClickListener { startMicSearch() }
|
||||
|
||||
searchContainer.setCardBackgroundColor(RetroUtil.toolbarColor(this))
|
||||
searchContainer.setCardBackgroundColor(RetroColorUtil.toolbarColor(this))
|
||||
|
||||
keyboardPopup.setOnClickListener {
|
||||
val inputManager = getSystemService(Service.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
|
|
|
@ -13,7 +13,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
|||
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import java.util.*
|
||||
|
||||
|
@ -37,7 +37,7 @@ open class PlaylistSongAdapter(activity: AppCompatActivity,
|
|||
|
||||
if (holder.itemViewType == OFFSET_ITEM) {
|
||||
|
||||
val buttonColor = RetroUtil.toolbarColor(activity)
|
||||
val buttonColor = RetroColorUtil.toolbarColor(activity)
|
||||
val textColor = MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(buttonColor))
|
||||
val viewHolder = holder as ViewHolder
|
||||
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
package code.name.monkey.retromusic.adapter.song
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.view.View
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import java.util.*
|
||||
|
||||
|
@ -28,51 +25,19 @@ class ShuffleButtonSongAdapter(activity: AppCompatActivity,
|
|||
|
||||
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
|
||||
if (holder.itemViewType == OFFSET_ITEM) {
|
||||
val accentColor = ThemeStore.accentColor(activity.applicationContext)
|
||||
val buttonColor = RetroUtil.toolbarColor(activity)
|
||||
val textColor = MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(buttonColor))
|
||||
val viewHolder = holder as ViewHolder
|
||||
|
||||
viewHolder.playAction?.let {
|
||||
it.backgroundTintList = ColorStateList.valueOf(buttonColor)
|
||||
it.setTextColor(textColor)
|
||||
it.iconTint = ColorStateList.valueOf(textColor)
|
||||
MaterialUtil.setTint(it, color = ATHUtil.resolveColor(activity, R.attr.cardBackgroundColor))
|
||||
it.setOnClickListener {
|
||||
MusicPlayerRemote.openQueue(dataSet, 0, true)
|
||||
}
|
||||
}
|
||||
viewHolder.shuffleAction?.let {
|
||||
it.backgroundTintList = ColorStateList.valueOf(buttonColor)
|
||||
it.setTextColor(textColor)
|
||||
it.iconTint = ColorStateList.valueOf(textColor)
|
||||
MaterialUtil.setTint(button = it, color = ATHUtil.resolveColor(activity, R.attr.cardBackgroundColor))
|
||||
it.setOnClickListener {
|
||||
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (holder.title != null) {
|
||||
holder.title!!.text = activity.resources.getString(R.string.action_shuffle_all)
|
||||
holder.title!!.setTextColor(accentColor)
|
||||
}
|
||||
if (holder.text != null) {
|
||||
holder.text!!.visibility = View.GONE
|
||||
}
|
||||
if (holder.menu != null) {
|
||||
holder.menu!!.visibility = View.GONE
|
||||
}
|
||||
if (holder.image != null) {
|
||||
val padding = activity.resources.getDimensionPixelSize(R.dimen.default_item_margin) / 2
|
||||
holder.image!!.setPadding(padding, padding, padding, padding)
|
||||
holder.image!!.setColorFilter(accentColor)
|
||||
holder.image!!.setImageResource(R.drawable.ic_shuffle_white_24dp)
|
||||
}
|
||||
if (holder.separator != null) {
|
||||
holder.separator!!.visibility = View.GONE
|
||||
}
|
||||
if (holder.shortSeparator != null) {
|
||||
holder.shortSeparator!!.visibility = View.GONE
|
||||
}
|
||||
} else {
|
||||
super.onBindViewHolder(holder, position - 1)
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
private void setupToolbar() {
|
||||
int primaryColor = ThemeStore.Companion.primaryColor(getContext());
|
||||
TintHelper.setTintAuto(contentContainer, primaryColor, true);
|
||||
toolbar.setBackgroundColor(RetroUtil.toolbarColor(getMainActivity()));
|
||||
toolbar.setBackgroundColor(RetroColorUtil.toolbarColor(getMainActivity()));
|
||||
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
|
||||
toolbar.setOnClickListener(v -> {
|
||||
Pair<View, String> pair = new Pair<>(toolbarContainer, getString(R.string.transition_toolbar));
|
||||
|
|
|
@ -229,7 +229,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
getMainActivity().setSupportActionBar(toolbar);
|
||||
TintHelper.setTintAuto(container, primaryColor, true);
|
||||
appBarLayout.setBackgroundColor(primaryColor);
|
||||
toolbar.setBackgroundColor(RetroUtil.toolbarColor(getMainActivity()));
|
||||
toolbar.setBackgroundColor(RetroColorUtil.toolbarColor(getMainActivity()));
|
||||
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
|
||||
toolbar.setOnClickListener(v -> {
|
||||
showMainMenu();
|
||||
|
|
|
@ -28,10 +28,7 @@ import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
|
|||
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist
|
||||
import code.name.monkey.retromusic.mvp.contract.HomeContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.HomePresenter
|
||||
import code.name.monkey.retromusic.util.Compressor
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import code.name.monkey.retromusic.util.*
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
@ -155,9 +152,9 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
private fun toolbarColor(): Int {
|
||||
return if (PreferenceUtil.getInstance().isHomeBanner) {
|
||||
toolbarContainer.setBackgroundColor(Color.TRANSPARENT)
|
||||
ColorUtil.withAlpha(RetroUtil.toolbarColor(mainActivity), 0.85f)
|
||||
ColorUtil.withAlpha(RetroColorUtil.toolbarColor(mainActivity), 0.85f)
|
||||
} else {
|
||||
RetroUtil.toolbarColor(mainActivity)
|
||||
RetroColorUtil.toolbarColor(mainActivity)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.content.Context;
|
|||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -28,12 +29,23 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
public class RetroColorUtil {
|
||||
public static int toolbarColor(@NonNull Context context) {
|
||||
int color = ThemeStore.Companion.primaryColor(context);
|
||||
if (ATHUtil.INSTANCE.isWindowBackgroundDark(context)) {
|
||||
return ATHUtil.INSTANCE.resolveColor(context, R.attr.cardBackgroundColor);
|
||||
} else {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Palette generatePalette(Bitmap bitmap) {
|
||||
public static Palette generatePalette(@Nullable Bitmap bitmap) {
|
||||
return bitmap == null ? null : Palette.from(bitmap).clearFilters().generate();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,14 +71,6 @@ public class RetroUtil {
|
|||
private static final int[] TEMP_ARRAY = new int[1];
|
||||
private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";
|
||||
|
||||
public static int toolbarColor(@NonNull Context context) {
|
||||
int color = ThemeStore.Companion.primaryColor(context);
|
||||
if (ATHUtil.INSTANCE.isWindowBackgroundDark(context)) {
|
||||
return ATHUtil.INSTANCE.resolveColor(context, R.attr.cardBackgroundColor);
|
||||
} else {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
public static int calculateNoOfColumns(@NonNull Context context) {
|
||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
|
||||
android:pathData="M9 11.75c-0.69 0-1.25 0.56 -1.25 1.25s0.56 1.25 1.25 1.25 1.25-0.56 1.25-1.25-0.56-1.25-1.25-1.25zm6 0c-0.69 0-1.25 0.56 -1.25 1.25s0.56 1.25 1.25 1.25 1.25-0.56 1.25-1.25-0.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-0.29 0.02 -0.58 0.05 -0.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c0.78 0 1.53-0.09 2.25-0.26 0.21 0.71 0.33 1.47 0.33 2.26 0 4.41-3.59 8-8 8z" />
|
||||
</vector>
|
|
@ -6,5 +6,5 @@
|
|||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z" />
|
||||
android:pathData="M10.25 13c0 0.69-0.56 1.25-1.25 1.25S7.75 13.69 7.75 13s0.56-1.25 1.25-1.25 1.25 0.56 1.25 1.25zM15 11.75c-0.69 0-1.25 0.56 -1.25 1.25s0.56 1.25 1.25 1.25 1.25-0.56 1.25-1.25-0.56-1.25-1.25-1.25zm7 0.25c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10zM10.66 4.12C12.06 6.44 14.6 8 17.5 8c0.46 0 0.91-0.05 1.34-0.12C17.44 5.56 14.9 4 12 4c-0.46 0-0.91 0.05 -1.34 0.12 zM4.42 9.47c1.71-0.97 3.03-2.55 3.66-4.44C6.37 6 5.05 7.58 4.42 9.47zM20 12c0-0.78-0.12-1.53-0.33-2.24-0.7 0.15 -1.42 0.24 -2.17 0.24 -3.13 0-5.92-1.44-7.76-3.69C8.69 8.87 6.6 10.88 4 11.86c0.01 0.04 0 0.09 0 0.14 0 4.41 3.59 8 8 8s8-3.59 8-8z" />
|
||||
</vector>
|
Loading…
Reference in a new issue