mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
fixed fanfou fav load more
This commit is contained in:
parent
e7edf60a96
commit
c5e0f90111
@ -7,10 +7,10 @@ android:
|
|||||||
- tools
|
- tools
|
||||||
|
|
||||||
# The BuildTools version used by your project
|
# The BuildTools version used by your project
|
||||||
- build-tools-23.0.3
|
- build-tools-24.0.0
|
||||||
|
|
||||||
# The SDK version used to compile your project
|
# The SDK version used to compile your project
|
||||||
- android-23
|
- android-24
|
||||||
|
|
||||||
# Additional components
|
# Additional components
|
||||||
- extra-google-google_play_services
|
- extra-google-google_play_services
|
||||||
|
@ -36,8 +36,8 @@ subprojects {
|
|||||||
|
|
||||||
if (project.hasProperty('android')) {
|
if (project.hasProperty('android')) {
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 24
|
||||||
buildToolsVersion '23.0.3'
|
buildToolsVersion '24.0.0'
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
|
@ -19,17 +19,16 @@
|
|||||||
|
|
||||||
package org.mariotaku.microblog.library.twitter.api;
|
package org.mariotaku.microblog.library.twitter.api;
|
||||||
|
|
||||||
import org.mariotaku.microblog.library.twitter.template.StatusAnnotationTemplate;
|
|
||||||
import org.mariotaku.restfu.annotation.method.GET;
|
|
||||||
import org.mariotaku.restfu.annotation.method.POST;
|
|
||||||
import org.mariotaku.restfu.annotation.param.KeyValue;
|
|
||||||
import org.mariotaku.restfu.annotation.param.Param;
|
|
||||||
import org.mariotaku.restfu.annotation.param.Queries;
|
|
||||||
import org.mariotaku.restfu.annotation.param.Query;
|
|
||||||
import org.mariotaku.microblog.library.MicroBlogException;
|
import org.mariotaku.microblog.library.MicroBlogException;
|
||||||
import org.mariotaku.microblog.library.twitter.model.Paging;
|
import org.mariotaku.microblog.library.twitter.model.Paging;
|
||||||
import org.mariotaku.microblog.library.twitter.model.ResponseList;
|
import org.mariotaku.microblog.library.twitter.model.ResponseList;
|
||||||
import org.mariotaku.microblog.library.twitter.model.Status;
|
import org.mariotaku.microblog.library.twitter.model.Status;
|
||||||
|
import org.mariotaku.microblog.library.twitter.template.StatusAnnotationTemplate;
|
||||||
|
import org.mariotaku.restfu.annotation.method.GET;
|
||||||
|
import org.mariotaku.restfu.annotation.method.POST;
|
||||||
|
import org.mariotaku.restfu.annotation.param.Param;
|
||||||
|
import org.mariotaku.restfu.annotation.param.Queries;
|
||||||
|
import org.mariotaku.restfu.annotation.param.Query;
|
||||||
|
|
||||||
@SuppressWarnings("RedundantThrows")
|
@SuppressWarnings("RedundantThrows")
|
||||||
@Queries(template = StatusAnnotationTemplate.class)
|
@Queries(template = StatusAnnotationTemplate.class)
|
||||||
@ -45,8 +44,8 @@ public interface FavoritesResources {
|
|||||||
ResponseList<Status> getFavorites() throws MicroBlogException;
|
ResponseList<Status> getFavorites() throws MicroBlogException;
|
||||||
|
|
||||||
@GET("/favorites/list.json")
|
@GET("/favorites/list.json")
|
||||||
ResponseList<Status> getFavorites(@Query("user_id") String userId, @Query({"since_id", "max_id", "count"}) Paging paging) throws MicroBlogException;
|
ResponseList<Status> getFavorites(@Query("user_id") String userId, @Query Paging paging) throws MicroBlogException;
|
||||||
|
|
||||||
@GET("/favorites/list.json")
|
@GET("/favorites/list.json")
|
||||||
ResponseList<Status> getFavoritesByScreenName(@Query("screen_name") String screenName, @Query({"since_id", "max_id", "count"}) Paging paging) throws MicroBlogException;
|
ResponseList<Status> getFavoritesByScreenName(@Query("screen_name") String screenName, @Query Paging paging) throws MicroBlogException;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.mariotaku.twidere"
|
applicationId "org.mariotaku.twidere"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 23
|
targetSdkVersion 24
|
||||||
versionCode 196
|
versionCode 196
|
||||||
versionName "3.1.7"
|
versionName "3.1.7"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
android:resizeableActivity="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Twidere.NoActionBar"
|
android:theme="@style/Theme.Twidere.NoActionBar"
|
||||||
tools:ignore="UnusedAttribute">
|
tools:ignore="UnusedAttribute">
|
||||||
|
@ -320,7 +320,7 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||||||
if (loader instanceof IExtendedLoader) {
|
if (loader instanceof IExtendedLoader) {
|
||||||
((IExtendedLoader) loader).setFromUser(false);
|
((IExtendedLoader) loader).setFromUser(false);
|
||||||
}
|
}
|
||||||
onLoadingFinished();
|
onStatusesLoaded(loader, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -574,7 +574,7 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||||||
protected abstract Loader<List<ParcelableStatus>> onCreateStatusesLoader(final Context context, final Bundle args,
|
protected abstract Loader<List<ParcelableStatus>> onCreateStatusesLoader(final Context context, final Bundle args,
|
||||||
final boolean fromUser);
|
final boolean fromUser);
|
||||||
|
|
||||||
protected abstract void onLoadingFinished();
|
protected abstract void onStatusesLoaded(Loader<List<ParcelableStatus>> loader, List<ParcelableStatus> data);
|
||||||
|
|
||||||
protected final void saveReadPosition(int position) {
|
protected final void saveReadPosition(int position) {
|
||||||
final String readPositionTag = getReadPositionTagWithAccounts();
|
final String readPositionTag = getReadPositionTagWithAccounts();
|
||||||
|
@ -70,22 +70,8 @@ import static org.mariotaku.twidere.util.DataStoreUtils.getTableNameByUri;
|
|||||||
public abstract class CursorStatusesFragment extends AbsStatusesFragment {
|
public abstract class CursorStatusesFragment extends AbsStatusesFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLoadingFinished() {
|
protected void onStatusesLoaded(Loader<List<ParcelableStatus>> loader, List<ParcelableStatus> data) {
|
||||||
final UserKey[] accountKeys = getAccountKeys();
|
showContentOrError();
|
||||||
final ParcelableStatusesAdapter adapter = getAdapter();
|
|
||||||
if (adapter.getItemCount() > 0) {
|
|
||||||
showContent();
|
|
||||||
} else if (accountKeys.length > 0) {
|
|
||||||
final ErrorInfoStore.DisplayErrorInfo errorInfo = ErrorInfoStore.getErrorInfo(getContext(),
|
|
||||||
mErrorInfoStore.get(getErrorInfoKey(), accountKeys[0]));
|
|
||||||
if (errorInfo != null) {
|
|
||||||
showEmpty(errorInfo.getIcon(), errorInfo.getMessage());
|
|
||||||
} else {
|
|
||||||
showEmpty(R.drawable.ic_info_refresh, getString(R.string.swipe_down_to_refresh));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showError(R.drawable.ic_info_accounts, getString(R.string.no_account_selected));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentObserver mContentObserver;
|
private ContentObserver mContentObserver;
|
||||||
@ -126,6 +112,24 @@ public abstract class CursorStatusesFragment extends AbsStatusesFragment {
|
|||||||
return new CursorStatusesBusCallback();
|
return new CursorStatusesBusCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showContentOrError() {
|
||||||
|
final UserKey[] accountKeys = getAccountKeys();
|
||||||
|
final ParcelableStatusesAdapter adapter = getAdapter();
|
||||||
|
if (adapter.getItemCount() > 0) {
|
||||||
|
showContent();
|
||||||
|
} else if (accountKeys.length > 0) {
|
||||||
|
final ErrorInfoStore.DisplayErrorInfo errorInfo = ErrorInfoStore.getErrorInfo(getContext(),
|
||||||
|
mErrorInfoStore.get(getErrorInfoKey(), accountKeys[0]));
|
||||||
|
if (errorInfo != null) {
|
||||||
|
showEmpty(errorInfo.getIcon(), errorInfo.getMessage());
|
||||||
|
} else {
|
||||||
|
showEmpty(R.drawable.ic_info_refresh, getString(R.string.swipe_down_to_refresh));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showError(R.drawable.ic_info_accounts, getString(R.string.no_account_selected));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected class CursorStatusesBusCallback {
|
protected class CursorStatusesBusCallback {
|
||||||
|
|
||||||
@ -136,7 +140,7 @@ public abstract class CursorStatusesFragment extends AbsStatusesFragment {
|
|||||||
if (!event.running) {
|
if (!event.running) {
|
||||||
setLoadMoreIndicatorPosition(IndicatorPosition.NONE);
|
setLoadMoreIndicatorPosition(IndicatorPosition.NONE);
|
||||||
setRefreshEnabled(true);
|
setRefreshEnabled(true);
|
||||||
onLoadingFinished();
|
showContentOrError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,19 @@ import android.os.Bundle;
|
|||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
|
import org.mariotaku.microblog.library.MicroBlogException;
|
||||||
|
import org.mariotaku.twidere.R;
|
||||||
import org.mariotaku.twidere.adapter.ListParcelableStatusesAdapter;
|
import org.mariotaku.twidere.adapter.ListParcelableStatusesAdapter;
|
||||||
import org.mariotaku.twidere.adapter.ParcelableStatusesAdapter;
|
import org.mariotaku.twidere.adapter.ParcelableStatusesAdapter;
|
||||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
||||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter;
|
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter;
|
||||||
|
import org.mariotaku.twidere.loader.MicroBlogAPIStatusesLoader;
|
||||||
import org.mariotaku.twidere.model.BaseRefreshTaskParam;
|
import org.mariotaku.twidere.model.BaseRefreshTaskParam;
|
||||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||||
import org.mariotaku.twidere.model.RefreshTaskParam;
|
import org.mariotaku.twidere.model.RefreshTaskParam;
|
||||||
@ -139,11 +143,23 @@ public abstract class ParcelableStatusesFragment extends AbsStatusesFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLoadingFinished() {
|
protected void onStatusesLoaded(Loader<List<ParcelableStatus>> loader, List<ParcelableStatus> data) {
|
||||||
showContent();
|
|
||||||
setRefreshEnabled(true);
|
setRefreshEnabled(true);
|
||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
setLoadMoreIndicatorPosition(IndicatorPosition.NONE);
|
setLoadMoreIndicatorPosition(IndicatorPosition.NONE);
|
||||||
|
final ParcelableStatusesAdapter adapter = getAdapter();
|
||||||
|
if (adapter.getItemCount() > 0) {
|
||||||
|
showContent();
|
||||||
|
} else if (loader instanceof MicroBlogAPIStatusesLoader) {
|
||||||
|
MicroBlogException e = ((MicroBlogAPIStatusesLoader) loader).getException();
|
||||||
|
if (e != null) {
|
||||||
|
showError(R.drawable.ic_info_error_generic, Utils.getErrorMessage(getContext(), e));
|
||||||
|
} else {
|
||||||
|
showEmpty(R.drawable.ic_info_refresh, getString(R.string.swipe_down_to_refresh));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showEmpty(R.drawable.ic_info_refresh, getString(R.string.swipe_down_to_refresh));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,12 +47,14 @@ public class UserFavoritesFragment extends ParcelableStatusesFragment {
|
|||||||
final UserKey accountKey = Utils.getAccountKey(context, args);
|
final UserKey accountKey = Utils.getAccountKey(context, args);
|
||||||
final String maxId = args.getString(EXTRA_MAX_ID);
|
final String maxId = args.getString(EXTRA_MAX_ID);
|
||||||
final String sinceId = args.getString(EXTRA_SINCE_ID);
|
final String sinceId = args.getString(EXTRA_SINCE_ID);
|
||||||
|
final int page = args.getInt(EXTRA_PAGE, -1);
|
||||||
final UserKey userKey = args.getParcelable(EXTRA_USER_KEY);
|
final UserKey userKey = args.getParcelable(EXTRA_USER_KEY);
|
||||||
final String screenName = args.getString(EXTRA_SCREEN_NAME);
|
final String screenName = args.getString(EXTRA_SCREEN_NAME);
|
||||||
final int tabPosition = args.getInt(EXTRA_TAB_POSITION, -1);
|
final int tabPosition = args.getInt(EXTRA_TAB_POSITION, -1);
|
||||||
final boolean loadingMore = args.getBoolean(EXTRA_LOADING_MORE, false);
|
final boolean loadingMore = args.getBoolean(EXTRA_LOADING_MORE, false);
|
||||||
return new UserFavoritesLoader(context, accountKey, userKey, screenName, sinceId, maxId,
|
return new UserFavoritesLoader(context, accountKey, userKey, screenName, sinceId, maxId,
|
||||||
getAdapterData(), getSavedStatusesFileArgs(), tabPosition, fromUser, loadingMore);
|
page,getAdapterData(), getSavedStatusesFileArgs(), tabPosition, fromUser,
|
||||||
|
loadingMore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,7 +56,7 @@ public class ConversationLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
final long sinceSortId, final long maxSortId,
|
final long sinceSortId, final long maxSortId,
|
||||||
final List<ParcelableStatus> data, final boolean fromUser,
|
final List<ParcelableStatus> data, final boolean fromUser,
|
||||||
final boolean loadingMore) {
|
final boolean loadingMore) {
|
||||||
super(context, status.account_key, sinceId, maxId, data, null, -1, fromUser, loadingMore);
|
super(context, status.account_key, sinceId, maxId, -1, data, null, -1, fromUser, loadingMore);
|
||||||
mStatus = Nullables.assertNonNull(ParcelUtils.clone(status));
|
mStatus = Nullables.assertNonNull(ParcelUtils.clone(status));
|
||||||
mSinceSortId = sinceSortId;
|
mSinceSortId = sinceSortId;
|
||||||
mMaxSortId = maxSortId;
|
mMaxSortId = maxSortId;
|
||||||
|
@ -45,7 +45,7 @@ public class GroupTimelineLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
final String groupName, final String sinceId, final String maxId,
|
final String groupName, final String sinceId, final String maxId,
|
||||||
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
||||||
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
||||||
super(context, accountKey, sinceId, maxId, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
super(context, accountKey, sinceId, maxId, -1, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
||||||
mGroupId = groupId;
|
mGroupId = groupId;
|
||||||
mGroupName = groupName;
|
mGroupName = groupName;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class MediaTimelineLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
@Nullable final String screenName, final String sinceId, final String maxId,
|
@Nullable final String screenName, final String sinceId, final String maxId,
|
||||||
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
||||||
final int tabPosition, final boolean fromUser, boolean loadingMore) {
|
final int tabPosition, final boolean fromUser, boolean loadingMore) {
|
||||||
super(context, accountKey, sinceId, maxId, data, savedStatusesArgs, tabPosition, fromUser,
|
super(context, accountKey, sinceId, maxId, -1, data, savedStatusesArgs, tabPosition, fromUser,
|
||||||
loadingMore);
|
loadingMore);
|
||||||
mUserKey = userKey;
|
mUserKey = userKey;
|
||||||
mUserScreenName = screenName;
|
mUserScreenName = screenName;
|
||||||
|
@ -62,6 +62,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@ -70,11 +71,13 @@ public abstract class MicroBlogAPIStatusesLoader extends ParcelableStatusesLoade
|
|||||||
@Nullable
|
@Nullable
|
||||||
private final UserKey mAccountKey;
|
private final UserKey mAccountKey;
|
||||||
private final String mMaxId, mSinceId;
|
private final String mMaxId, mSinceId;
|
||||||
|
private final int mPage;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final Object[] mSavedStatusesFileArgs;
|
private final Object[] mSavedStatusesFileArgs;
|
||||||
private final boolean mLoadingMore;
|
private final boolean mLoadingMore;
|
||||||
// Statuses sorted descending by default
|
// Statuses sorted descending by default
|
||||||
private Comparator<ParcelableStatus> mComparator = ParcelableStatus.REVERSE_COMPARATOR;
|
private Comparator<ParcelableStatus> mComparator = ParcelableStatus.REVERSE_COMPARATOR;
|
||||||
|
private AtomicReference<MicroBlogException> mException = new AtomicReference<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected DiskCache mFileCache;
|
protected DiskCache mFileCache;
|
||||||
@ -86,7 +89,7 @@ public abstract class MicroBlogAPIStatusesLoader extends ParcelableStatusesLoade
|
|||||||
public MicroBlogAPIStatusesLoader(@NonNull final Context context,
|
public MicroBlogAPIStatusesLoader(@NonNull final Context context,
|
||||||
@Nullable final UserKey accountKey,
|
@Nullable final UserKey accountKey,
|
||||||
final String sinceId, final String maxId,
|
final String sinceId, final String maxId,
|
||||||
@Nullable final List<ParcelableStatus> data,
|
int page, @Nullable final List<ParcelableStatus> data,
|
||||||
@Nullable final String[] savedStatusesArgs,
|
@Nullable final String[] savedStatusesArgs,
|
||||||
final int tabPosition, final boolean fromUser, boolean loadingMore) {
|
final int tabPosition, final boolean fromUser, boolean loadingMore) {
|
||||||
super(context, data, tabPosition, fromUser);
|
super(context, data, tabPosition, fromUser);
|
||||||
@ -94,6 +97,7 @@ public abstract class MicroBlogAPIStatusesLoader extends ParcelableStatusesLoade
|
|||||||
mAccountKey = accountKey;
|
mAccountKey = accountKey;
|
||||||
mMaxId = maxId;
|
mMaxId = maxId;
|
||||||
mSinceId = sinceId;
|
mSinceId = sinceId;
|
||||||
|
mPage = page;
|
||||||
mSavedStatusesFileArgs = savedStatusesArgs;
|
mSavedStatusesFileArgs = savedStatusesArgs;
|
||||||
mLoadingMore = loadingMore;
|
mLoadingMore = loadingMore;
|
||||||
}
|
}
|
||||||
@ -142,6 +146,7 @@ public abstract class MicroBlogAPIStatusesLoader extends ParcelableStatusesLoade
|
|||||||
statuses = getStatuses(twitter, credentials, paging);
|
statuses = getStatuses(twitter, credentials, paging);
|
||||||
} catch (final MicroBlogException e) {
|
} catch (final MicroBlogException e) {
|
||||||
// mHandler.post(new ShowErrorRunnable(e));
|
// mHandler.post(new ShowErrorRunnable(e));
|
||||||
|
mException.set(e);
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Log.w(LOGTAG, e);
|
Log.w(LOGTAG, e);
|
||||||
}
|
}
|
||||||
@ -209,6 +214,10 @@ public abstract class MicroBlogAPIStatusesLoader extends ParcelableStatusesLoade
|
|||||||
return mMaxId;
|
return mMaxId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPage() {
|
||||||
|
return mPage;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public UserKey getAccountKey() {
|
public UserKey getAccountKey() {
|
||||||
return mAccountKey;
|
return mAccountKey;
|
||||||
@ -222,9 +231,18 @@ public abstract class MicroBlogAPIStatusesLoader extends ParcelableStatusesLoade
|
|||||||
@WorkerThread
|
@WorkerThread
|
||||||
protected abstract boolean shouldFilterStatus(final SQLiteDatabase database, final ParcelableStatus status);
|
protected abstract boolean shouldFilterStatus(final SQLiteDatabase database, final ParcelableStatus status);
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public MicroBlogException getException() {
|
||||||
|
return mException.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStartLoading() {
|
||||||
|
mException.set(null);
|
||||||
|
super.onStartLoading();
|
||||||
|
}
|
||||||
|
|
||||||
protected void processPaging(@NonNull ParcelableCredentials credentials, int loadItemLimit, @NonNull final Paging paging) {
|
protected void processPaging(@NonNull ParcelableCredentials credentials, int loadItemLimit, @NonNull final Paging paging) {
|
||||||
|
|
||||||
|
|
||||||
paging.setCount(loadItemLimit);
|
paging.setCount(loadItemLimit);
|
||||||
if (mMaxId != null) {
|
if (mMaxId != null) {
|
||||||
paging.setMaxId(mMaxId);
|
paging.setMaxId(mMaxId);
|
||||||
|
@ -42,7 +42,7 @@ public class PublicTimelineLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
final String sinceId, final String maxId,
|
final String sinceId, final String maxId,
|
||||||
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
||||||
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
||||||
super(context, accountId, sinceId, maxId, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
super(context, accountId, sinceId, maxId, -1, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -43,7 +43,7 @@ public class RetweetsOfMeLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
final String sinceId, final String maxId,
|
final String sinceId, final String maxId,
|
||||||
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
||||||
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
||||||
super(context, accountKey, sinceId, maxId, data, savedStatusesArgs, tabPosition, fromUser,
|
super(context, accountKey, sinceId, maxId, -1, data, savedStatusesArgs, tabPosition, fromUser,
|
||||||
loadingMore);
|
loadingMore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ public class TweetSearchLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final String mQuery;
|
private final String mQuery;
|
||||||
private final int mPage;
|
|
||||||
private final boolean mGapEnabled;
|
private final boolean mGapEnabled;
|
||||||
|
|
||||||
public TweetSearchLoader(final Context context, final UserKey accountKey, @Nullable final String query,
|
public TweetSearchLoader(final Context context, final UserKey accountKey, @Nullable final String query,
|
||||||
@ -52,8 +51,8 @@ public class TweetSearchLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
||||||
final int tabPosition, final boolean fromUser, final boolean makeGap,
|
final int tabPosition, final boolean fromUser, final boolean makeGap,
|
||||||
boolean loadingMore) {
|
boolean loadingMore) {
|
||||||
super(context, accountKey, sinceId, maxId, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
super(context, accountKey, sinceId, maxId, page, data, savedStatusesArgs, tabPosition,
|
||||||
mPage = page;
|
fromUser, loadingMore);
|
||||||
mQuery = query;
|
mQuery = query;
|
||||||
mGapEnabled = makeGap;
|
mGapEnabled = makeGap;
|
||||||
}
|
}
|
||||||
@ -99,8 +98,9 @@ public class TweetSearchLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
protected void processPaging(@NonNull ParcelableCredentials credentials, int loadItemLimit, @NonNull Paging paging) {
|
protected void processPaging(@NonNull ParcelableCredentials credentials, int loadItemLimit, @NonNull Paging paging) {
|
||||||
if (MicroBlogAPIFactory.isStatusNetCredentials(credentials)) {
|
if (MicroBlogAPIFactory.isStatusNetCredentials(credentials)) {
|
||||||
paging.setRpp(loadItemLimit);
|
paging.setRpp(loadItemLimit);
|
||||||
if (mPage > 0) {
|
final int page = getPage();
|
||||||
paging.setPage(mPage);
|
if (page > 0) {
|
||||||
|
paging.setPage(page);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super.processPaging(credentials, loadItemLimit, paging);
|
super.processPaging(credentials, loadItemLimit, paging);
|
||||||
|
@ -29,9 +29,12 @@ import org.mariotaku.microblog.library.MicroBlogException;
|
|||||||
import org.mariotaku.microblog.library.twitter.model.Paging;
|
import org.mariotaku.microblog.library.twitter.model.Paging;
|
||||||
import org.mariotaku.microblog.library.twitter.model.ResponseList;
|
import org.mariotaku.microblog.library.twitter.model.ResponseList;
|
||||||
import org.mariotaku.microblog.library.twitter.model.Status;
|
import org.mariotaku.microblog.library.twitter.model.Status;
|
||||||
|
import org.mariotaku.twidere.model.ParcelableAccount;
|
||||||
import org.mariotaku.twidere.model.ParcelableCredentials;
|
import org.mariotaku.twidere.model.ParcelableCredentials;
|
||||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||||
import org.mariotaku.twidere.model.UserKey;
|
import org.mariotaku.twidere.model.UserKey;
|
||||||
|
import org.mariotaku.twidere.model.util.ParcelableAccountUtils;
|
||||||
|
import org.mariotaku.twidere.util.InternalTwitterContentUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -42,9 +45,10 @@ public class UserFavoritesLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
|
|
||||||
public UserFavoritesLoader(final Context context, final UserKey accountKey, final UserKey userKey,
|
public UserFavoritesLoader(final Context context, final UserKey accountKey, final UserKey userKey,
|
||||||
final String screenName, final String sinceId, final String maxId,
|
final String screenName, final String sinceId, final String maxId,
|
||||||
|
final int page,
|
||||||
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
||||||
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
||||||
super(context, accountKey, sinceId, maxId, data, savedStatusesArgs, tabPosition, fromUser,
|
super(context, accountKey, sinceId, maxId, page, data, savedStatusesArgs, tabPosition, fromUser,
|
||||||
loadingMore);
|
loadingMore);
|
||||||
mUserKey = userKey;
|
mUserKey = userKey;
|
||||||
mUserScreenName = screenName;
|
mUserScreenName = screenName;
|
||||||
@ -64,6 +68,25 @@ public class UserFavoritesLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
@WorkerThread
|
@WorkerThread
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldFilterStatus(final SQLiteDatabase database, final ParcelableStatus status) {
|
protected boolean shouldFilterStatus(final SQLiteDatabase database, final ParcelableStatus status) {
|
||||||
return false;
|
return InternalTwitterContentUtils.isFiltered(database, status, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processPaging(@NonNull ParcelableCredentials credentials, int loadItemLimit, @NonNull Paging paging) {
|
||||||
|
switch (ParcelableAccountUtils.getAccountType(credentials)) {
|
||||||
|
case ParcelableAccount.Type.FANFOU: {
|
||||||
|
paging.setCount(loadItemLimit);
|
||||||
|
final int page = getPage();
|
||||||
|
if (page > 0) {
|
||||||
|
paging.setPage(page);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
super.processPaging(credentials, loadItemLimit, paging);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class UserListTimelineLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
final UserKey userKey, final String screenName, final String listName,
|
final UserKey userKey, final String screenName, final String listName,
|
||||||
final String sinceId, final String maxId, final List<ParcelableStatus> data,
|
final String sinceId, final String maxId, final List<ParcelableStatus> data,
|
||||||
final String[] savedStatusesArgs, final int tabPosition, boolean fromUser, boolean loadingMore) {
|
final String[] savedStatusesArgs, final int tabPosition, boolean fromUser, boolean loadingMore) {
|
||||||
super(context, accountKey, sinceId, maxId, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
super(context, accountKey, sinceId, maxId, -1, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
||||||
mListId = listId;
|
mListId = listId;
|
||||||
mUserKey = userKey;
|
mUserKey = userKey;
|
||||||
mScreenName = screenName;
|
mScreenName = screenName;
|
||||||
|
@ -50,7 +50,7 @@ public class UserTimelineLoader extends MicroBlogAPIStatusesLoader {
|
|||||||
final String sinceId, final String maxId,
|
final String sinceId, final String maxId,
|
||||||
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
final List<ParcelableStatus> data, final String[] savedStatusesArgs,
|
||||||
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
final int tabPosition, boolean fromUser, boolean loadingMore) {
|
||||||
super(context, accountId, sinceId, maxId, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
super(context, accountId, sinceId, maxId, -1, data, savedStatusesArgs, tabPosition, fromUser, loadingMore);
|
||||||
mUserId = userId;
|
mUserId = userId;
|
||||||
mUserScreenName = screenName;
|
mUserScreenName = screenName;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user