fixed crashes

This commit is contained in:
Mariotaku Lee 2017-03-07 20:40:04 +08:00
parent da5b276e16
commit 16e4b81afa
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
3 changed files with 9 additions and 5 deletions

View File

@ -319,7 +319,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
val context = applicationContext
TaskStarter.execute(object : AbstractTask<Any?, Any?, Any?>() {
override fun doLongOperation(o: Any?): Any? {
override fun doLongOperation(params: Any?): Any? {
DataStoreUtils.cleanDatabasesByItemLimit(context)
return null
}

View File

@ -39,9 +39,9 @@ class UpdateUserListDetailsTask(
private val accountKey: UserKey,
private val listId: String,
private val update: UserListUpdate
) : BaseAbstractTask<Any, SingleResponse<ParcelableUserList>, Any>(context) {
) : BaseAbstractTask<Any?, SingleResponse<ParcelableUserList>, Any>(context) {
override fun doLongOperation(o: Any): SingleResponse<ParcelableUserList> {
override fun doLongOperation(params: Any?): SingleResponse<ParcelableUserList> {
val microBlog = MicroBlogAPIFactory.getInstance(context, accountKey)
if (microBlog != null) {
try {

View File

@ -326,7 +326,7 @@ class AsyncTwitterWrapper(
}
fun updateFriendship(accountKey: UserKey, userKey: UserKey, update: FriendshipUpdate) {
TaskStarter.execute(object : ExceptionHandlingAbstractTask<Any, Relationship, MicroBlogException, Any>(context) {
TaskStarter.execute(object : ExceptionHandlingAbstractTask<Any, Relationship, Exception, Any>(context) {
override fun onExecute(params: Any): Relationship {
val microBlog = MicroBlogAPIFactory.getInstance(context, accountKey)
?: throw MicroBlogException("No account")
@ -347,7 +347,11 @@ class AsyncTwitterWrapper(
bus.post(FriendshipUpdatedEvent(accountKey, userKey, result))
}
override fun onException(callback: Any?, exception: MicroBlogException) {
override fun onException(callback: Any?, exception: Exception) {
if (exception !is MicroBlogException) {
Analyzer.logException(exception)
return
}
DebugLog.w(TwidereConstants.LOGTAG, "Unable to update friendship", exception)
}