Commit ed2c0336 authored by akwizgran's avatar akwizgran

Merge branch 'crash-button' into 'master'

Add crash button to UI in debug mode

See merge request akwizgran/briar!801
parents 135cf086 6735e507
Pipeline #1530 passed with stage
in 7 minutes and 9 seconds
......@@ -12,6 +12,7 @@ import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.support.v7.preference.PreferenceGroup;
import android.widget.Toast;
import org.acra.ACRA;
......@@ -149,9 +150,17 @@ public class SettingsFragment extends PreferenceFragmentCompat
return true;
});
Preference testData = findPreference("pref_key_test_data");
if (!IS_DEBUG_BUILD) {
testData.setVisible(false);
if (IS_DEBUG_BUILD) {
findPreference("pref_key_explode").setOnPreferenceClickListener(
preference -> {
throw new RuntimeException("Boom!");
}
);
} else {
PreferenceGroup testing =
findPreference("pref_key_explode").getParent();
if (testing == null) throw new AssertionError();
testing.setVisible(false);
}
loadSettings();
......
......@@ -111,21 +111,29 @@
<PreferenceCategory
android:layout="@layout/preferences_category"
android:title="@string/feedback_settings_title">
android:title="@string/feedback_settings_title"/>
<Preference
android:key="pref_key_send_feedback"
android:title="@string/send_feedback"/>
<PreferenceCategory
android:layout="@layout/preferences_category"
android:title="Testing">
<Preference
android:key="pref_key_send_feedback"
android:title="@string/send_feedback"/>
android:key="pref_key_test_data"
android:title="Create Test Data">
</PreferenceCategory>
<intent
android:targetClass="org.briarproject.briar.android.test.TestDataActivity"
android:targetPackage="@string/app_package"/>
</Preference>
<Preference
android:key="pref_key_test_data"
android:title="Create Test Data">
<Preference
android:key="pref_key_explode"
android:title="Crash"/>
<intent
android:targetClass="org.briarproject.briar.android.test.TestDataActivity"
android:targetPackage="@string/app_package"/>
</Preference>
</PreferenceCategory>
</PreferenceScreen>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment