App shortcut fixed
This commit is contained in:
parent
1425bfe612
commit
0b6f043995
181 changed files with 1616 additions and 2052 deletions
|
@ -4,12 +4,12 @@ import android.annotation.SuppressLint;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.signature.ObjectKey;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import code.name.monkey.retromusic.App;
|
||||
|
||||
|
||||
public class ArtistSignatureUtil {
|
||||
private static final String ARTIST_SIGNATURE_PREFS = "artist_signatures";
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class CustomArtistImageUtil private constructor(context: Context) {
|
|||
object : AsyncTask<Void, Void, Void>() {
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun doInBackground(vararg params: Void): Void? {
|
||||
val dir = File(App.context.getFilesDir(), FOLDER_NAME)
|
||||
val dir = File(App.context.filesDir, FOLDER_NAME)
|
||||
if (!dir.exists()) {
|
||||
if (!dir.mkdirs()) { // create the folder
|
||||
return null
|
||||
|
@ -63,7 +63,7 @@ class CustomArtistImageUtil private constructor(context: Context) {
|
|||
if (succesful) {
|
||||
mPreferences.edit().putBoolean(getFileName(artist), true).commit()
|
||||
ArtistSignatureUtil.getInstance().updateArtistSignature(artist.name)
|
||||
App.context.getContentResolver().notifyChange(Uri.parse("content://media"), null) // trigger media store changed to force artist image reload
|
||||
App.context.contentResolver.notifyChange(Uri.parse("content://media"), null) // trigger media store changed to force artist image reload
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class CustomArtistImageUtil private constructor(context: Context) {
|
|||
|
||||
@JvmStatic
|
||||
fun getFile(artist: Artist): File {
|
||||
val dir = File(App.context.getFilesDir(), FOLDER_NAME)
|
||||
val dir = File(App.context.filesDir, FOLDER_NAME)
|
||||
return File(dir, getFileName(artist))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ 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;
|
||||
|
@ -12,8 +11,8 @@ import androidx.annotation.Nullable;
|
|||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.core.util.Pair;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.cast.ExpandedCastControlsActivity;
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.model.Genre;
|
||||
import code.name.monkey.retromusic.model.Playlist;
|
||||
|
@ -137,20 +136,7 @@ public class NavigationUtil {
|
|||
openUrl(activity, RATE_ON_GOOGLE_PLAY);
|
||||
}
|
||||
|
||||
public static void gotoExpandedController(Activity activity) {
|
||||
ActivityCompat.startActivity(activity, new Intent(activity, ExpandedCastControlsActivity.class), null);
|
||||
}
|
||||
|
||||
public static void gotoWhatNews(Activity activity) {
|
||||
ActivityCompat.startActivity(activity, new Intent(activity, WhatsNewActivity.class), null);
|
||||
}
|
||||
|
||||
public static void gotoNowPlayingActivity(Context context, @Nullable Pair... sharedElements) {
|
||||
//ActivityCompat.startActivity(context, new Intent(context, NowPayingActivity.class), ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, sharedElements).toBundle());
|
||||
|
||||
}
|
||||
|
||||
public static void gotoNowPlaying(Activity activity) {
|
||||
//ActivityCompat.startActivity(activity, new Intent(activity, NowPayingActivity.class),null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,30 +7,24 @@ import android.content.SharedPreferences.Editor;
|
|||
import android.content.res.TypedArray;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
import code.name.monkey.retromusic.App;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.helper.SortOrder;
|
||||
import code.name.monkey.retromusic.model.CategoryInfo;
|
||||
import code.name.monkey.retromusic.transform.CascadingPageTransformer;
|
||||
import code.name.monkey.retromusic.transform.DepthTransformation;
|
||||
import code.name.monkey.retromusic.transform.HingeTransformation;
|
||||
import code.name.monkey.retromusic.transform.HorizontalFlipTransformation;
|
||||
import code.name.monkey.retromusic.transform.NormalPageTransformer;
|
||||
import code.name.monkey.retromusic.transform.StackPagerTransformer;
|
||||
import code.name.monkey.retromusic.transform.StackTransformer;
|
||||
import code.name.monkey.retromusic.transform.VerticalFlipTransformation;
|
||||
import code.name.monkey.retromusic.ui.activities.MainActivity;
|
||||
|
@ -71,7 +65,6 @@ public final class PreferenceUtil {
|
|||
public static final String ALBUM_COVER_TRANSFORM = "album_cover_transform";
|
||||
public static final String TAB_TEXT_MODE = "tab_text_mode";
|
||||
private static final String GENRE_SORT_ORDER = "genre_sort_order";
|
||||
private static final String LIBRARY_CATEGORIES = "library_categories";
|
||||
private static final String LAST_PAGE = "last_start_page";
|
||||
private static final String LAST_MUSIC_CHOOSER = "last_music_chooser";
|
||||
private static final String DEFAULT_START_PAGE = "default_start_page";
|
||||
|
@ -106,7 +99,7 @@ public final class PreferenceUtil {
|
|||
private static final String LOCK_SCREEN = "lock_screen";
|
||||
private static final String ALBUM_DETAIL_SONG_SORT_ORDER = "album_detail_song_sort_order";
|
||||
private static final String ARTIST_DETAIL_SONG_SORT_ORDER = "artist_detail_song_sort_order";
|
||||
private static final String LYRICS_OPTIONS = "lyrics_options";
|
||||
private static final String LYRICS_OPTIONS = "lyrics_tab_position";
|
||||
private static final String CHOOSE_EQUALIZER = "choose_equalizer";
|
||||
private static final String TOGGLE_SHUFFLE = "toggle_shuffle";
|
||||
private static final String SONG_GRID_STYLE = "song_grid_style";
|
||||
|
@ -133,17 +126,17 @@ public final class PreferenceUtil {
|
|||
@StyleRes
|
||||
public static int getThemeResFromPrefValue(String themePrefValue) {
|
||||
switch (themePrefValue) {
|
||||
case "dark":
|
||||
return R.style.Theme_RetroMusic;
|
||||
case "light":
|
||||
return R.style.Theme_RetroMusic_Light;
|
||||
case "color":
|
||||
return R.style.Theme_RetroMusic_Color;
|
||||
case "acolor":
|
||||
return R.style.Theme_RetroMusic_Black;
|
||||
case "black":
|
||||
return R.style.Theme_RetroMusic_Black;
|
||||
case "light":
|
||||
case "dark":
|
||||
default:
|
||||
return R.style.Theme_RetroMusic_Light;
|
||||
return R.style.Theme_RetroMusic;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,8 +163,7 @@ public final class PreferenceUtil {
|
|||
}
|
||||
|
||||
public final String getArtistAlbumSortOrder() {
|
||||
return mPreferences
|
||||
.getString(ARTIST_ALBUM_SORT_ORDER, SortOrder.ArtistAlbumSortOrder.ALBUM_YEAR);
|
||||
return mPreferences.getString(ARTIST_ALBUM_SORT_ORDER, SortOrder.ArtistAlbumSortOrder.ALBUM_YEAR);
|
||||
}
|
||||
|
||||
public final String getAlbumSortOrder() {
|
||||
|
@ -221,51 +213,10 @@ public final class PreferenceUtil {
|
|||
return mPreferences.getBoolean(TOGGLE_ADD_CONTROLS, false);
|
||||
}
|
||||
|
||||
public boolean circularAlbumArt() {
|
||||
return mPreferences.getBoolean(CIRCULAR_ALBUM_ART, false);
|
||||
}
|
||||
|
||||
public boolean carouselEffect() {
|
||||
return mPreferences.getBoolean(CAROUSEL_EFFECT, false);
|
||||
}
|
||||
|
||||
public ArrayList<CategoryInfo> getLibraryCategoryInfos() {
|
||||
String data = mPreferences.getString(LIBRARY_CATEGORIES, null);
|
||||
if (data != null) {
|
||||
Gson gson = new Gson();
|
||||
Type collectionType = new TypeToken<ArrayList<CategoryInfo>>() {
|
||||
}.getType();
|
||||
|
||||
try {
|
||||
return gson.fromJson(data, collectionType);
|
||||
} catch (JsonSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return getDefaultLibraryCategoryInfos();
|
||||
}
|
||||
|
||||
public void setLibraryCategoryInfos(ArrayList<CategoryInfo> categories) {
|
||||
Gson gson = new Gson();
|
||||
Type collectionType = new TypeToken<ArrayList<CategoryInfo>>() {
|
||||
}.getType();
|
||||
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(LIBRARY_CATEGORIES, gson.toJson(categories, collectionType));
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public ArrayList<CategoryInfo> getDefaultLibraryCategoryInfos() {
|
||||
ArrayList<CategoryInfo> defaultCategoryInfos = new ArrayList<>(5);
|
||||
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.GENRES, true));
|
||||
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.PLAYLISTS, true));
|
||||
return defaultCategoryInfos;
|
||||
}
|
||||
|
||||
public boolean isRoundCorners() {
|
||||
return mPreferences.getBoolean(ROUND_CORNERS, false);
|
||||
}
|
||||
|
@ -552,7 +503,7 @@ public final class PreferenceUtil {
|
|||
}
|
||||
|
||||
public int getGeneralTheme() {
|
||||
return getThemeResFromPrefValue(mPreferences.getString(GENERAL_THEME, "light"));
|
||||
return getThemeResFromPrefValue(mPreferences.getString(GENERAL_THEME, "dark"));
|
||||
}
|
||||
|
||||
public void setGeneralTheme(String theme) {
|
||||
|
@ -611,10 +562,6 @@ public final class PreferenceUtil {
|
|||
mPreferences.edit().putInt(TOGGLE_FULL_SCREEN, newValue).apply();
|
||||
}
|
||||
|
||||
public String lyricsOptions() {
|
||||
return mPreferences.getString(LYRICS_OPTIONS, "offline");
|
||||
}
|
||||
|
||||
public void saveProfileImage(String profileImagePath) {
|
||||
mPreferences.edit().putString(PROFILE_IMAGE_PATH, profileImagePath)
|
||||
.apply();
|
||||
|
|
|
@ -1,24 +1,53 @@
|
|||
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.Resources;
|
||||
import android.graphics.Color;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.PathInterpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
|
||||
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
public class ViewUtil {
|
||||
|
||||
public final static int RETRO_MUSIC_ANIM_TIME = 1000;
|
||||
|
||||
public static Animator createTextColorTransition(final TextView v, @ColorInt final int startColor, @ColorInt final int endColor) {
|
||||
return createColorAnimator(v, "textColor", startColor, endColor);
|
||||
}
|
||||
|
||||
private static Animator createColorAnimator(Object target, String propertyName, @ColorInt int startColor, @ColorInt int endColor) {
|
||||
ObjectAnimator animator;
|
||||
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(new ArgbEvaluator());
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
animator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
|
||||
}
|
||||
animator.setDuration(RETRO_MUSIC_ANIM_TIME);
|
||||
return animator;
|
||||
}
|
||||
|
||||
public static void setStatusBarHeight(final Context context, View statusBar) {
|
||||
ViewGroup.LayoutParams lp = statusBar.getLayoutParams();
|
||||
lp.height = getStatusBarHeight(context);
|
||||
|
@ -59,4 +88,9 @@ public class ViewUtil {
|
|||
DisplayMetrics metrics = resources.getDisplayMetrics();
|
||||
return dp * metrics.density;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Animator createBackgroundColorTransition(@Nullable View colorGradientBackground, int lastColor, int newColor) {
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue