mirror of https://github.com/M66B/FairEmail.git
Show last cleanup time
This commit is contained in:
parent
1ae23fb11f
commit
240a30b1a3
|
@ -115,6 +115,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
|||
private SwitchCompat swEnglish;
|
||||
private SwitchCompat swUpdates;
|
||||
private SwitchCompat swDebug;
|
||||
private TextView tvLastCleanup;
|
||||
|
||||
private Group grpSearchLocal;
|
||||
private Group grpNotification;
|
||||
|
@ -201,6 +202,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
|||
swEnglish = view.findViewById(R.id.swEnglish);
|
||||
swUpdates = view.findViewById(R.id.swUpdates);
|
||||
swDebug = view.findViewById(R.id.swDebug);
|
||||
tvLastCleanup = view.findViewById(R.id.tvLastCleanup);
|
||||
|
||||
grpSearchLocal = view.findViewById(R.id.grpSearchLocal);
|
||||
grpNotification = view.findViewById(R.id.grpNotification);
|
||||
|
@ -596,6 +598,12 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
|||
}
|
||||
});
|
||||
|
||||
long last_cleanup = prefs.getLong("last_cleanup", -1);
|
||||
java.text.DateFormat df = SimpleDateFormat.getDateTimeInstance();
|
||||
tvLastCleanup.setText(
|
||||
getString(R.string.title_advanced_last_cleanup,
|
||||
last_cleanup < 0 ? "-" : df.format(last_cleanup)));
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
return view;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package eu.faircode.email;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.work.Constraints;
|
||||
|
@ -156,6 +158,10 @@ public class WorkerCleanup extends Worker {
|
|||
Log.e(ex);
|
||||
} finally {
|
||||
Log.i("End cleanup");
|
||||
if (!manual) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putLong("last_cleanup", new Date().getTime()).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -964,6 +964,19 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swUpdates"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLastCleanup"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:text="@string/title_advanced_last_cleanup"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swDebug" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpSearchLocal"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -203,6 +203,7 @@
|
|||
<string name="title_advanced_paranoid">Extra privacy features</string>
|
||||
<string name="title_advanced_updates">Check for updates</string>
|
||||
<string name="title_advanced_debug">Debug mode</string>
|
||||
<string name="title_advanced_last_cleanup">Last cleanup: %1$s</string>
|
||||
|
||||
<string name="title_advanced_enabled_hint">Globally disable or enable receiving and sending of messages</string>
|
||||
<string name="title_advanced_schedule_hint">Tap on a time to set a time</string>
|
||||
|
|
Loading…
Reference in New Issue