android-material-app-rating

by stepstone-tech

This library allows to use customized Rating Dialog inside applications.

449 Stars 85 Forks Last release: Not found Apache License 2.0 47 Commits 11 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

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 <?xml version="1.0" encoding="utf-8"?>




```

And assign this style to the theme. ```xml <?xml version="1.0" encoding="utf-8"?>

```

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.