Skip to content

Commit 1a758a2

Browse files
committed
removed java options for send button colors. Replaced with theme settings
1 parent d47f374 commit 1a758a2

File tree

5 files changed

+61
-54
lines changed

5 files changed

+61
-54
lines changed

CHANGELOG.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
7+
- Add New User Feedback form ([#4384](https://github.com/getsentry/sentry-java/pull/4384))
8+
- We now introduce SentryUserFeedbackDialog, which extends AlertDialog, inheriting the show() and cancel() methods, among others.
9+
- The dialog integrates with the current dialog theme, so it's compatible with dark mode, and can be customized with a custom xml style.
10+
- ```styles.xml or themes.xml
11+
<!-- Application theme. -->
12+
<style name="MyAppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
13+
...
14+
current theme customizations
15+
...
16+
<!-- Set a dialog theme if not already done. -->
17+
<item name="android:dialogTheme">@style/MyAppDialogTheme</item>
18+
</style>
19+
20+
<!-- Edit application dialog theme. -->
21+
<style name="MyAppDialogTheme" parent="Theme.AppCompat.DayNight.Dialog">
22+
<!-- Set the style of the feedback dialog title. -->
23+
<item name="android:windowTitleStyle">@style/FeedbackFormTitleStyle</item>
24+
25+
<!-- Set the color of title, cancel button text, and non editable texts. -->
26+
<item name="android:textColor">@color/colorPrimary</item>
27+
<!-- Set the color of editable texts. -->
28+
<item name="android:editTextColor">@color/colorPrimaryDark</item>
29+
<!-- Set the color of the hint of editable texts. -->
30+
<item name="android:textColorHint">@color/colorPrimaryDark</item>
31+
<!-- Set the color of the send button text. -->
32+
<item name="android:textColorPrimaryInverse">@android:color/white</item>
33+
34+
<!-- Set the background color of the send button. -->
35+
<item name="android:colorPrimary">@color/colorPrimary</item>
36+
<!-- Set the background color of the cancel button. -->
37+
<item name="android:colorBackground">@android:color/black</item>
38+
<!-- Set the color tint of the image logo. -->
39+
<item name="android:colorForeground">@color/colorPrimary</item>
40+
</style>
41+
42+
<style name="FeedbackFormTitleStyle">
43+
<!-- Customize your theme here. -->
44+
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Title</item>
45+
</style>
46+
```
47+
348
## 8.12.0
449

550
### Features
@@ -21,11 +66,6 @@
2166

2267
- Hook User Interaction integration into running Activity in case of deferred SDK init ([#4337](https://github.com/getsentry/sentry-java/pull/4337))
2368

24-
### Features
25-
26-
- Add new User Feedback API ([#4286](https://github.com/getsentry/sentry-java/pull/4286))
27-
- We now introduced Sentry.captureFeedback, which supersedes Sentry.captureUserFeedback
28-
2969
### Dependencies
3070

3171
- Bump Gradle from v8.13 to v8.14.0 ([#4360](https://github.com/getsentry/sentry-java/pull/4360))

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import android.app.AlertDialog;
44
import android.content.Context;
5-
import android.content.res.ColorStateList;
6-
import android.graphics.Color;
75
import android.os.Bundle;
86
import android.view.View;
97
import android.widget.Button;
@@ -112,9 +110,6 @@ protected void onCreate(Bundle savedInstanceState) {
112110
edtMessage.setHint(feedbackOptions.getMessagePlaceholder());
113111
lblTitle.setText(feedbackOptions.getFormTitle());
114112

115-
btnSend.setBackgroundTintList(
116-
ColorStateList.valueOf(Color.parseColor(feedbackOptions.getSubmitBackgroundHex())));
117-
btnSend.setTextColor(Color.parseColor(feedbackOptions.getSubmitForegroundHex()));
118113
btnSend.setText(feedbackOptions.getSubmitButtonLabel());
119114
btnSend.setOnClickListener(
120115
v -> {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
android:id="@+id/sentry_dialog_user_feedback_btn_send"
9393
android:layout_width="match_parent"
9494
android:layout_height="wrap_content"
95-
android:backgroundTint="#584AC0"
96-
android:textColor="@android:color/white"
95+
android:backgroundTint="?android:attr/colorPrimary"
96+
android:textColor="?android:attr/textColorPrimaryInverse"
9797
android:layout_marginTop="32dp"
9898
android:text="Send Bug Report"
9999
android:layout_below="@id/sentry_dialog_user_feedback_edt_description" />

sentry-samples/sentry-samples-android/src/main/res/values/styles.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,28 @@
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
88
<item name="colorAccent">@color/colorAccent</item>
9+
<!-- Set a custom theme for dialogs, to customize user feedback dialog -->
910
<item name="android:dialogTheme">@style/AppThemeDialog</item>
1011
</style>
1112

1213
<!-- Base application theme. -->
13-
<style name="AppThemeDialog" parent="Theme.AppCompat.DayNight.DarkActionBar">
14+
<style name="AppThemeDialog" parent="Theme.AppCompat.DayNight.Dialog">
1415
<!-- Customize your theme here. -->
16+
<item name="android:colorPrimary">@android:color/holo_blue_dark</item>
17+
<item name="android:background">@android:color/holo_blue_light</item>
18+
<item name="android:colorBackground">@android:color/black</item>
19+
<item name="android:textColorPrimaryInverse">@android:color/white</item>
1520
<item name="android:textColor">@color/colorPrimary</item>
1621
<item name="android:editTextColor">@color/colorPrimaryDark</item>
17-
<item name="android:textColorHint">@color/colorPrimaryDark</item>
22+
<item name="android:textColorHint">@android:color/holo_orange_light</item>
1823
<item name="android:colorForeground">@color/colorPrimary</item>
24+
<item name="android:windowTitleStyle">@style/WindowTitleStyle</item>
25+
</style>
26+
27+
<!-- Base application theme. -->
28+
<style name="WindowTitleStyle">
29+
<!-- Customize your theme here. -->
30+
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Title</item>
1931
</style>
2032

2133
</resources>

sentry/src/main/java/io/sentry/SentryFeedbackOptions.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ public final class SentryFeedbackOptions {
5050
private @NotNull String messagePlaceholder = "What's the bug? What did you expect?";
5151
/** The message displayed after a successful feedback submission. */
5252
private @NotNull String successMessageText = "Thank you for your report!";
53-
/** The background color of the submit button, in hexadecimal form (#584AC0). */
54-
private @NotNull String submitBackgroundHex = "#584AC0";
55-
/** The foreground color of the submit button, in hexadecimal form (#FFFFFF). */
56-
private @NotNull String submitForegroundHex = "#FFFFFF";
5753

5854
// Callbacks
5955
/** Callback called when the feedback form is opened. */
@@ -391,42 +387,6 @@ public void setSuccessMessageText(final @NotNull String successMessageText) {
391387
this.successMessageText = successMessageText;
392388
}
393389

394-
/**
395-
* The background color of the submit button, in hexadecimal form (#584AC0).
396-
*
397-
* @return the background color of the submit button
398-
*/
399-
public @NotNull String getSubmitBackgroundHex() {
400-
return submitBackgroundHex;
401-
}
402-
403-
/**
404-
* Sets the background color of the submit button, in hexadecimal form (#584AC0).
405-
*
406-
* @param submitBackgroundHex the background color of the submit button
407-
*/
408-
public void setSubmitBackgroundHex(final @NotNull String submitBackgroundHex) {
409-
this.submitBackgroundHex = submitBackgroundHex;
410-
}
411-
412-
/**
413-
* The foreground color of the submit button, in hexadecimal form (#FFFFFF).
414-
*
415-
* @return the foreground color of the submit button
416-
*/
417-
public @NotNull String getSubmitForegroundHex() {
418-
return submitForegroundHex;
419-
}
420-
421-
/**
422-
* Sets the foreground color of the submit button, in hexadecimal form (#FFFFFF).
423-
*
424-
* @param submitForegroundHex the foreground color of the submit button
425-
*/
426-
public void setSubmitForegroundHex(final @NotNull String submitForegroundHex) {
427-
this.submitForegroundHex = submitForegroundHex;
428-
}
429-
430390
// Callbacks
431391
/**
432392
* Callback called when the feedback form is opened.

0 commit comments

Comments
 (0)