mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Extend BlogActivity to also show individual posts
This allows for swiping left/right to read other posts by using a ViewPager. This hasn't been done as a separate activity, but with fragments, so both can share the `BlogPersistentData` without needing to reload it. Closes #428
This commit is contained in:
@@ -10,7 +10,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.briarproject.R;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.util.StringUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -61,13 +60,11 @@ class BlogPostAdapter extends
|
||||
});
|
||||
|
||||
private final Context ctx;
|
||||
private final GroupId blogGroupId;
|
||||
private final String blogTitle;
|
||||
private final OnBlogPostClickListener listener;
|
||||
|
||||
BlogPostAdapter(Context ctx, GroupId blogGroupId, String blogTitle) {
|
||||
BlogPostAdapter(Context ctx, OnBlogPostClickListener listener) {
|
||||
this.ctx = ctx;
|
||||
this.blogGroupId = blogGroupId;
|
||||
this.blogTitle = blogTitle;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,7 +75,7 @@ class BlogPostAdapter extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(BlogPostHolder ui, int position) {
|
||||
public void onBindViewHolder(final BlogPostHolder ui, int position) {
|
||||
final BlogPostItem item = getItem(position);
|
||||
|
||||
// title
|
||||
@@ -95,7 +92,7 @@ class BlogPostAdapter extends
|
||||
ui.layout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO #428
|
||||
listener.onBlogPostClick(ui.getAdapterPosition());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -154,4 +151,9 @@ class BlogPostAdapter extends
|
||||
body = (TextView) v.findViewById(R.id.bodyView);
|
||||
}
|
||||
}
|
||||
|
||||
interface OnBlogPostClickListener {
|
||||
void onBlogPostClick(int position);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user