diff --git a/twidere/src/main/java/org/mariotaku/yandex/YandexAPI.kt b/twidere/src/main/java/org/mariotaku/yandex/YandexAPI.kt index 7154cbff3..e5401b703 100644 --- a/twidere/src/main/java/org/mariotaku/yandex/YandexAPI.kt +++ b/twidere/src/main/java/org/mariotaku/yandex/YandexAPI.kt @@ -6,7 +6,6 @@ import org.mariotaku.yandex.model.YandexTranslateResult interface YandexAPI { @POST("/api/v1.5/tr.json/translate") - @Throws(YandexException::class) fun search(@Query("text") text: String, @Query("lang") lang: String): YandexTranslateResult } \ No newline at end of file diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/StatusFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/StatusFragment.kt index 40d29eb78..eea9202aa 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/StatusFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/StatusFragment.kt @@ -73,7 +73,6 @@ import org.mariotaku.twidere.constant.KeyboardShortcutConstants.* import org.mariotaku.twidere.constant.displaySensitiveContentsKey import org.mariotaku.twidere.constant.newDocumentApiKey import org.mariotaku.twidere.constant.yandexKeyKey -import org.mariotaku.twidere.exception.AccountNotFoundException import org.mariotaku.twidere.extension.* import org.mariotaku.twidere.extension.model.* import org.mariotaku.twidere.extension.model.api.key @@ -95,7 +94,7 @@ import org.mariotaku.twidere.model.pagination.SinceMaxPagination import org.mariotaku.twidere.model.util.AccountUtils import org.mariotaku.twidere.provider.TwidereDataStore.CachedStatuses import org.mariotaku.twidere.provider.TwidereDataStore.Statuses -import org.mariotaku.twidere.task.ExceptionHandlingAbstractTask +import org.mariotaku.twidere.task.AbsAccountRequestTask import org.mariotaku.twidere.util.* import org.mariotaku.twidere.util.ContentScrollHandler.ContentListSupport import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback @@ -108,7 +107,6 @@ import org.mariotaku.twidere.view.holder.StatusViewHolder import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder.StatusClickListener import org.mariotaku.yandex.YandexAPIFactory -import org.mariotaku.yandex.YandexException import java.lang.ref.WeakReference import kotlin.math.max import kotlin.math.min @@ -689,14 +687,11 @@ class StatusFragment : BaseFragment(), LoaderCallbacks(fragment.requireContext()) { + AbsAccountRequestTask(fragment.requireContext(), status.account_key) { private val weakFragment = WeakReference(fragment) - override fun onExecute(params: Any?): TranslationResult { - val am = AccountManager.get(context) - val account = status.account_key?.let { AccountUtils.getAccountDetails(am, it, true) } ?: - throw AccountNotFoundException() + override fun onExecute(account: AccountDetails, params: Any?): TranslationResult { val prefDest = preferences.getString(KEY_TRANSLATION_DESTINATION, null).orEmpty() val twitter = account.newMicroBlogInstance(context, MicroBlog::class.java) val dest: String @@ -730,11 +725,9 @@ class StatusFragment : BaseFragment(), LoaderCallbacks