Added fragment to bottom options

This commit is contained in:
h4h13 2020-02-21 23:48:11 +05:30
parent 1dc0a8fcc0
commit bad40d4ccd
12 changed files with 80 additions and 112 deletions

View file

@ -36,6 +36,7 @@ import code.name.monkey.retromusic.fragments.mainactivity.folders.FoldersFragmen
import code.name.monkey.retromusic.helper.SortOrder;
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder;
import code.name.monkey.retromusic.model.CategoryInfo;
import code.name.monkey.retromusic.model.CategoryInfo.Category;
import code.name.monkey.retromusic.transform.CascadingPageTransformer;
import code.name.monkey.retromusic.transform.DepthTransformation;
import code.name.monkey.retromusic.transform.HingeTransformation;
@ -491,14 +492,15 @@ public final class PreferenceUtil {
@NonNull
public List<CategoryInfo> getDefaultLibraryCategoryInfos() {
List<CategoryInfo> defaultCategoryInfos = new ArrayList<>(7);
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.HOME, true));
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.SONGS, true));
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.ALBUMS, true));
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.ARTISTS, true));
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.PLAYLISTS, true));
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.GENRES, false));
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.QUEUE, false));
List<CategoryInfo> defaultCategoryInfos = new ArrayList<>(8);
defaultCategoryInfos.add(new CategoryInfo(Category.HOME, true));
defaultCategoryInfos.add(new CategoryInfo(Category.SONGS, true));
defaultCategoryInfos.add(new CategoryInfo(Category.ALBUMS, true));
defaultCategoryInfos.add(new CategoryInfo(Category.ARTISTS, true));
defaultCategoryInfos.add(new CategoryInfo(Category.PLAYLISTS, true));
defaultCategoryInfos.add(new CategoryInfo(Category.GENRES, false));
defaultCategoryInfos.add(new CategoryInfo(Category.QUEUE, false));
defaultCategoryInfos.add(new CategoryInfo(Category.FOLDER, false));
return defaultCategoryInfos;
}

View file

@ -14,28 +14,20 @@
package code.name.monkey.retromusic.util
import android.animation.Animator
import android.animation.ArgbEvaluator
import android.animation.ObjectAnimator
import android.content.Context
import android.content.res.ColorStateList
import android.content.res.Resources
import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.drawable.LayerDrawable
import android.os.Build
import android.view.View
import android.view.animation.PathInterpolator
import android.widget.ProgressBar
import android.widget.SeekBar
import androidx.annotation.ColorInt
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat.SRC_IN
import androidx.core.view.ViewCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.R
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
object ViewUtil {
@ -57,37 +49,24 @@ object ViewUtil {
fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {
val ld = progressSlider.progressDrawable as LayerDrawable
val layerDrawable = progressSlider.progressDrawable as LayerDrawable
val progress = ld.findDrawableByLayerId(android.R.id.progress)
progress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
val progress = layerDrawable.findDrawableByLayerId(android.R.id.progress)
progress.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(newColor, SRC_IN)
val background = ld.findDrawableByLayerId(android.R.id.background)
val background = layerDrawable.findDrawableByLayerId(android.R.id.background)
val primaryColor = ATHUtil.resolveColor(progressSlider.context, android.R.attr.windowBackground)
background.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(primaryColor)), PorterDuff.Mode.SRC_IN)
val secondaryProgress = ld.findDrawableByLayerId(android.R.id.secondaryProgress)
secondaryProgress?.setColorFilter(
ColorUtil.withAlpha(newColor, 0.65f), PorterDuff.Mode.SRC_IN
background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
MaterialValueHelper.getPrimaryDisabledTextColor(
progressSlider.context,
ColorUtil.isColorLight(primaryColor)
), SRC_IN
)
}
private fun createColorAnimator(
target: Any, propertyName: String, @ColorInt startColor: Int, @ColorInt endColor: Int
): Animator {
val animator: ObjectAnimator
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
animator = ObjectAnimator.ofArgb(target, propertyName, startColor, endColor)
} else {
animator = ObjectAnimator.ofInt(target, propertyName, startColor, endColor)
animator.setEvaluator(ArgbEvaluator())
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
animator.interpolator = PathInterpolator(0.4f, 0f, 1f, 1f)
}
animator.duration = RETRO_MUSIC_ANIM_TIME.toLong()
return animator
val secondaryProgress = layerDrawable.findDrawableByLayerId(android.R.id.secondaryProgress)
secondaryProgress?.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(ColorUtil.withAlpha(newColor, 0.65f), SRC_IN)
}
fun hitTest(v: View, x: Int, y: Int): Boolean {
@ -101,18 +80,6 @@ object ViewUtil {
return x in left..right && y >= top && y <= bottom
}
fun setUpFastScrollRecyclerViewColor(
context: Context,
recyclerView: FastScrollRecyclerView,
accentColor: Int = ThemeStore.accentColor(context)
) {
recyclerView.setPopupBgColor(accentColor)
recyclerView.setPopupTextColor(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(accentColor)))
recyclerView.setThumbColor(accentColor)
recyclerView.setTrackColor(Color.TRANSPARENT)
recyclerView.setTrackColor(ColorUtil.withAlpha(ATHUtil.resolveColor(context, R.attr.colorControlNormal), 0.12f))
}
fun convertDpToPixel(dp: Float, resources: Resources): Float {
val metrics = resources.displayMetrics
return dp * metrics.density