mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] Closes https://github.com/mozilla-mobile/fenix/pull/1062 & Closes https://github.com/mozilla-mobile/fenix/issues/1121: Restyles crash reporter fragment (https://github.com/mozilla-mobile/fenix/pull/1122)
This commit is contained in:
parent
853b7b0078
commit
c9d29fab1f
@ -8,12 +8,14 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.TextView
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.navigation.Navigation
|
import androidx.navigation.Navigation
|
||||||
import kotlinx.android.synthetic.main.fragment_crash_reporter.*
|
import kotlinx.android.synthetic.main.fragment_crash_reporter.*
|
||||||
import mozilla.components.lib.crash.Crash
|
import mozilla.components.lib.crash.Crash
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.ext.requireComponents
|
import org.mozilla.fenix.ext.requireComponents
|
||||||
|
import org.mozilla.fenix.utils.Settings
|
||||||
|
|
||||||
class CrashReporterFragment : Fragment() {
|
class CrashReporterFragment : Fragment() {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
@ -24,20 +26,21 @@ class CrashReporterFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
val crashIntent = CrashReporterFragmentArgs.fromBundle(arguments!!).crashIntent
|
val crashIntent = CrashReporterFragmentArgs.fromBundle(arguments!!).crashIntent
|
||||||
|
|
||||||
val crash = Crash.fromIntent(CrashReporterFragmentArgs.fromBundle(arguments!!).crashIntent)
|
val crash = Crash.fromIntent(CrashReporterFragmentArgs.fromBundle(arguments!!).crashIntent)
|
||||||
|
|
||||||
|
view.findViewById<TextView>(R.id.title).text =
|
||||||
|
getString(R.string.tab_crash_title, context!!.getString(R.string.app_name))
|
||||||
|
|
||||||
// TODO TelemetryWrapper.crashReporterOpened()
|
// TODO TelemetryWrapper.crashReporterOpened()
|
||||||
|
|
||||||
closeTabButton.setOnClickListener {
|
closeTabButton.setOnClickListener {
|
||||||
val wantsToSubmitCrashReport = sendCrashCheckbox.isChecked
|
|
||||||
val selectedSession = requireComponents.core.sessionManager.selectedSession
|
val selectedSession = requireComponents.core.sessionManager.selectedSession
|
||||||
|
|
||||||
selectedSession?.let { session -> requireComponents.useCases.tabsUseCases.removeTab.invoke(session) }
|
selectedSession?.let { session -> requireComponents.useCases.tabsUseCases.removeTab.invoke(session) }
|
||||||
// TODO TelemetryWrapper.crashReporterClosed(wantsSubmitCrashReport)
|
// TODO TelemetryWrapper.crashReporterClosed(wantsSubmitCrashReport)
|
||||||
|
|
||||||
if (wantsToSubmitCrashReport) {
|
if (Settings.getInstance(context!!).isCrashReportingEnabled) {
|
||||||
requireComponents.analytics.crashReporter.submitReport(crash)
|
requireComponents.analytics.crashReporter.submitReport(crash)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,9 @@ class Settings private constructor(context: Context) {
|
|||||||
val defaultSearchEngineName: String
|
val defaultSearchEngineName: String
|
||||||
get() = preferences.getString(appContext.getPreferenceKey(R.string.pref_key_search_engine), "") ?: ""
|
get() = preferences.getString(appContext.getPreferenceKey(R.string.pref_key_search_engine), "") ?: ""
|
||||||
|
|
||||||
|
val isCrashReportingEnabled: Boolean
|
||||||
|
get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_crash_reporter), true)
|
||||||
|
|
||||||
val isTelemetryEnabled: Boolean
|
val isTelemetryEnabled: Boolean
|
||||||
get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_telemetry), true)
|
get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_telemetry), true)
|
||||||
|
|
||||||
@ -61,9 +64,4 @@ class Settings private constructor(context: Context) {
|
|||||||
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions),
|
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
fun crashReportingEnabled(): Boolean = preferences.getBoolean(
|
|
||||||
appContext.getPreferenceKey(R.string.pref_key_crash_reporter),
|
|
||||||
true
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
10
app/src/main/res/drawable/crash_reporter_button.xml
Normal file
10
app/src/main/res/drawable/crash_reporter_button.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
|
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
<size android:height="36dp" android:width="158dp" />
|
||||||
|
<solid android:color="#FF312A65" />
|
||||||
|
</shape>
|
BIN
app/src/main/res/drawable/fenix_error_1.png
Normal file
BIN
app/src/main/res/drawable/fenix_error_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 123 KiB |
@ -5,7 +5,6 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/photonGrey10">
|
android:background="@color/photonGrey10">
|
||||||
@ -13,12 +12,11 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/crash_tab_image"
|
android:id="@+id/crash_tab_image"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="120dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="40dp"
|
||||||
android:src="@drawable/ic_error_session_crashed"
|
android:src="@drawable/fenix_error_1"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
app:layout_constraintWidth_percent="0.8"
|
||||||
app:layout_constraintWidth_percent="0.6"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
@ -26,58 +24,31 @@
|
|||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="300dp"
|
android:layout_width="300dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="6dp"
|
||||||
android:lineSpacingExtra="8sp"
|
android:lineSpacingExtra="8sp"
|
||||||
android:singleLine="false"
|
android:singleLine="false"
|
||||||
android:text="@string/tab_crash_title"
|
android:textColor="@color/light_mode_text_color"
|
||||||
android:textAlignment="center"
|
android:textSize="24sp"
|
||||||
android:textColor="@color/search_text"
|
android:textStyle="bold"
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/crash_tab_image" />
|
app:layout_constraintTop_toBottomOf="@id/crash_tab_image" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/description"
|
|
||||||
android:layout_width="300dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:lineSpacingExtra="7sp"
|
|
||||||
android:singleLine="false"
|
|
||||||
android:text="@string/tab_crash_description"
|
|
||||||
android:textColor="@color/search_text"
|
|
||||||
android:textSize="15sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/sendCrashCheckbox"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="32dp"
|
|
||||||
android:layout_marginBottom="@dimen/crash_reporter_close_tab_button_bottom_margin"
|
|
||||||
android:buttonTint="@color/crash_page_accent"
|
|
||||||
android:checked="true"
|
|
||||||
android:text="@string/tab_crash_send_report"
|
|
||||||
android:textColor="@color/search_text"
|
|
||||||
android:textSize="15sp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/restoreTabButton"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintWidth_percent="0.8"
|
|
||||||
tools:text="@string/tab_crash_send_report" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/restoreTabButton"
|
android:id="@+id/restoreTabButton"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="36dp"
|
||||||
android:layout_marginStart="@dimen/crash_reporter_close_tab_button_horizontal_margin"
|
android:layout_marginStart="@dimen/crash_reporter_close_tab_button_horizontal_margin"
|
||||||
android:layout_marginEnd="@dimen/crash_reporter_close_tab_button_horizontal_margin"
|
android:layout_marginEnd="@dimen/crash_reporter_close_tab_button_horizontal_margin"
|
||||||
android:layout_marginBottom="@dimen/crash_reporter_close_tab_button_bottom_margin"
|
android:layout_marginBottom="@dimen/crash_reporter_close_tab_button_bottom_margin"
|
||||||
android:backgroundTint="@color/crash_page_accent"
|
android:backgroundTint="@color/crash_page_accent"
|
||||||
android:text="@string/tab_crash_restore"
|
android:text="@string/tab_crash_restore"
|
||||||
|
android:fontFamily="Sharp Sans"
|
||||||
android:textColor="@color/off_white"
|
android:textColor="@color/off_white"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textAllCaps="false"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
android:background="@drawable/crash_reporter_button"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintWidth_percent="0.4" />
|
app:layout_constraintWidth_percent="0.4" />
|
||||||
@ -85,14 +56,18 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/closeTabButton"
|
android:id="@+id/closeTabButton"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="36dp"
|
||||||
android:layout_marginStart="@dimen/crash_reporter_close_tab_button_horizontal_margin"
|
android:layout_marginStart="@dimen/crash_reporter_close_tab_button_horizontal_margin"
|
||||||
android:layout_marginEnd="@dimen/crash_reporter_close_tab_button_horizontal_margin"
|
android:layout_marginEnd="@dimen/crash_reporter_close_tab_button_horizontal_margin"
|
||||||
android:layout_marginBottom="@dimen/crash_reporter_close_tab_button_bottom_margin"
|
android:layout_marginBottom="@dimen/crash_reporter_close_tab_button_bottom_margin"
|
||||||
android:backgroundTint="@color/crash_page_off_accent"
|
android:backgroundTint="@color/crash_page_off_accent"
|
||||||
android:text="@string/tab_crash_close"
|
android:text="@string/tab_crash_close"
|
||||||
android:textColor="@color/search_text"
|
android:fontFamily="Sharp Sans"
|
||||||
|
android:textColor="@color/light_mode_text_color"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textAllCaps="false"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
android:background="@drawable/crash_reporter_button"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintWidth_percent="0.4" />
|
app:layout_constraintWidth_percent="0.4" />
|
||||||
|
@ -70,7 +70,6 @@
|
|||||||
app:destination="@id/libraryFragment" />
|
app:destination="@id/libraryFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/libraryFragment"
|
android:id="@+id/libraryFragment"
|
||||||
android:name="org.mozilla.fenix.library.LibraryFragment"
|
android:name="org.mozilla.fenix.library.LibraryFragment"
|
||||||
@ -81,8 +80,6 @@
|
|||||||
app:destination="@+id/historyFragment" />
|
app:destination="@+id/historyFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/historyFragment"
|
android:id="@+id/historyFragment"
|
||||||
android:name="org.mozilla.fenix.library.history.HistoryFragment"
|
android:name="org.mozilla.fenix.library.history.HistoryFragment"
|
||||||
|
@ -77,8 +77,8 @@
|
|||||||
<color name="history_title_private_theme">@color/off_white</color>
|
<color name="history_title_private_theme">@color/off_white</color>
|
||||||
<color name="history_url_private_theme">@color/photonGrey40</color>
|
<color name="history_url_private_theme">@color/photonGrey40</color>
|
||||||
|
|
||||||
<color name="crash_page_accent">#45a1ff</color>
|
<color name="crash_page_accent">#312a65</color>
|
||||||
<color name="crash_page_off_accent">@color/photonGrey30</color>
|
<color name="crash_page_off_accent">#efeff2</color>
|
||||||
|
|
||||||
<color name="quick_action_share_icon">#174291</color>
|
<color name="quick_action_share_icon">#174291</color>
|
||||||
<color name="quick_action_share_icon_background">#b9f0fd</color>
|
<color name="quick_action_share_icon_background">#b9f0fd</color>
|
||||||
|
@ -250,7 +250,7 @@
|
|||||||
|
|
||||||
<!-- Crashes -->
|
<!-- Crashes -->
|
||||||
<!-- Title text displayed on the tab crash page -->
|
<!-- Title text displayed on the tab crash page -->
|
||||||
<string name="tab_crash_title">Sorry. We\'re having a problem with this tab.</string>
|
<string name="tab_crash_title">Sorry. %1$s can\'t get that tab back</string>
|
||||||
<!-- Description text displayed on the tab crash page -->
|
<!-- Description text displayed on the tab crash page -->
|
||||||
<string name="tab_crash_description">You can attempt to restore or close this tab below.</string>
|
<string name="tab_crash_description">You can attempt to restore or close this tab below.</string>
|
||||||
<!-- Send crash report checkbox text on the tab crash page -->
|
<!-- Send crash report checkbox text on the tab crash page -->
|
||||||
|
Loading…
Reference in New Issue
Block a user