Show uuid when debug mode enabled

pull/156/head
M66B 6 years ago
parent 89c45410da
commit ef3a03ca87

@ -37,6 +37,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.SwitchCompat;
import androidx.constraintlayout.widget.Group;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.bugsnag.android.Bugsnag; import com.bugsnag.android.Bugsnag;
@ -58,6 +59,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvMemoryClass; private TextView tvMemoryClass;
private TextView tvLastCleanup; private TextView tvLastCleanup;
private TextView tvUuid;
private Group grpDebug;
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"badge", "subscriptions", "subscribed_only", "english", "authentication", "paranoid", "watchdog", "updates", "crash_reports", "debug" "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); tvMemoryClass = view.findViewById(R.id.tvMemoryClass);
tvLastCleanup = view.findViewById(R.id.tvLastCleanup); tvLastCleanup = view.findViewById(R.id.tvLastCleanup);
tvUuid = view.findViewById(R.id.tvUuid);
grpDebug = view.findViewById(R.id.grpDebug);
setOptions(); setOptions();
@ -186,8 +193,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("debug", checked).apply(); prefs.edit().putBoolean("debug", checked).apply();
tvMemoryClass.setVisibility(checked ? View.VISIBLE : View.GONE); grpDebug.setVisibility(checked ? View.VISIBLE : View.GONE);
tvLastCleanup.setVisibility(checked ? View.VISIBLE : View.GONE);
ServiceSynchronize.reload(getContext(), "debug=" + checked); ServiceSynchronize.reload(getContext(), "debug=" + checked);
} }
}); });
@ -258,9 +264,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
ActivityManager am = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE); ActivityManager am = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
int class_mb = am.getMemoryClass(); int class_mb = am.getMemoryClass();
tvMemoryClass.setText(getString(R.string.title_advanced_memory_class, class_mb + " MB")); 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); grpDebug.setVisibility(swDebug.isChecked() ? View.VISIBLE : View.GONE);
tvLastCleanup.setVisibility(swDebug.isChecked() ? View.VISIBLE : View.GONE);
} }
private void setLastCleanup(long time) { private void setLastCleanup(long time) {

@ -213,6 +213,25 @@
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/tvMemoryClass" /> app:layout_constraintTop_toBottomOf="@id/tvMemoryClass" />
<TextView
android:id="@+id/tvUuid"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_uuid"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLastCleanup" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpDebug"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="
tvMemoryClass,tvLastCleanup,tvUuid" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -229,8 +229,9 @@
<string name="title_advanced_updates">Check for updates</string> <string name="title_advanced_updates">Check for updates</string>
<string name="title_advanced_crash_reports">Send error reports</string> <string name="title_advanced_crash_reports">Send error reports</string>
<string name="title_advanced_debug">Debug mode</string> <string name="title_advanced_debug">Debug mode</string>
<string name="title_advanced_memory_class">Memory class: %1$s</string> <string name="title_advanced_memory_class" translatable="false">Memory class: %1$s</string>
<string name="title_advanced_last_cleanup">Last cleanup: %1$s</string> <string name="title_advanced_last_cleanup" translatable="false">Last cleanup: %1$s</string>
<string name="title_advanced_uuid" translatable="false">UUID: %1$s</string>
<string name="title_advanced_enabled_hint">Globally disable or enable receiving of messages</string> <string name="title_advanced_enabled_hint">Globally disable or enable receiving of messages</string>
<string name="title_advanced_manual_hint">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.</string> <string name="title_advanced_manual_hint">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.</string>

Loading…
Cancel
Save