mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-06-05 21:09:11 +02:00
Some changes
This commit is contained in:
@ -2,7 +2,6 @@ package app.fedilab.fedilabtube.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -37,9 +36,10 @@ import app.fedilab.fedilabtube.drawer.PeertubeAdapter;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import app.fedilab.fedilabtube.interfaces.OnPostActionInterface;
|
||||
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
|
||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
import static app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type.POVERVIEW;
|
||||
|
||||
|
||||
public class DisplayStatusFragment extends Fragment implements OnPostActionInterface, OnRetrieveFeedsInterface {
|
||||
|
||||
@ -56,11 +56,9 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
||||
private boolean firstLoad;
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
private SharedPreferences sharedpreferences;
|
||||
private boolean isSwipped;
|
||||
private String search_peertube;
|
||||
private TextView textviewNoActionText;
|
||||
private boolean ischannel;
|
||||
private boolean ownVideos;
|
||||
private View rootView;
|
||||
private RecyclerView lv_status;
|
||||
|
||||
@ -82,25 +80,16 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
||||
}
|
||||
|
||||
if (bundle != null) {
|
||||
String targetedId = bundle.getString("targetedid", null);
|
||||
String tag = bundle.getString("tag", null);
|
||||
search_peertube = bundle.getString("search_peertube", null);
|
||||
String remote_channel_name = bundle.getString("remote_channel_name", null);
|
||||
String instanceType = bundle.getString("instanceType", "MASTODON");
|
||||
ischannel = bundle.getBoolean("ischannel", false);
|
||||
int timelineId = bundle.getInt("timelineId");
|
||||
}
|
||||
if (ischannel) {
|
||||
type = RetrieveFeedsAsyncTask.Type.CHANNEL;
|
||||
}
|
||||
|
||||
assert context != null;
|
||||
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
|
||||
|
||||
lv_status = rootView.findViewById(R.id.lv_status);
|
||||
|
||||
isSwipped = false;
|
||||
max_id = null;
|
||||
flag_loading = true;
|
||||
firstLoad = true;
|
||||
@ -115,9 +104,6 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
||||
textviewNoActionText = rootView.findViewById(R.id.no_action_text);
|
||||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, context != null ? Helper.getLiveInstance(context) : null);
|
||||
|
||||
|
||||
peertubeAdapater = new PeertubeAdapter(this.peertubes);
|
||||
lv_status.setAdapter(peertubeAdapater);
|
||||
@ -146,29 +132,31 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
||||
}, 500);
|
||||
}
|
||||
|
||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if( type != POVERVIEW) {
|
||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
|
||||
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
||||
if (dy > 0) {
|
||||
int visibleItemCount = mLayoutManager.getChildCount();
|
||||
int totalItemCount = mLayoutManager.getItemCount();
|
||||
if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) {
|
||||
if (!flag_loading) {
|
||||
flag_loading = true;
|
||||
if (search_peertube == null) { //Not a Peertube search
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).execute();
|
||||
} else {
|
||||
asyncTask = new RetrievePeertubeSearchAsyncTask(context, max_id, search_peertube, DisplayStatusFragment.this).execute();
|
||||
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
||||
if (dy > 0) {
|
||||
int visibleItemCount = mLayoutManager.getChildCount();
|
||||
int totalItemCount = mLayoutManager.getItemCount();
|
||||
if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) {
|
||||
if (!flag_loading) {
|
||||
flag_loading = true;
|
||||
if (search_peertube == null) { //Not a Peertube search
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).execute();
|
||||
} else {
|
||||
asyncTask = new RetrievePeertubeSearchAsyncTask(context, max_id, search_peertube, DisplayStatusFragment.this).execute();
|
||||
}
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return rootView;
|
||||
@ -289,7 +277,6 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
||||
public void pullToRefresh() {
|
||||
if (peertubes.size() > 0) {
|
||||
int size = peertubes.size();
|
||||
isSwipped = true;
|
||||
peertubes.clear();
|
||||
peertubes = new ArrayList<>();
|
||||
max_id = "0";
|
||||
|
@ -125,21 +125,21 @@ public class Helper {
|
||||
"ac-amiens.fr",
|
||||
"ac-besancon.fr",
|
||||
"ac-bordeaux.fr",
|
||||
"ac-clermont.fr",
|
||||
// "ac-clermont.fr",
|
||||
"ac-corse.fr",
|
||||
"ac-creteil.fr",
|
||||
"ac-dijon.fr",
|
||||
"ac-grenoble.fr",
|
||||
"ac-guadeloupe.fr",
|
||||
"ac-guyane.fr",
|
||||
"ac-reunion.fr",
|
||||
// "ac-guadeloupe.fr",
|
||||
// "ac-guyane.fr",
|
||||
// "ac-reunion.fr",
|
||||
"ac-lille.fr",
|
||||
"ac-limoges.fr",
|
||||
"ac-lyon.fr",
|
||||
"ac-martinique.fr",
|
||||
// "ac-martinique.fr",
|
||||
"ac-mayotte.fr",
|
||||
"ac-montpellier.fr",
|
||||
"ac-nancy-metz.fr",
|
||||
"ac-nancy.fr",
|
||||
"ac-nantes.fr",
|
||||
"ac-normandie.fr",
|
||||
"ac-orleans-tours.fr",
|
||||
@ -147,7 +147,7 @@ public class Helper {
|
||||
"ac-poitiers.fr",
|
||||
"outremer.fr",
|
||||
"ac-rennes.fr",
|
||||
"ac-spm.fr",
|
||||
// "ac-spm.fr",
|
||||
"ac-strasbourg.fr",
|
||||
"ac-toulouse.fr",
|
||||
"ac-versailles.fr"
|
||||
|
Reference in New Issue
Block a user