Fix issue
This commit is contained in:
parent
d878ac780c
commit
2044a85b58
|
@ -46,7 +46,6 @@ import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
||||||
import app.fedilab.fedilabtube.client.data.PlaylistData;
|
|
||||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||||
import app.fedilab.fedilabtube.drawer.AccountsHorizontalListAdapter;
|
import app.fedilab.fedilabtube.drawer.AccountsHorizontalListAdapter;
|
||||||
import app.fedilab.fedilabtube.drawer.PeertubeAdapter;
|
import app.fedilab.fedilabtube.drawer.PeertubeAdapter;
|
||||||
|
@ -69,7 +68,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
private String max_id, max_id_accounts;
|
private String max_id, max_id_accounts;
|
||||||
private List<VideoData.Video> peertubes;
|
private List<VideoData.Video> peertubes;
|
||||||
private List<Account> accounts;
|
private List<Account> accounts;
|
||||||
private TimelineVM.TimelineType timelineType;
|
private TimelineVM.TimelineType type;
|
||||||
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
||||||
private boolean firstLoad;
|
private boolean firstLoad;
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
|
@ -103,11 +102,11 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
search_peertube = bundle.getString("search_peertube", null);
|
search_peertube = bundle.getString("search_peertube", null);
|
||||||
channelId = bundle.getString("channelId", null);
|
channelId = bundle.getString("channelId", null);
|
||||||
timelineType = (TimelineVM.TimelineType) bundle.get("timelineType");
|
type = (TimelineVM.TimelineType) bundle.get("timelineType");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getArguments() != null && timelineType == null) {
|
if (getArguments() != null && type == null) {
|
||||||
timelineType = DisplayVideosFragment.fromBundle(getArguments()).getType();
|
type = DisplayVideosFragmentArgs.fromBundle(getArguments()).getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
forAccount = null;
|
forAccount = null;
|
||||||
|
@ -157,7 +156,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
||||||
//Load data depending of the value
|
//Load data depending of the value
|
||||||
if (search_peertube == null) { //Not a Peertube search
|
if (search_peertube == null) { //Not a Peertube search
|
||||||
viewModelFeeds.getVideos(timelineType, "0").observe(DisplayVideosFragment.this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.getVideos(type, "0").observe(DisplayVideosFragment.this.requireActivity(), this::manageVIewVideos);
|
||||||
} else {
|
} else {
|
||||||
viewModelSearch.getVideos("0", search_peertube).observe(DisplayVideosFragment.this.requireActivity(), this::manageVIewVideos);
|
viewModelSearch.getVideos("0", search_peertube).observe(DisplayVideosFragment.this.requireActivity(), this::manageVIewVideos);
|
||||||
}
|
}
|
||||||
|
@ -176,10 +175,10 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (timelineType != TimelineVM.TimelineType.OVERVIEW) {
|
if (type != TimelineVM.TimelineType.OVERVIEW) {
|
||||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
if (timelineType == TimelineVM.TimelineType.SUBSCRIBTIONS) {
|
if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) {
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
if (check_ScrollingUp) {
|
if (check_ScrollingUp) {
|
||||||
top_account_container.setVisibility(View.GONE);
|
top_account_container.setVisibility(View.GONE);
|
||||||
|
@ -204,10 +203,10 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
if (!flag_loading) {
|
if (!flag_loading) {
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
if (search_peertube == null) { //Not a Peertube search
|
if (search_peertube == null) { //Not a Peertube search
|
||||||
if( timelineType != TimelineVM.TimelineType.USER_VIDEOS){
|
if( type != TimelineVM.TimelineType.USER_VIDEOS){
|
||||||
viewModelFeeds.getVideosInChannel(channelId, max_id).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
viewModelFeeds.getVideosInChannel(channelId, max_id).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
||||||
}else {
|
}else {
|
||||||
viewModelFeeds.getVideos(timelineType, max_id).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
viewModelFeeds.getVideos(type, max_id).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewModelSearch.getVideos(max_id, search_peertube).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
viewModelSearch.getVideos(max_id, search_peertube).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
||||||
|
@ -227,10 +226,10 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
if (!flag_loading) {
|
if (!flag_loading) {
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
if (search_peertube == null) { //Not a Peertube search
|
if (search_peertube == null) { //Not a Peertube search
|
||||||
if( timelineType != TimelineVM.TimelineType.USER_VIDEOS){
|
if( type != TimelineVM.TimelineType.USER_VIDEOS){
|
||||||
viewModelFeeds.getVideosInChannel(channelId, max_id).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
viewModelFeeds.getVideosInChannel(channelId, max_id).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
||||||
}else {
|
}else {
|
||||||
viewModelFeeds.getVideos(timelineType, max_id).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
viewModelFeeds.getVideos(type, max_id).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewModelSearch.getVideos(max_id, search_peertube).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
viewModelSearch.getVideos(max_id, search_peertube).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageVIewVideos(apiResponse));
|
||||||
|
@ -246,7 +245,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (timelineType == TimelineVM.TimelineType.SUBSCRIBTIONS) {
|
if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) {
|
||||||
AccountsVM viewModel = new ViewModelProvider(this).get(AccountsVM.class);
|
AccountsVM viewModel = new ViewModelProvider(this).get(AccountsVM.class);
|
||||||
viewModel.getAccounts(RetrofitPeertubeAPI.DataType.SUBSCRIBER, max_id).observe(DisplayVideosFragment.this.requireActivity(), this::manageViewAccounts);
|
viewModel.getAccounts(RetrofitPeertubeAPI.DataType.SUBSCRIBER, max_id).observe(DisplayVideosFragment.this.requireActivity(), this::manageViewAccounts);
|
||||||
}
|
}
|
||||||
|
@ -402,10 +401,10 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||||
}
|
}
|
||||||
if (search_peertube == null) { //Not a Peertube search
|
if (search_peertube == null) { //Not a Peertube search
|
||||||
|
|
||||||
if( timelineType != TimelineVM.TimelineType.USER_VIDEOS){
|
if( type != TimelineVM.TimelineType.USER_VIDEOS){
|
||||||
viewModelFeeds.getVideosInChannel(channelId, "0").observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.getVideosInChannel(channelId, "0").observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
}else {
|
}else {
|
||||||
viewModelFeeds.getVideos(timelineType, "0").observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelFeeds.getVideos(type, "0").observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewModelSearch.getVideos("0", search_peertube).observe(this.requireActivity(), this::manageVIewVideos);
|
viewModelSearch.getVideos("0", search_peertube).observe(this.requireActivity(), this::manageVIewVideos);
|
||||||
|
|
Loading…
Reference in New Issue