mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Show Blog Invitations
This refactors the forum invitation code, so it can be used by both: forums and blogs.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package org.briarproject.android.sharing;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.briarproject.R;
|
||||
import org.briarproject.api.blogs.Blog;
|
||||
|
||||
class BlogInvitationAdapter extends InvitationAdapter {
|
||||
|
||||
BlogInvitationAdapter(Context ctx, AvailableForumClickListener listener) {
|
||||
super(ctx, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(InvitationsViewHolder ui, int position) {
|
||||
super.onBindViewHolder(ui, position);
|
||||
InvitationItem item = getItem(position);
|
||||
Blog blog = (Blog) item.getShareable();
|
||||
|
||||
ui.avatar.setAuthorAvatar(blog.getAuthor());
|
||||
|
||||
ui.name.setText(ctx.getString(R.string.blogs_personal_blog,
|
||||
blog.getAuthor().getName()));
|
||||
|
||||
if (item.isSubscribed()) {
|
||||
ui.subscribed.setText(ctx.getString(R.string.blogs_sharing_exists,
|
||||
blog.getAuthor().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
int compareInvitations(InvitationItem o1, InvitationItem o2) {
|
||||
return String.CASE_INSENSITIVE_ORDER
|
||||
.compare(((Blog) o1.getShareable()).getAuthor().getName(),
|
||||
((Blog) o2.getShareable()).getAuthor().getName());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user