mirror of https://github.com/FongMi/TV.git
parent
e3a11d8bc6
commit
2b3d00c8a9
@ -0,0 +1,35 @@ |
||||
package com.fongmi.android.tv.ui.activity; |
||||
|
||||
import androidx.appcompat.app.AlertDialog; |
||||
import androidx.viewbinding.ViewBinding; |
||||
|
||||
import com.fongmi.android.tv.R; |
||||
import com.fongmi.android.tv.databinding.ActivityCrashBinding; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
import cat.ereza.customactivityoncrash.CustomActivityOnCrash; |
||||
|
||||
public class CrashActivity extends BaseActivity { |
||||
|
||||
private ActivityCrashBinding mBinding; |
||||
|
||||
@Override |
||||
protected ViewBinding getBinding() { |
||||
return mBinding = ActivityCrashBinding.inflate(getLayoutInflater()); |
||||
} |
||||
|
||||
@Override |
||||
protected void initEvent() { |
||||
mBinding.details.setOnClickListener(v -> showError()); |
||||
mBinding.restart.setOnClickListener(v -> CustomActivityOnCrash.restartApplication(this, Objects.requireNonNull(CustomActivityOnCrash.getConfigFromIntent(getIntent())))); |
||||
} |
||||
|
||||
private void showError() { |
||||
new AlertDialog.Builder(this) |
||||
.setTitle(R.string.crash_details_title) |
||||
.setMessage(CustomActivityOnCrash.getAllErrorDetailsFromIntent(this, getIntent())) |
||||
.setPositiveButton(R.string.crash_details_close, null) |
||||
.show(); |
||||
} |
||||
} |
||||
@ -0,0 +1,41 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:gravity="center" |
||||
android:orientation="vertical"> |
||||
|
||||
<ImageView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:contentDescription="@null" |
||||
android:src="@drawable/customactivityoncrash_error_image" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" |
||||
android:gravity="center" |
||||
android:lineSpacingExtra="4dp" |
||||
android:text="@string/crash_info" |
||||
android:textColor="@color/grey_200" |
||||
android:textSize="18sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<Button |
||||
android:id="@+id/restart" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" |
||||
android:backgroundTint="@color/blue_500" |
||||
android:text="@string/crash_restart" /> |
||||
|
||||
<Button |
||||
android:id="@+id/details" |
||||
style="?borderlessButtonStyle" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="@string/crash_details" |
||||
android:textColor="@color/grey_200" /> |
||||
|
||||
</LinearLayout> |
||||
Loading…
Reference in new issue