-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to Kotlin and other minor improvements (#52)
- Loading branch information
Showing
32 changed files
with
887 additions
and
860 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
# Changelog | ||
|
||
## Version 2.0.0 | ||
|
||
- Refactor to Kotlin | ||
- Option to handle session increments manually by setting `incrementSessionsAutomatically(false)` in Builder and using `incrementSessionCount()` helper function | ||
- Add click listeners for positive button and negative button | ||
- Option to reset count using `resetCount()` | ||
- Dark theme support | ||
|
||
## Version 1.1.2 | ||
|
||
- Migrate library from JCenter to Maven Central | ||
- Update targetSdkVersion to 29 | ||
- Fix warnings | ||
|
||
## Version 1.1.1 | ||
|
||
- Update dependencies to AndroidX | ||
- Dark mode support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
app/src/main/java/com/codemybrainsout/rating/MainActivity.java
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
app/src/main/java/com/codemybrainsout/rating/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.codemybrainsout.rating | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import android.widget.RelativeLayout | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.codemybrainsout.ratingdialog.RatingDialog | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
val rlRate = findViewById<RelativeLayout>(R.id.rlRate) | ||
rlRate.setOnClickListener { showDialog() } | ||
} | ||
|
||
private fun showCustomDialogOnSession(session: Int = 3) { | ||
val ratingDialog = RatingDialog.Builder(this) | ||
.icon(R.mipmap.ic_launcher) | ||
.session(session) | ||
.threshold(3) | ||
.title(text = R.string.rating_dialog_experience, textColor = R.color.primaryTextColor) | ||
.positiveButton(text = R.string.rating_dialog_maybe_later, textColor = R.color.colorPrimary, background = R.drawable.button_selector_positive) | ||
.negativeButton(text = R.string.rating_dialog_never, textColor = R.color.secondaryTextColor) | ||
.formTitle(R.string.submit_feedback) | ||
.formHint(R.string.rating_dialog_suggestions) | ||
.feedbackTextColor(R.color.feedbackTextColor) | ||
.formSubmitText(R.string.rating_dialog_submit) | ||
.formCancelText(R.string.rating_dialog_cancel) | ||
.ratingBarColor(R.color.ratingBarColor) | ||
.playstoreUrl("YOUR_URL") | ||
.onThresholdCleared { dialog, rating, thresholdCleared -> Log.i(TAG, "onThresholdCleared: $rating $thresholdCleared") } | ||
.onThresholdFailed { dialog, rating, thresholdCleared -> Log.i(TAG, "onThresholdFailed: $rating $thresholdCleared") } | ||
.onRatingChanged { rating, thresholdCleared -> Log.i(TAG, "onRatingChanged: $rating $thresholdCleared") } | ||
.onRatingBarFormSubmit { feedback -> Log.i(TAG, "onRatingBarFormSubmit: $feedback") } | ||
.build() | ||
|
||
ratingDialog.show() | ||
} | ||
|
||
private fun showDialog() { | ||
val ratingDialog: RatingDialog = RatingDialog.Builder(this) | ||
.threshold(3) | ||
.session(1) | ||
.onRatingBarFormSubmit { feedback -> Log.i(TAG, "onRatingBarFormSubmit: $feedback") } | ||
.build() | ||
|
||
ratingDialog.show() | ||
} | ||
|
||
companion object { | ||
private val TAG = MainActivity::class.java.simpleName | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/grey_200" /> | ||
<solid android:color="@color/secondaryTextColor" /> | ||
<corners android:bottomLeftRadius="5dp" /> | ||
</shape> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/accent" /> | ||
<solid android:color="@color/colorAccent" /> | ||
<corners android:bottomRightRadius="5dp" /> | ||
</shape> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/colorAccent" /> | ||
<corners android:bottomRightRadius="5dp" android:bottomLeftRadius="5dp" /> | ||
</shape> | ||
|
Oops, something went wrong.