Refactor
This commit is contained in:
parent
63c417cd61
commit
a81536ab9a
96 changed files with 729 additions and 724 deletions
|
@ -2,6 +2,7 @@ package code.name.monkey.retromusic.util;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.audiofx.AudioEffect;
|
||||
import android.widget.Toast;
|
||||
|
@ -104,8 +105,8 @@ public class NavigationUtil {
|
|||
ActivityCompat.startActivity(activity, intent, null);
|
||||
}
|
||||
|
||||
public static void goToProVersion(@NonNull Activity activity) {
|
||||
ActivityCompat.startActivity(activity, new Intent(activity, PurchaseActivity.class), null);
|
||||
public static void goToProVersion(@NonNull Context context) {
|
||||
ActivityCompat.startActivity(context, new Intent(context, PurchaseActivity.class), null);
|
||||
}
|
||||
|
||||
public static void goToSettings(@NonNull Activity activity) {
|
||||
|
|
|
@ -63,26 +63,6 @@ public class RetroUtil {
|
|||
return ContentUris.withAppendedId(Uri.parse("content://media/external/audio/albumart"), paramInt);
|
||||
}
|
||||
|
||||
public static String EncodeString(String string) {
|
||||
return string.replace("%", "%25")
|
||||
.replace(".", "%2E")
|
||||
.replace("#", "%23")
|
||||
.replace("$", "%24")
|
||||
.replace("/", "%2F")
|
||||
.replace("[", "%5B")
|
||||
.replace("]", "%5D");
|
||||
}
|
||||
|
||||
public static String DecodeString(String string) {
|
||||
return string.replace("%25", "%")
|
||||
.replace("%2E", ".")
|
||||
.replace("%23", "#")
|
||||
.replace("%24", "$")
|
||||
.replace("%2F", "/")
|
||||
.replace("%5B", "[")
|
||||
.replace("%5D", "]");
|
||||
}
|
||||
|
||||
public static boolean isTablet() {
|
||||
return App.Companion.getContext().getResources().getConfiguration().smallestScreenWidthDp >= 600;
|
||||
}
|
||||
|
|
|
@ -7,31 +7,38 @@ import android.content.Context
|
|||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Build
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.PathInterpolator
|
||||
import android.widget.SeekBar
|
||||
import android.widget.TextView
|
||||
|
||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
|
||||
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.core.view.ViewCompat
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
|
||||
|
||||
object ViewUtil {
|
||||
|
||||
val RETRO_MUSIC_ANIM_TIME = 1000
|
||||
const val RETRO_MUSIC_ANIM_TIME = 1000
|
||||
|
||||
fun createTextColorTransition(v: TextView, @ColorInt startColor: Int, @ColorInt endColor: Int): Animator {
|
||||
return createColorAnimator(v, "textColor", startColor, endColor)
|
||||
}
|
||||
|
||||
fun setProgressDrawable(progressSlider: SeekBar, newColor: Int) {}
|
||||
fun setProgressDrawable(progressSlider: SeekBar, newColor: Int) {
|
||||
val ld = progressSlider.progressDrawable as LayerDrawable
|
||||
|
||||
val clipDrawableProgress = ld.findDrawableByLayerId(android.R.id.progress)
|
||||
clipDrawableProgress.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
|
||||
|
||||
val clipDrawableBackground = ld.findDrawableByLayerId(android.R.id.background)
|
||||
clipDrawableBackground.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(ThemeStore.primaryColor(progressSlider.context))), PorterDuff.Mode.SRC_IN)
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun createColorAnimator(target: Any, propertyName: String, @ColorInt startColor: Int, @ColorInt endColor: Int): Animator {
|
||||
val animator: ObjectAnimator
|
||||
|
@ -89,8 +96,4 @@ object ViewUtil {
|
|||
val metrics = resources.displayMetrics
|
||||
return dp * metrics.density
|
||||
}
|
||||
|
||||
fun createBackgroundColorTransition(colorGradientBackground: View?, lastColor: Int, newColor: Int): Animator {
|
||||
return null
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue