This library allows to use customized Rating Dialog inside applications.

Overview

Android Material App Rating Build Status Android ArsenalAwesome Android

This library allows to use customized Rating Dialog inside applications.

Download

compile 'com.stepstone.apprating:app-rating:2.3.1'

Supported features

  • custom styles for dialog's background, stars, title, description, hint
  • custom rating scope (number of stars)
  • note descriptions below rating bar, which describes each note
  • defining custom dialog's title, description and hint
  • defining text for positive, negative and neutral button
  • enter/exit window animation

Using different app themes

    

Getting started

Browse samples

There are few samples of rating dialog usage. Please refer to SamplesActivity in samples module. There are also two gradle flavors for sample app which can switched to see dialog in different themes, styles.

Prepare styling for dialog

Styling app rating dialog works in the same way like styling standard android's AlertDialog. Just need to define own style for your dialog.

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- Dialog -->
    <style name="MyAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="android:background">@color/backgroundColor</item>
        <item name="buttonBarPositiveButtonStyle">@style/MyAlertDialogButtonStyle</item>
        <item name="buttonBarNegativeButtonStyle">@style/MyAlertDialogButtonStyle</item>
        <item name="buttonBarNeutralButtonStyle">@style/MyAlertDialogButtonStyle</item>
    </style>

    <style name="MyAlertDialogButtonStyle" parent="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
        <item name="android:textColor">@color/colorAccent</item>
        <item name="android:textSize">@dimen/text_size_medium</item>
    </style>

    <style name="MyDialogFadeAnimation">
        <item name="android:windowEnterAnimation">@android:anim/fade_in</item>
        <item name="android:windowExitAnimation">@android:anim/fade_out</item>
    </style>

</resources>

And assign this style to the theme.

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>

        <!-- Assign dialog style here. -->
        <item name="alertDialogTheme">@style/MyAlertDialogStyle</item>
        <item name="alertDialogStyle">@style/MyAlertDialogStyle</item>

        <!-- Assign custom text styles for title, description, comment -->
        <item name="appRatingDialogTitleStyle">@style/MyDialogTitleStyle</item>
        <item name="appRatingDialogDescriptionStyle">@style/MyDialogDescriptionStyle</item>
        <item name="appRatingDialogNoteDescriptionStyle">@style/MyDialogNoteDescriptionStyle</item>
        <item name="appRatingDialogCommentStyle">@style/MyDialogCommentStyle</item>
    </style>

</resources>

Setup and create dialog

This code need to be invoked inside FragmentActivity. Activity MUST implement RatingDialogListener ! Otherwise an exception will be thrown.

private void showDialog() {
        new AppRatingDialog.Builder()
                .setPositiveButtonText("Submit")
                .setNegativeButtonText("Cancel")
                .setNeutralButtonText("Later")
                .setNoteDescriptions(Arrays.asList("Very Bad", "Not good", "Quite ok", "Very Good", "Excellent !!!"))
                .setDefaultRating(2)
                .setTitle("Rate this application")
                .setDescription("Please select some stars and give your feedback")
                .setCommentInputEnabled(true)
                .setDefaultComment("This app is pretty cool !")
                .setStarColor(R.color.starColor)
                .setNoteDescriptionTextColor(R.color.noteDescriptionTextColor)
                .setTitleTextColor(R.color.titleTextColor)
                .setDescriptionTextColor(R.color.contentTextColor)
                .setHint("Please write your comment here ...")
                .setHintTextColor(R.color.hintTextColor)
                .setCommentTextColor(R.color.commentTextColor)
                .setCommentBackgroundColor(R.color.colorPrimaryDark)
                .setWindowAnimation(R.style.MyDialogFadeAnimation)
                .setCancelable(false)
                .setCanceledOnTouchOutside(false)
                .create(MainActivity.this)
                .setTargetFragment(this, TAG) // only if listener is implemented by fragment
                .show();
    }

Getting results

Rating and comments can be fetched by listener implemented by activity.

class MyActivity implements RatingDialogListener {

        @Override
        public void onPositiveButtonClicked(int rate, String comment) {
            // interpret results, send it to analytics etc...
        }

        @Override
        public void onNegativeButtonClicked() {

        }
        
        @Override
        public void onNeutralButtonClicked() {

        }
}

Changelog

See changelog

License

Copyright 2017 StepStone Services

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Maintained by

Stepstone

Comments
  • Possible to set default rating to nothing?

    Possible to set default rating to nothing?

    I want to be able to set the default rating to nothing, so none of the stars get selected by default. Is there a way to do it? @fabiozo @marlonbosse @defio @pglebocki @tommywo

    opened by hamzabinamin 7
  • app crash when send to background

    app crash when send to background

    Hi, the library crash when application detached from window.

    throw NotSerializableException

    java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.stepstone.apprating.AppRatingDialog$Builder$Data)
    
    Caused by: java.io.NotSerializableException: com.stepstone.apprating.listener.OnNegativeButtonClickedListener$Companion$NULL$1
    

    thanks

    opened by anastr 5
  • default EditText color

    default EditText color

    the default EditText background color is white ! it is annoying when i have dark theme (commentBackgroundColorResId and commentTextColorResId is white!!)

    opened by anastr 3
  • Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0-beta01] AndroidManifest.xml:22:18-86 	is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91

    Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0-beta01] AndroidManifest.xml:22:18-86 is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91

    1. Start new Android project.
    2. add library to build.gradle
    3. insert showDialog() method in MainActivity.
    4. Project doesn't compile.
    Executing tasks: [:app:assembleDebug]
    
    > Task :app:preBuild UP-TO-DATE
    > Task :app:preDebugBuild UP-TO-DATE
    > Task :app:compileDebugAidl NO-SOURCE
    > Task :app:compileDebugRenderscript UP-TO-DATE
    > Task :app:checkDebugManifest UP-TO-DATE
    > Task :app:generateDebugBuildConfig UP-TO-DATE
    > Task :app:mainApkListPersistenceDebug UP-TO-DATE
    > Task :app:generateDebugResValues UP-TO-DATE
    > Task :app:generateDebugResources UP-TO-DATE
    > Task :app:mergeDebugResources UP-TO-DATE
    > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
    
    > Task :app:processDebugManifest FAILED
    /Users/jimclermonts/Downloads/MyApplication/app/src/main/AndroidManifest.xml:22:18-86 Error:
    	Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0-beta01] AndroidManifest.xml:22:18-86
    	is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
    	Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
    
    See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
    
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:processDebugManifest'.
    > Manifest merger failed : Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0-beta01] AndroidManifest.xml:22:18-86
      	is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
      	Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 0s
    9 actionable tasks: 1 executed, 8 up-to-date
    
    
    
    
    opened by JimClermonts 2
  • You need to add more details regarding the themes.  Ie where to past that code. Which folders etc.

    You need to add more details regarding the themes. Ie where to past that code. Which folders etc.

    Make sure these boxes are checked before submitting your issue - thank you!

    • [ ] Check in the issue tracker whether this issue wasn't already reported.
    • [ ] If it's a bug report check that clear steps to reproduce, stacktrace, expected behaviour and other needed details are provided.
    • [ ] Feature requests contain a description of the feature you're requesting as well as a brief scenario explaining under what circumstances this might be useful.
    opened by Zapnologica 2
  • bug:  java.lang.NoSuchFieldError: No field textSpacerNoTitle of type I in class Landroid/support/v7/appcompat/R$id; or its superclasses

    bug: java.lang.NoSuchFieldError: No field textSpacerNoTitle of type I in class Landroid/support/v7/appcompat/R$id; or its superclasses

    04-13 22:45:09.151 551-551/ir.example.nbd E/AndroidRuntime: FATAL EXCEPTION: main Process: ir.example.nbd, PID: 551 java.lang.NoSuchFieldError: No field textSpacerNoTitle of type I in class Landroid/support/v7/appcompat/R$id; or its superclasses (declaration of 'android.support.v7.appcompat.R$id' appears in /data/app/ir.example.nbd-2/base.apk) at android.support.v7.app.AlertController.setupView(AlertController.java:513) at android.support.v7.app.AlertController.installContent(AlertController.java:227) at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:260) at android.app.Dialog.dispatchOnCreate(Dialog.java:436) at android.app.Dialog.show(Dialog.java:314) at android.support.v4.app.DialogFragment.onStart(DialogFragment.java:416) at android.support.v4.app.Fragment.performStart(Fragment.java:2287) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1458) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377) at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6247) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

    opened by naser9878 2
  • Auto-hide the keyboard

    Auto-hide the keyboard

    Hello! On older versions of operating systems (and small screens), the keyboard covers the "Send" and "Cancel" buttons. How can I hide the keyboard, for example, when I click outside the Comment field?

    opened by kostasoft 2
  • Add neutral button

    Add neutral button

    Hi, I would like to contribute to your project by adding a neutral button.

    It would be useful, for example, to show a "later" button. Can I submit a pull to request?

    screenshot-1505222113243

    opened by defio 2
  • JCenter is deprecated

    JCenter is deprecated

    Make sure these boxes are checked before submitting your issue - thank you!

    • [x] Check in the issue tracker whether this issue wasn't already reported.
    • [x] If it's a bug report check that clear steps to reproduce, stacktrace, expected behaviour and other needed details are provided.
    • [x] Feature requests contain a description of the feature you're requesting as well as a brief scenario explaining under what circumstances this might be useful.

    JCenter is deprecated and will allow to download until feb 1st 2022 as stated here https://developer.android.com/studio/build/jcenter-migration

    Any plan to migrate elsewhere? maven or jitpack?

    opened by aenonGit 1
  • add threshold for send comment

    add threshold for send comment

    hi For merge two good features that exist in different libraries, I added Threshold to this library.

    1. sending feedback
    2. redirection to the market for high rates

    Now:

    • The user can submit a comment for the rates below the threshold.
    • And the developer can programming for two states (less than threshold and more).
    opened by hosseiniSeyRo 1
  • Make possible to change UI at runtime

    Make possible to change UI at runtime

    Make possible to define 'positive' rating, hide comments in case of positive and change positive button text: https://github.com/stepstone-tech/android-material-app-rating/issues/52

    opened by dryaz 1
  • android.content.res.Resources$NotFoundException: Resource ID #0xff000000

    android.content.res.Resources$NotFoundException: Resource ID #0xff000000

    this is my code private fun showRateAppDialog() {

        AppRatingDialog.Builder()
                .setPositiveButtonText(getString(R.string.submit))
                .setNegativeButtonText(getString(R.string.cancel))
                .setNeutralButtonText(getString(R.string.later))
                .setNoteDescriptions(listOf(getString(R.string.very_bad_rate_dialog)
                        , getString(R.string.not_good_rate_dialog)
                        , getString(R.string.quite_ok_rate_dialog)
                        , getString(R.string.very_good_rate_dialog)
                        , getString(R.string.excellent_rate_dialog)))
                .setDefaultRating(2)
                .setTitle("Rate this application")
                .setDescription("Please select some stars and give your feedback!")
                .setCommentInputEnabled(true)
                .setDefaultComment("This app is pretty cool !")
                .setStarColor(context?.resources?.getColor(R.color.red)!!)
                .setNoteDescriptionTextColor(context?.resources?.getColor(R.color.red)!!)
                .setTitleTextColor(context?.resources?.getColor(R.color.black)!!)
                .setDescriptionTextColor(context?.resources?.getColor(R.color.black)!!)
                .setHint("Please write your comment here ...")
                .setHintTextColor(context?.resources?.getColor(R.color.grey)!!)
                .setCommentTextColor(context?.resources?.getColor(R.color.black)!!)
                .setCommentBackgroundColor(context?.resources?.getColor(R.color.white)!!)
                .setCancelable(false)
                .setWindowAnimation(android.R.anim.slide_out_right)
                .setCanceledOnTouchOutside(false)
                .create(activity!!)
                .setTargetFragment(this, 0)
                .show()
    }
    

    and xml @color/red #b7112a #d81b60 #F05053 #707070 #000 #FFFF

    opened by HusseinAliF 1
  • Problem : create (androidx.fragment.app.@org.jetbrains.NotNull FragmentActivity) in Builder cannot be applied to (......myActivity)

    Problem : create ([email protected] FragmentActivity) in Builder cannot be applied to (......myActivity)

    I have an activity @NotNull public class myActivity extends FragmentActivity implements RatingDialogListener, myActivityContract.View

    But when I write in my activity this function : `private void showDialog()

    { new AppRatingDialog.Builder() .setPositiveButtonText("Submit") .setNegativeButtonText("Cancel") .setNeutralButtonText("Later") .setNoteDescriptions(Arrays.asList("Very Bad", "Not good", "Quite ok", "Very Good", "Excellent !!!")) .setDefaultRating(2) .setTitle("Rate this application") .setDescription("Please select some stars and give your feedback") .setCommentInputEnabled(true) .setDefaultComment("This app is pretty cool !") .setStarColor(R.color.black) .setNoteDescriptionTextColor(R.color.black) .setTitleTextColor(R.color.black) .setDescriptionTextColor(R.color.black) .setHint("Please write your comment here ...") .setHintTextColor(R.color.black) .setCommentTextColor(R.color.black) .setCommentBackgroundColor(R.color.colorPrimaryDark) .setWindowAnimation(R.style.MyDialogFadeAnimation) .setCancelable(false) .setCanceledOnTouchOutside(false) .create(myActivity.this) .show(); }`

    AndroidStudio tells me on the "create" function parameter that :

    create ([email protected] FragmentActivity) in Builder cannot be applied to (com.visitey.eip.visitey.pages.my.view.myActivity)

    Am I doing something wrong or is this a bug ?

    opened by Florent-Sebag 0
  • Can we add a picture in this dialogue?

    Can we add a picture in this dialogue?

    Make sure these boxes are checked before submitting your issue - thank you!

    • [ ] Check in the issue tracker whether this issue wasn't already reported.
    • [ ] If it's a bug report check that clear steps to reproduce, stacktrace, expected behaviour and other needed details are provided.
    • [ ] Feature requests contain a description of the feature you're requesting as well as a brief scenario explaining under what circumstances this might be useful.
    opened by saadbzu 5
  • Control dismiss behaviour

    Control dismiss behaviour

    Is it somehow possible to control the dismiss behaviour of the dialog? I'm trying to validate review text, so If nothing is written, the dialog shouldn't dismiss but display an alert to the user. Currently it dismisses no matter if there is text or not.

    opened by hamzabinamin 4
Owner
StepStone Tech
Technology of StepStone.
StepStone Tech
RatingRequest library is a simple android dialog for request rating and review.

Rating Request RatingRequest library is a simple android dialog for request rating and review. ##Usage Add below line in app build.gradle dependencies

Habibur Rahman 28 Aug 10, 2022
A simple Emoji Rating Bar library for Android completely written in Kotlin.

EmojiRatingBar A simple Emoji Rating Bar library for Android completely written in Kotlin. ?? Installation Add the JitPack repository to your build.gr

Unaisul Hadi 41 Aug 26, 2022
A rating scale android library

RatingScale A rating scale android library A customizable rating scale supporting a 1-10 scale. Usage In your layout.xml <?xml version="1.0" encod

Tilak Sharma 3 Mar 26, 2022
AndroidRate is a library to help you promote your Android app by prompting users to rate the app after using it for a few days.

AndroidRate AndroidRate is a library to help you promote your Android app by prompting users to rate the app after using it for a few days. Project ba

 Vorlonsoft LLC 129 Nov 24, 2022
A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.

A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.

dqq 300 Aug 29, 2021
A rating toggle for Android which switches between 3 rating levels: positive, neutral, and negative.

SimpleRatingView A rating toggle for Android which switches between 3 rating levels: positive, neutral, and negative. Usage Since, SimpleRatingView is

İhsan Işık 166 Nov 25, 2022
SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.

Smiley Rating SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon. Drawn completely using android canvas Insp

Sujith Niraikulathan 1.1k Dec 22, 2022
Make your native android Dialog Fancy and Gify. A library that takes the standard Android Dialog to the next level with a variety of styling options and Gif's. Style your dialog from code.

FancyGifDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ...

Shashank Singhal 522 Jan 2, 2023
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Shashank Singhal 350 Dec 9, 2022
RatingRequest library is a simple android dialog for request rating and review.

Rating Request RatingRequest library is a simple android dialog for request rating and review. ##Usage Add below line in app build.gradle dependencies

Habibur Rahman 28 Aug 10, 2022
An android library through which users can add a customized loading dialog box with Lottie Animations.

CustomLottieDialogBox About CustomLottieDialogBox is an android library which facilitate developers to add customized loading Dialog-Boxes to their an

Siddharth Singh 7 Aug 10, 2022
Android library that allows applications to add dialog-based slider widgets to their settings

Android Slider Preference Library Overview Slider represents a float between 0.0 and 1.0 Access with SliderPreference.getValue() or SharedPreferences.

Jay Petacat 135 Nov 29, 2022
Alert Dialog - You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment.

We show a warning message (Alert Dialog) to the user in many parts of our applications. You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment. Thanks to this extension, you can create a Dialog and call it in the Activity or Fragment you want and customize the component you want.

Gökmen Bayram 0 Jan 9, 2022
A custom view for rating which easy to make and use, but function is excellent

QRatingView A custom view for rating which easy to make and use, but function is excellent Effect Picture Properties <declare-styleable name="QRat

QCoder 1 Dec 3, 2021
Android loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel

ACProgressLite English Version / 中文版本 An Android loading widget library. Lite and easy to use, strong customizability. Can be used to implement 'iOS'

Cloudist Technology Co., Ltd. 234 Nov 24, 2022
An Android Library that allows users to pull down a menu and select different actions. It can be implemented inside ScrollView, GridView, ListView.

AndroidPullMenu AndroidPullMenu is an Open Source Android library that allows developers to easily create applications with pull menu. The aim of this

Armando TBA 181 Nov 29, 2022
Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Abdullah Alhazmy 73 Nov 29, 2022
Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Abdullah Alhazmy 73 Nov 29, 2022
ionalert 1.3 1.6 Java Sweetalert, Dialog, Alert Dialog

ionalert - Android Alert Dialog A beautiful design Android Alert Dialog, alternative of Sweet Alert Dialog based on KAlertDialog using MaterialCompone

Excel Dwi Oktavianto 23 Sep 17, 2022
🗨️ Beautiful Dialog is a Simple and Beautiful custom dialog

Beautiful Dialog ??️ Beautiful Dialog is a Simple and Beautiful custom dialog. Screenshots Including in your project Gradle Add below codes to your ro

Geovani Amaral 21 Jan 6, 2023