Remove unreachable

This commit is contained in:
Andrew Rabert 2018-04-24 20:27:13 -04:00
parent d8ee4d012c
commit d84327db02
9 changed files with 4 additions and 68 deletions

View File

@ -23,7 +23,7 @@ import android.content.Context;
public class AudioEffectsController { public class AudioEffectsController {
private final Context context; private final Context context;
private int audioSessionId = 0; private int audioSessionId;
private EqualizerController equalizerController; private EqualizerController equalizerController;

View File

@ -43,7 +43,7 @@ public class EqualizerController {
private boolean loudnessAvailable = false; private boolean loudnessAvailable = false;
private LoudnessEnhancerController loudnessEnhancerController; private LoudnessEnhancerController loudnessEnhancerController;
private boolean released = false; private boolean released = false;
private int audioSessionId = 0; private int audioSessionId;
public EqualizerController(Context context, int audioSessionId) { public EqualizerController(Context context, int audioSessionId) {
this.context = context; this.context = context;

View File

@ -39,17 +39,12 @@ public class User implements Serializable {
ROLES.add(COMMENT); ROLES.add(COMMENT);
} }
private final List<Setting> settings = new ArrayList<>();
private List<Setting> musicFolders; private List<Setting> musicFolders;
public User() { public User() {
} }
public void addSetting(String name, Boolean value) {
settings.add(new Setting(name, value));
}
public void addMusicFolder(MusicFolder musicFolder) { public void addMusicFolder(MusicFolder musicFolder) {
if (musicFolders == null) { if (musicFolders == null) {
musicFolders = new ArrayList<>(); musicFolders = new ArrayList<>();
@ -66,10 +61,6 @@ public class User implements Serializable {
private String name; private String name;
private Boolean value; private Boolean value;
public Setting() {
}
public Setting(String name, Boolean value) { public Setting(String name, Boolean value) {
this.name = name; this.name = name;
this.value = value; this.value = value;

View File

@ -176,13 +176,11 @@ public class SelectArtistFragment extends SelectRecyclerFragment<Serializable> i
entries = indexes.getEntries(); entries = indexes.getEntries();
items.addAll(entries); items.addAll(entries);
} else { } else {
List<Artist> artists = new ArrayList<>();
MusicDirectory dir = musicService.getMusicDirectory(groupId, groupName, refresh, context, listener); MusicDirectory dir = musicService.getMusicDirectory(groupId, groupName, refresh, context, listener);
for (Entry entry : dir.getChildren(true, false)) { for (Entry entry : dir.getChildren(true, false)) {
Artist artist = new Artist(); Artist artist = new Artist();
artist.setId(entry.getId()); artist.setId(entry.getId());
artist.setName(entry.getTitle()); artist.setName(entry.getTitle());
artists.add(artist);
} }
Indexes indexes = new Indexes(); Indexes indexes = new Indexes();

View File

@ -106,15 +106,6 @@ public class SelectPlaylistFragment extends SelectRecyclerFragment<Playlist> {
@Override @Override
public SectionAdapter<Playlist> getAdapter(List<Playlist> playlists) { public SectionAdapter<Playlist> getAdapter(List<Playlist> playlists) {
List<Playlist> mine = new ArrayList<>();
String currentUsername = UserUtil.getCurrentUsername(context);
for (Playlist playlist : playlists) {
if (playlist.getOwner() == null || playlist.getOwner().equals(currentUsername)) {
mine.add(playlist);
}
}
return new PlaylistAdapter(context, playlists, getImageLoader(), largeAlbums, this); return new PlaylistAdapter(context, playlists, getImageLoader(), largeAlbums, this);
} }

View File

@ -232,8 +232,6 @@ public class DownloadService extends Service {
} }
} else if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) { } else if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
imageLoader.onLowMemory(0.25f); imageLoader.onLowMemory(0.25f);
} else if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
imageLoader.onLowMemory(0.75f);
} }
} }
} }
@ -336,7 +334,6 @@ public class DownloadService extends Service {
} }
revision++; revision++;
onSongsChanged(); onSongsChanged();
updateRemotePlaylist();
if (shuffle) { if (shuffle) {
shuffle(); shuffle();
@ -391,22 +388,6 @@ public class DownloadService extends Service {
lifecycleSupport.serializeDownloadQueue(); lifecycleSupport.serializeDownloadQueue();
} }
private synchronized void updateRemotePlaylist() {
List<DownloadFile> playlist = new ArrayList<>();
if (currentPlaying != null) {
int index = downloadList.indexOf(currentPlaying);
if (index == -1) {
index = 0;
}
int size = size();
int end = index + REMOTE_PLAYLIST_TOTAL;
for (int i = index; i < size && i < end; i++) {
playlist.add(downloadList.get(i));
}
}
}
public synchronized void restore(List<MusicDirectory.Entry> songs, List<MusicDirectory.Entry> toDelete, int currentPlayingIndex, int currentPlayingPosition) { public synchronized void restore(List<MusicDirectory.Entry> songs, List<MusicDirectory.Entry> toDelete, int currentPlayingIndex, int currentPlayingPosition) {
SharedPreferences prefs = Util.getPreferences(this); SharedPreferences prefs = Util.getPreferences(this);
if (prefs.getBoolean(Constants.PREFERENCES_KEY_REMOVE_PLAYED, false)) { if (prefs.getBoolean(Constants.PREFERENCES_KEY_REMOVE_PLAYED, false)) {
@ -481,7 +462,6 @@ public class DownloadService extends Service {
revision++; revision++;
onSongsChanged(); onSongsChanged();
lifecycleSupport.serializeDownloadQueue(); lifecycleSupport.serializeDownloadQueue();
updateRemotePlaylist();
setNextPlaying(); setNextPlaying();
} }
@ -551,7 +531,6 @@ public class DownloadService extends Service {
} }
} }
lifecycleSupport.serializeDownloadQueue(); lifecycleSupport.serializeDownloadQueue();
updateRemotePlaylist();
onSongsChanged(); onSongsChanged();
} }
@ -589,7 +568,6 @@ public class DownloadService extends Service {
} }
setCurrentPlaying(null); setCurrentPlaying(null);
lifecycleSupport.serializeDownloadQueue(); lifecycleSupport.serializeDownloadQueue();
updateRemotePlaylist();
setNextPlaying(); setNextPlaying();
if (proxy != null) { if (proxy != null) {
proxy.stop(); proxy.stop();
@ -618,7 +596,6 @@ public class DownloadService extends Service {
revision++; revision++;
onSongsChanged(); onSongsChanged();
lifecycleSupport.serializeDownloadQueue(); lifecycleSupport.serializeDownloadQueue();
updateRemotePlaylist();
if (downloadFile == nextPlaying) { if (downloadFile == nextPlaying) {
setNextPlaying(); setNextPlaying();
} }
@ -873,7 +850,6 @@ public class DownloadService extends Service {
proxy = null; proxy = null;
} }
checkDownloads(); checkDownloads();
updateRemotePlaylist();
} }
/** /**
@ -1329,8 +1305,6 @@ public class DownloadService extends Service {
setPlayerState(PAUSED); setPlayerState(PAUSED);
onSongProgress(); onSongProgress();
} }
updateRemotePlaylist();
} }
// Only call when starting, setPlayerState(PAUSED) already calls this // Only call when starting, setPlayerState(PAUSED) already calls this
@ -1650,7 +1624,6 @@ public class DownloadService extends Service {
if (revisionBefore != revision) { if (revisionBefore != revision) {
onSongsChanged(); onSongsChanged();
updateRemotePlaylist();
} }
if (wasEmpty && !downloadList.isEmpty()) { if (wasEmpty && !downloadList.isEmpty()) {

View File

@ -49,11 +49,6 @@ public class UserParser extends AbstractParser {
tagName = getElementName(); tagName = getElementName();
if ("user".equals(tagName)) { if ("user".equals(tagName)) {
user = new User(); user = new User();
for (String role : User.ROLES) {
parseSetting(user, role);
}
result.add(user); result.add(user);
} else if ("error".equals(tagName)) { } else if ("error".equals(tagName)) {
handleError(); handleError();
@ -92,11 +87,4 @@ public class UserParser extends AbstractParser {
MusicService musicService = MusicServiceFactory.getMusicService(context); MusicService musicService = MusicServiceFactory.getMusicService(context);
return musicService.getMusicFolders(false, context, null); return musicService.getMusicFolders(false, context, null);
} }
private void parseSetting(User user, String name) {
String value = get(name);
if (value != null) {
user.addSetting(name, "true".equals(value));
}
}
} }

View File

@ -60,7 +60,7 @@ public final class MenuUtil {
} }
// Apply similar logic to album views // Apply similar logic to album views
else if (updateView instanceof AlbumView || updateView instanceof ArtistView || updateView instanceof ArtistEntryView) { else if (updateView instanceof AlbumView || updateView instanceof ArtistView || updateView instanceof ArtistEntryView) {
File folder = null; File folder;
if (updateView instanceof AlbumView) { if (updateView instanceof AlbumView) {
folder = ((AlbumView) updateView).getFile(); folder = ((AlbumView) updateView).getFile();
} else if (updateView instanceof ArtistView) { } else if (updateView instanceof ArtistView) {

View File

@ -77,14 +77,9 @@ public class CacheLocationPreference extends EditTextPreference {
for (File dir : dirs) { for (File dir : dirs) {
try { try {
if (dir != null) { if (dir != null) {
if (Environment.isExternalStorageRemovable(dir)) { if (!Environment.isExternalStorageRemovable(dir)) {
} else {
internalDir = dir; internalDir = dir;
} }
if (internalDir != null && null != null) {
break;
}
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Failed to check if is external", e); Log.e(TAG, "Failed to check if is external", e);