Comment #477 - Allow remote actions

This commit is contained in:
Thomas 2022-11-19 16:50:55 +01:00
parent a57659bd69
commit fdc365dc00
4 changed files with 9 additions and 7 deletions

View File

@ -259,7 +259,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
if (notification.status != null) {
notification.status.cached = notification.cached;
}
statusManagement(context, statusesVM, searchVM, holderStatus, this, null, notification.status, Timeline.TimeLineEnum.NOTIFICATION, false, true, null);
statusManagement(context, statusesVM, searchVM, holderStatus, this, null, notification.status, Timeline.TimeLineEnum.NOTIFICATION, false, true, false, null);
holderStatus.bindingNotification.status.dateShort.setText(Helper.dateDiff(context, notification.created_at));
holderStatus.bindingNotification.containerTransparent.setAlpha(.3f);
if (getItemViewType(position) == TYPE_MENTION || getItemViewType(position) == TYPE_STATUS || getItemViewType(position) == TYPE_REACTION) {

View File

@ -153,14 +153,16 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
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<Status> statuses, Timeline.TimeLineEnum timelineType, boolean minified, boolean canBeFederated) {
public StatusAdapter(List<Status> 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<RecyclerView.ViewHolder>
List<Status> 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<RecyclerView.ViewHolder>
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));

View File

@ -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);

View File

@ -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();