Show Blog Invitations

This refactors the forum invitation code,
so it can be used by both: forums and blogs.
This commit is contained in:
Torsten Grote
2016-08-02 16:48:27 -03:00
parent a69a4028b0
commit e4f5d8e6e7
14 changed files with 461 additions and 256 deletions

View File

@@ -0,0 +1,31 @@
package org.briarproject.android.sharing;
import android.content.Context;
import org.briarproject.api.forum.Forum;
class ForumInvitationAdapter extends InvitationAdapter {
ForumInvitationAdapter(Context ctx, AvailableForumClickListener listener) {
super(ctx, listener);
}
@Override
public void onBindViewHolder(InvitationsViewHolder ui, int position) {
super.onBindViewHolder(ui, position);
InvitationItem item = getItem(position);
Forum forum = (Forum) item.getShareable();
ui.avatar.setText(forum.getName().substring(0, 1));
ui.avatar.setBackgroundBytes(item.getShareable().getId().getBytes());
ui.name.setText(forum.getName());
}
int compareInvitations(InvitationItem o1, InvitationItem o2) {
return String.CASE_INSENSITIVE_ORDER
.compare(((Forum) o1.getShareable()).getName(),
((Forum) o2.getShareable()).getName());
}
}