From 21d9dbe45f8c29390f42ab7d86a8138ddee1238f Mon Sep 17 00:00:00 2001 From: JavaCafe01 Date: Fri, 23 Feb 2018 15:25:13 -0800 Subject: [PATCH] Added rate and review --- app/build.gradle | 3 + .../com/gsnathan/pdfviewer/AboutActivity.java | 56 +++++++++++++++++-- app/src/main/res/drawable/message_draw.xml | 8 +++ app/src/main/res/drawable/star.xml | 8 +++ app/src/main/res/values/strings.xml | 4 ++ 5 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 app/src/main/res/drawable/message_draw.xml create mode 100644 app/src/main/res/drawable/star.xml diff --git a/app/build.gradle b/app/build.gradle index 7f5529f..eb40eac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -58,4 +58,7 @@ dependencies { //View for App Licence compile 'com.jgabrielfreitas:licensetextview:1.1.2' + + //Review Dialogue + compile 'com.webianks.library:easy-feedback:1.0.2' } diff --git a/app/src/main/java/com/gsnathan/pdfviewer/AboutActivity.java b/app/src/main/java/com/gsnathan/pdfviewer/AboutActivity.java index 97cec02..c8aed7c 100644 --- a/app/src/main/java/com/gsnathan/pdfviewer/AboutActivity.java +++ b/app/src/main/java/com/gsnathan/pdfviewer/AboutActivity.java @@ -17,6 +17,7 @@ import com.franmontiel.attributionpresenter.entities.Attribution; import com.franmontiel.attributionpresenter.entities.Library; import com.franmontiel.attributionpresenter.entities.License; +import com.webianks.easy_feedback.EasyFeedback; /** * Created by Gokul Swaminathan on 2/22/2018. @@ -36,7 +37,9 @@ protected MaterialAboutList getMaterialAboutList(@NonNull Context context) { buildAuthor(authorBuilder, context); MaterialAboutCard.Builder openBuilder = new MaterialAboutCard.Builder(); buildOpenLicenses(openBuilder, context); - return new MaterialAboutList(appBuilder.build(), authorBuilder.build(), openBuilder.build()); + MaterialAboutCard.Builder rateBuilder = new MaterialAboutCard.Builder(); + buildRateAndReview(rateBuilder, context); + return new MaterialAboutList(appBuilder.build(), authorBuilder.build(), openBuilder.build(), rateBuilder.build()); } @@ -137,6 +140,7 @@ public void onClick() { .build()); appBuilder.addItem(new MaterialAboutActionItem.Builder() .text(R.string.open_license) + .subText(R.string.open_license_desc) .icon(R.drawable.document_icon) .setOnClickAction(new MaterialAboutItemOnClickAction() { @Override @@ -158,6 +162,39 @@ public void onClick() { .build()); } + private void buildRateAndReview(MaterialAboutCard.Builder appBuilder, final Context context){ + appBuilder.title(R.string.rateReview_title); + appBuilder.addItem(new MaterialAboutActionItem.Builder() + .text(R.string.rate) + .icon(R.drawable.star) + .setOnClickAction(new MaterialAboutItemOnClickAction() { + @Override + public void onClick() { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=com.gsnathan.pdfviewer"))); + } + }) + .build()); + appBuilder.addItem(new MaterialAboutActionItem.Builder() + .text(R.string.review) + .icon(R.drawable.message_draw) + .setOnClickAction(new MaterialAboutItemOnClickAction() { + @Override + public void onClick() { + showReviewPage(); + } + }) + .build()); + } + + private void showReviewPage() + { + new EasyFeedback.Builder(this) + .withEmail("gsnathandev@outlook.com") + .withSystemInfo() + .build() + .start(); + } + private void showLibs() { AttributionPresenter attributionPresenter = new AttributionPresenter.Builder(this) @@ -192,39 +229,46 @@ private void showLibs() ) .addAttributions( new Attribution.Builder("material-intro") - .addCopyrightNotice("Copyright (c) 2017 Jan Heinrich Reimer") + .addCopyrightNotice("Copyright 2017 Jan Heinrich Reimer") .addLicense(License.MIT) .setWebsite("https://github.com/heinrichreimer/material-intro") .build() ) .addAttributions( new Attribution.Builder("Android Open Source Project") - .addCopyrightNotice("Copyright (c) 2016 The Android Open Source Project") + .addCopyrightNotice("Copyright 2016 The Android Open Source Project") .addLicense(License.APACHE) .setWebsite("http://developer.android.com/tools/support-library/index.html") .build() ) .addAttributions( new Attribution.Builder("Android Support Libraries") - .addCopyrightNotice("Copyright (c) 2016 The Android Open Source Project") + .addCopyrightNotice("Copyright 2016 The Android Open Source Project") .addLicense(License.APACHE) .setWebsite("http://developer.android.com/tools/support-library/index.html") .build() ) .addAttributions( new Attribution.Builder("HtmlTextView for Android") - .addCopyrightNotice("Copyright (c) 2013 Dominik Schürmann") + .addCopyrightNotice("Copyright 2013 Dominik Schürmann") .addLicense(License.APACHE) .setWebsite("https://github.com/PrivacyApps/html-textview") .build() ) .addAttributions( new Attribution.Builder("LicenseTextView") - .addCopyrightNotice("Copyright 2016 JGabrielFreitas\n") + .addCopyrightNotice("Copyright 2016 JGabrielFreitas") .addLicense(License.APACHE) .setWebsite("https://github.com/jgabrielfreitas/LicenseTextView") .build() ) + .addAttributions( + new Attribution.Builder("EasyFeedback") + .addCopyrightNotice("Copyright 2017 Ramankit Singh") + .addLicense(License.APACHE) + .setWebsite("https://github.com/webianks/EasyFeedback") + .build() + ) .build(); //show license dialogue diff --git a/app/src/main/res/drawable/message_draw.xml b/app/src/main/res/drawable/message_draw.xml new file mode 100644 index 0000000..58b9e90 --- /dev/null +++ b/app/src/main/res/drawable/message_draw.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/star.xml b/app/src/main/res/drawable/star.xml new file mode 100644 index 0000000..82b9838 --- /dev/null +++ b/app/src/main/res/drawable/star.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7cb1518..601db32 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -39,6 +39,10 @@ Icons By Material Design Icons + Rate and Review + Special Thanks + Rate + Review