reverted test code

This commit is contained in:
Mariotaku Lee 2017-09-20 13:04:06 +08:00
parent a9b83d8977
commit a23448eae4
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
2 changed files with 15 additions and 28 deletions

View File

@ -83,7 +83,6 @@ import org.mariotaku.twidere.fragment.AbsStatusesFragment
import org.mariotaku.twidere.fragment.AbsStatusesFragment.Companion.handleActionClick
import org.mariotaku.twidere.fragment.BaseDialogFragment
import org.mariotaku.twidere.fragment.BaseFragment
import org.mariotaku.twidere.fragment.status.TranslationDestinationDialogFragment
import org.mariotaku.twidere.loader.ParcelableStatusLoader
import org.mariotaku.twidere.loader.statuses.ConversationLoader
import org.mariotaku.twidere.model.*
@ -516,13 +515,6 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
restoreReadPosition(readPosition)
}
private fun scrollToCurrent() {
if (adapter.status != null) {
val position = adapter.getFirstPositionOfItem(StatusDetailsAdapter.ITEM_IDX_STATUS)
recyclerView.smoothScrollToPosition(position)
}
}
private fun displayTranslation(translation: TranslationResult) {
adapter.translationResult = translation
}
@ -853,14 +845,11 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
return Math.max((firstPosition - skippedCount) * 100 - top * 100 / height, 0)
}
} else {
val index: Int
val count = validScrollItemCount
if (firstPosition == 0) {
index = 0
} else if (firstPosition + childCount == count) {
index = count
} else {
index = firstPosition + childCount / 2
val index = when {
firstPosition == 0 -> 0
firstPosition + childCount == count -> count
else -> firstPosition + childCount / 2
}
return (firstPosition + childCount * (index / count.toFloat())).toInt()
}
@ -869,13 +858,11 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
}
override fun computeVerticalScrollRange(state: RecyclerView.State?): Int {
val result: Int
if (isSmoothScrollbarEnabled) {
result = Math.max(validScrollItemCount * 100, 0)
return if (isSmoothScrollbarEnabled) {
Math.max(validScrollItemCount * 100, 0)
} else {
result = validScrollItemCount
validScrollItemCount
}
return result
}
private val skippedScrollItemCount: Int

View File

@ -68,11 +68,11 @@ class ConversationLoader(
@Throws(MicroBlogException::class)
override fun getStatuses(account: AccountDetails, paging: Paging): PaginatedList<ParcelableStatus> {
when (account.type) {
AccountType.MASTODON -> return getMastodonStatuses(account, paging).mapTo(PaginatedArrayList()) {
return when (account.type) {
AccountType.MASTODON -> getMastodonStatuses(account, paging).mapTo(PaginatedArrayList()) {
it.toParcelable(account)
}
else -> return getMicroBlogStatuses(account, paging)
else -> getMicroBlogStatuses(account, paging)
}
}
@ -91,11 +91,11 @@ class ConversationLoader(
AccountType.TWITTER -> {
val isOfficial = account.isOfficial(context)
canLoadAllReplies = isOfficial
// if (isOfficial) {
// return microBlog.showConversation(status.id, paging).mapMicroBlogToPaginated {
// it.toParcelable(account, profileImageSize)
// }
// }
if (isOfficial) {
return microBlog.showConversation(status.id, paging).mapMicroBlogToPaginated {
it.toParcelable(account, profileImageSize)
}
}
return showConversationCompat(microBlog, account, status, true)
}
AccountType.STATUSNET -> {