Syntax cleanup

Mostly replaced tabs with spaces
This commit is contained in:
ByteHamster 2019-10-05 23:32:19 +02:00
parent 1c6e1cbc6d
commit cf3e8107f3
1 changed files with 192 additions and 189 deletions

View File

@ -6,17 +6,14 @@ import android.content.SharedPreferences.Editor;
import android.media.MediaMetadataRetriever;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
import java.util.concurrent.Callable;
import de.danoeh.antennapod.core.feed.Chapter;
import de.danoeh.antennapod.core.feed.MediaType;
import de.danoeh.antennapod.core.util.ChapterUtils;
import java.util.List;
import java.util.concurrent.Callable;
/** Represents a media file that is stored on the local storage device. */
public class ExternalMedia implements Playable {
public static final int PLAYABLE_TYPE_EXTERNAL_MEDIA = 2;
public static final String PREF_SOURCE_URL = "ExternalMedia.PrefSourceUrl";
public static final String PREF_POSITION = "ExternalMedia.PrefPosition";
@ -24,21 +21,32 @@ public class ExternalMedia implements Playable {
public static final String PREF_LAST_PLAYED_TIME = "ExternalMedia.PrefLastPlayedTime";
private final String source;
private String episodeTitle;
private String feedTitle;
private MediaType mediaType = MediaType.AUDIO;
private MediaType mediaType;
private List<Chapter> chapters;
private int duration;
private int position;
private long lastPlayedTime;
/**
* Creates a new playable for files on the sd card.
* @param source File path of the file
* @param mediaType Type of the file
*/
public ExternalMedia(String source, MediaType mediaType) {
super();
this.source = source;
this.mediaType = mediaType;
}
/**
* Creates a new playable for files on the sd card.
* @param source File path of the file
* @param mediaType Type of the file
* @param position Position to start from
* @param lastPlayedTime Timestamp when it was played last
*/
public ExternalMedia(String source, MediaType mediaType, int position, long lastPlayedTime) {
this(source, mediaType);
this.position = position;
@ -73,21 +81,16 @@ public class ExternalMedia implements Playable {
mmr.setDataSource(source);
} catch (IllegalArgumentException e) {
e.printStackTrace();
throw new PlayableException(
"IllegalArgumentException when setting up MediaMetadataReceiver");
throw new PlayableException("IllegalArgumentException when setting up MediaMetadataReceiver");
} catch (RuntimeException e) {
// http://code.google.com/p/android/issues/detail?id=39770
e.printStackTrace();
throw new PlayableException(
"RuntimeException when setting up MediaMetadataRetriever");
throw new PlayableException("RuntimeException when setting up MediaMetadataRetriever");
}
episodeTitle = mmr
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
feedTitle = mmr
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
episodeTitle = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
feedTitle = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
try {
duration = Integer.parseInt(mmr
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
duration = Integer.parseInt(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
} catch (NumberFormatException e) {
e.printStackTrace();
throw new PlayableException("NumberFormatException when reading duration of media file");