Fix some bugs
This commit is contained in:
parent
964b0f2690
commit
962462ff84
|
@ -288,7 +288,6 @@ public class ShowAccountActivity extends AppCompatActivity {
|
|||
if (position == 0) {
|
||||
DisplayChannelsFragment displayChannelsFragment = new DisplayChannelsFragment();
|
||||
bundle.putString("name", account.getAcct());
|
||||
bundle.putBoolean("myChannels", false);
|
||||
displayChannelsFragment.setArguments(bundle);
|
||||
return displayChannelsFragment;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,6 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||
} else if (account != null) {
|
||||
channelId = account.getAcct();
|
||||
}
|
||||
|
||||
max_id = "0";
|
||||
//forChannel = type == TimelineVM.TimelineType.ACCOUNT_VIDEOS ? channelId : null;
|
||||
max_id_accounts = null;
|
||||
|
@ -498,7 +497,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||
} else if (type == TimelineVM.TimelineType.HISTORY) {
|
||||
viewModelFeeds.getVideoHistory(max_id, startDate, endDate).observe(this.requireActivity(), this::manageVIewVideos);
|
||||
} else {
|
||||
viewModelFeeds.getVideos(type, max_id, forChannel).observe(this.requireActivity(), this::manageVIewVideos);
|
||||
viewModelFeeds.getVideos(type, max_id, forChannel, account).observe(this.requireActivity(), this::manageVIewVideos);
|
||||
}
|
||||
} else {
|
||||
viewModelSearch.getVideos(max_id, search_peertube).observe(this.requireActivity(), this::manageVIewVideos);
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||
|
||||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||
import app.fedilab.fedilabtube.client.data.ChannelData;
|
||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
@ -46,9 +47,9 @@ public class TimelineVM extends AndroidViewModel {
|
|||
super(application);
|
||||
}
|
||||
|
||||
public LiveData<APIResponse> getVideos(TimelineType action, String max_id, ChannelData.Channel forChannel) {
|
||||
public LiveData<APIResponse> getVideos(TimelineType action, String max_id, ChannelData.Channel forChannel, AccountData.Account forAccount) {
|
||||
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||
loadVideos(action, max_id, forChannel);
|
||||
loadVideos(action, max_id, forChannel, forAccount);
|
||||
return apiResponseMutableLiveData;
|
||||
}
|
||||
|
||||
|
@ -190,20 +191,25 @@ public class TimelineVM extends AndroidViewModel {
|
|||
}).start();
|
||||
}
|
||||
|
||||
private void loadVideos(TimelineType timeline, String max_id, ChannelData.Channel forChannel) {
|
||||
private void loadVideos(TimelineType timeline, String max_id, ChannelData.Channel forChannel, AccountData.Account forAccount) {
|
||||
Context _mContext = getApplication().getApplicationContext();
|
||||
new Thread(() -> {
|
||||
try {
|
||||
RetrofitPeertubeAPI retrofitPeertubeAPI;
|
||||
String acct = null;
|
||||
if (forChannel != null) {
|
||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, forChannel.getHost(), null);
|
||||
acct = forChannel.getAcct();
|
||||
} else if (forAccount != null) {
|
||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext, forAccount.getHost(), null);
|
||||
acct = forAccount.getAcct();
|
||||
} else {
|
||||
retrofitPeertubeAPI = new RetrofitPeertubeAPI(_mContext);
|
||||
}
|
||||
if (timeline == null)
|
||||
return;
|
||||
APIResponse apiResponse;
|
||||
apiResponse = retrofitPeertubeAPI.getTL(timeline, max_id, forChannel != null ? forChannel.getAcct() : null);
|
||||
apiResponse = retrofitPeertubeAPI.getTL(timeline, max_id, acct);
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> apiResponseMutableLiveData.setValue(apiResponse);
|
||||
mainHandler.post(myRunnable);
|
||||
|
|
Loading…
Reference in New Issue