Skip to content

Commit 8eba86b

Browse files
committed
Fix formatting issue
1 parent 48a13f2 commit 8eba86b

File tree

1 file changed

+80
-79
lines changed
  • crashlytics/app/src/main/java/com/google/firebase/example/crashlytics

1 file changed

+80
-79
lines changed
Lines changed: 80 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,111 @@
11
package com.google.firebase.example.crashlytics;
22

33
import android.os.Bundle;
4+
import androidx.appcompat.app.AppCompatActivity;
5+
import android.util.Log;
46
import android.view.View;
57
import android.view.ViewGroup;
68
import android.widget.Button;
7-
import androidx.appcompat.app.AppCompatActivity;
9+
810
import com.google.firebase.crashlytics.FirebaseCrashlytics;
911

1012
public class MainActivity extends AppCompatActivity {
1113

12-
@Override
13-
protected void onCreate(Bundle savedInstanceState) {
14-
super.onCreate(savedInstanceState);
15-
}
16-
17-
public void setKeysBasic() {
18-
// [START crash_set_keys_basic]
19-
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
14+
@Override
15+
protected void onCreate(Bundle savedInstanceState) {
16+
super.onCreate(savedInstanceState);
17+
}
2018

21-
crashlytics.setCustomKey("my_string_key", "foo" /* string value */);
19+
public void setKeysBasic() {
20+
// [START crash_set_keys_basic]
21+
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
2222

23-
crashlytics.setCustomKey("my_bool_key", true /* boolean value */);
23+
crashlytics.setCustomKey("my_string_key", "foo" /* string value */);
2424

25-
crashlytics.setCustomKey("my_double_key", 1.0 /* double value */);
25+
crashlytics.setCustomKey("my_bool_key", true /* boolean value */);
2626

27-
crashlytics.setCustomKey("my_float_key", 1.0f /* float value */);
27+
crashlytics.setCustomKey("my_double_key", 1.0 /* double value */);
2828

29-
crashlytics.setCustomKey("my_int_key", 1 /* int value */);
30-
// [END crash_set_keys_basic]
31-
}
29+
crashlytics.setCustomKey("my_float_key", 1.0f /* float value */);
3230

33-
public void resetKey() {
34-
// [START crash_re_set_key]
35-
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
31+
crashlytics.setCustomKey("my_int_key", 1 /* int value */);
32+
// [END crash_set_keys_basic]
33+
}
3634

37-
crashlytics.setCustomKey("current_level", 3);
38-
crashlytics.setCustomKey("last_UI_action", "logged_in");
39-
// [END crash_re_set_key]
40-
}
35+
public void resetKey() {
36+
// [START crash_re_set_key]
37+
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
4138

42-
public void logReportAndPrint() {
43-
// [START crash_log_report_and_print]
44-
FirebaseCrashlytics.getInstance().log("message");
45-
// [END crash_log_report_and_print]
46-
}
39+
crashlytics.setCustomKey("current_level", 3);
40+
crashlytics.setCustomKey("last_UI_action", "logged_in");
41+
// [END crash_re_set_key]
42+
}
4743

48-
public void logReportOnly() {
49-
// [START crash_log_report_only]
50-
FirebaseCrashlytics.getInstance().log("message");
51-
// [END crash_log_report_only]
52-
}
44+
public void logReportAndPrint() {
45+
// [START crash_log_report_and_print]
46+
FirebaseCrashlytics.getInstance().log("message");
47+
// [END crash_log_report_and_print]
48+
}
5349

54-
public void enableAtRuntime() {
55-
// [START crash_enable_at_runtime]
56-
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
57-
// [END crash_enable_at_runtime]
58-
}
50+
public void logReportOnly() {
51+
// [START crash_log_report_only]
52+
FirebaseCrashlytics.getInstance().log("message");
53+
// [END crash_log_report_only]
54+
}
5955

60-
public void setUserId() {
61-
// [START crash_set_user_id]
62-
FirebaseCrashlytics.getInstance().setUserId("user123456789");
63-
// [END crash_set_user_id]
64-
}
56+
public void enableAtRuntime() {
57+
// [START crash_enable_at_runtime]
58+
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
59+
// [END crash_enable_at_runtime]
60+
}
6561

66-
public void methodThatThrows() throws Exception {
67-
throw new Exception();
68-
}
62+
public void setUserId() {
63+
// [START crash_set_user_id]
64+
FirebaseCrashlytics.getInstance().setUserId("user123456789");
65+
// [END crash_set_user_id]
66+
}
6967

70-
public void logCaughtEx() {
71-
// [START crash_log_caught_ex]
72-
try {
73-
methodThatThrows();
74-
} catch (Exception e) {
75-
FirebaseCrashlytics.getInstance().recordException(e);
76-
// handle your exception here
68+
public void methodThatThrows() throws Exception {
69+
throw new Exception();
7770
}
78-
// [END crash_log_caught_ex]
79-
}
8071

81-
public void logCaughtExWithCustomKeys() {
82-
// [START crash_log_caught_ex_custom_keys]
83-
try {
84-
methodThatThrows();
85-
} catch (Exception e) {
86-
FirebaseCrashlytics.getInstance()
87-
.recordException(e, Map.of("key_1", "value_1", "key_2", "value_2"));
88-
// handle your exception here
72+
public void logCaughtEx() {
73+
// [START crash_log_caught_ex]
74+
try {
75+
methodThatThrows();
76+
} catch (Exception e) {
77+
FirebaseCrashlytics.getInstance().recordException(e);
78+
// handle your exception here
79+
}
80+
// [END crash_log_caught_ex]
8981
}
90-
// [END crash_log_caught_ex_custom_keys]
82+
83+
public void logCaughtExWithCustomKeys() {
84+
// [START crash_log_caught_ex_custom_keys]
85+
try {
86+
methodThatThrows();
87+
} catch (Exception e) {
88+
FirebaseCrashlytics.getInstance().recordException(
89+
e,
90+
Map.of("key_1", "value_1", "key_2", "value_2"));
91+
// handle your exception here
92+
}
93+
// [END crash_log_caught_ex_custom_keys]
9194
}
9295

93-
public void forceACrash() {
94-
// [START crash_force_crash]
95-
Button crashButton = new Button(this);
96-
crashButton.setText("Crash!");
97-
crashButton.setOnClickListener(
98-
new View.OnClickListener() {
99-
public void onClick(View view) {
100-
throw new RuntimeException(); // Force a crash
101-
}
96+
public void forceACrash() {
97+
// [START crash_force_crash]
98+
Button crashButton = new Button(this);
99+
crashButton.setText("Crash!");
100+
crashButton.setOnClickListener(new View.OnClickListener() {
101+
public void onClick(View view) {
102+
throw new RuntimeException(); // Force a crash
103+
}
102104
});
103105

104-
addContentView(
105-
crashButton,
106-
new ViewGroup.LayoutParams(
107-
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
108-
// [END crash_force_crash]
109-
}
106+
addContentView(crashButton, new ViewGroup.LayoutParams(
107+
ViewGroup.LayoutParams.MATCH_PARENT,
108+
ViewGroup.LayoutParams.WRAP_CONTENT));
109+
// [END crash_force_crash]
110+
}
110111
}

0 commit comments

Comments
 (0)