This commit is contained in:
Thomas 2023-12-22 11:00:32 +01:00
parent daf3e08995
commit 1c529c52e1

View file

@ -23,11 +23,9 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -95,7 +93,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras(); Bundle b = intent.getExtras();
Log.v(Helper.TAG, "onReceive: " + b);
if (b != null) { if (b != null) {
Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION); Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION);
String delete_statuses_for_user = b.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED); String delete_statuses_for_user = b.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED);
@ -781,27 +778,24 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} }
timelineParams.fetchingMissing = fetchingMissing; timelineParams.fetchingMissing = fetchingMissing;
switch (timelineType) { switch (timelineType) {
case LOCAL: case LOCAL -> {
timelineParams.local = true; timelineParams.local = true;
timelineParams.remote = false; timelineParams.remote = false;
break; }
case PUBLIC: case PUBLIC -> {
timelineParams.local = false; timelineParams.local = false;
timelineParams.remote = true; timelineParams.remote = true;
break; }
case BUBBLE: case BUBBLE -> {
if (bubbleTimeline != null) { if (bubbleTimeline != null) {
timelineParams.onlyMedia = bubbleTimeline.only_media; timelineParams.onlyMedia = bubbleTimeline.only_media;
timelineParams.remote = bubbleTimeline.remote; timelineParams.remote = bubbleTimeline.remote;
timelineParams.replyVisibility = bubbleTimeline.reply_visibility; timelineParams.replyVisibility = bubbleTimeline.reply_visibility;
timelineParams.excludeVisibilities = bubbleTimeline.exclude_visibilities; timelineParams.excludeVisibilities = bubbleTimeline.exclude_visibilities;
} }
break; }
case LIST: case LIST -> timelineParams.listId = list_id;
timelineParams.listId = list_id; case ART, TAG -> {
break;
case ART:
case TAG:
if (tagTimeline == null) { if (tagTimeline == null) {
tagTimeline = new TagTimeline(); tagTimeline = new TagTimeline();
tagTimeline.name = search; tagTimeline.name = search;
@ -814,11 +808,11 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
if (timelineParams.hashtagTrim != null && timelineParams.hashtagTrim.startsWith("#")) { if (timelineParams.hashtagTrim != null && timelineParams.hashtagTrim.startsWith("#")) {
timelineParams.hashtagTrim = tagTimeline.name.substring(1); timelineParams.hashtagTrim = tagTimeline.name.substring(1);
} }
break; }
case REMOTE: case REMOTE -> {
timelineParams.instance = remoteInstance; timelineParams.instance = remoteInstance;
timelineParams.token = null; timelineParams.token = null;
break; }
} }
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean useCache = sharedpreferences.getBoolean(getString(R.string.SET_USE_CACHE), true); boolean useCache = sharedpreferences.getBoolean(getString(R.string.SET_USE_CACHE), true);
@ -1022,15 +1016,13 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} }
}); });
} }
} //GNU TIMELINES
else if (pinnedTimeline != null && pinnedTimeline.remoteInstance.type == RemoteInstance.InstanceType.GNU) {
}//MISSKEY TIMELINES }//MISSKEY TIMELINES
else if (pinnedTimeline != null && pinnedTimeline.remoteInstance.type == RemoteInstance.InstanceType.MISSKEY) { else if (pinnedTimeline != null && pinnedTimeline.remoteInstance.type == RemoteInstance.InstanceType.MISSKEY) {
if (direction == null) { if (direction == null) {
timelinesVM.getMisskey(remoteInstance, null, MastodonHelper.statusesPerCall(requireActivity())) timelinesVM.getMisskey(remoteInstance, null, MastodonHelper.statusesPerCall(requireActivity()))
.observe(getViewLifecycleOwner(), this::initializeStatusesCommonView); .observe(getViewLifecycleOwner(), this::initializeStatusesCommonView);
} else if (direction == DIRECTION.BOTTOM) { } else if (direction == DIRECTION.BOTTOM) {
timelinesVM.getMisskey(remoteInstance, max_id, MastodonHelper.statusesPerCall(requireActivity())) timelinesVM.getMisskey(remoteInstance, max_id, MastodonHelper.statusesPerCall(requireActivity()))
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.BOTTOM, false, true, fetchStatus)); .observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.BOTTOM, false, true, fetchStatus));
} else if (direction == DIRECTION.TOP) { } else if (direction == DIRECTION.TOP) {