Debug: show last folder sync time

pull/207/head
M66B 3 years ago
parent a8c37e45b9
commit a05e106c31

@ -257,6 +257,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private ViewGroup view; private ViewGroup view;
private SwipeRefreshLayoutEx swipeRefresh; private SwipeRefreshLayoutEx swipeRefresh;
private TextView tvAirplane; private TextView tvAirplane;
private TextView tvLastSync;
private TextView tvSupport; private TextView tvSupport;
private ImageButton ibHintSupport; private ImageButton ibHintSupport;
private ImageButton ibHintSwipe; private ImageButton ibHintSwipe;
@ -279,6 +280,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private BottomNavigationView bottom_navigation; private BottomNavigationView bottom_navigation;
private ContentLoadingProgressBar pbWait; private ContentLoadingProgressBar pbWait;
private Group grpAirplane; private Group grpAirplane;
private Group grpLastSync;
private Group grpSupport; private Group grpSupport;
private Group grpHintSupport; private Group grpHintSupport;
private Group grpHintSwipe; private Group grpHintSwipe;
@ -336,6 +338,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private boolean quick_scroll; private boolean quick_scroll;
private boolean addresses; private boolean addresses;
private boolean swipe_reply; private boolean swipe_reply;
private boolean last_sync_time;
private int colorPrimary; private int colorPrimary;
private int colorAccent; private int colorAccent;
@ -472,6 +475,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
quick_scroll = prefs.getBoolean("quick_scroll", true); quick_scroll = prefs.getBoolean("quick_scroll", true);
addresses = prefs.getBoolean("addresses", false); addresses = prefs.getBoolean("addresses", false);
swipe_reply = prefs.getBoolean("swipe_reply", false); swipe_reply = prefs.getBoolean("swipe_reply", false);
last_sync_time = prefs.getBoolean("last_sync_time", false);
colorPrimary = Helper.resolveColor(getContext(), R.attr.colorPrimary); colorPrimary = Helper.resolveColor(getContext(), R.attr.colorPrimary);
colorAccent = Helper.resolveColor(getContext(), R.attr.colorAccent); colorAccent = Helper.resolveColor(getContext(), R.attr.colorAccent);
@ -521,6 +525,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
// Get controls // Get controls
swipeRefresh = view.findViewById(R.id.swipeRefresh); swipeRefresh = view.findViewById(R.id.swipeRefresh);
tvAirplane = view.findViewById(R.id.tvAirplane); tvAirplane = view.findViewById(R.id.tvAirplane);
tvLastSync = view.findViewById(R.id.tvLastSync);
tvSupport = view.findViewById(R.id.tvSupport); tvSupport = view.findViewById(R.id.tvSupport);
ibHintSupport = view.findViewById(R.id.ibHintSupport); ibHintSupport = view.findViewById(R.id.ibHintSupport);
ibHintSwipe = view.findViewById(R.id.ibHintSwipe); ibHintSwipe = view.findViewById(R.id.ibHintSwipe);
@ -544,6 +549,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
pbWait = view.findViewById(R.id.pbWait); pbWait = view.findViewById(R.id.pbWait);
grpAirplane = view.findViewById(R.id.grpAirplane); grpAirplane = view.findViewById(R.id.grpAirplane);
grpLastSync = view.findViewById(R.id.grpLastSync);
grpSupport = view.findViewById(R.id.grpSupport); grpSupport = view.findViewById(R.id.grpSupport);
grpHintSupport = view.findViewById(R.id.grpHintSupport); grpHintSupport = view.findViewById(R.id.grpHintSupport);
grpHintSwipe = view.findViewById(R.id.grpHintSwipe); grpHintSwipe = view.findViewById(R.id.grpHintSwipe);
@ -580,7 +586,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} }
}); });
grpAirplane.setVisibility(View.GONE);
tvAirplane.setOnClickListener(new View.OnClickListener() { tvAirplane.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -1479,6 +1484,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
// Initialize // Initialize
FragmentDialogTheme.setBackground(getContext(), view, false); FragmentDialogTheme.setBackground(getContext(), view, false);
grpAirplane.setVisibility(View.GONE);
grpLastSync.setVisibility(View.GONE);
tvNoEmail.setVisibility(View.GONE); tvNoEmail.setVisibility(View.GONE);
tvNoEmailHint.setVisibility(View.GONE); tvNoEmailHint.setVisibility(View.GONE);
etSearch.setVisibility(View.GONE); etSearch.setVisibility(View.GONE);
@ -5733,6 +5740,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
name = getString(R.string.title_name_count, name, NF.format(unseen)); name = getString(R.string.title_name_count, name, NF.format(unseen));
setSubtitle(name); setSubtitle(name);
if (viewType == AdapterMessage.ViewType.FOLDER &&
folders.size() == 1 &&
folders.get(0).last_sync != null) {
tvLastSync.setText(DateUtils.getRelativeTimeSpanString(context,
folders.get(0).last_sync, true));
grpLastSync.setVisibility(View.VISIBLE);
} else
grpLastSync.setVisibility(View.GONE);
fabError.setTag(accountErrors); fabError.setTag(accountErrors);
if (folderErrors || accountErrors) if (folderErrors || accountErrors)
fabError.show(); fabError.show();

@ -157,7 +157,8 @@ public class FragmentOptions extends FragmentBase {
"quick_filter", "quick_scroll", "quick_filter", "quick_scroll",
"experiments", "debug", "log_level", "test1", "test2", "test3", "test4", "test5", "webview_legacy", "experiments", "debug", "log_level", "test1", "test2", "test3", "test4", "test5", "webview_legacy",
"biometrics", "biometrics",
"default_light" "default_light",
"last_sync_time"
}; };
@Override @Override

@ -174,6 +174,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swExactAlarms; private SwitchCompat swExactAlarms;
private SwitchCompat swInfra; private SwitchCompat swInfra;
private SwitchCompat swDupMsgId; private SwitchCompat swDupMsgId;
private SwitchCompat swLastSync;
private SwitchCompat swTestIab; private SwitchCompat swTestIab;
private Button btnImportProviders; private Button btnImportProviders;
private TextView tvProcessors; private TextView tvProcessors;
@ -216,7 +217,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"use_modseq", "uid_command", "perform_expunge", "uid_expunge", "use_modseq", "uid_command", "perform_expunge", "uid_expunge",
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop",
"keep_alive_poll", "empty_pool", "idle_done", "logarithmic_backoff", "keep_alive_poll", "empty_pool", "idle_done", "logarithmic_backoff",
"exact_alarms", "infra", "dkim_verify", "dup_msgids", "test_iab" "exact_alarms", "infra", "dkim_verify", "dup_msgids", "last_sync_time", "test_iab"
}; };
private final static String[] RESET_QUESTIONS = new String[]{ private final static String[] RESET_QUESTIONS = new String[]{
@ -345,6 +346,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swExactAlarms = view.findViewById(R.id.swExactAlarms); swExactAlarms = view.findViewById(R.id.swExactAlarms);
swInfra = view.findViewById(R.id.swInfra); swInfra = view.findViewById(R.id.swInfra);
swDupMsgId = view.findViewById(R.id.swDupMsgId); swDupMsgId = view.findViewById(R.id.swDupMsgId);
swLastSync = view.findViewById(R.id.swLastSync);
swTestIab = view.findViewById(R.id.swTestIab); swTestIab = view.findViewById(R.id.swTestIab);
btnImportProviders = view.findViewById(R.id.btnImportProviders); btnImportProviders = view.findViewById(R.id.btnImportProviders);
tvProcessors = view.findViewById(R.id.tvProcessors); tvProcessors = view.findViewById(R.id.tvProcessors);
@ -1168,6 +1170,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
} }
}); });
swLastSync.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("last_sync_time", checked).apply();
}
});
swTestIab.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swTestIab.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1765,6 +1774,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swExactAlarms.setChecked(prefs.getBoolean("exact_alarms", true)); swExactAlarms.setChecked(prefs.getBoolean("exact_alarms", true));
swInfra.setChecked(prefs.getBoolean("infra", false)); swInfra.setChecked(prefs.getBoolean("infra", false));
swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false)); swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false));
swLastSync.setChecked(prefs.getBoolean("last_sync_time", false));
swTestIab.setChecked(prefs.getBoolean("test_iab", false)); swTestIab.setChecked(prefs.getBoolean("test_iab", false));
tvProcessors.setText(getString(R.string.title_advanced_processors, Runtime.getRuntime().availableProcessors())); tvProcessors.setText(getString(R.string.title_advanced_processors, Runtime.getRuntime().availableProcessors()));

@ -40,6 +40,27 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAirplane" /> app:layout_constraintTop_toBottomOf="@id/tvAirplane" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvLastSync"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:text="@string/title_last_connected"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorAirplane" />
<View
android:id="@+id/vSeparatorLastSync"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/colorSeparator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLastSync" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvSupport" android:id="@+id/tvSupport"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -50,7 +71,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vSeparatorAirplane" /> app:layout_constraintTop_toBottomOf="@+id/vSeparatorLastSync" />
<View <View
android:id="@+id/vSeparatorSupport" android:id="@+id/vSeparatorSupport"
@ -429,6 +450,12 @@
android:layout_height="0dp" android:layout_height="0dp"
app:constraint_referenced_ids="tvAirplane,vSeparatorAirplane" /> app:constraint_referenced_ids="tvAirplane,vSeparatorAirplane" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpLastSync"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvLastSync,vSeparatorLastSync" />
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
android:id="@+id/grpSupport" android:id="@+id/grpSupport"
android:layout_width="0dp" android:layout_width="0dp"

@ -1435,6 +1435,17 @@
app:layout_constraintTop_toBottomOf="@id/tvDkimVerifyHint" app:layout_constraintTop_toBottomOf="@id/tvDkimVerifyHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swLastSync"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_show_last_sync"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDupMsgId"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swTestIab" android:id="@+id/swTestIab"
android:layout_width="0dp" android:layout_width="0dp"
@ -1443,7 +1454,7 @@
android:text="@string/title_advanced_test_iab" android:text="@string/title_advanced_test_iab"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDupMsgId" app:layout_constraintTop_toBottomOf="@id/swLastSync"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<Button <Button

@ -750,6 +750,7 @@
<string name="title_advanced_exact_alarms" translatable="false">Use exact timers</string> <string name="title_advanced_exact_alarms" translatable="false">Use exact timers</string>
<string name="title_advanced_infra" translatable="false">Show infrastructure</string> <string name="title_advanced_infra" translatable="false">Show infrastructure</string>
<string name="title_advanced_dup_msgid" translatable="false">Duplicates by message ID</string> <string name="title_advanced_dup_msgid" translatable="false">Duplicates by message ID</string>
<string name="title_advanced_show_last_sync" translatable="false">Show last sync time</string>
<string name="title_advanced_test_iab" translatable="false">Test IAB</string> <string name="title_advanced_test_iab" translatable="false">Test IAB</string>
<string name="title_advanced_import_providers" translatable="false">Import providers</string> <string name="title_advanced_import_providers" translatable="false">Import providers</string>
<string name="title_advanced_processors" translatable="false">Processors: %1$d</string> <string name="title_advanced_processors" translatable="false">Processors: %1$d</string>

Loading…
Cancel
Save