Some changes

This commit is contained in:
Thomas 2020-06-27 14:16:45 +02:00
parent 4275183b79
commit 8609862f54
17 changed files with 53 additions and 47 deletions

View File

@ -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";

View File

@ -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"

View 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>

View File

@ -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"

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#512DA8</color>
</resources>