mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 01:00:04 +02:00
Manage Peertube videos
This commit is contained in:
parent
a48f997ae3
commit
1b8211a341
3 changed files with 13 additions and 18 deletions
|
@ -141,10 +141,8 @@ public class MisskeyNote implements Serializable {
|
||||||
public boolean remote = false;
|
public boolean remote = false;
|
||||||
@SerializedName("reply")
|
@SerializedName("reply")
|
||||||
public boolean reply = false;
|
public boolean reply = false;
|
||||||
@SerializedName("max_id")
|
@SerializedName("untilId")
|
||||||
public String max_id;
|
public String untilId;
|
||||||
@SerializedName("since_id")
|
|
||||||
public String since_id;
|
|
||||||
@SerializedName("limit")
|
@SerializedName("limit")
|
||||||
public int limit;
|
public int limit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -649,16 +649,15 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
}//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, 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, null, MastodonHelper.statusesPerCall(requireActivity()))
|
timelinesVM.getMisskey(remoteInstance, max_id, MastodonHelper.statusesPerCall(requireActivity()))
|
||||||
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.BOTTOM, false));
|
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.BOTTOM, false));
|
||||||
} else if (direction == DIRECTION.TOP) {
|
} else if (direction == DIRECTION.TOP) {
|
||||||
timelinesVM.getMisskey(remoteInstance, null, fetchingMissing ? min_id_fetch_more : min_id, MastodonHelper.statusesPerCall(requireActivity()))
|
flagLoading = false;
|
||||||
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.TOP, fetchingMissing));
|
|
||||||
} else if (direction == DIRECTION.REFRESH) {
|
} else if (direction == DIRECTION.REFRESH) {
|
||||||
timelinesVM.getMisskey(remoteInstance, null, null, MastodonHelper.statusesPerCall(requireActivity()))
|
timelinesVM.getMisskey(remoteInstance, null, MastodonHelper.statusesPerCall(requireActivity()))
|
||||||
.observe(getViewLifecycleOwner(), statusesRefresh -> {
|
.observe(getViewLifecycleOwner(), statusesRefresh -> {
|
||||||
if (statusAdapter != null) {
|
if (statusAdapter != null) {
|
||||||
dealWithPagination(statusesRefresh, DIRECTION.REFRESH, true);
|
dealWithPagination(statusesRefresh, DIRECTION.REFRESH, true);
|
||||||
|
@ -674,7 +673,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
timelinesVM.getPeertube(remoteInstance, null, MastodonHelper.statusesPerCall(requireActivity()))
|
timelinesVM.getPeertube(remoteInstance, null, MastodonHelper.statusesPerCall(requireActivity()))
|
||||||
.observe(getViewLifecycleOwner(), this::initializeStatusesCommonView);
|
.observe(getViewLifecycleOwner(), this::initializeStatusesCommonView);
|
||||||
} else if (direction == DIRECTION.BOTTOM) {
|
} else if (direction == DIRECTION.BOTTOM) {
|
||||||
timelinesVM.getPeertube(remoteInstance, max_id, MastodonHelper.statusesPerCall(requireActivity()))
|
timelinesVM.getPeertube(remoteInstance, String.valueOf(statuses.size()), MastodonHelper.statusesPerCall(requireActivity()))
|
||||||
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.BOTTOM, false));
|
.observe(getViewLifecycleOwner(), statusesBottom -> dealWithPagination(statusesBottom, DIRECTION.BOTTOM, false));
|
||||||
} else if (direction == DIRECTION.TOP) {
|
} else if (direction == DIRECTION.TOP) {
|
||||||
flagLoading = false;
|
flagLoading = false;
|
||||||
|
|
|
@ -150,21 +150,18 @@ public class TimelinesVM extends AndroidViewModel {
|
||||||
/**
|
/**
|
||||||
* Public timeline for Misskey
|
* Public timeline for Misskey
|
||||||
*
|
*
|
||||||
* @param maxId Return results older than this id
|
* @param untilId Return results older than this id
|
||||||
* @param sinceId Return results newer than this id
|
|
||||||
* @param limit Maximum number of results to return. Defaults to 20.
|
* @param limit Maximum number of results to return. Defaults to 20.
|
||||||
* @return {@link LiveData} containing a {@link Statuses}
|
* @return {@link LiveData} containing a {@link Statuses}
|
||||||
*/
|
*/
|
||||||
public LiveData<Statuses> getMisskey(@NonNull String instance,
|
public LiveData<Statuses> getMisskey(@NonNull String instance,
|
||||||
String maxId,
|
String untilId,
|
||||||
String sinceId,
|
|
||||||
Integer limit) {
|
Integer limit) {
|
||||||
MastodonTimelinesService mastodonTimelinesService = initInstanceOnly(instance);
|
MastodonTimelinesService mastodonTimelinesService = initInstanceOnly(instance);
|
||||||
statusesMutableLiveData = new MutableLiveData<>();
|
statusesMutableLiveData = new MutableLiveData<>();
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
MisskeyNote.MisskeyParams misskeyParams = new MisskeyNote.MisskeyParams();
|
MisskeyNote.MisskeyParams misskeyParams = new MisskeyNote.MisskeyParams();
|
||||||
misskeyParams.max_id = maxId;
|
misskeyParams.untilId = untilId;
|
||||||
misskeyParams.since_id = sinceId;
|
|
||||||
misskeyParams.limit = limit;
|
misskeyParams.limit = limit;
|
||||||
Call<List<MisskeyNote>> publicTlCall = mastodonTimelinesService.getMisskey(misskeyParams);
|
Call<List<MisskeyNote>> publicTlCall = mastodonTimelinesService.getMisskey(misskeyParams);
|
||||||
Statuses statuses = new Statuses();
|
Statuses statuses = new Statuses();
|
||||||
|
@ -231,8 +228,9 @@ public class TimelinesVM extends AndroidViewModel {
|
||||||
statuses.statuses = SpannableHelper.convertStatus(getApplication().getApplicationContext(), filteredStatuses);
|
statuses.statuses = SpannableHelper.convertStatus(getApplication().getApplicationContext(), filteredStatuses);
|
||||||
statuses.pagination = new Pagination();
|
statuses.pagination = new Pagination();
|
||||||
if (statusList.size() > 0) {
|
if (statusList.size() > 0) {
|
||||||
statuses.pagination.min_id = statusList.get(0).id;
|
//These values are not used.
|
||||||
statuses.pagination.max_id = statusList.get(statusList.size() - 1).id;
|
statuses.pagination.min_id = null;
|
||||||
|
statuses.pagination.max_id = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in a new issue