mirror of
https://gitea.mayex.net/mayekkuzu/Audinaut.git
synced 2025-01-23 22:04:53 +03:00
Remove unreachable statements
This commit is contained in:
parent
9f3ecd5e8e
commit
99c03d59b3
@ -768,11 +768,6 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DownloadService getDownloadService() {
|
public DownloadService getDownloadService() {
|
||||||
boolean finished = false;
|
|
||||||
if (finished) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If service is not available, request it to start and wait for it.
|
// If service is not available, request it to start and wait for it.
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
DownloadService downloadService = DownloadService.getInstance();
|
DownloadService downloadService = DownloadService.getInstance();
|
||||||
|
@ -97,7 +97,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
|||||||
firstRun = true;
|
firstRun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("".equals(fragmentType) || fragmentType == null || firstRun) {
|
if ("".equals(fragmentType) || firstRun) {
|
||||||
// Initial startup stuff
|
// Initial startup stuff
|
||||||
if (!sessionInitialized) {
|
if (!sessionInitialized) {
|
||||||
loadSession();
|
loadSession();
|
||||||
@ -590,7 +590,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
|||||||
private boolean resetCacheLocation(SharedPreferences prefs) {
|
private boolean resetCacheLocation(SharedPreferences prefs) {
|
||||||
String newDirectory = FileUtil.getDefaultMusicDirectory(this).getPath();
|
String newDirectory = FileUtil.getDefaultMusicDirectory(this).getPath();
|
||||||
String oldDirectory = prefs.getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, null);
|
String oldDirectory = prefs.getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, null);
|
||||||
if (newDirectory == null || (oldDirectory != null && newDirectory.equals(oldDirectory))) {
|
if (oldDirectory != null && newDirectory.equals(oldDirectory)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
@ -120,8 +120,6 @@ abstract class ExpandableSectionAdapter<T> extends SectionAdapter<T> {
|
|||||||
toggleSelectionView.setVisibility(View.GONE);
|
toggleSelectionView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view != null) {
|
view.setObject(header);
|
||||||
view.setObject(header);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,6 @@ public class MainAdapter extends SectionAdapter<Integer> {
|
|||||||
checkBox.setVisibility(View.GONE);
|
checkBox.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view != null) {
|
view.setObject(display);
|
||||||
view.setObject(display);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
|
|||||||
PlayerState state = service.getPlayerState();
|
PlayerState state = service.getPlayerState();
|
||||||
if (state == PAUSED || state == COMPLETED || state == STOPPED) {
|
if (state == PAUSED || state == COMPLETED || state == STOPPED) {
|
||||||
service.start();
|
service.start();
|
||||||
} else if (state == STOPPED || state == IDLE) {
|
} else if (state == IDLE) {
|
||||||
warnIfStorageUnavailable();
|
warnIfStorageUnavailable();
|
||||||
int current = service.getCurrentPlayingIndex();
|
int current = service.getCurrentPlayingIndex();
|
||||||
// TODO: Use play() method.
|
// TODO: Use play() method.
|
||||||
|
@ -85,9 +85,6 @@ public abstract class PreferenceCompatFragment extends SubsonicFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mList = (ListView) listView;
|
mList = (ListView) listView;
|
||||||
if (mList == null) {
|
|
||||||
throw new RuntimeException("Your content must have a ListView whose id attribute is 'android.R.id.list'");
|
|
||||||
}
|
|
||||||
|
|
||||||
mHandler.post(mRequestFocus);
|
mHandler.post(mRequestFocus);
|
||||||
}
|
}
|
||||||
|
@ -661,8 +661,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
}.execute();
|
}.execute();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_useCombo = true;
|
final boolean useCombo = true;
|
||||||
final boolean useCombo = _useCombo;
|
|
||||||
|
|
||||||
startYearBox.setText(oldStartYear);
|
startYearBox.setText(oldStartYear);
|
||||||
endYearBox.setText(oldEndYear);
|
endYearBox.setText(oldEndYear);
|
||||||
@ -674,11 +673,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
.setView(dialogView)
|
.setView(dialogView)
|
||||||
.setPositiveButton(R.string.common_ok, (dialog, id) -> {
|
.setPositiveButton(R.string.common_ok, (dialog, id) -> {
|
||||||
String genre;
|
String genre;
|
||||||
if (useCombo) {
|
genre = genreCombo.getText().toString();
|
||||||
genre = genreCombo.getText().toString();
|
|
||||||
} else {
|
|
||||||
genre = genreBox.getText().toString();
|
|
||||||
}
|
|
||||||
String startYear = startYearBox.getText().toString();
|
String startYear = startYearBox.getText().toString();
|
||||||
String endYear = endYearBox.getText().toString();
|
String endYear = endYearBox.getText().toString();
|
||||||
|
|
||||||
@ -1051,14 +1046,9 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
size = file.length();
|
size = file.length();
|
||||||
|
|
||||||
// If no duration try to read bitrate tag
|
// If no duration try to read bitrate tag
|
||||||
if (duration == null) {
|
// Otherwise do a calculation for it
|
||||||
tmp = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE);
|
// Divide by 1000 so in kbps
|
||||||
bitrate = Integer.parseInt((tmp != null) ? tmp : "0") / 1000;
|
bitrate = (int) (size / duration) / 1000 * 8;
|
||||||
} else {
|
|
||||||
// Otherwise do a calculation for it
|
|
||||||
// Divide by 1000 so in kbps
|
|
||||||
bitrate = (int) (size / duration) / 1000 * 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Util.isOffline(context)) {
|
if (Util.isOffline(context)) {
|
||||||
song.setGenre(metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE));
|
song.setGenre(metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE));
|
||||||
|
@ -66,9 +66,6 @@ public class AudinautSearchProvider extends ContentProvider {
|
|||||||
|
|
||||||
private SearchResult search(String query) {
|
private SearchResult search(String query) {
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService(getContext());
|
MusicService musicService = MusicServiceFactory.getMusicService(getContext());
|
||||||
if (musicService == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return musicService.search(new SearchCritera(query, 5, 10, 10), getContext(), null);
|
return musicService.search(new SearchCritera(query, 5, 10, 10), getContext(), null);
|
||||||
|
@ -935,7 +935,7 @@ public class DownloadService extends Service {
|
|||||||
private int seekToWrapper(int difference) {
|
private int seekToWrapper(int difference) {
|
||||||
int msPlayed = Math.max(0, getPlayerPosition());
|
int msPlayed = Math.max(0, getPlayerPosition());
|
||||||
Integer duration = getPlayerDuration();
|
Integer duration = getPlayerDuration();
|
||||||
int msTotal = duration == null ? 0 : duration;
|
int msTotal = duration;
|
||||||
|
|
||||||
int seekTo;
|
int seekTo;
|
||||||
if (msPlayed + difference > msTotal) {
|
if (msPlayed + difference > msTotal) {
|
||||||
|
@ -67,12 +67,10 @@ public class GenreParser extends AbstractParser {
|
|||||||
} else if (eventType == XmlPullParser.TEXT) {
|
} else if (eventType == XmlPullParser.TEXT) {
|
||||||
if (genre != null) {
|
if (genre != null) {
|
||||||
String value = getText();
|
String value = getText();
|
||||||
if (genre != null) {
|
genre.setName(Html.fromHtml(value).toString());
|
||||||
genre.setName(Html.fromHtml(value).toString());
|
genre.setIndex(value.substring(0, 1));
|
||||||
genre.setIndex(value.substring(0, 1));
|
result.add(genre);
|
||||||
result.add(genre);
|
genre = null;
|
||||||
genre = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (eventType != XmlPullParser.END_DOCUMENT);
|
} while (eventType != XmlPullParser.END_DOCUMENT);
|
||||||
|
@ -637,15 +637,6 @@ public class FileUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != 0) {
|
|
||||||
Date fileDate = new Date(file.lastModified());
|
|
||||||
// Convert into hours
|
|
||||||
long age = (new Date().getTime() - fileDate.getTime()) / 1000 / 3600;
|
|
||||||
if (age > 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RandomAccessFile randomFile = new RandomAccessFile(file, "r");
|
RandomAccessFile randomFile = new RandomAccessFile(file, "r");
|
||||||
|
|
||||||
in = new Input(new FileInputStream(randomFile.getFD()));
|
in = new Input(new FileInputStream(randomFile.getFD()));
|
||||||
|
@ -65,7 +65,7 @@ public final class MenuUtil {
|
|||||||
folder = ((AlbumView) updateView).getFile();
|
folder = ((AlbumView) updateView).getFile();
|
||||||
} else if (updateView instanceof ArtistView) {
|
} else if (updateView instanceof ArtistView) {
|
||||||
folder = ((ArtistView) updateView).getFile();
|
folder = ((ArtistView) updateView).getFile();
|
||||||
} else if (updateView instanceof ArtistEntryView) {
|
} else {
|
||||||
folder = ((ArtistEntryView) updateView).getFile();
|
folder = ((ArtistEntryView) updateView).getFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,31 +199,19 @@ public class SongView extends UpdateView2<MusicDirectory.Entry, Boolean> {
|
|||||||
boolean playing = Util.equals(downloadService.getCurrentPlaying(), downloadFile);
|
boolean playing = Util.equals(downloadService.getCurrentPlaying(), downloadFile);
|
||||||
if (playing) {
|
if (playing) {
|
||||||
if (!this.playing) {
|
if (!this.playing) {
|
||||||
this.playing = playing;
|
this.playing = true;
|
||||||
playingTextView.setCompoundDrawablesWithIntrinsicBounds(DrawableTint.getDrawableRes(context, R.attr.playing), 0, 0, 0);
|
playingTextView.setCompoundDrawablesWithIntrinsicBounds(DrawableTint.getDrawableRes(context, R.attr.playing), 0, 0, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.playing) {
|
if (this.playing) {
|
||||||
this.playing = playing;
|
this.playing = false;
|
||||||
playingTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
playingTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isPlayed = false;
|
if (isPlayedShown) {
|
||||||
if (isPlayed) {
|
playedButton.setVisibility(View.GONE);
|
||||||
if (!isPlayedShown) {
|
isPlayedShown = false;
|
||||||
if (playedButton.getDrawable() == null) {
|
|
||||||
playedButton.setImageDrawable(DrawableTint.getTintedDrawable(context));
|
|
||||||
}
|
|
||||||
|
|
||||||
playedButton.setVisibility(View.VISIBLE);
|
|
||||||
isPlayedShown = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isPlayedShown) {
|
|
||||||
playedButton.setVisibility(View.GONE);
|
|
||||||
isPlayedShown = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user