trying to fix 'load more'

This commit is contained in:
Mariotaku Lee 2015-06-13 15:52:38 +08:00
parent 095f499b1c
commit 6abbdb2c6a
8 changed files with 9 additions and 35 deletions

View File

@ -162,8 +162,6 @@ public interface Constants extends TwidereConstants {
long HONDAJOJO_ID = 514378421;
String HONDAJOJO_SCREEN_NAME = "HondaJOJO";
int UUCKY_ID = 1062473329;
String UUCKY_SCREEN_NAME = "Uucky_Lee";
String EASTER_EGG_TRIGGER_TEXT = "\u718A\u5B69\u5B50";
String EASTER_EGG_RESTORE_TEXT_PART1 = "\u5927\u738B";
String EASTER_EGG_RESTORE_TEXT_PART2 = "\u5C0F\u7684";

View File

@ -226,7 +226,8 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentRecyclerViewFr
final long sinceId = position + 1 < adapter.getStatusesCount() ? adapter.getStatus(position + 1).id : -1;
final long[] accountIds = {status.account_id};
final long[] maxIds = {status.id};
final long[] sinceIds = {sinceId};
// final long[] sinceIds = {sinceId};
final long[] sinceIds = null;
getStatuses(accountIds, maxIds, sinceIds);
}

View File

@ -45,7 +45,6 @@ import android.nfc.NfcAdapter.CreateNdefMessageCallback;
import android.nfc.NfcEvent;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
@ -196,7 +195,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
private TabPagerIndicator mPagerIndicator;
private View mPagerOverlay;
private View mErrorOverlay;
private View mUuckyFooter;
private View mProfileBannerContainer;
private Button mFollowButton;
private ProgressBar mFollowProgress;
@ -554,7 +552,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
final int defWidth = resources.getDisplayMetrics().widthPixels;
final int width = mBannerWidth > 0 ? mBannerWidth : defWidth;
mProfileImageLoader.displayProfileBanner(mProfileBannerView, user.profile_banner_url, width);
mUuckyFooter.setVisibility(isUucky(user.id, user.screen_name, user) ? View.VISIBLE : View.GONE);
final Relationship relationship = mRelationship;
if (relationship == null || relationship.getTargetUserId() != user.id) {
getFriendship();
@ -787,7 +784,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mProfileNameBackground.setBackgroundColor(mCardBackgroundColor);
mProfileDetailsContainer.setBackgroundColor(mCardBackgroundColor);
mPagerIndicator.setBackgroundColor(mCardBackgroundColor);
mUuckyFooter.setBackgroundColor(mCardBackgroundColor);
final float actionBarElevation = ThemeUtils.getSupportActionBarElevation(activity);
ViewCompat.setElevation(mPagerIndicator, actionBarElevation);
@ -1116,7 +1112,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mErrorOverlay = contentView.findViewById(R.id.error_window_overlay);
mFollowButton = (Button) headerView.findViewById(R.id.follow);
mFollowProgress = (ProgressBar) headerView.findViewById(R.id.follow_progress);
mUuckyFooter = headerView.findViewById(R.id.uucky_footer);
mPagesContent = view.findViewById(R.id.pages_content);
mPagesErrorContainer = view.findViewById(R.id.pages_error_container);
mPagesErrorIcon = (ImageView) view.findViewById(R.id.pages_error_icon);
@ -1354,15 +1349,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
getUserInfo(user.account_id, user.id, user.screen_name, omitIntentExtra);
}
private boolean isUucky(long userId, String screenName, Parcelable parcelable) {
if (userId == UUCKY_ID || UUCKY_SCREEN_NAME.equalsIgnoreCase(screenName)) return true;
if (parcelable instanceof ParcelableUser) {
final ParcelableUser user = (ParcelableUser) parcelable;
return user.id == UUCKY_ID || UUCKY_SCREEN_NAME.equalsIgnoreCase(user.screen_name);
}
return false;
}
private static void setCompatToolbarOverlayAlpha(FragmentActivity activity, float alpha) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return;
final View windowOverlay = activity.findViewById(R.id.window_overlay);

View File

@ -2235,6 +2235,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
protected void onPostExecute(List<StatusListResponse> result) {
super.onPostExecute(result);
final Bus bus = TwidereApplication.getInstance(mContext).getMessageBus();
assert bus != null;
bus.post(new GetStatusesTaskEvent(getDatabaseUri(), false, getException(result)));
}
@ -2242,6 +2243,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
protected void onPreExecute() {
super.onPreExecute();
final Bus bus = TwidereApplication.getInstance(mContext).getMessageBus();
assert bus != null;
bus.post(new GetStatusesTaskEvent(getDatabaseUri(), true, null));
}
@ -2256,17 +2258,17 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
if (twitter == null) continue;
try {
final Paging paging = new Paging();
paging.setCount(loadItemLimit);
paging.count(loadItemLimit);
final long maxId, sinceId;
if (isMaxIdsValid() && mMaxIds[idx] > 0) {
maxId = mMaxIds[idx];
paging.setMaxId(maxId);
paging.maxId(maxId);
} else {
maxId = -1;
}
if (isSinceIdsValid() && mSinceIds[idx] > 0) {
sinceId = mSinceIds[idx];
paging.setSinceId(sinceId - 1);
paging.sinceId(sinceId - 1);
} else {
sinceId = -1;
}

View File

@ -129,6 +129,8 @@
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/element_spacing_small"
android:layout_marginRight="@dimen/element_spacing_small"
android:orientation="horizontal"
app:nv_primaryTextColor="?android:textColorPrimary"
app:nv_primaryTextStyle="bold"

View File

@ -376,19 +376,4 @@
android:scaleType="fitCenter"
tools:visibility="gone" />
<org.mariotaku.twidere.view.AssetFontTextView
android:id="@+id/uucky_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/profile_details_container"
android:gravity="center"
android:padding="@dimen/element_spacing_small"
android:text="@string/uucky_footer_text"
android:textColor="?android:textColorTertiary"
android:textSize="10sp"
android:textStyle="italic"
android:typeface="serif"
android:visibility="gone"
app:fontPath="fonts/LibreBaskerville-Italic.ttf" />
</RelativeLayout>