mirror of
https://github.com/PhilKes/NotallyX.git
synced 2025-06-28 12:19:55 +00:00
Fix ErrorActivity report bug
This commit is contained in:
parent
ceaf4cc3a3
commit
c749ff1018
4 changed files with 25 additions and 47 deletions
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -22,7 +22,7 @@ body:
|
||||||
- type: input
|
- type: input
|
||||||
id: android-version
|
id: android-version
|
||||||
attributes:
|
attributes:
|
||||||
label: Android Version
|
label: Android Version (API Level)
|
||||||
description: What Android version are you using?
|
description: What Android version are you using?
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: logs
|
id: logs
|
||||||
|
|
|
@ -261,7 +261,7 @@ fun Context.createReportBugIntent(
|
||||||
return Intent(
|
return Intent(
|
||||||
Intent.ACTION_VIEW,
|
Intent.ACTION_VIEW,
|
||||||
Uri.parse(
|
Uri.parse(
|
||||||
"https://github.com/PhilKes/NotallyX/issues/new?labels=bug&projects=&template=bug_report.yml${title?.let { "&title=$it" }}${body?.let { "&what-happened=$it" }}&version=${BuildConfig.VERSION_NAME}&android-version=${Build.VERSION.SDK_INT}${stackTrace?.let { "&logs=$stackTrace" } ?: ""}"
|
"https://github.com/PhilKes/NotallyX/issues/new?labels=bug&projects=&template=bug_report.yml${title?.let { "&title=$it" } ?: ""}${body?.let { "&what-happened=$it" } ?: ""}&version=${BuildConfig.VERSION_NAME}&android-version=${Build.VERSION.SDK_INT}${stackTrace?.let { "&logs=$stackTrace" } ?: ""}"
|
||||||
.take(2000)
|
.take(2000)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,57 +1,34 @@
|
||||||
package com.philkes.notallyx.utils
|
package com.philkes.notallyx.utils
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Button
|
|
||||||
import android.widget.ImageView
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import cat.ereza.customactivityoncrash.CustomActivityOnCrash
|
import cat.ereza.customactivityoncrash.CustomActivityOnCrash
|
||||||
import com.philkes.notallyx.R
|
import com.philkes.notallyx.databinding.ActivityErrorBinding
|
||||||
import com.philkes.notallyx.presentation.dp
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity used when the app is about to crash. Implicitly used by cat.ereza:customactivityoncrash.
|
* Activity used when the app is about to crash. Implicitly used by
|
||||||
|
* `cat.ereza:customactivityoncrash`.
|
||||||
*/
|
*/
|
||||||
class ErrorActivity : AppCompatActivity() {
|
class ErrorActivity : AppCompatActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_error)
|
val binding = ActivityErrorBinding.inflate(layoutInflater)
|
||||||
findViewById<ImageView>(
|
setContentView(binding.root)
|
||||||
cat.ereza.customactivityoncrash.R.id.customactivityoncrash_error_activity_image
|
binding.apply {
|
||||||
)
|
RestartButton.setOnClickListener {
|
||||||
.apply {
|
CustomActivityOnCrash.restartApplication(
|
||||||
minimumWidth = 100.dp(this@ErrorActivity)
|
this@ErrorActivity,
|
||||||
minimumHeight = 100.dp(this@ErrorActivity)
|
CustomActivityOnCrash.getConfigFromIntent(intent)!!,
|
||||||
setImageResource(R.drawable.error)
|
|
||||||
}
|
|
||||||
findViewById<Button>(
|
|
||||||
cat.ereza.customactivityoncrash.R.id
|
|
||||||
.customactivityoncrash_error_activity_restart_button
|
|
||||||
)
|
|
||||||
.apply {
|
|
||||||
setText(
|
|
||||||
cat.ereza.customactivityoncrash.R.string
|
|
||||||
.customactivityoncrash_error_activity_restart_app
|
|
||||||
)
|
)
|
||||||
setOnClickListener {
|
|
||||||
CustomActivityOnCrash.restartApplication(
|
|
||||||
this@ErrorActivity,
|
|
||||||
CustomActivityOnCrash.getConfigFromIntent(intent)!!,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
val stackTrace = CustomActivityOnCrash.getStackTraceFromIntent(intent)
|
|
||||||
stackTrace?.let { application.log(TAG, stackTrace = it) }
|
val stackTrace = CustomActivityOnCrash.getStackTraceFromIntent(intent)
|
||||||
findViewById<Button>(
|
stackTrace?.let { application.log(TAG, stackTrace = it) }
|
||||||
cat.ereza.customactivityoncrash.R.id
|
ReportButton.setOnClickListener {
|
||||||
.customactivityoncrash_error_activity_more_info_button
|
reportBug(CustomActivityOnCrash.getStackTraceFromIntent(intent))
|
||||||
)
|
|
||||||
.apply {
|
|
||||||
setText(R.string.report_crash)
|
|
||||||
setOnClickListener {
|
|
||||||
reportBug(CustomActivityOnCrash.getStackTraceFromIntent(intent))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -22,11 +22,12 @@
|
||||||
android:paddingTop="@dimen/customactivityoncrash_activity_vertical_margin">
|
android:paddingTop="@dimen/customactivityoncrash_activity_vertical_margin">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/customactivityoncrash_error_activity_image"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:src="@drawable/customactivityoncrash_error_image" />
|
android:minWidth="100dp"
|
||||||
|
android:minHeight="100dp"
|
||||||
|
android:src="@drawable/error" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -38,19 +39,19 @@
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/customactivityoncrash_error_activity_restart_button"
|
android:id="@+id/RestartButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/customactivityoncrash_activity_vertical_margin"
|
android:layout_marginTop="@dimen/customactivityoncrash_activity_vertical_margin"
|
||||||
android:text="@string/customactivityoncrash_error_activity_close_app" />
|
android:text="@string/customactivityoncrash_error_activity_restart_app" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/customactivityoncrash_error_activity_more_info_button"
|
android:id="@+id/ReportButton"
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||||
app:strokeColor="?attr/colorPrimary"
|
app:strokeColor="?attr/colorPrimary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/customactivityoncrash_error_activity_error_details"
|
android:text="@string/report_crash"
|
||||||
android:textColor="?colorPrimary" />
|
android:textColor="?colorPrimary" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue