From 0e2fee3ee670cca3506a59db97c1fc0b7a7229d2 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Mon, 18 Apr 2016 16:30:39 +0800 Subject: [PATCH] fixed follow and accept request action --- .../org/mariotaku/twidere/activity/SignInActivity.java | 3 ++- .../twidere/fragment/IncomingFriendshipsFragment.java | 10 +++++++++- .../twidere/fragment/ParcelableUsersFragment.java | 7 +------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/SignInActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/SignInActivity.java index d6ab8dc0b..50e303aa0 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/SignInActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/SignInActivity.java @@ -96,6 +96,7 @@ import org.mariotaku.twidere.util.JsonSerializer; import org.mariotaku.twidere.util.OAuthPasswordAuthenticator; import org.mariotaku.twidere.util.OAuthPasswordAuthenticator.AuthenticationException; import org.mariotaku.twidere.util.OAuthPasswordAuthenticator.AuthenticityTokenException; +import org.mariotaku.twidere.util.OAuthPasswordAuthenticator.LoginVerificationCallback; import org.mariotaku.twidere.util.OAuthPasswordAuthenticator.LoginVerificationException; import org.mariotaku.twidere.util.OAuthPasswordAuthenticator.WrongUserPassException; import org.mariotaku.twidere.util.ParseUtils; @@ -828,7 +829,7 @@ public class SignInActivity extends BaseActivity implements OnClickListener, Tex } - class InputLoginVerificationCallback implements OAuthPasswordAuthenticator.LoginVerificationCallback { + class InputLoginVerificationCallback implements LoginVerificationCallback { boolean isChallengeFinished; String challengeResponse; diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/IncomingFriendshipsFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/IncomingFriendshipsFragment.java index b8e1e5430..d90a72afc 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/IncomingFriendshipsFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/IncomingFriendshipsFragment.java @@ -31,6 +31,7 @@ import org.mariotaku.twidere.loader.IncomingFriendshipsLoader; import org.mariotaku.twidere.model.ParcelableUser; import org.mariotaku.twidere.model.UserKey; import org.mariotaku.twidere.model.message.FriendshipTaskEvent; +import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.view.holder.UserViewHolder; public class IncomingFriendshipsFragment extends CursorSupportUsersListFragment implements @@ -51,7 +52,14 @@ public class IncomingFriendshipsFragment extends CursorSupportUsersListFragment @Override protected ParcelableUsersAdapter onCreateAdapter(Context context, boolean compact) { final ParcelableUsersAdapter adapter = super.onCreateAdapter(context, compact); - adapter.setRequestClickListener(this); + final Bundle args = getArguments(); + final UserKey accountKey = args.getParcelable(EXTRA_ACCOUNT_KEY); + if (accountKey != null && USER_TYPE_FANFOU_COM.equals(accountKey.getHost()) && + Utils.isOfficialCredentials(context, accountKey)) { + adapter.setRequestClickListener(this); + } else { + adapter.setRequestClickListener(null); + } return adapter; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/ParcelableUsersFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/ParcelableUsersFragment.java index 88fc7e768..9b85a1562 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/ParcelableUsersFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/ParcelableUsersFragment.java @@ -47,7 +47,6 @@ import org.mariotaku.twidere.util.KeyboardShortcutsHandler; import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback; import org.mariotaku.twidere.util.ParcelUtils; import org.mariotaku.twidere.util.RecyclerViewNavigationHelper; -import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.view.holder.UserViewHolder; import java.util.List; @@ -103,11 +102,7 @@ public abstract class ParcelableUsersFragment extends AbsContentListRecyclerView @Override protected ParcelableUsersAdapter onCreateAdapter(Context context, boolean compact) { final ParcelableUsersAdapter adapter = new ParcelableUsersAdapter(context); - if (Utils.isOfficialCredentials(context, Utils.getAccountKey(context, getArguments()))) { - adapter.setFollowClickListener(this); - } else { - adapter.setFollowClickListener(null); - } + adapter.setFollowClickListener(this); return adapter; }