Skip to content

Commit

Permalink
Fix thank you dialog button color
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Serrano committed Feb 3, 2023
1 parent 3f92118 commit d6c2254
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.22.1 (2023-02-03)

- Fix thank you dialog button color
- Thank you dialog dismiss survey on touch outside

## 2.22.0 (2023-01-31)

- Add option to hide "powered by InMoment"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ If you use Maven, you can include this library as a dependency:
<dependency>
<groupId>com.wootric</groupId>
<artifactId>wootric-sdk-android</artifactId>
<version>2.22.0</version>
<version>2.22.1</version>
</dependency>
```

### Using Gradle

```xml
implementation 'com.wootric:wootric-sdk-android:2.22.0'
implementation 'com.wootric:wootric-sdk-android:2.22.1'
```

## Initializing Wootric
Expand Down
4 changes: 2 additions & 2 deletions androidsdk/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=2.22.0
VERSION_CODE=2220
VERSION_NAME=2.22.1
VERSION_CODE=2221
GROUP=com.wootric

POM_DESCRIPTION=WootricSDK Android
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.os.Build;

import com.wootric.androidsdk.WootricSurveyCallback;
import com.wootric.androidsdk.objects.Settings;
Expand All @@ -37,13 +39,13 @@
* Created by maciejwitowski on 10/2/15.
*/
public class ThankYouDialogFactory {
public static Dialog create(Context context, Settings settings, final int score, final String text, final WootricSurveyCallback surveyCallback, final OnSurveyFinishedListener onSurveyFinishedListener) {
AlertDialog thankYouDialog = new AlertDialog.Builder(context).create();
public static Dialog create(final Context context, final Settings settings, final int score, final String text, final WootricSurveyCallback surveyCallback, final OnSurveyFinishedListener onSurveyFinishedListener) {
final AlertDialog thankYouDialog = new AlertDialog.Builder(context).create();
thankYouDialog.setCancelable(false);
final String thankYouText = settings.getFinalThankYou(score);

thankYouDialog.setMessage(thankYouText);

thankYouDialog.setCanceledOnTouchOutside(true);
thankYouDialog.setButton(AlertDialog.BUTTON_NEGATIVE, "OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Expand All @@ -63,6 +65,23 @@ public void onClick(DialogInterface dialog, int which) {
}
});

thankYouDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
int thankYouBackgroundColor;
try {
thankYouBackgroundColor = context.getResources().getColor(settings.getThankYouButtonBackgroundColor());
} catch(Exception e) {
thankYouBackgroundColor = settings.getThankYouButtonBackgroundColor();
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ColorStateList csl = ColorStateList.valueOf(thankYouBackgroundColor);
thankYouDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(csl);
}
}
});

return thankYouDialog;
}
}

0 comments on commit d6c2254

Please sign in to comment.