From 0615aa34f28a2fece27980e57bb453c72060e818 Mon Sep 17 00:00:00 2001 From: Grishka Date: Sun, 13 Feb 2022 01:34:11 +0300 Subject: [PATCH] Poll display --- .../fragments/BaseStatusListFragment.java | 4 + .../org/joinmastodon/android/model/Poll.java | 4 +- .../PollFooterStatusDisplayItem.java | 45 +++++++++++ .../PollOptionStatusDisplayItem.java | 80 +++++++++++++++++++ .../ui/displayitems/StatusDisplayItem.java | 10 ++- .../displayitems/TextStatusDisplayItem.java | 3 - .../android/ui/utils/UiUtils.java | 19 +++++ .../res/drawable/bg_poll_option_clickable.xml | 9 +++ .../res/layout/display_item_poll_footer.xml | 9 +++ .../res/layout/display_item_poll_option.xml | 43 ++++++++++ .../src/main/res/layout/fragment_compose.xml | 2 +- mastodon/src/main/res/values/strings.xml | 21 +++++ 12 files changed, 242 insertions(+), 7 deletions(-) create mode 100644 mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/PollFooterStatusDisplayItem.java create mode 100644 mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/PollOptionStatusDisplayItem.java create mode 100644 mastodon/src/main/res/drawable/bg_poll_option_clickable.xml create mode 100644 mastodon/src/main/res/layout/display_item_poll_footer.xml create mode 100644 mastodon/src/main/res/layout/display_item_poll_option.xml diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java index d9551292..9cf464f8 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java @@ -21,6 +21,7 @@ import org.joinmastodon.android.model.Status; import org.joinmastodon.android.ui.displayitems.FooterStatusDisplayItem; import org.joinmastodon.android.ui.displayitems.ImageStatusDisplayItem; import org.joinmastodon.android.ui.displayitems.PhotoStatusDisplayItem; +import org.joinmastodon.android.ui.displayitems.PollOptionStatusDisplayItem; import org.joinmastodon.android.ui.displayitems.StatusDisplayItem; import org.joinmastodon.android.ui.photoviewer.PhotoViewer; import org.joinmastodon.android.ui.photoviewer.PhotoViewerHost; @@ -329,6 +330,9 @@ public abstract class BaseStatusListFragment exten } + public void onPollOptionClick(PollOptionStatusDisplayItem.Holder holder){ + } + protected class DisplayItemsAdapter extends UsableRecyclerView.Adapter> implements ImageLoaderRecyclerAdapter{ public DisplayItemsAdapter(){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/Poll.java b/mastodon/src/main/java/org/joinmastodon/android/model/Poll.java index 1706db58..a8fb5214 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/model/Poll.java +++ b/mastodon/src/main/java/org/joinmastodon/android/model/Poll.java @@ -17,7 +17,7 @@ public class Poll extends BaseModel{ public boolean multiple; public int votersCount; public boolean voted; - public int[] ownVotes; + public List ownVotes; public List