Some fixes

This commit is contained in:
Thomas 2023-03-08 16:41:01 +01:00
parent 2687f85935
commit 9a08f5eb5f
3 changed files with 14 additions and 4 deletions

View file

@ -16,6 +16,7 @@ package app.fedilab.android.mastodon.activities;
import static app.fedilab.android.mastodon.helper.Helper.dateDiffFull; import static app.fedilab.android.mastodon.helper.Helper.dateDiffFull;
import static app.fedilab.android.mastodon.helper.Helper.dateDiffFullShort;
import static app.fedilab.android.mastodon.viewmodel.mastodon.TimelinesVM.sortAsc; import static app.fedilab.android.mastodon.viewmodel.mastodon.TimelinesVM.sortAsc;
import android.content.Context; import android.content.Context;
@ -281,8 +282,8 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
int inc = 0; int inc = 0;
for (TimelineCacheLogs timelineCacheLogs : timelineCacheLogsListToAnalyse) { for (TimelineCacheLogs timelineCacheLogs : timelineCacheLogsListToAnalyse) {
//X-Axis //X-Axis
SimpleDateFormat df = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()); //X-Axis
String xDate = df.format(timelineCacheLogs.created_at); String xDate = dateDiffFullShort(timelineCacheLogs.created_at);
xVals2.add(xDate); xVals2.add(xDate);
//Entries //Entries
failEntry.add(new BarEntry(inc, timelineCacheLogs.failed)); failEntry.add(new BarEntry(inc, timelineCacheLogs.failed));

View file

@ -1654,6 +1654,16 @@ public class Helper {
} }
} }
public static String dateDiffFullShort(Date dateToot) {
SimpleDateFormat df = (SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault());
try {
return df.format(dateToot);
} catch (Exception e) {
return "";
}
}
/** /**
* Makes the tvDate TextView field clickable, and displays the absolute date & time of a toot * Makes the tvDate TextView field clickable, and displays the absolute date & time of a toot
* for 5 seconds. * for 5 seconds.

View file

@ -41,7 +41,6 @@ import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.mastodon.client.endpoints.MastodonTimelinesService; import app.fedilab.android.mastodon.client.endpoints.MastodonTimelinesService;
import app.fedilab.android.mastodon.client.entities.api.Pagination; import app.fedilab.android.mastodon.client.entities.api.Pagination;
import app.fedilab.android.mastodon.client.entities.api.Status; import app.fedilab.android.mastodon.client.entities.api.Status;
@ -165,7 +164,7 @@ public class FetchHomeWorker extends Worker {
boolean failed = false; boolean failed = false;
int fetched = 0, inserted = 0, updated = 0, frequency = 0; int fetched = 0, inserted = 0, updated = 0, frequency = 0;
String timeRefresh = prefs.getString(context.getString(R.string.SET_FETCH_HOME_DELAY_VALUE) + MainActivity.currentUserID + MainActivity.currentInstance, "60"); String timeRefresh = prefs.getString(context.getString(R.string.SET_FETCH_HOME_DELAY_VALUE) + account.user_id + account.instance, "60");
try { try {
frequency = Integer.parseInt(timeRefresh); frequency = Integer.parseInt(timeRefresh);
} catch (Exception ignored) { } catch (Exception ignored) {