Code refactor

1. Chaning Home Album sections from MetalAdapter to Normal
2. Adding animation icons
3. Removed cardElevation 0dp
This commit is contained in:
Hemanth S 2020-07-18 02:55:04 +05:30
parent 768ab295b0
commit 76331eae7d
55 changed files with 490 additions and 815 deletions

View file

@ -1,39 +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.util;
import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;
import androidx.annotation.NonNull;
/**
* Created by hefuyi on 16/7/30.
*/
public class DensityUtil {
public static int getScreenHeight(@NonNull Context context) {
DisplayMetrics displayMetrics = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return displayMetrics.heightPixels;
}
public static int dip2px(@NonNull Context context, float dpVale) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpVale * scale + 0.5f);
}
}

View file

@ -0,0 +1,49 @@
/*
* 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.util
import android.app.Activity
import android.content.Context
import android.util.DisplayMetrics
import android.util.TypedValue
/**
* Created by hefuyi on 16/7/30.
*/
object DensityUtil {
fun getScreenHeight(context: Context): Int {
val displayMetrics = DisplayMetrics()
(context as Activity).windowManager.defaultDisplay.getMetrics(displayMetrics)
return displayMetrics.heightPixels
}
fun getScreenWidth(context: Context): Int {
val displayMetrics = DisplayMetrics()
(context as Activity).windowManager.defaultDisplay.getMetrics(displayMetrics)
return displayMetrics.widthPixels
}
private fun toDP(context: Context, value: Int): Int {
return TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
value.toFloat(), context.resources.displayMetrics
).toInt()
}
@JvmStatic
fun dip2px(context: Context, dpVale: Float): Int {
val scale = context.resources.displayMetrics.density
return (dpVale * scale + 0.5f).toInt()
}
}

View file

@ -78,7 +78,8 @@ object ViewUtil {
}
fun setProgressDrawable(progressIndicator: ProgressIndicator, newColor: Int) {
progressIndicator.progressTintList = ColorStateList.valueOf(newColor)
progressIndicator.indicatorColors = intArrayOf(newColor)
progressIndicator.trackColor = ColorUtil.withAlpha(newColor, 0.2f)
}
fun hitTest(v: View, x: Int, y: Int): Boolean {