浏览代码

Remove theming, use better title

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 5 年之前
父节点
当前提交
1d79f899af

+ 6 - 25
src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt

@@ -24,17 +24,16 @@ import android.net.Uri
 import android.os.Bundle
 import android.view.Menu
 import android.view.MenuItem
-import android.view.View
 import android.widget.Toast
 import androidx.appcompat.app.AppCompatActivity
 import com.google.android.material.snackbar.Snackbar
 import com.owncloud.android.R
 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 ShowErrorActivity : AppCompatActivity() {
     companion object {
         const val EXTRA_ERROR_TEXT = "error"
@@ -47,37 +46,22 @@ class ShowErrorActivity : AppCompatActivity() {
         text_view_error.text = intent.getStringExtra(EXTRA_ERROR_TEXT)
 
         setSupportActionBar(toolbar)
+        supportActionBar!!.title = createErrorTitle()
 
         val snackbar = DisplayUtils.createSnackbar(
             error_page_container,
             R.string.error_report_issue_text, Snackbar.LENGTH_INDEFINITE)
             .setAction(R.string.error_report_issue_action) { reportIssue() }
 
-        val primaryColor = ThemeUtils.primaryColor(this)
-        val fontColor = ThemeUtils.fontColor(this)
-
-        ThemeUtils.colorSnackbar(this, snackbar)
-        ThemeUtils.colorStatusBar(this, primaryColor)
-        progressBar?.visibility = View.GONE
-
-        toolbar.setBackgroundColor(primaryColor)
-        if (toolbar.overflowIcon != null) {
-            ThemeUtils.tintDrawable(toolbar.overflowIcon, fontColor)
-        }
-
-        if (toolbar.navigationIcon != null) {
-            ThemeUtils.tintDrawable(toolbar.navigationIcon, fontColor)
-        }
-
-        ThemeUtils.setColoredTitle(supportActionBar, R.string.common_error, this)
-
         snackbar.show()
     }
 
+    private fun createErrorTitle() = String.format(getString(R.string.error_crash_title), getString(R.string.app_name))
+
     private fun reportIssue() {
         ClipboardUtil.copyToClipboard(this, text_view_error.text.toString(), false)
         val issueLink = getString(R.string.report_issue_link)
-        if (!issueLink.isEmpty()) {
+        if (issueLink.isNotEmpty()) {
             val uriUrl = Uri.parse(issueLink)
             val intent = Intent(Intent.ACTION_VIEW, uriUrl)
             DisplayUtils.startIntentIfAppAvailable(intent, this, R.string.no_browser_available)
@@ -87,9 +71,6 @@ class ShowErrorActivity : AppCompatActivity() {
 
     override fun onCreateOptionsMenu(menu: Menu?): Boolean {
         menuInflater.inflate(R.menu.activity_error_show, menu)
-
-        ThemeUtils.tintDrawable(menu?.findItem(R.id.error_share)?.icon, ThemeUtils.fontColor(this))
-
         return super.onCreateOptionsMenu(menu)
     }
 
@@ -102,7 +83,7 @@ class ShowErrorActivity : AppCompatActivity() {
 
     private fun onClickedShare() {
         val intent = Intent(Intent.ACTION_SEND)
-        intent.putExtra(Intent.EXTRA_SUBJECT, "Nextcloud Error")
+        intent.putExtra(Intent.EXTRA_SUBJECT, createErrorTitle())
         intent.putExtra(Intent.EXTRA_TEXT, text_view_error.text)
         intent.type = "text/plain"
         startActivity(intent)

+ 1 - 0
src/main/res/values/strings.xml

@@ -879,5 +879,6 @@
 
     <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="error_crash_title">%1$s crashed</string>
     <string name="copied_to_clipboard">Copied to clipboard</string>
 </resources>