Fix volume color, text style etc
This commit is contained in:
parent
2c09074ad6
commit
b9412c6ef6
81 changed files with 2028 additions and 305 deletions
|
@ -16,10 +16,6 @@ import android.text.TextUtils;
|
|||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import org.jaudiotagger.audio.AudioFileIO;
|
||||
import org.jaudiotagger.tag.FieldKey;
|
||||
|
||||
|
@ -30,6 +26,9 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.FileProvider;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.loaders.PlaylistLoader;
|
||||
|
@ -106,6 +105,39 @@ public class MusicUtil {
|
|||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String getSongInfoString(@NonNull final Song song) {
|
||||
return MusicUtil.buildInfoString(
|
||||
song.artistName,
|
||||
song.albumName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a concatenated string from the provided arguments
|
||||
* The intended purpose is to show extra annotations
|
||||
* to a music library item.
|
||||
* Ex: for a given album --> buildInfoString(album.artist, album.songCount)
|
||||
*/
|
||||
public static String buildInfoString(@NonNull final String string1, @NonNull final String string2) {
|
||||
// Skip empty strings
|
||||
if (string1.isEmpty()) {
|
||||
return string2;
|
||||
}
|
||||
if (string2.isEmpty()) {
|
||||
return string1;
|
||||
}
|
||||
|
||||
final String separator = " • ";
|
||||
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append(string1);
|
||||
builder.append(separator);
|
||||
builder.append(string2);
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String getArtistInfoString(@NonNull final Context context,
|
||||
@NonNull final Artist artist) {
|
||||
|
|
|
@ -4,6 +4,7 @@ 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
|
||||
|
@ -11,6 +12,7 @@ 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 android.widget.TextView
|
||||
import androidx.annotation.ColorInt
|
||||
|
@ -28,7 +30,33 @@ object ViewUtil {
|
|||
return createColorAnimator(v, "textColor", startColor, endColor)
|
||||
}
|
||||
|
||||
fun setProgressDrawable(progressSlider: SeekBar, newColor: Int) {
|
||||
fun createBackgroundColorTransition(v: View, @ColorInt startColor: Int, @ColorInt endColor: Int): Animator {
|
||||
return createColorAnimator(v, "backgroundColor", startColor, endColor)
|
||||
}
|
||||
|
||||
fun setProgressDrawable(progressSlider: SeekBar, newColor: Int, thumbTint: Boolean = false) {
|
||||
|
||||
if (thumbTint) {
|
||||
progressSlider.thumbTintList = ColorStateList.valueOf(newColor)
|
||||
}
|
||||
|
||||
if (progressSlider.progressDrawable is LayerDrawable) {
|
||||
val ld = progressSlider.progressDrawable as LayerDrawable?
|
||||
|
||||
if (ld != null) {
|
||||
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)
|
||||
}
|
||||
} else {
|
||||
progressSlider.progressTintList = ColorStateList.valueOf(newColor)
|
||||
}
|
||||
}
|
||||
|
||||
fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {
|
||||
|
||||
val ld = progressSlider.progressDrawable as LayerDrawable
|
||||
|
||||
val clipDrawableProgress = ld.findDrawableByLayerId(android.R.id.progress)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue