mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Removed unused resources
This commit is contained in:
parent
00df65f64d
commit
a531502a1b
12 changed files with 21 additions and 242 deletions
|
|
@ -6,12 +6,6 @@ import android.content.SharedPreferences;
|
|||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.cappielloantonio.play.helper.ThemeHelper;
|
||||
import com.cappielloantonio.play.model.DirectPlayCodec;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class PreferenceUtil {
|
||||
private static final String TAG = "PreferenceUtil";
|
||||
|
|
@ -21,22 +15,10 @@ public class PreferenceUtil {
|
|||
public static final String PASSWORD = "password";
|
||||
public static final String TOKEN = "token";
|
||||
public static final String SALT = "salt";
|
||||
public static final String MUSIC_LIBRARY_ID = "music_library_id";
|
||||
public static final String POSITION = "position";
|
||||
public static final String PROGRESS = "progress";
|
||||
public static final String SYNC = "sync";
|
||||
public static final String SONG_GENRE_SYNC = "song_genre_sync";
|
||||
public static final String SEARCH_ELEMENT_PER_CATEGORY = "search_element_per_category";
|
||||
public static final String IMAGE_CACHE_SIZE = "image_cache_size";
|
||||
public static final String MEDIA_CACHE_SIZE = "media_cache_size";
|
||||
public static final String INSTANT_MIX_SONG_NUMBER = "instant_mix_song_number";
|
||||
public static final String SIMILAR_ITEMS_NUMBER = "similar_items_number";
|
||||
public static final String TRANSCODE_CODEC = "transcode_codec";
|
||||
public static final String DIRECT_PLAY_CODECS = "direct_play_codecs";
|
||||
public static final String MAXIMUM_BITRATE = "maximum_bitrate";
|
||||
public static final String AUDIO_DUCKING = "audio_ducking";
|
||||
public static final String SONG_NUMBER = "SONG_NUMBER";
|
||||
public static final String IMAGE_QUALITY = "image_quality";
|
||||
|
||||
private static PreferenceUtil sInstance;
|
||||
private final SharedPreferences mPreferences;
|
||||
|
|
@ -107,36 +89,6 @@ public class PreferenceUtil {
|
|||
editor.apply();
|
||||
}
|
||||
|
||||
public Boolean getSync() {
|
||||
return mPreferences.getBoolean(SYNC, false);
|
||||
}
|
||||
|
||||
public void setSync(Boolean sync) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean(SYNC, sync);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public Boolean getSongGenreSync() {
|
||||
return mPreferences.getBoolean(SONG_GENRE_SYNC, false);
|
||||
}
|
||||
|
||||
public void setSongGenreSync(Boolean sync) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean(SONG_GENRE_SYNC, sync);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public String getMusicLibraryID() {
|
||||
return mPreferences.getString(MUSIC_LIBRARY_ID, "");
|
||||
}
|
||||
|
||||
public void setMusicLibraryID(String musicLibraryID) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(MUSIC_LIBRARY_ID, musicLibraryID);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return mPreferences.getInt(POSITION, -1);
|
||||
}
|
||||
|
|
@ -161,72 +113,7 @@ public class PreferenceUtil {
|
|||
return Integer.parseInt(mPreferences.getString(IMAGE_CACHE_SIZE, "400000000"));
|
||||
}
|
||||
|
||||
public final int getInstantMixSongNumber() {
|
||||
return Integer.parseInt(mPreferences.getString(INSTANT_MIX_SONG_NUMBER, "10"));
|
||||
}
|
||||
|
||||
public final int getSimilarItemsNumber() {
|
||||
return Integer.parseInt(mPreferences.getString(SIMILAR_ITEMS_NUMBER, "5"));
|
||||
}
|
||||
|
||||
public final int getSearchElementPerCategory() {
|
||||
return Integer.parseInt(mPreferences.getString(SEARCH_ELEMENT_PER_CATEGORY, "10"));
|
||||
}
|
||||
|
||||
public final String getTranscodeCodec() {
|
||||
return mPreferences.getString(TRANSCODE_CODEC, "aac");
|
||||
}
|
||||
|
||||
public final String getMaximumBitrate() {
|
||||
return mPreferences.getString(MAXIMUM_BITRATE, "10000000");
|
||||
}
|
||||
|
||||
public List<DirectPlayCodec> getDirectPlayCodecs() {
|
||||
DirectPlayCodec.Codec[] codecs = DirectPlayCodec.Codec.values();
|
||||
|
||||
Set<String> selectedCodecNames = new HashSet<>();
|
||||
for (DirectPlayCodec.Codec codec : codecs) {
|
||||
// this will be the default value
|
||||
selectedCodecNames.add(codec.name());
|
||||
}
|
||||
|
||||
selectedCodecNames = mPreferences.getStringSet(DIRECT_PLAY_CODECS, selectedCodecNames);
|
||||
|
||||
ArrayList<DirectPlayCodec> directPlayCodecs = new ArrayList<>();
|
||||
for (DirectPlayCodec.Codec codec : codecs) {
|
||||
String name = codec.name();
|
||||
boolean selected = selectedCodecNames.contains(name);
|
||||
directPlayCodecs.add(new DirectPlayCodec(codec, selected));
|
||||
}
|
||||
|
||||
return directPlayCodecs;
|
||||
}
|
||||
|
||||
public final int getMediaCacheSize() {
|
||||
return Integer.parseInt(mPreferences.getString(MEDIA_CACHE_SIZE, "400000000"));
|
||||
}
|
||||
|
||||
public final String getImageQuality() {
|
||||
return mPreferences.getString(IMAGE_QUALITY, "Top");
|
||||
}
|
||||
|
||||
public final boolean getAudioDucking() {
|
||||
return mPreferences.getBoolean(AUDIO_DUCKING, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Numero di canzoni salvate nel db
|
||||
*/
|
||||
public int getSongNumber() {
|
||||
return mPreferences.getInt(SONG_NUMBER, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Numero di canzoni salvate nel db
|
||||
*/
|
||||
public void setSongNumber(int number) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putInt(SONG_NUMBER, number);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue