Skip to content

Commit 6eb876c

Browse files
committed
user feedback dialog now uses dialogTheme
added dialog theme to sample app MainActivity "send user feedback" button now opens feedback dialog instead of sending feedback
1 parent 2bf99b5 commit 6eb876c

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackDialog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ protected void onCreate(Bundle savedInstanceState) {
7373
} else {
7474
imgLogo.setVisibility(View.GONE);
7575
}
76-
imgLogo.setImageTintList(ColorStateList.valueOf(lblTitle.getTextColors().getDefaultColor()));
7776

7877
if (!feedbackOptions.isShowName() && !feedbackOptions.isNameRequired()) {
7978
lblName.setVisibility(View.GONE);
@@ -113,7 +112,8 @@ protected void onCreate(Bundle savedInstanceState) {
113112
edtMessage.setHint(feedbackOptions.getMessagePlaceholder());
114113
lblTitle.setText(feedbackOptions.getFormTitle());
115114

116-
btnSend.setBackgroundColor(Color.parseColor(feedbackOptions.getSubmitBackgroundHex()));
115+
btnSend.setBackgroundTintList(
116+
ColorStateList.valueOf(Color.parseColor(feedbackOptions.getSubmitBackgroundHex())));
117117
btnSend.setTextColor(Color.parseColor(feedbackOptions.getSubmitForegroundHex()));
118118
btnSend.setText(feedbackOptions.getSubmitButtonLabel());
119119
btnSend.setOnClickListener(

sentry-android-core/src/main/res/layout/sentry_dialog_user_feedback.xml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
android:layout_width="match_parent"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
tools:ignore="HardcodedText"
6+
tools:ignore="HardcodedText"
7+
android:theme="?android:attr/dialogTheme"
78
android:padding="24dp">
89

910

@@ -12,7 +13,7 @@
1213
android:layout_width="match_parent"
1314
android:layout_height="wrap_content"
1415
android:text="Report a Bug"
15-
style="@android:style/TextAppearance.DialogWindowTitle"
16+
style="?android:attr/windowTitleStyle"
1617
android:textStyle="bold"
1718
android:layout_marginBottom="16dp"
1819
android:layout_alignParentTop="true"
@@ -25,6 +26,7 @@
2526
android:layout_alignTop="@+id/sentry_dialog_user_feedback_title"
2627
android:layout_alignBottom="@+id/sentry_dialog_user_feedback_title"
2728
android:layout_alignParentEnd="true"
29+
android:tint="?android:attr/colorForeground"
2830
android:src="@drawable/sentry_logo_dark_400x352"/>
2931

3032
<TextView
@@ -33,7 +35,7 @@
3335
android:layout_height="wrap_content"
3436
android:text="Name"
3537
android:layout_marginTop="4dp"
36-
style="@android:style/TextAppearance.Widget.TextView"
38+
android:textStyle="bold"
3739
android:layout_below="@id/sentry_dialog_user_feedback_title" />
3840

3941
<EditText
@@ -42,7 +44,6 @@
4244
android:layout_height="wrap_content"
4345
android:hint="Your Name"
4446
android:inputType="textPersonName"
45-
style="@android:style/TextAppearance.Widget.EditText"
4647
android:background="@drawable/edit_text_border"
4748
android:paddingHorizontal="8dp"
4849
android:layout_below="@id/sentry_dialog_user_feedback_txt_name" />
@@ -53,7 +54,7 @@
5354
android:layout_height="wrap_content"
5455
android:text="Email"
5556
android:layout_marginTop="8dp"
56-
style="@android:style/TextAppearance.Widget.TextView"
57+
android:textStyle="bold"
5758
android:layout_below="@id/sentry_dialog_user_feedback_edt_name" />
5859

5960
<EditText
@@ -62,7 +63,6 @@
6263
android:layout_height="wrap_content"
6364
android:hint="your.email@example.org"
6465
android:inputType="textEmailAddress"
65-
style="@android:style/TextAppearance.Widget.EditText"
6666
android:background="@drawable/edit_text_border"
6767
android:paddingHorizontal="8dp"
6868
android:layout_below="@id/sentry_dialog_user_feedback_txt_email" />
@@ -73,7 +73,7 @@
7373
android:layout_height="wrap_content"
7474
android:text="Description (Required)"
7575
android:layout_marginTop="8dp"
76-
style="@android:style/TextAppearance.Widget.TextView"
76+
android:textStyle="bold"
7777
android:layout_below="@id/sentry_dialog_user_feedback_edt_email" />
7878

7979
<EditText
@@ -84,7 +84,6 @@
8484
android:inputType="textMultiLine"
8585
android:gravity="top|start"
8686
android:hint="What's the bug? What did you expect?"
87-
style="@android:style/TextAppearance.Widget.EditText"
8887
android:background="@drawable/edit_text_border"
8988
android:paddingHorizontal="8dp"
9089
android:layout_below="@id/sentry_dialog_user_feedback_txt_description" />
@@ -103,8 +102,8 @@
103102
android:id="@+id/sentry_dialog_user_feedback_btn_cancel"
104103
android:layout_width="match_parent"
105104
android:layout_height="wrap_content"
106-
android:backgroundTint="#FAF9FD"
107105
android:layout_marginTop="8dp"
106+
android:backgroundTint="?android:attr/colorBackground"
108107
android:text="Cancel"
109108
android:layout_below="@id/sentry_dialog_user_feedback_btn_send" />
110109

sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import io.sentry.ISpan;
99
import io.sentry.MeasurementUnit;
1010
import io.sentry.Sentry;
11+
import io.sentry.android.core.SentryUserFeedbackDialog;
1112
import io.sentry.instrumentation.file.SentryFileOutputStream;
12-
import io.sentry.protocol.Feedback;
1313
import io.sentry.protocol.User;
1414
import io.sentry.samples.android.compose.ComposeActivity;
1515
import io.sentry.samples.android.databinding.ActivityMainBinding;
@@ -69,12 +69,7 @@ protected void onCreate(Bundle savedInstanceState) {
6969

7070
binding.sendUserFeedback.setOnClickListener(
7171
view -> {
72-
Feedback feedback =
73-
new Feedback("It broke on Android. I don't know why, but this happens.");
74-
feedback.setContactEmail("john@me.com");
75-
feedback.setName("John Me");
76-
77-
Sentry.captureFeedback(feedback);
72+
new SentryUserFeedbackDialog(this).show();
7873
});
7974

8075
binding.addAttachment.setOnClickListener(
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
4+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
55
<!-- Customize your theme here. -->
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
88
<item name="colorAccent">@color/colorAccent</item>
9+
<item name="android:dialogTheme">@style/AppThemeDialog</item>
10+
</style>
11+
12+
<!-- Base application theme. -->
13+
<style name="AppThemeDialog" parent="Theme.AppCompat.DayNight.DarkActionBar">
14+
<!-- Customize your theme here. -->
15+
<item name="android:textColor">@color/colorPrimary</item>
16+
<item name="android:editTextColor">@color/colorPrimaryDark</item>
17+
<item name="android:textColorHint">@color/colorPrimaryDark</item>
18+
<item name="android:colorForeground">@color/colorPrimary</item>
919
</style>
1020

1121
</resources>

0 commit comments

Comments
 (0)