Convert MissionRecoveryInfo to Kotlin and use the Parcelize annotation.

This commit is contained in:
Isira Seneviratne 2020-10-04 06:15:59 +05:30
parent ec1e746a22
commit 897c754dd4
4 changed files with 83 additions and 127 deletions

View file

@ -129,10 +129,10 @@ public class DownloadMissionRecover extends Thread {
String url = null;
switch (mRecovery.kind) {
switch (mRecovery.getKind()) {
case 'a':
for (AudioStream audio : mExtractor.getAudioStreams()) {
if (audio.average_bitrate == mRecovery.desiredBitrate && audio.getFormat() == mRecovery.format) {
if (audio.average_bitrate == mRecovery.getDesiredBitrate() && audio.getFormat() == mRecovery.getFormat()) {
url = audio.getUrl();
break;
}
@ -140,21 +140,21 @@ public class DownloadMissionRecover extends Thread {
break;
case 'v':
List<VideoStream> videoStreams;
if (mRecovery.desired2)
if (mRecovery.isDesired2())
videoStreams = mExtractor.getVideoOnlyStreams();
else
videoStreams = mExtractor.getVideoStreams();
for (VideoStream video : videoStreams) {
if (video.resolution.equals(mRecovery.desired) && video.getFormat() == mRecovery.format) {
if (video.resolution.equals(mRecovery.getDesired()) && video.getFormat() == mRecovery.getFormat()) {
url = video.getUrl();
break;
}
}
break;
case 's':
for (SubtitlesStream subtitles : mExtractor.getSubtitles(mRecovery.format)) {
for (SubtitlesStream subtitles : mExtractor.getSubtitles(mRecovery.getFormat())) {
String tag = subtitles.getLanguageTag();
if (tag.equals(mRecovery.desired) && subtitles.isAutoGenerated() == mRecovery.desired2) {
if (tag.equals(mRecovery.getDesired()) && subtitles.isAutoGenerated() == mRecovery.isDesired2()) {
url = subtitles.getUrl();
break;
}
@ -168,11 +168,11 @@ public class DownloadMissionRecover extends Thread {
}
private void resolve(String url) throws IOException, HttpError {
if (mRecovery.validateCondition == null) {
if (mRecovery.getValidateCondition() == null) {
Log.w(TAG, "validation condition not defined, the resource can be stale");
}
if (mMission.unknownLength || mRecovery.validateCondition == null) {
if (mMission.unknownLength || mRecovery.getValidateCondition() == null) {
recover(url, false);
return;
}
@ -182,7 +182,7 @@ public class DownloadMissionRecover extends Thread {
/////////////////////
try {
mConn = mMission.openConnection(url, true, mMission.length - 10, mMission.length);
mConn.setRequestProperty("If-Range", mRecovery.validateCondition);
mConn.setRequestProperty("If-Range", mRecovery.getValidateCondition());
mMission.establishConnection(mID, mConn);
int code = mConn.getResponseCode();