mirror of
https://gitea.mayex.net/mayekkuzu/Audinaut.git
synced 2025-01-23 15:14:55 +03:00
Misc refactor
This commit is contained in:
parent
665bbb3788
commit
e5702c1761
@ -827,7 +827,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
|
||||
if (service != null) {
|
||||
new SilentBackgroundTask<Void>(this) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
service.clearIncomplete();
|
||||
return null;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
||||
rewindButton = findViewById(R.id.download_rewind);
|
||||
rewindButton.setOnClickListener(v -> new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
if (getDownloadService() != null) {
|
||||
getDownloadService().rewind();
|
||||
}
|
||||
@ -244,7 +244,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
||||
previousButton = findViewById(R.id.download_previous);
|
||||
previousButton.setOnClickListener(v -> new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
if (getDownloadService() != null) {
|
||||
getDownloadService().previous();
|
||||
}
|
||||
@ -255,7 +255,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
||||
startButton = findViewById(R.id.download_start);
|
||||
startButton.setOnClickListener(v -> new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
PlayerState state = getDownloadService().getPlayerState();
|
||||
if (state == PlayerState.STARTED) {
|
||||
getDownloadService().pause();
|
||||
@ -269,7 +269,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
||||
nextButton = findViewById(R.id.download_next);
|
||||
nextButton.setOnClickListener(v -> new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
if (getDownloadService() != null) {
|
||||
getDownloadService().next();
|
||||
}
|
||||
@ -280,7 +280,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
||||
fastforwardButton = findViewById(R.id.download_fastforward);
|
||||
fastforwardButton.setOnClickListener(v -> new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
if (getDownloadService() == null) {
|
||||
return null;
|
||||
}
|
||||
@ -613,7 +613,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
||||
|
||||
new SilentBackgroundTask<Void>(this) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
AccountManager accountManager = (AccountManager) context.getSystemService(ACCOUNT_SERVICE);
|
||||
Account account = new Account(Constants.SYNC_ACCOUNT_NAME, Constants.SYNC_ACCOUNT_TYPE);
|
||||
accountManager.addAccountExplicitly(account, null, null);
|
||||
|
@ -91,7 +91,7 @@ public class DownloadFragment extends SelectRecyclerFragment<DownloadFile> imple
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DownloadFile> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) throws Exception {
|
||||
public List<DownloadFile> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) {
|
||||
DownloadService downloadService = getDownloadService();
|
||||
if (downloadService == null) {
|
||||
return new ArrayList<>();
|
||||
@ -139,7 +139,7 @@ public class DownloadFragment extends SelectRecyclerFragment<DownloadFile> imple
|
||||
case R.id.menu_remove_all:
|
||||
Util.confirmDialog(context, R.string.download_menu_remove_all, "", (dialog, which) -> new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().clearBackground();
|
||||
return null;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class MainFragment extends SelectRecyclerFragment<Integer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) throws Exception {
|
||||
public List<Integer> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) {
|
||||
return Collections.singletonList(0);
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
warnIfStorageUnavailable();
|
||||
new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().previous();
|
||||
return null;
|
||||
}
|
||||
@ -204,7 +204,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
warnIfStorageUnavailable();
|
||||
new SilentBackgroundTask<Boolean>(context) {
|
||||
@Override
|
||||
protected Boolean doInBackground() throws Throwable {
|
||||
protected Boolean doInBackground() {
|
||||
getDownloadService().next();
|
||||
return true;
|
||||
}
|
||||
@ -222,7 +222,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
|
||||
pauseButton.setOnClickListener(view -> new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().pause();
|
||||
return null;
|
||||
}
|
||||
@ -230,7 +230,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
|
||||
stopButton.setOnClickListener(view -> new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().reset();
|
||||
return null;
|
||||
}
|
||||
@ -240,7 +240,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
warnIfStorageUnavailable();
|
||||
new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
start();
|
||||
return null;
|
||||
}
|
||||
@ -286,7 +286,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
public void onStopTrackingTouch(final SeekBar seekBar) {
|
||||
new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().seekTo(progressBar.getProgress());
|
||||
return null;
|
||||
}
|
||||
@ -421,7 +421,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
case R.id.menu_remove_all:
|
||||
Util.confirmDialog(context, R.string.download_menu_remove_all, "", (dialog, which) -> new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().setShufflePlayEnabled(false);
|
||||
getDownloadService().clear();
|
||||
return null;
|
||||
@ -444,7 +444,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
case R.id.menu_shuffle:
|
||||
new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().shuffle();
|
||||
return null;
|
||||
}
|
||||
@ -674,7 +674,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
int seekTo;
|
||||
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
if (rewind) {
|
||||
seekTo = downloadService.rewind();
|
||||
} else {
|
||||
@ -726,7 +726,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
warnIfStorageUnavailable();
|
||||
new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
switch (performAction) {
|
||||
case ACTION_NEXT:
|
||||
downloadService.next();
|
||||
@ -774,7 +774,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
||||
warnIfStorageUnavailable();
|
||||
new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().play(item);
|
||||
return null;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public abstract class SelectRecyclerFragment<T> extends SubsonicFragment impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> doInBackground() throws Exception {
|
||||
public List<T> doInBackground() {
|
||||
MusicService musicService = MusicServiceFactory.getMusicService(context);
|
||||
|
||||
objects = new ArrayList<>();
|
||||
|
@ -51,7 +51,7 @@ public class SelectYearFragment extends SelectRecyclerFragment<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) throws Exception {
|
||||
public List<String> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) {
|
||||
List<String> decades = new ArrayList<>();
|
||||
for (int i = 2010; i >= 1800; i -= 10) {
|
||||
decades.add(String.valueOf(i));
|
||||
|
@ -224,7 +224,7 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared
|
||||
this.findPreference("clearCache").setOnPreferenceClickListener(preference -> {
|
||||
Util.confirmDialog(context, (dialog, which) -> new LoadingTask<Void>(context, false) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
FileUtil.deleteMusicDirectory(context);
|
||||
FileUtil.deleteSerializedCache(context);
|
||||
FileUtil.deleteArtworkCache(context);
|
||||
|
@ -1151,7 +1151,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
|
||||
|
||||
new LoadingTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
MediaStoreService mediaStore = new MediaStoreService(context);
|
||||
FileUtil.recursiveDelete(dir, mediaStore);
|
||||
return null;
|
||||
@ -1176,7 +1176,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
|
||||
private void deleteSongs(final List<Entry> songs) {
|
||||
new LoadingTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
getDownloadService().delete(songs);
|
||||
return null;
|
||||
}
|
||||
@ -1287,7 +1287,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
|
||||
private void playNow(final List<Entry> entries, final Entry song, final String playlistName, final String playlistId) {
|
||||
new LoadingTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
playNowInTask(entries, song, playlistName, playlistId);
|
||||
return null;
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ public class CachedMusicService implements MusicService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser(boolean refresh, String username, Context context, ProgressListener progressListener) throws Exception {
|
||||
public User getUser(boolean refresh, String username, Context context, ProgressListener progressListener) {
|
||||
User result = null;
|
||||
|
||||
try {
|
||||
|
@ -62,12 +62,12 @@ public class OfflineMusicService implements MusicService {
|
||||
private static final Random random = new Random();
|
||||
|
||||
@Override
|
||||
public void ping(Context context, ProgressListener progressListener) throws Exception {
|
||||
public void ping(Context context, ProgressListener progressListener) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Indexes getIndexes(String musicFolderId, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
|
||||
public Indexes getIndexes(String musicFolderId, boolean refresh, Context context, ProgressListener progressListener) {
|
||||
List<Artist> artists = new ArrayList<>();
|
||||
List<Entry> entries = new ArrayList<>();
|
||||
File root = FileUtil.getMusicDirectory(context);
|
||||
@ -91,7 +91,7 @@ public class OfflineMusicService implements MusicService {
|
||||
return getMusicDirectory(id, context);
|
||||
}
|
||||
|
||||
private MusicDirectory getMusicDirectory(String id, Context context) throws Exception {
|
||||
private MusicDirectory getMusicDirectory(String id, Context context) {
|
||||
File dir = new File(id);
|
||||
MusicDirectory result = new MusicDirectory();
|
||||
result.setName(dir.getName());
|
||||
@ -186,7 +186,7 @@ public class OfflineMusicService implements MusicService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap getCoverArt(Context context, Entry entry, int size, ProgressListener progressListener, SilentBackgroundTask task) throws Exception {
|
||||
public Bitmap getCoverArt(Context context, Entry entry, int size, ProgressListener progressListener, SilentBackgroundTask task) {
|
||||
try {
|
||||
return FileUtil.getAlbumArtBitmap(context, entry, size);
|
||||
} catch (Exception e) {
|
||||
@ -205,7 +205,7 @@ public class OfflineMusicService implements MusicService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchResult search(SearchCritera criteria, Context context, ProgressListener progressListener) throws Exception {
|
||||
public SearchResult search(SearchCritera criteria, Context context, ProgressListener progressListener) {
|
||||
List<Artist> artists = new ArrayList<>();
|
||||
List<Entry> albums = new ArrayList<>();
|
||||
List<Entry> songs = new ArrayList<>();
|
||||
@ -294,7 +294,7 @@ public class OfflineMusicService implements MusicService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Playlist> getPlaylists(boolean refresh, Context context, ProgressListener progressListener) throws Exception {
|
||||
public List<Playlist> getPlaylists(boolean refresh, Context context, ProgressListener progressListener) {
|
||||
List<Playlist> playlists = new ArrayList<>();
|
||||
File root = FileUtil.getPlaylistDirectory(context);
|
||||
String lastServer = null;
|
||||
@ -481,7 +481,7 @@ public class OfflineMusicService implements MusicService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MusicDirectory getRandomSongs(int size, String folder, String genre, String startYear, String endYear, Context context, ProgressListener progressListener) throws Exception {
|
||||
public MusicDirectory getRandomSongs(int size, String folder, String genre, String startYear, String endYear, Context context, ProgressListener progressListener) {
|
||||
File root = FileUtil.getMusicDirectory(context);
|
||||
List<File> children = new LinkedList<>();
|
||||
listFilesRecursively(root, children);
|
||||
|
@ -729,7 +729,7 @@ public class RESTMusicService implements MusicService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInstance(Integer instance) throws Exception {
|
||||
public void setInstance(Integer instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ package net.nullsum.audinaut.service.sync;
|
||||
import android.accounts.AbstractAccountAuthenticator;
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountAuthenticatorResponse;
|
||||
import android.accounts.NetworkErrorException;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -58,17 +57,17 @@ public class AuthenticatorService extends Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException {
|
||||
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) throws NetworkErrorException {
|
||||
public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException {
|
||||
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -78,12 +77,12 @@ public class AuthenticatorService extends Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException {
|
||||
public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) throws NetworkErrorException {
|
||||
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class DownloadFileItemHelperCallback extends ItemTouchHelper.SimpleCallba
|
||||
|
||||
pendingTask = new SilentBackgroundTask<Void>(downloadService) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
boolean running = true;
|
||||
while (running) {
|
||||
Object nextOperation = null;
|
||||
|
@ -99,7 +99,7 @@ public class ImageLoader {
|
||||
nowPlayingSmall = null;
|
||||
new SilentBackgroundTask<Void>(context) {
|
||||
@Override
|
||||
protected Void doInBackground() throws Throwable {
|
||||
protected Void doInBackground() {
|
||||
clearingCache = true;
|
||||
cache.evictAll();
|
||||
clearingCache = false;
|
||||
|
Loading…
Reference in New Issue
Block a user