fixed media timeline hasMore condition
This commit is contained in:
parent
28492d2d12
commit
1ed23be230
|
@ -31,6 +31,7 @@ import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
|||
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_FROM_USER
|
||||
import org.mariotaku.twidere.extension.reachingEnd
|
||||
import org.mariotaku.twidere.extension.reachingStart
|
||||
import org.mariotaku.twidere.loader.MicroBlogAPIStatusesLoader
|
||||
import org.mariotaku.twidere.loader.iface.IExtendedLoader
|
||||
import org.mariotaku.twidere.model.ParcelableStatus
|
||||
import org.mariotaku.twidere.util.IntentUtils
|
||||
|
@ -130,12 +131,22 @@ abstract class AbsMediaStatusesFragment : AbsContentRecyclerViewFragment<Stagger
|
|||
IntentUtils.openStatus(context, status.account_key, status.quoted_id)
|
||||
}
|
||||
|
||||
protected open fun hasMoreData(loader: Loader<List<ParcelableStatus>?>,
|
||||
data: List<ParcelableStatus>?, changed: Boolean): Boolean {
|
||||
if (loader !is MicroBlogAPIStatusesLoader) return false
|
||||
val maxId = loader.maxId?.takeIf(String::isNotEmpty)
|
||||
val sinceId = loader.sinceId?.takeIf(String::isNotEmpty)
|
||||
if (sinceId == null && maxId != null) {
|
||||
if (data != null && !data.isEmpty()) {
|
||||
return changed
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
protected abstract fun onCreateStatusesLoader(context: Context, args: Bundle,
|
||||
fromUser: Boolean): Loader<List<ParcelableStatus>?>
|
||||
|
||||
protected abstract fun hasMoreData(loader: Loader<List<ParcelableStatus>?>,
|
||||
data: List<ParcelableStatus>?, changed: Boolean): Boolean
|
||||
|
||||
protected abstract fun getStatuses(maxId: String?, sinceId: String?): Int
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.content.Context
|
|||
import android.os.Bundle
|
||||
import android.support.v4.content.Loader
|
||||
import org.mariotaku.twidere.TwidereConstants.*
|
||||
import org.mariotaku.twidere.loader.MediaStatusesSearchLoader
|
||||
import org.mariotaku.twidere.loader.TweetSearchLoader
|
||||
import org.mariotaku.twidere.model.ParcelableStatus
|
||||
import org.mariotaku.twidere.util.Utils
|
||||
|
@ -48,19 +47,6 @@ class MediaStatusesSearchFragment : AbsMediaStatusesFragment() {
|
|||
null, tabPosition, fromUser, makeGap, loadingMore)
|
||||
}
|
||||
|
||||
override fun hasMoreData(loader: Loader<List<ParcelableStatus>?>, data: List<ParcelableStatus>?,
|
||||
changed: Boolean): Boolean {
|
||||
if (loader !is MediaStatusesSearchLoader) return false
|
||||
val maxId = loader.maxId?.takeIf(String::isNotEmpty)
|
||||
val sinceId = loader.sinceId?.takeIf(String::isNotEmpty)
|
||||
if (sinceId != null && maxId != null) {
|
||||
if (data != null && !data.isEmpty()) {
|
||||
return changed
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getStatuses(maxId: String?, sinceId: String?): Int {
|
||||
if (context == null) return -1
|
||||
val args = Bundle(arguments)
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.os.Bundle
|
|||
import android.support.v4.content.Loader
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.loader.MediaTimelineLoader
|
||||
import org.mariotaku.twidere.loader.MicroBlogAPIStatusesLoader
|
||||
import org.mariotaku.twidere.model.ParcelableStatus
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
|
||||
|
@ -26,18 +27,6 @@ class UserMediaTimelineFragment : AbsMediaStatusesFragment() {
|
|||
adapter.getData(), null, tabPosition, fromUser, loadingMore)
|
||||
}
|
||||
|
||||
override fun hasMoreData(loader: Loader<List<ParcelableStatus>?>, data: List<ParcelableStatus>?,
|
||||
changed: Boolean): Boolean {
|
||||
if (loader !is MediaTimelineLoader) return false
|
||||
val maxId = loader.maxId?.takeIf(String::isNotEmpty)
|
||||
val sinceId = loader.sinceId?.takeIf(String::isNotEmpty)
|
||||
if (sinceId != null && maxId != null) {
|
||||
if (data != null && !data.isEmpty()) {
|
||||
return changed
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getStatuses(maxId: String?, sinceId: String?): Int {
|
||||
if (context == null) return -1
|
||||
|
|
Loading…
Reference in New Issue