fixed crashes
This commit is contained in:
parent
5af50a7289
commit
991b54c37d
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.mariotaku.microblog.library.twitter.model;
|
package org.mariotaku.microblog.library.twitter.model;
|
||||||
|
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.annotation.StringDef;
|
import android.support.annotation.StringDef;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
|
@ -39,6 +40,7 @@ public class MediaUploadResponse extends TwitterResponseObject implements Twitte
|
||||||
@JsonField(name = "video")
|
@JsonField(name = "video")
|
||||||
Video video;
|
Video video;
|
||||||
@JsonField(name = "processing_info")
|
@JsonField(name = "processing_info")
|
||||||
|
@Nullable
|
||||||
ProcessingInfo processingInfo;
|
ProcessingInfo processingInfo;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -57,6 +59,7 @@ public class MediaUploadResponse extends TwitterResponseObject implements Twitte
|
||||||
return video;
|
return video;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public ProcessingInfo getProcessingInfo() {
|
public ProcessingInfo getProcessingInfo() {
|
||||||
return processingInfo;
|
return processingInfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,8 +450,8 @@ class UpdateStatusTask(internal val context: Context, internal val stateCallback
|
||||||
}
|
}
|
||||||
response = upload.finalizeUploadMedia(response.id)
|
response = upload.finalizeUploadMedia(response.id)
|
||||||
run {
|
run {
|
||||||
var info: MediaUploadResponse.ProcessingInfo = response.processingInfo
|
var info: MediaUploadResponse.ProcessingInfo? = response.processingInfo
|
||||||
while (shouldWaitForProcess(info)) {
|
while (info != null && shouldWaitForProcess(info)) {
|
||||||
val checkAfterSecs = info.checkAfterSecs
|
val checkAfterSecs = info.checkAfterSecs
|
||||||
if (checkAfterSecs <= 0) {
|
if (checkAfterSecs <= 0) {
|
||||||
break
|
break
|
||||||
|
@ -482,8 +482,7 @@ class UpdateStatusTask(internal val context: Context, internal val stateCallback
|
||||||
return exception is MicroBlogException && exception.errorCode == ErrorInfo.STATUS_IS_DUPLICATE
|
return exception is MicroBlogException && exception.errorCode == ErrorInfo.STATUS_IS_DUPLICATE
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shouldWaitForProcess(info: MediaUploadResponse.ProcessingInfo?): Boolean {
|
private fun shouldWaitForProcess(info: MediaUploadResponse.ProcessingInfo): Boolean {
|
||||||
if (info == null) return false
|
|
||||||
when (info.state) {
|
when (info.state) {
|
||||||
MediaUploadResponse.ProcessingInfo.State.PENDING, MediaUploadResponse.ProcessingInfo.State.IN_PROGRESS -> return true
|
MediaUploadResponse.ProcessingInfo.State.PENDING, MediaUploadResponse.ProcessingInfo.State.IN_PROGRESS -> return true
|
||||||
else -> return false
|
else -> return false
|
||||||
|
|
|
@ -144,7 +144,7 @@ class QuickSearchBarActivity : BaseActivity(), OnClickListener, LoaderCallbacks<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
||||||
supportLoaderManager.restartLoader(0, null, this)
|
supportLoaderManager.restartLoader(0, null, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue