mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 09:33:33 +00:00
Fix code style
This commit is contained in:
parent
ff1f4ef106
commit
99135a0e0d
7 changed files with 28 additions and 12 deletions
|
|
@ -19,8 +19,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ArtistCatalogueAdapter extends
|
public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogueAdapter.ViewHolder> {
|
||||||
RecyclerView.Adapter<ArtistCatalogueAdapter.ViewHolder> {
|
|
||||||
private static final String TAG = "ArtistCatalogueAdapter";
|
private static final String TAG = "ArtistCatalogueAdapter";
|
||||||
|
|
||||||
private List<Artist> artists;
|
private List<Artist> artists;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAd
|
||||||
this.genres = new ArrayList<>();
|
this.genres = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// inflates the row layout from xml when needed
|
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
View view = mInflater.inflate(R.layout.item_library_catalogue_genre, parent, false);
|
View view = mInflater.inflate(R.layout.item_library_catalogue_genre, parent, false);
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,14 @@ public class ThemeHelper {
|
||||||
public static void applyTheme(@NonNull String themePref) {
|
public static void applyTheme(@NonNull String themePref) {
|
||||||
switch (themePref) {
|
switch (themePref) {
|
||||||
case LIGHT_MODE: {
|
case LIGHT_MODE: {
|
||||||
Log.d(TAG, "applyTheme: LIGHT");
|
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DARK_MODE: {
|
case DARK_MODE: {
|
||||||
Log.d(TAG, "applyTheme: DARK");
|
|
||||||
|
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
Log.d(TAG, "applyTheme: SYSTEM");
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.cappielloantonio.play.interfaces;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface MediaCallback {
|
public interface MediaCallback {
|
||||||
|
|
||||||
void onError(Exception exception);
|
void onError(Exception exception);
|
||||||
|
|
||||||
void onLoadMedia(List<?> media);
|
void onLoadMedia(List<?> media);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.cappielloantonio.play.interfaces;
|
package com.cappielloantonio.play.interfaces;
|
||||||
|
|
||||||
public interface MusicServiceEventListener {
|
public interface MusicServiceEventListener {
|
||||||
|
|
||||||
void onServiceConnected();
|
void onServiceConnected();
|
||||||
|
|
||||||
void onServiceDisconnected();
|
void onServiceDisconnected();
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.cappielloantonio.play.App;
|
import com.cappielloantonio.play.App;
|
||||||
import com.cappielloantonio.play.R;
|
import com.cappielloantonio.play.R;
|
||||||
|
|
@ -331,11 +332,11 @@ public class MusicService extends Service implements Playback.PlaybackCallbacks
|
||||||
}
|
}
|
||||||
|
|
||||||
private void savePosition() {
|
private void savePosition() {
|
||||||
PreferenceManager.getDefaultSharedPreferences(this).edit().putInt(PreferenceUtil.POSITION, getPosition()).apply();
|
PreferenceUtil.getInstance(getApplicationContext()).setPosition(getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveProgress() {
|
private void saveProgress() {
|
||||||
PreferenceManager.getDefaultSharedPreferences(this).edit().putInt(PreferenceUtil.PROGRESS, getSongProgressMillis()).apply();
|
PreferenceUtil.getInstance(getApplicationContext()).setProgress(getSongProgressMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreState() {
|
private void restoreState() {
|
||||||
|
|
@ -348,8 +349,8 @@ public class MusicService extends Service implements Playback.PlaybackCallbacks
|
||||||
QueueRepository queueRepository = new QueueRepository(App.getInstance());
|
QueueRepository queueRepository = new QueueRepository(App.getInstance());
|
||||||
List<Song> restoredQueue = queueRepository.getSongs();
|
List<Song> restoredQueue = queueRepository.getSongs();
|
||||||
|
|
||||||
int restoredPosition = PreferenceManager.getDefaultSharedPreferences(this).getInt(PreferenceUtil.POSITION, -1);
|
int restoredPosition = PreferenceUtil.getInstance(getApplicationContext()).getPosition();
|
||||||
int restoredPositionInTrack = PreferenceManager.getDefaultSharedPreferences(this).getInt(PreferenceUtil.PROGRESS, -1);
|
int restoredPositionInTrack = PreferenceUtil.getInstance(getApplicationContext()).getProgress();
|
||||||
|
|
||||||
if (restoredQueue.size() > 0 && restoredPosition != -1) {
|
if (restoredQueue.size() > 0 && restoredPosition != -1) {
|
||||||
this.playingQueue = restoredQueue;
|
this.playingQueue = restoredQueue;
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,26 @@ public class PreferenceUtil {
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPosition() {
|
||||||
|
return mPreferences.getInt(POSITION, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosition(int position) {
|
||||||
|
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
|
editor.putInt(POSITION, position);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProgress() {
|
||||||
|
return mPreferences.getInt(PROGRESS, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgress(int progress) {
|
||||||
|
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
|
editor.putInt(PROGRESS, progress);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
public final int getImageCacheSize() {
|
public final int getImageCacheSize() {
|
||||||
return Integer.parseInt(mPreferences.getString(IMAGE_CACHE_SIZE, "400000000"));
|
return Integer.parseInt(mPreferences.getString(IMAGE_CACHE_SIZE, "400000000"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue