From ef3a03ca87f798ce36ae87a42d213d11c9a1628d Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 26 May 2019 12:41:41 +0200 Subject: [PATCH] Show uuid when debug mode enabled --- .../faircode/email/FragmentOptionsMisc.java | 14 ++++++++++---- .../main/res/layout/fragment_options_misc.xml | 19 +++++++++++++++++++ app/src/main/res/values/strings.xml | 5 +++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index c439853a93..8b020aa66f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -37,6 +37,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SwitchCompat; +import androidx.constraintlayout.widget.Group; import androidx.preference.PreferenceManager; import com.bugsnag.android.Bugsnag; @@ -58,6 +59,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private TextView tvMemoryClass; private TextView tvLastCleanup; + private TextView tvUuid; + + private Group grpDebug; private final static String[] RESET_OPTIONS = new String[]{ "badge", "subscriptions", "subscribed_only", "english", "authentication", "paranoid", "watchdog", "updates", "crash_reports", "debug" @@ -91,6 +95,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc tvMemoryClass = view.findViewById(R.id.tvMemoryClass); tvLastCleanup = view.findViewById(R.id.tvLastCleanup); + tvUuid = view.findViewById(R.id.tvUuid); + + grpDebug = view.findViewById(R.id.grpDebug); setOptions(); @@ -186,8 +193,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("debug", checked).apply(); - tvMemoryClass.setVisibility(checked ? View.VISIBLE : View.GONE); - tvLastCleanup.setVisibility(checked ? View.VISIBLE : View.GONE); + grpDebug.setVisibility(checked ? View.VISIBLE : View.GONE); ServiceSynchronize.reload(getContext(), "debug=" + checked); } }); @@ -258,9 +264,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc ActivityManager am = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE); int class_mb = am.getMemoryClass(); tvMemoryClass.setText(getString(R.string.title_advanced_memory_class, class_mb + " MB")); + tvUuid.setText(prefs.getString("uuid", null)); - tvMemoryClass.setVisibility(swDebug.isChecked() ? View.VISIBLE : View.GONE); - tvLastCleanup.setVisibility(swDebug.isChecked() ? View.VISIBLE : View.GONE); + grpDebug.setVisibility(swDebug.isChecked() ? View.VISIBLE : View.GONE); } private void setLastCleanup(long time) { diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 1eb7a3db3c..7b53693171 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -213,6 +213,25 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvMemoryClass" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d994adb035..bef011738c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -229,8 +229,9 @@ Check for updates Send error reports Debug mode - Memory class: %1$s - Last cleanup: %1$s + Memory class: %1$s + Last cleanup: %1$s + UUID: %1$s Globally disable or enable receiving of messages If synchronization is disabled, it is still possible to synchronize manually by pulling down the message list. This will synchronize messages and execute operations for a limited time.