mirror of
https://github.com/KitsunePie/AppErrorsTracking.git
synced 2025-09-01 08:45:16 +08:00
Added disable automatic wrapping error stack trace contents function in ConfigData, AppErrorsDetailActivity, activity_app_errors_detail
This commit is contained in:
@@ -54,6 +54,9 @@ object ConfigData {
|
|||||||
/** 启用应用配置模板 */
|
/** 启用应用配置模板 */
|
||||||
val ENABLE_APP_CONFIG_TEMPLATE = PrefsData("_enable_app_config_template", false)
|
val ENABLE_APP_CONFIG_TEMPLATE = PrefsData("_enable_app_config_template", false)
|
||||||
|
|
||||||
|
/** 禁止异常堆栈内容自动换行 */
|
||||||
|
val DISABLE_AUTO_WRAP_ERROR_STACK_TRACE = PrefsData("_disable_auto_wrap_error_stack_trace", false)
|
||||||
|
|
||||||
/** 当前实例 - [Context] or [PackageParam] */
|
/** 当前实例 - [Context] or [PackageParam] */
|
||||||
private var instance: Any? = null
|
private var instance: Any? = null
|
||||||
|
|
||||||
|
@@ -31,6 +31,8 @@ import androidx.core.view.isGone
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.fankes.apperrorstracking.R
|
import com.fankes.apperrorstracking.R
|
||||||
import com.fankes.apperrorstracking.bean.AppErrorsInfoBean
|
import com.fankes.apperrorstracking.bean.AppErrorsInfoBean
|
||||||
|
import com.fankes.apperrorstracking.data.ConfigData
|
||||||
|
import com.fankes.apperrorstracking.data.ConfigData.bind
|
||||||
import com.fankes.apperrorstracking.databinding.ActivityAppErrorsDetailBinding
|
import com.fankes.apperrorstracking.databinding.ActivityAppErrorsDetailBinding
|
||||||
import com.fankes.apperrorstracking.locale.LocaleString
|
import com.fankes.apperrorstracking.locale.LocaleString
|
||||||
import com.fankes.apperrorstracking.ui.activity.base.BaseActivity
|
import com.fankes.apperrorstracking.ui.activity.base.BaseActivity
|
||||||
@@ -118,7 +120,13 @@ class AppErrorsDetailActivity : BaseActivity<ActivityAppErrorsDetailBinding>() {
|
|||||||
binding.errorThrowMethodText.text = appErrorsInfo.throwMethodName
|
binding.errorThrowMethodText.text = appErrorsInfo.throwMethodName
|
||||||
binding.errorLineNumberText.text = appErrorsInfo.throwLineNumber.toString()
|
binding.errorLineNumberText.text = appErrorsInfo.throwLineNumber.toString()
|
||||||
binding.errorRecordTimeText.text = appErrorsInfo.dateTime
|
binding.errorRecordTimeText.text = appErrorsInfo.dateTime
|
||||||
binding.errorStackText.text = appErrorsInfo.stackTrace
|
binding.errorStackTraceMovableText.text = appErrorsInfo.stackTrace
|
||||||
|
binding.errorStackTraceFixedText.text = appErrorsInfo.stackTrace
|
||||||
|
binding.disableAutoWrapErrorStackTraceSwitch.bind(ConfigData.DISABLE_AUTO_WRAP_ERROR_STACK_TRACE) {
|
||||||
|
binding.errorStackTraceScrollView.isVisible = it
|
||||||
|
binding.errorStackTraceFixedText.isGone = it
|
||||||
|
binding.errorStackTraceScrollView.post { binding.errorStackTraceScrollView.scrollTo(0, 0) }
|
||||||
|
}
|
||||||
binding.appPanelScrollView.setOnScrollChangeListener { _, _, y, _, _ ->
|
binding.appPanelScrollView.setOnScrollChangeListener { _, _, y, _, _ ->
|
||||||
binding.detailTitleText.text = if (y >= 30.dp(context = this)) appNameOf(appErrorsInfo.packageName) else LocaleString.appName
|
binding.detailTitleText.text = if (y >= 30.dp(context = this)) appNameOf(appErrorsInfo.packageName) else LocaleString.appName
|
||||||
}
|
}
|
||||||
|
@@ -437,8 +437,51 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.fankes.apperrorstracking.ui.widget.MaterialSwitch
|
||||||
|
android:id="@+id/disable_auto_wrap_error_stack_trace_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@drawable/bg_permotion_round"
|
||||||
|
android:paddingLeft="15dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingRight="15dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:text="@string/disable_auto_wrap_error_stack_trace_content"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:id="@+id/error_stack_trace_scroll_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:background="@drawable/bg_stack_round"
|
||||||
|
android:fadingEdgeLength="10dp"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
android:padding="15dp"
|
||||||
|
android:requiresFadingEdge="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/error_stack_trace_movable_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:lineSpacingExtra="5dp"
|
||||||
|
android:textColor="#B65B57"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:typeface="monospace" />
|
||||||
|
</HorizontalScrollView>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/error_stack_text"
|
android:id="@+id/error_stack_trace_fixed_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
|
Reference in New Issue
Block a user