diff --git a/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayStatusFragment.java b/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayStatusFragment.java index 185fa9e..f4c5162 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayStatusFragment.java +++ b/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayStatusFragment.java @@ -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"; diff --git a/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java b/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java index ab3f5f5..d6bebdb 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java +++ b/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java @@ -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" diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..74f2585 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 270e70b..b56c932 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -21,7 +21,7 @@ android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="0dp" app:defaultNavHost="true" app:layout_constraintBottom_toTopOf="@id/nav_view" app:layout_constraintLeft_toLeftOf="parent" diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index eca70cf..7353dbd 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index eca70cf..7353dbd 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index a571e60..0184e0d 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index 61da551..559d866 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index c41dd28..63ed57f 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index db5080a..bd9060f 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 6dba46d..db747e8 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index da31a87..d3684bf 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 15ac681..535d446 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index b216f2d..212dd28 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index f25a419..6e34c12 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index e96783c..082784a 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..884c4c4 --- /dev/null +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #512DA8 + \ No newline at end of file