1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-05 11:07:36 +01:00

hiding approve/deny follow request for third party credentials

fixed #504
This commit is contained in:
Mariotaku Lee 2016-04-17 14:38:16 +08:00
parent 3629c4cba0
commit 844233bc7f
3 changed files with 16 additions and 9 deletions

View File

@ -19,6 +19,7 @@
package org.mariotaku.twidere.fragment; package org.mariotaku.twidere.fragment;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -70,6 +71,7 @@ public class IncomingFriendshipsFragment extends CursorSupportUsersListFragment
mTwitterWrapper.denyFriendshipAsync(user.account_key, user.key); mTwitterWrapper.denyFriendshipAsync(user.account_key, user.key);
} }
@SuppressLint("SwitchIntDef")
@Override @Override
protected boolean shouldRemoveUser(int position, FriendshipTaskEvent event) { protected boolean shouldRemoveUser(int position, FriendshipTaskEvent event) {
if (!event.isSucceeded()) return false; if (!event.isSucceeded()) return false;

View File

@ -47,6 +47,7 @@ import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback; import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback;
import org.mariotaku.twidere.util.ParcelUtils; import org.mariotaku.twidere.util.ParcelUtils;
import org.mariotaku.twidere.util.RecyclerViewNavigationHelper; import org.mariotaku.twidere.util.RecyclerViewNavigationHelper;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.holder.UserViewHolder; import org.mariotaku.twidere.view.holder.UserViewHolder;
import java.util.List; import java.util.List;
@ -102,7 +103,11 @@ public abstract class ParcelableUsersFragment extends AbsContentListRecyclerView
@Override @Override
protected ParcelableUsersAdapter onCreateAdapter(Context context, boolean compact) { protected ParcelableUsersAdapter onCreateAdapter(Context context, boolean compact) {
final ParcelableUsersAdapter adapter = new ParcelableUsersAdapter(context); final ParcelableUsersAdapter adapter = new ParcelableUsersAdapter(context);
adapter.setFollowClickListener(this); if (Utils.isOfficialCredentials(context, Utils.getAccountKey(context, getArguments()))) {
adapter.setFollowClickListener(this);
} else {
adapter.setFollowClickListener(null);
}
return adapter; return adapter;
} }
@ -211,10 +216,6 @@ public abstract class ParcelableUsersFragment extends AbsContentListRecyclerView
return data == null || !data.isEmpty(); return data == null || !data.isEmpty();
} }
protected void removeUsers(String... ids) {
//TODO remove from adapter
}
public final List<ParcelableUser> getData() { public final List<ParcelableUser> getData() {
return getAdapter().getData(); return getAdapter().getData();
} }

View File

@ -69,9 +69,13 @@ public class HtmlSpanBuilder {
} }
private static void applyTag(SpannableStringBuilder sb, int start, int end, TagInfo info) { private static void applyTag(SpannableStringBuilder sb, int start, int end, TagInfo info) {
final Object span = createSpan(info); if (info.name.equalsIgnoreCase("br")) {
if (span == null) return; sb.append('\n');
sb.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } else {
final Object span = createSpan(info);
if (span == null) return;
sb.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
} }
private static Object createSpan(TagInfo info) { private static Object createSpan(TagInfo info) {
@ -142,7 +146,7 @@ public class HtmlSpanBuilder {
public HtmlSpanHandler(HtmlParsingConfiguration conf) { public HtmlSpanHandler(HtmlParsingConfiguration conf) {
super(conf); super(conf);
this.sb = new SpannableStringBuilder(); sb = new SpannableStringBuilder();
tagInfo = new ArrayList<>(); tagInfo = new ArrayList<>();
} }