Debug: show last daily rules execution

pull/212/head
M66B 1 year ago
parent 8b9cfc24a9
commit fd83af8771

@ -186,6 +186,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private Button btnRepair;
private Button btnDaily;
private TextView tvLastDaily;
private SwitchCompat swAutostart;
private SwitchCompat swEmergency;
private SwitchCompat swWorkManager;
@ -429,6 +430,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
btnRepair = view.findViewById(R.id.btnRepair);
btnDaily = view.findViewById(R.id.btnDaily);
tvLastDaily = view.findViewById(R.id.tvLastDaily);
swAutostart = view.findViewById(R.id.swAutostart);
swEmergency = view.findViewById(R.id.swEmergency);
swWorkManager = view.findViewById(R.id.swWorkManager);
@ -2132,6 +2134,11 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
setLastCleanup(prefs.getLong("last_cleanup", -1));
if (prefs.contains("last_daily"))
tvLastDaily.setText(new Date(prefs.getLong("last_daily", 0)).toString());
else
tvLastDaily.setText(("-"));
File external = Helper.getExternalFilesDir(getContext());
boolean emulated = (external != null && Environment.isExternalStorageEmulated(external));
tvExternalStorageFolder.setText(
@ -2214,6 +2221,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
if ("last_cleanup".equals(key))
setLastCleanup(prefs.getLong(key, -1));
if ("last_daily".equals(key))
tvLastDaily.setText(new Date(prefs.getLong(key, 0)).toString());
if ("lt_uri".equals(key) ||
"lt_user".equals(key) ||
"lt_key".equals(key) ||

@ -33,6 +33,7 @@ import androidx.work.Worker;
import androidx.work.WorkerParameters;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@ -116,6 +117,9 @@ public class WorkerDailyRules extends Worker {
"Executed " + count + " daily rules for " + account.name + "/" + folder.name);
}
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
prefs.edit().putLong("last_daily", new Date().getTime()).apply();
} catch (Throwable ex) {
Log.e(ex);
} finally {

@ -1388,6 +1388,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnRepair" />
<TextView
android:id="@+id/tvLastDaily"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="daily"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnDaily" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutostart"
android:layout_width="0dp"
@ -1397,7 +1407,7 @@
android:text="@string/title_advanced_autostart"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnDaily"
app:layout_constraintTop_toBottomOf="@id/tvLastDaily"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

Loading…
Cancel
Save