abis = new LinkedList<>();
- abis.add(Build.CPU_ABI);
- if (Build.CPU_ABI2 != null && !"unknown".equals(Build.CPU_ABI2)) {
- abis.add(Build.CPU_ABI2);
- }
- return abis;
- }
- }
-
- /**
- * This interface must be implemented by activities that contain this
- * fragment to allow an interaction in this fragment to be communicated
- * to the activity and potentially other fragments contained in that
- * activity.
- *
- * See the Android Training lesson Communicating with Other Fragments for more information.
- */
- public interface OnLogSubmittedListener {
- public void onSuccess();
- public void onFailure();
- public void onCancel();
- }
-
- private static final class LogPreviewAdapter extends RecyclerView.Adapter {
-
- private String[] lines = new String[0];
-
- @Override
- public LogPreviewViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
- return new LogPreviewViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_log_preview, parent, false));
- }
-
- @Override
- public void onBindViewHolder(LogPreviewViewHolder holder, int position) {
- holder.bind(lines, position);
- }
-
- @Override
- public void onViewRecycled(LogPreviewViewHolder holder) {
- holder.unbind();
- }
-
- @Override
- public int getItemCount() {
- return lines.length;
- }
-
- void setText(@NonNull String text) {
- lines = text.split("\n");
- notifyDataSetChanged();
- }
-
- String getText() {
- return Util.join(lines, "\n");
- }
- }
-
- private static final class LogPreviewViewHolder extends RecyclerView.ViewHolder {
-
- private EditText text;
- private String[] lines;
- private int index;
-
- LogPreviewViewHolder(View itemView) {
- super(itemView);
- text = (EditText) itemView;
- }
-
- void bind(String[] lines, int index) {
- this.lines = lines;
- this.index = index;
-
- text.setText(lines[index]);
- text.addTextChangedListener(textWatcher);
- }
-
- void unbind() {
- text.removeTextChangedListener(textWatcher);
- }
-
- private final SimpleTextWatcher textWatcher = new SimpleTextWatcher() {
- @Override
- public void onTextChanged(String text) {
- if (lines != null) {
- lines[index] = text;
- }
- }
- };
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/AdvancedPreferenceFragment.java b/app/src/main/java/org/thoughtcrime/securesms/preferences/AdvancedPreferenceFragment.java
index 8ebfc686850..3780edb1313 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/preferences/AdvancedPreferenceFragment.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/AdvancedPreferenceFragment.java
@@ -4,10 +4,8 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
-import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.widget.Toast;
@@ -26,10 +24,10 @@
import com.google.firebase.iid.FirebaseInstanceId;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
-import org.thoughtcrime.securesms.LogSubmitActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.contacts.ContactAccessor;
import org.thoughtcrime.securesms.contacts.ContactIdentityManager;
+import org.thoughtcrime.securesms.logsubmit.SubmitDebugLogActivity;
import org.thoughtcrime.securesms.registration.RegistrationNavigationActivity;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
@@ -146,7 +144,7 @@ private void handleIdentitySelection(Intent data) {
private class SubmitDebugLogListener implements Preference.OnPreferenceClickListener {
@Override
public boolean onPreferenceClick(Preference preference) {
- final Intent intent = new Intent(getActivity(), LogSubmitActivity.class);
+ final Intent intent = new Intent(getActivity(), SubmitDebugLogActivity.class);
startActivity(intent);
return true;
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/BaseRegistrationFragment.java b/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/BaseRegistrationFragment.java
index 6828144a381..7ebc2d0df3f 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/BaseRegistrationFragment.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/BaseRegistrationFragment.java
@@ -17,8 +17,8 @@
import com.dd.CircularProgressButton;
-import org.thoughtcrime.securesms.LogSubmitActivity;
import org.thoughtcrime.securesms.R;
+import org.thoughtcrime.securesms.logsubmit.SubmitDebugLogActivity;
import org.thoughtcrime.securesms.registration.viewmodel.RegistrationViewModel;
import static org.thoughtcrime.securesms.registration.RegistrationNavigationActivity.RE_REGISTRATION_EXTRA;
@@ -95,7 +95,7 @@ public void onClick(View v) {
debugTapCounter++;
if (debugTapCounter >= DEBUG_TAP_TARGET) {
- context.startActivity(new Intent(context, LogSubmitActivity.class));
+ context.startActivity(new Intent(context, SubmitDebugLogActivity.class));
} else if (debugTapCounter >= DEBUG_TAP_ANNOUNCE) {
int remaining = DEBUG_TAP_TARGET - debugTapCounter;
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/ByteUnit.java b/app/src/main/java/org/thoughtcrime/securesms/util/ByteUnit.java
new file mode 100644
index 00000000000..739419d98ce
--- /dev/null
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/ByteUnit.java
@@ -0,0 +1,40 @@
+package org.thoughtcrime.securesms.util;
+
+/**
+ * Just like {@link java.util.concurrent.TimeUnit}, but for bytes.
+ */
+public enum ByteUnit {
+
+ BYTES {
+ public long toBytes(long d) { return d; }
+ public long toKilobytes(long d) { return d/1024; }
+ public long toMegabytes(long d) { return toKilobytes(d)/1024; }
+ public long toGigabytes(long d) { return toMegabytes(d)/1024; }
+ },
+
+ KILOBYTES {
+ public long toBytes(long d) { return d * 1024; }
+ public long toKilobytes(long d) { return d; }
+ public long toMegabytes(long d) { return d/1024; }
+ public long toGigabytes(long d) { return toMegabytes(d)/1024; }
+ },
+
+ MEGABYTES {
+ public long toBytes(long d) { return toKilobytes(d) * 1024; }
+ public long toKilobytes(long d) { return d * 1024; }
+ public long toMegabytes(long d) { return d; }
+ public long toGigabytes(long d) { return d/1024; }
+ },
+
+ GIGABYTES {
+ public long toBytes(long d) { return toKilobytes(d) * 1024; }
+ public long toKilobytes(long d) { return toMegabytes(d) * 1024; }
+ public long toMegabytes(long d) { return d * 1024; }
+ public long toGigabytes(long d) { return d; }
+ };
+
+ public long toBytes(long d) { throw new AbstractMethodError(); }
+ public long toKilobytes(long d) { throw new AbstractMethodError(); }
+ public long toMegabytes(long d) { throw new AbstractMethodError(); }
+ public long toGigabytes(long d) { throw new AbstractMethodError(); }
+}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/DefaultValueLiveData.java b/app/src/main/java/org/thoughtcrime/securesms/util/DefaultValueLiveData.java
new file mode 100644
index 00000000000..68b9623558b
--- /dev/null
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/DefaultValueLiveData.java
@@ -0,0 +1,19 @@
+package org.thoughtcrime.securesms.util;
+
+import androidx.annotation.NonNull;
+import androidx.lifecycle.MutableLiveData;
+
+public class DefaultValueLiveData extends MutableLiveData {
+
+ private final T defaultValue;
+
+ public DefaultValueLiveData(@NonNull T defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public @NonNull T getValue() {
+ T value = super.getValue();
+ return value != null ? value : defaultValue;
+ }
+}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtil.java b/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtil.java
index 3782dc3f0ed..cf438a23aa4 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtil.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtil.java
@@ -266,6 +266,10 @@ public static void setPaddingBottom(@NonNull View view, int padding) {
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), padding);
}
+ public static void setPadding(@NonNull View view, int padding) {
+ view.setPadding(padding, padding, padding, padding);
+ }
+
public static boolean isPointInsideView(@NonNull View view, float x, float y) {
int[] location = new int[2];
diff --git a/app/src/main/res/layout/fragment_submit_log.xml b/app/src/main/res/layout/fragment_submit_log.xml
deleted file mode 100644
index e7eafcc9ee4..00000000000
--- a/app/src/main/res/layout/fragment_submit_log.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/submit_debug_log_activity.xml b/app/src/main/res/layout/submit_debug_log_activity.xml
new file mode 100644
index 00000000000..4370fe25b4a
--- /dev/null
+++ b/app/src/main/res/layout/submit_debug_log_activity.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/submit_debug_log_line_item.xml b/app/src/main/res/layout/submit_debug_log_line_item.xml
new file mode 100644
index 00000000000..8bfa296f224
--- /dev/null
+++ b/app/src/main/res/layout/submit_debug_log_line_item.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/menu/submit_debug_log_normal.xml b/app/src/main/res/menu/submit_debug_log_normal.xml
new file mode 100644
index 00000000000..2f7e2f4dac5
--- /dev/null
+++ b/app/src/main/res/menu/submit_debug_log_normal.xml
@@ -0,0 +1,25 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index 539b46051d0..8506da35498 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -261,6 +261,13 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/debuglog_colors.xml b/app/src/main/res/values/debuglog_colors.xml
new file mode 100644
index 00000000000..e1f07d7cad5
--- /dev/null
+++ b/app/src/main/res/values/debuglog_colors.xml
@@ -0,0 +1,16 @@
+
+
+ @color/core_black
+ #515151
+ #089314
+ #0a7087
+ #b58c12
+ #af0d0a
+
+ @color/core_white
+ #8a8a8a
+ #5ca72b
+ #46bbb9
+ #cdd637
+ #ff6b68
+
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 08165d5942c..1cf2ead3041 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -149,4 +149,6 @@
8dp
+ 12sp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0ddaaccd867..f794de8034b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -870,6 +870,18 @@
Stickers
Failed to load sticker pack
+
+ Edit
+ Done
+ Tap a line to delete it
+ Submit
+ Failed to submit logs
+ Success!
+ Copy this URL and add it to your issue report or support email:\n\n%1$s
+ Copied to clipboard
+ Ok
+ Share
+
Group updated
Left the group
@@ -1282,9 +1294,6 @@
This log will be posted publicly online for contributors to view, you may examine and edit it before submitting.
Loading logs…
Uploading logs…
- Success!
- Copy this URL and add it to your issue report or support email:\n\n%1$s\n
- Copied to clipboard
Choose email app
Please review this log from my app: %1$s
Network failure. Please try again.
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 98c441678fd..d3bba18cb66 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -249,6 +249,13 @@
- @drawable/contact_list_divider_light
+ - @color/debuglog_light_none
+ - @color/debuglog_light_verbose
+ - @color/debuglog_light_debug
+ - @color/debuglog_light_info
+ - @color/debuglog_light_warn
+ - @color/debuglog_light_error
+
- @color/core_grey_05
- @color/core_grey_05
@@ -496,6 +503,13 @@
- @drawable/contact_list_divider_dark
+ - @color/debuglog_dark_none
+ - @color/debuglog_dark_verbose
+ - @color/debuglog_dark_debug
+ - @color/debuglog_dark_info
+ - @color/debuglog_dark_warn
+ - @color/debuglog_dark_error
+
- @color/core_grey_95
- @drawable/ic_info_outline_dark