mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
reafactor error handler (renamings), improve issue report url
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
c2e7458f4c
commit
f9196927c4
7 changed files with 47 additions and 11 deletions
|
@ -320,7 +320,7 @@
|
|||
|
||||
<activity android:name=".ui.activity.LogHistoryActivity"/>
|
||||
|
||||
<activity android:name=".ui.errorhandling.ErrorShowActivity"
|
||||
<activity android:name=".ui.errorhandling.ShowErrorActivity"
|
||||
android:theme="@style/Theme.ownCloud.Toolbar"/>
|
||||
<activity android:name=".ui.activity.UploadListActivity" />
|
||||
<activity
|
||||
|
|
|
@ -62,7 +62,7 @@ import com.owncloud.android.ui.activity.UploadListActivity;
|
|||
import com.owncloud.android.ui.activity.UploadPathActivity;
|
||||
import com.owncloud.android.ui.activity.UserInfoActivity;
|
||||
import com.owncloud.android.ui.dialog.ChooseTemplateDialogFragment;
|
||||
import com.owncloud.android.ui.errorhandling.ErrorShowActivity;
|
||||
import com.owncloud.android.ui.errorhandling.ShowErrorActivity;
|
||||
import com.owncloud.android.ui.fragment.ExtendedListFragment;
|
||||
import com.owncloud.android.ui.fragment.FileDetailActivitiesFragment;
|
||||
import com.owncloud.android.ui.fragment.FileDetailFragment;
|
||||
|
@ -94,7 +94,7 @@ abstract class ComponentsModule {
|
|||
@ContributesAndroidInjector abstract CopyToClipboardActivity copyToClipboardActivity();
|
||||
@ContributesAndroidInjector abstract DeepLinkLoginActivity deepLinkLoginActivity();
|
||||
@ContributesAndroidInjector abstract DrawerActivity drawerActivity();
|
||||
@ContributesAndroidInjector abstract ErrorShowActivity errorShowActivity();
|
||||
@ContributesAndroidInjector abstract ShowErrorActivity errorShowActivity();
|
||||
@ContributesAndroidInjector abstract ErrorsWhileCopyingHandlerActivity errorsWhileCopyingHandlerActivity();
|
||||
@ContributesAndroidInjector abstract ExternalSiteWebView externalSiteWebView();
|
||||
@ContributesAndroidInjector abstract FileDisplayActivity fileDisplayActivity();
|
||||
|
|
|
@ -48,8 +48,8 @@ public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
|
|||
|
||||
Log.e(TAG, "An exception was thrown and handled by ExceptionHandler:", exception);
|
||||
|
||||
Intent intent = new Intent(context, ErrorShowActivity.class);
|
||||
intent.putExtra(ErrorShowActivity.EXTRA_ERROR_TEXT, errorReport);
|
||||
Intent intent = new Intent(context, ShowErrorActivity.class);
|
||||
intent.putExtra(ShowErrorActivity.EXTRA_ERROR_TEXT, errorReport);
|
||||
context.startActivity(intent);
|
||||
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
|
|
|
@ -20,27 +20,56 @@
|
|||
package com.owncloud.android.ui.errorhandling
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.owncloud.android.R
|
||||
import kotlinx.android.synthetic.main.errorhandling_showerror.*
|
||||
import com.owncloud.android.utils.ClipboardUtil
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
import com.owncloud.android.utils.ThemeUtils
|
||||
import kotlinx.android.synthetic.main.activity_show_error.*
|
||||
import kotlinx.android.synthetic.main.toolbar_standard.*
|
||||
|
||||
class ErrorShowActivity : AppCompatActivity() {
|
||||
class ShowErrorActivity : AppCompatActivity() {
|
||||
companion object {
|
||||
const val EXTRA_ERROR_TEXT = "error"
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.errorhandling_showerror)
|
||||
setContentView(R.layout.activity_show_error)
|
||||
|
||||
text_view_error.text = intent.getStringExtra(EXTRA_ERROR_TEXT)
|
||||
|
||||
setSupportActionBar(toolbar)
|
||||
setTitle(R.string.common_error)
|
||||
|
||||
val snackbar = DisplayUtils.createSnackbar(
|
||||
error_page_container,
|
||||
R.string.error_report_issue_text, Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(R.string.error_report_issue_action
|
||||
) { v ->
|
||||
reportIssue()
|
||||
}
|
||||
|
||||
ThemeUtils.colorSnackbar(this, snackbar)
|
||||
|
||||
snackbar.show()
|
||||
}
|
||||
|
||||
private fun reportIssue() {
|
||||
ClipboardUtil.copyToClipboard(this, text_view_error.text.toString(), false)
|
||||
val issueLink = getString(R.string.report_issue_link)
|
||||
if (!issueLink.isEmpty()) {
|
||||
val uriUrl = Uri.parse(issueLink)
|
||||
val intent = Intent(Intent.ACTION_VIEW, uriUrl)
|
||||
DisplayUtils.startIntentIfAppAvailable(intent, this, R.string.no_browser_available)
|
||||
}
|
||||
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
7
src/main/res/layout/errorhandling_showerror.xml → src/main/res/layout/activity_show_error.xml
Executable file → Normal file
7
src/main/res/layout/errorhandling_showerror.xml → src/main/res/layout/activity_show_error.xml
Executable file → Normal file
|
@ -21,7 +21,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.errorhandling.ErrorShowActivity">
|
||||
tools:context=".ui.errorhandling.ShowErrorActivity">
|
||||
|
||||
<include layout="@layout/toolbar_standard" />
|
||||
|
||||
|
@ -35,7 +35,10 @@
|
|||
android:id="@+id/text_view_error"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/standard_padding" />
|
||||
android:paddingLeft="@dimen/standard_padding"
|
||||
android:paddingRight="@dimen/standard_padding"
|
||||
android:paddingTop="@dimen/standard_padding"
|
||||
android:paddingBottom="@dimen/standard_list_item_size" />
|
||||
|
||||
</ScrollView>
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
<string name="help_link" translatable="false">https://help.nextcloud.com/c/clients/android</string>
|
||||
<string name="translation_link" translatable="false">https://www.transifex.com/nextcloud/nextcloud/android/</string>
|
||||
<string name="contributing_link" translatable="false">https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md</string>
|
||||
<string name="report_issue_link" translatable="false">https://github.com/nextcloud/android/issues</string>
|
||||
<string name="report_issue_link" translatable="false">https://github.com/nextcloud/android/issues/new/choose</string>
|
||||
|
||||
<!-- login data links -->
|
||||
<string name="login_data_own_scheme" translatable="false">nc</string>
|
||||
|
|
|
@ -876,4 +876,8 @@
|
|||
|
||||
<string name="etm_title">Engineering Test Mode</string>
|
||||
<string name="etm_preferences">Preferences</string>
|
||||
|
||||
<string name="error_report_issue_text">Report issue to tracker? (requires a Github account)</string>
|
||||
<string name="error_report_issue_action">Report</string>
|
||||
<string name="copied_to_clipboard">Copied to clipboard</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue