Loading app/src/main/java/it/niedermann/owncloud/notes/android/activity/ExceptionActivity.java +12 −14 Original line number Original line Diff line number Diff line Loading @@ -11,9 +11,6 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import it.niedermann.nextcloud.exception.ExceptionUtil; import it.niedermann.nextcloud.exception.ExceptionUtil; import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.R; Loading @@ -23,28 +20,30 @@ public class ExceptionActivity extends AppCompatActivity { Throwable throwable; Throwable throwable; @BindView(R.id.toolbar) private TextView stacktrace; Toolbar toolbar; @BindView(R.id.message) TextView message; @BindView(R.id.stacktrace) TextView stacktrace; @SuppressLint("SetTextI18n") // only used for logging @SuppressLint("SetTextI18n") // only used for logging @Override @Override protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_exception); setContentView(R.layout.activity_exception); ButterKnife.bind(this); super.onCreate(savedInstanceState); super.onCreate(savedInstanceState); Toolbar toolbar = findViewById(R.id.toolbar); TextView message = findViewById(R.id.message); stacktrace = findViewById(R.id.stacktrace); findViewById(R.id.copy).setOnClickListener((v) -> copyStacktraceToClipboard()); findViewById(R.id.close).setOnClickListener((v) -> close()); setSupportActionBar(toolbar); setSupportActionBar(toolbar); throwable = ((Throwable) getIntent().getSerializableExtra(KEY_THROWABLE)); throwable = ((Throwable) getIntent().getSerializableExtra(KEY_THROWABLE)); throwable.printStackTrace(); throwable.printStackTrace(); toolbar.setTitle(getString(R.string.simple_error)); toolbar.setTitle(getString(R.string.simple_error)); this.message.setText(throwable.getMessage()); message.setText(throwable.getMessage()); this.stacktrace.setText(ExceptionUtil.getDebugInfos(this, throwable)); stacktrace.setText(ExceptionUtil.getDebugInfos(this, throwable)); } } @OnClick(R.id.copy) void copyStacktraceToClipboard() { void copyStacktraceToClipboard() { final ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); final ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipData clipData = ClipData.newPlainText(getString(R.string.simple_exception), "```\n" + this.stacktrace.getText() + "\n```"); ClipData clipData = ClipData.newPlainText(getString(R.string.simple_exception), "```\n" + this.stacktrace.getText() + "\n```"); Loading @@ -52,7 +51,6 @@ public class ExceptionActivity extends AppCompatActivity { Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show(); } } @OnClick(R.id.close) void close() { void close() { finish(); finish(); } } Loading Loading
app/src/main/java/it/niedermann/owncloud/notes/android/activity/ExceptionActivity.java +12 −14 Original line number Original line Diff line number Diff line Loading @@ -11,9 +11,6 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import it.niedermann.nextcloud.exception.ExceptionUtil; import it.niedermann.nextcloud.exception.ExceptionUtil; import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.R; Loading @@ -23,28 +20,30 @@ public class ExceptionActivity extends AppCompatActivity { Throwable throwable; Throwable throwable; @BindView(R.id.toolbar) private TextView stacktrace; Toolbar toolbar; @BindView(R.id.message) TextView message; @BindView(R.id.stacktrace) TextView stacktrace; @SuppressLint("SetTextI18n") // only used for logging @SuppressLint("SetTextI18n") // only used for logging @Override @Override protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_exception); setContentView(R.layout.activity_exception); ButterKnife.bind(this); super.onCreate(savedInstanceState); super.onCreate(savedInstanceState); Toolbar toolbar = findViewById(R.id.toolbar); TextView message = findViewById(R.id.message); stacktrace = findViewById(R.id.stacktrace); findViewById(R.id.copy).setOnClickListener((v) -> copyStacktraceToClipboard()); findViewById(R.id.close).setOnClickListener((v) -> close()); setSupportActionBar(toolbar); setSupportActionBar(toolbar); throwable = ((Throwable) getIntent().getSerializableExtra(KEY_THROWABLE)); throwable = ((Throwable) getIntent().getSerializableExtra(KEY_THROWABLE)); throwable.printStackTrace(); throwable.printStackTrace(); toolbar.setTitle(getString(R.string.simple_error)); toolbar.setTitle(getString(R.string.simple_error)); this.message.setText(throwable.getMessage()); message.setText(throwable.getMessage()); this.stacktrace.setText(ExceptionUtil.getDebugInfos(this, throwable)); stacktrace.setText(ExceptionUtil.getDebugInfos(this, throwable)); } } @OnClick(R.id.copy) void copyStacktraceToClipboard() { void copyStacktraceToClipboard() { final ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); final ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipData clipData = ClipData.newPlainText(getString(R.string.simple_exception), "```\n" + this.stacktrace.getText() + "\n```"); ClipData clipData = ClipData.newPlainText(getString(R.string.simple_exception), "```\n" + this.stacktrace.getText() + "\n```"); Loading @@ -52,7 +51,6 @@ public class ExceptionActivity extends AppCompatActivity { Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show(); } } @OnClick(R.id.close) void close() { void close() { finish(); finish(); } } Loading