From fdc365dc00439d0e73f156ac3c28888417325f35 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 19 Nov 2022 16:50:55 +0100 Subject: [PATCH] Comment #477 - Allow remote actions --- .../fedilab/android/ui/drawer/NotificationAdapter.java | 2 +- .../app/fedilab/android/ui/drawer/StatusAdapter.java | 10 ++++++---- .../ui/fragment/timeline/FragmentMastodonContext.java | 2 +- .../ui/fragment/timeline/FragmentMastodonTimeline.java | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java index 04aae75d2..4009f56ef 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java @@ -259,7 +259,7 @@ public class NotificationAdapter extends RecyclerView.Adapter private final boolean minified; private final Timeline.TimeLineEnum timelineType; private final boolean canBeFederated; + private final boolean checkRemotely; public FetchMoreCallBack fetchMoreCallBack; private Context context; - public StatusAdapter(List statuses, Timeline.TimeLineEnum timelineType, boolean minified, boolean canBeFederated) { + public StatusAdapter(List statuses, Timeline.TimeLineEnum timelineType, boolean minified, boolean canBeFederated, boolean checkRemotely) { this.statusList = statuses; this.timelineType = timelineType; this.minified = minified; this.canBeFederated = canBeFederated; + this.checkRemotely = checkRemotely; } @@ -349,14 +351,14 @@ public class StatusAdapter extends RecyclerView.Adapter List statusList, Status status, Timeline.TimeLineEnum timelineType, - boolean minified, boolean canBeFederated, + boolean minified, boolean canBeFederated, boolean checkRemotely, FetchMoreCallBack fetchMoreCallBack) { if (status == null) { return; } SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); - boolean remote = timelineType == Timeline.TimeLineEnum.REMOTE; + boolean remote = timelineType == Timeline.TimeLineEnum.REMOTE || checkRemotely; Status statusToDeal = status.reblog != null ? status.reblog : status; @@ -2161,7 +2163,7 @@ public class StatusAdapter extends RecyclerView.Adapter StatusViewHolder holder = (StatusViewHolder) viewHolder; StatusesVM statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get(StatusesVM.class); SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class); - statusManagement(context, statusesVM, searchVM, holder, this, statusList, status, timelineType, minified, canBeFederated, fetchMoreCallBack); + statusManagement(context, statusesVM, searchVM, holder, this, statusList, status, timelineType, minified, canBeFederated, checkRemotely, fetchMoreCallBack); } else if (viewHolder.getItemViewType() == STATUS_FILTERED) { StatusViewHolder holder = (StatusViewHolder) viewHolder; holder.bindingFiltered.filteredText.setText(context.getString(R.string.filtered_by, status.filteredByApp.title)); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java index a5138f52e..2388ecc1a 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java @@ -162,7 +162,7 @@ public class FragmentMastodonContext extends Fragment { this.statuses = new ArrayList<>(); focusedStatus.isFocused = true; this.statuses.add(focusedStatus); - statusAdapter = new StatusAdapter(this.statuses, Timeline.TimeLineEnum.UNKNOWN, false, true); + statusAdapter = new StatusAdapter(this.statuses, Timeline.TimeLineEnum.UNKNOWN, false, true, false); binding.swipeContainer.setRefreshing(false); LinearLayoutManager mLayoutManager = new LinearLayoutManager(requireActivity()); binding.recyclerView.setLayoutManager(mLayoutManager); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java index c3487f4be..c822467ec 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java @@ -530,7 +530,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. if (min_id == null || (statuses.pagination.min_id != null && Helper.compareTo(statuses.pagination.min_id, min_id) > 0)) { min_id = statuses.pagination.min_id; } - statusAdapter = new StatusAdapter(timelineStatuses, timelineType, minified, canBeFederated); + statusAdapter = new StatusAdapter(timelineStatuses, timelineType, minified, canBeFederated, checkRemotely); statusAdapter.fetchMoreCallBack = this; if (statusReport != null) { scrollToTop();