mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 08:40:03 +02:00
Fix issue #7
This commit is contained in:
parent
713b5307e2
commit
d7acab0a8c
5 changed files with 25 additions and 19 deletions
|
@ -176,7 +176,7 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
|
|||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call call, @NonNull final Response response) {
|
||||
if (!response.isSuccessful()) {
|
||||
if (response.isSuccessful()) {
|
||||
runOnUiThread(() -> {
|
||||
dialog.dismiss();
|
||||
RemoteInstance.InstanceType instanceType = null;
|
||||
|
|
|
@ -51,7 +51,6 @@ import android.provider.MediaStore;
|
|||
import android.provider.OpenableColumns;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -177,6 +176,7 @@ public class Helper {
|
|||
public static final String ARG_TYPE_OF_INFO = "ARG_TYPE_OF_INFO";
|
||||
public static final String ARG_TOKEN = "ARG_TOKEN";
|
||||
public static final String ARG_INSTANCE = "ARG_INSTANCE";
|
||||
public static final String ARG_REMOTE_INSTANCE = "ARG_REMOTE_INSTANCE";
|
||||
public static final String ARG_STATUS_ID = "ARG_STATUS_ID";
|
||||
public static final String ARG_WORK_ID = "ARG_WORK_ID";
|
||||
public static final String ARG_LIST_ID = "ARG_LIST_ID";
|
||||
|
@ -1189,14 +1189,9 @@ public class Helper {
|
|||
attachment.size = Helper.getRealSizeFromUri(context, uri);
|
||||
ContentResolver cR = context.getApplicationContext().getContentResolver();
|
||||
attachment.mimeType = cR.getType(uri);
|
||||
Log.v(Helper.TAG, "uri: " + uri);
|
||||
Log.v(Helper.TAG, "attachment.mimeType: " + attachment.mimeType);
|
||||
|
||||
MimeTypeMap mime = MimeTypeMap.getSingleton();
|
||||
String extension = mime.getExtensionFromMimeType(cR.getType(uri));
|
||||
|
||||
Log.v(Helper.TAG, "mime: " + attachment.mimeType);
|
||||
Log.v(Helper.TAG, "extension: " + attachment.mimeType);
|
||||
if (uri.toString().endsWith("fedilab_recorded_audio.wav")) {
|
||||
extension = "wav";
|
||||
attachment.mimeType = "audio/x-wav";
|
||||
|
|
|
@ -305,7 +305,7 @@ public class PinnedTimelineHelper {
|
|||
Bundle bundle = new Bundle();
|
||||
bundle.putString("tag", tagTimeline.name);
|
||||
bundle.putInt("timelineId", tagTimeline.id);
|
||||
bundle.putSerializable("type", Timeline.TimeLineEnum.TAG);
|
||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TAG);
|
||||
if (mediaOnly[0])
|
||||
bundle.putString("instanceType", "ART");
|
||||
else
|
||||
|
@ -529,10 +529,10 @@ public class PinnedTimelineHelper {
|
|||
}
|
||||
fragTransaction.detach(fragmentMastodonTimeline);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("remote_instance", remoteInstance.host != null ? remoteInstance.host : "");
|
||||
bundle.putString(Helper.ARG_REMOTE_INSTANCE, remoteInstance.host != null ? remoteInstance.host : "");
|
||||
bundle.putString("instanceType", remoteInstance.type.getValue());
|
||||
bundle.putString("timelineId", remoteInstance.id);
|
||||
bundle.putSerializable("type", Timeline.TimeLineEnum.REMOTE);
|
||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
||||
fragmentMastodonTimeline.setArguments(bundle);
|
||||
fragTransaction.attach(fragmentMastodonTimeline);
|
||||
fragTransaction.commit();
|
||||
|
@ -569,11 +569,11 @@ public class PinnedTimelineHelper {
|
|||
currentFilter[0] = remoteInstance.filteredWith;
|
||||
fragTransaction.detach(fragmentMastodonTimeline);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("remote_instance", remoteInstance.host != null ? remoteInstance.host : "");
|
||||
bundle.putString(Helper.ARG_REMOTE_INSTANCE, remoteInstance.host != null ? remoteInstance.host : "");
|
||||
bundle.putString("instanceType", remoteInstance.type.getValue());
|
||||
bundle.putString("timelineId", remoteInstance.id);
|
||||
bundle.putString("currentfilter", remoteInstance.filteredWith);
|
||||
bundle.putSerializable("type", Timeline.TimeLineEnum.REMOTE);
|
||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
||||
fragmentMastodonTimeline.setArguments(bundle);
|
||||
fragTransaction.attach(fragmentMastodonTimeline);
|
||||
fragTransaction.commit();
|
||||
|
@ -621,7 +621,7 @@ public class PinnedTimelineHelper {
|
|||
}
|
||||
popup.getMenu().clear();
|
||||
popup.getMenu().close();
|
||||
instanceClick(context, pinned, view, offSetPosition);
|
||||
instanceClick(context, pinned, view, position);
|
||||
});
|
||||
AlertDialog alertDialog = dialogBuilder.create();
|
||||
alertDialog.show();
|
||||
|
@ -638,13 +638,13 @@ public class PinnedTimelineHelper {
|
|||
return;
|
||||
fragTransaction.detach(fragmentMastodonTimeline);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("remote_instance", remoteInstance.host != null ? remoteInstance.host : "");
|
||||
bundle.putString(Helper.ARG_REMOTE_INSTANCE, remoteInstance.host != null ? remoteInstance.host : "");
|
||||
bundle.putString("instanceType", remoteInstance.type.getValue());
|
||||
bundle.putString("timelineId", remoteInstance.id);
|
||||
if (currentFilter[0] != null) {
|
||||
bundle.putString("currentfilter", remoteInstance.filteredWith);
|
||||
}
|
||||
bundle.putSerializable("type", Timeline.TimeLineEnum.REMOTE);
|
||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
|
||||
fragmentMastodonTimeline.setArguments(bundle);
|
||||
fragTransaction.attach(fragmentMastodonTimeline);
|
||||
fragTransaction.commit();
|
||||
|
|
|
@ -71,7 +71,7 @@ public class FragmentMastodonTimeline extends Fragment {
|
|||
private LinearLayoutManager mLayoutManager;
|
||||
private Account accountTimeline;
|
||||
private boolean exclude_replies, exclude_reblogs, show_pinned, media_only, minified;
|
||||
private String viewModelKey;
|
||||
private String viewModelKey, remoteInstance;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -83,6 +83,7 @@ public class FragmentMastodonTimeline extends Fragment {
|
|||
list_id = getArguments().getString(Helper.ARG_LIST_ID, null);
|
||||
search = getArguments().getString(Helper.ARG_SEARCH_KEYWORD, null);
|
||||
searchCache = getArguments().getString(Helper.ARG_SEARCH_KEYWORD_CACHE, null);
|
||||
remoteInstance = getArguments().getString(Helper.ARG_REMOTE_INSTANCE, null);
|
||||
tagTimeline = (TagTimeline) getArguments().getSerializable(Helper.ARG_TAG_TIMELINE);
|
||||
accountTimeline = (Account) getArguments().getSerializable(Helper.ARG_ACCOUNT);
|
||||
exclude_replies = !getArguments().getBoolean(Helper.ARG_SHOW_REPLIES, true);
|
||||
|
@ -93,7 +94,6 @@ public class FragmentMastodonTimeline extends Fragment {
|
|||
minified = getArguments().getBoolean(Helper.ARG_MINIFIED, false);
|
||||
statusReport = (Status) getArguments().getSerializable(Helper.ARG_STATUS_REPORT);
|
||||
}
|
||||
|
||||
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
@ -337,6 +337,17 @@ public class FragmentMastodonTimeline extends Fragment {
|
|||
timelinesVM.getPublic(BaseMainActivity.currentToken, BaseMainActivity.currentInstance, false, true, false, null, null, min_id, MastodonHelper.statusesPerCall(requireActivity()))
|
||||
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.TOP));
|
||||
}
|
||||
} else if (timelineType == Timeline.TimeLineEnum.REMOTE) { //REMOTE TIMELINE
|
||||
if (direction == null) {
|
||||
timelinesVM.getPublic(null, remoteInstance, false, true, false, null, null, null, MastodonHelper.statusesPerCall(requireActivity()))
|
||||
.observe(getViewLifecycleOwner(), this::initializeStatusesCommonView);
|
||||
} else if (direction == DIRECTION.BOTTOM) {
|
||||
timelinesVM.getPublic(null, remoteInstance, false, true, false, max_id, null, null, MastodonHelper.statusesPerCall(requireActivity()))
|
||||
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.BOTTOM));
|
||||
} else if (direction == DIRECTION.TOP) {
|
||||
timelinesVM.getPublic(null, remoteInstance, false, true, false, null, null, min_id, MastodonHelper.statusesPerCall(requireActivity()))
|
||||
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.TOP));
|
||||
}
|
||||
} else if (timelineType == Timeline.TimeLineEnum.LIST) { //LIST TIMELINE
|
||||
if (direction == null) {
|
||||
timelinesVM.getList(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, list_id, null, null, null, MastodonHelper.statusesPerCall(requireActivity()))
|
||||
|
|
|
@ -88,9 +88,9 @@ public class FedilabPageAdapter extends FragmentStatePagerAdapter {
|
|||
String tag = pinnedTimeline.tagTimeline.name.replaceAll("#", "");
|
||||
bundle.putString(Helper.ARG_SEARCH_KEYWORD, tag);
|
||||
} else if (pinnedTimeline.type == Timeline.TimeLineEnum.REMOTE) {
|
||||
|
||||
String instance = pinnedTimeline.remoteInstance.host;
|
||||
bundle.putString(Helper.ARG_REMOTE_INSTANCE, instance);
|
||||
}
|
||||
|
||||
}
|
||||
bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position);
|
||||
fragment.setArguments(bundle);
|
||||
|
|
Loading…
Reference in a new issue