Some changes
@ -2,7 +2,6 @@ package app.fedilab.fedilabtube.fragment;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -37,9 +36,10 @@ import app.fedilab.fedilabtube.drawer.PeertubeAdapter;
|
|||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.interfaces.OnPostActionInterface;
|
import app.fedilab.fedilabtube.interfaces.OnPostActionInterface;
|
||||||
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
|
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type.POVERVIEW;
|
||||||
|
|
||||||
|
|
||||||
public class DisplayStatusFragment extends Fragment implements OnPostActionInterface, OnRetrieveFeedsInterface {
|
public class DisplayStatusFragment extends Fragment implements OnPostActionInterface, OnRetrieveFeedsInterface {
|
||||||
|
|
||||||
@ -56,11 +56,9 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||||||
private boolean firstLoad;
|
private boolean firstLoad;
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private SharedPreferences sharedpreferences;
|
private SharedPreferences sharedpreferences;
|
||||||
private boolean isSwipped;
|
|
||||||
private String search_peertube;
|
private String search_peertube;
|
||||||
private TextView textviewNoActionText;
|
private TextView textviewNoActionText;
|
||||||
private boolean ischannel;
|
private boolean ischannel;
|
||||||
private boolean ownVideos;
|
|
||||||
private View rootView;
|
private View rootView;
|
||||||
private RecyclerView lv_status;
|
private RecyclerView lv_status;
|
||||||
|
|
||||||
@ -82,25 +80,16 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
String targetedId = bundle.getString("targetedid", null);
|
|
||||||
String tag = bundle.getString("tag", null);
|
|
||||||
search_peertube = bundle.getString("search_peertube", 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);
|
ischannel = bundle.getBoolean("ischannel", false);
|
||||||
int timelineId = bundle.getInt("timelineId");
|
|
||||||
}
|
}
|
||||||
if (ischannel) {
|
if (ischannel) {
|
||||||
type = RetrieveFeedsAsyncTask.Type.CHANNEL;
|
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);
|
lv_status = rootView.findViewById(R.id.lv_status);
|
||||||
|
|
||||||
isSwipped = false;
|
|
||||||
max_id = null;
|
max_id = null;
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
@ -115,9 +104,6 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||||||
textviewNoActionText = rootView.findViewById(R.id.no_action_text);
|
textviewNoActionText = rootView.findViewById(R.id.no_action_text);
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
mainLoader.setVisibility(View.VISIBLE);
|
||||||
nextElementLoader.setVisibility(View.GONE);
|
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);
|
peertubeAdapater = new PeertubeAdapter(this.peertubes);
|
||||||
lv_status.setAdapter(peertubeAdapater);
|
lv_status.setAdapter(peertubeAdapater);
|
||||||
@ -146,29 +132,31 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
if( type != POVERVIEW) {
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
|
||||||
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
int visibleItemCount = mLayoutManager.getChildCount();
|
int visibleItemCount = mLayoutManager.getChildCount();
|
||||||
int totalItemCount = mLayoutManager.getItemCount();
|
int totalItemCount = mLayoutManager.getItemCount();
|
||||||
if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) {
|
if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) {
|
||||||
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
|
||||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).execute();
|
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).execute();
|
||||||
} else {
|
} else {
|
||||||
asyncTask = new RetrievePeertubeSearchAsyncTask(context, max_id, search_peertube, DisplayStatusFragment.this).execute();
|
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;
|
return rootView;
|
||||||
@ -289,7 +277,6 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||||||
public void pullToRefresh() {
|
public void pullToRefresh() {
|
||||||
if (peertubes.size() > 0) {
|
if (peertubes.size() > 0) {
|
||||||
int size = peertubes.size();
|
int size = peertubes.size();
|
||||||
isSwipped = true;
|
|
||||||
peertubes.clear();
|
peertubes.clear();
|
||||||
peertubes = new ArrayList<>();
|
peertubes = new ArrayList<>();
|
||||||
max_id = "0";
|
max_id = "0";
|
||||||
|
@ -125,21 +125,21 @@ public class Helper {
|
|||||||
"ac-amiens.fr",
|
"ac-amiens.fr",
|
||||||
"ac-besancon.fr",
|
"ac-besancon.fr",
|
||||||
"ac-bordeaux.fr",
|
"ac-bordeaux.fr",
|
||||||
"ac-clermont.fr",
|
// "ac-clermont.fr",
|
||||||
"ac-corse.fr",
|
"ac-corse.fr",
|
||||||
"ac-creteil.fr",
|
"ac-creteil.fr",
|
||||||
"ac-dijon.fr",
|
"ac-dijon.fr",
|
||||||
"ac-grenoble.fr",
|
"ac-grenoble.fr",
|
||||||
"ac-guadeloupe.fr",
|
// "ac-guadeloupe.fr",
|
||||||
"ac-guyane.fr",
|
// "ac-guyane.fr",
|
||||||
"ac-reunion.fr",
|
// "ac-reunion.fr",
|
||||||
"ac-lille.fr",
|
"ac-lille.fr",
|
||||||
"ac-limoges.fr",
|
"ac-limoges.fr",
|
||||||
"ac-lyon.fr",
|
"ac-lyon.fr",
|
||||||
"ac-martinique.fr",
|
// "ac-martinique.fr",
|
||||||
"ac-mayotte.fr",
|
"ac-mayotte.fr",
|
||||||
"ac-montpellier.fr",
|
"ac-montpellier.fr",
|
||||||
"ac-nancy-metz.fr",
|
"ac-nancy.fr",
|
||||||
"ac-nantes.fr",
|
"ac-nantes.fr",
|
||||||
"ac-normandie.fr",
|
"ac-normandie.fr",
|
||||||
"ac-orleans-tours.fr",
|
"ac-orleans-tours.fr",
|
||||||
@ -147,7 +147,7 @@ public class Helper {
|
|||||||
"ac-poitiers.fr",
|
"ac-poitiers.fr",
|
||||||
"outremer.fr",
|
"outremer.fr",
|
||||||
"ac-rennes.fr",
|
"ac-rennes.fr",
|
||||||
"ac-spm.fr",
|
// "ac-spm.fr",
|
||||||
"ac-strasbourg.fr",
|
"ac-strasbourg.fr",
|
||||||
"ac-toulouse.fr",
|
"ac-toulouse.fr",
|
||||||
"ac-versailles.fr"
|
"ac-versailles.fr"
|
||||||
|
15
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108"
|
||||||
|
android:tint="#9C27B0">
|
||||||
|
<group android:scaleX="2.61"
|
||||||
|
android:scaleY="2.61"
|
||||||
|
android:translateX="22.68"
|
||||||
|
android:translateY="22.68">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
@ -21,7 +21,7 @@
|
|||||||
android:id="@+id/nav_host_fragment"
|
android:id="@+id/nav_host_fragment"
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
app:defaultNavHost="true"
|
app:defaultNavHost="true"
|
||||||
app:layout_constraintBottom_toTopOf="@id/nav_view"
|
app:layout_constraintBottom_toTopOf="@id/nav_view"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#512DA8</color>
|
||||||
|
</resources>
|