Some fixes with Peertube

This commit is contained in:
tom79 2019-06-25 18:29:08 +02:00
parent 6c20904a8b
commit aa07a91fa9
3 changed files with 31 additions and 3 deletions

View File

@ -710,6 +710,28 @@ public abstract class BaseMainActivity extends BaseActivity
manageTimelineList(false);
tabLayout.setVisibility(View.GONE);
}
}else if ( social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
DisplayStatusFragment statusFragment;
Bundle bundle = new Bundle();
statusFragment = new DisplayStatusFragment();
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE);
bundle.putString("remote_instance", instance);
bundle.putString("instanceType", "PEERTUBE");
bundle.putString("search_peertube", query);
statusFragment.setArguments(bundle);
String fragmentTag = "REMOTE_INSTANCE";
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
if( main_app_container.getVisibility() == View.GONE){
main_app_container.setVisibility(View.VISIBLE);
toolbarTitle.setVisibility(View.VISIBLE);
delete_instance.setVisibility(View.VISIBLE);
viewPager.setVisibility(View.GONE);
manageTimelineList(false);
tabLayout.setVisibility(View.GONE);
}
}else{
if( social != UpdateAccountInfoAsyncTask.SOCIAL.GNU) {
boolean isAccount = false;

View File

@ -1690,6 +1690,7 @@ public class API {
} catch (UnsupportedEncodingException e) {
params.put("search", query);
}
List<Peertube> peertubes = new ArrayList<>();
try {
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);

View File

@ -340,21 +340,26 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
}
});
else
else {
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if( peertubes.size() > 0) {
if (peertubes.size() > 0) {
int size = peertubes.size();
isSwipped = true;
peertubes.clear();
peertubes = new ArrayList<>();
max_id = "0";
peertubeAdapater.notifyItemRangeRemoved(0, size);
asyncTask = new RetrieveFeedsAsyncTask(context, type, remoteInstance, "0", DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (search_peertube == null) { //Not a Peertube search
asyncTask = new RetrieveFeedsAsyncTask(context, type, remoteInstance, "0", DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
asyncTask = new RetrievePeertubeSearchAsyncTask(context, remoteInstance, search_peertube, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}
});
}
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
switch (theme){