Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Added rate and review
Browse files Browse the repository at this point in the history
  • Loading branch information
javacafe01 committed Feb 23, 2018
1 parent bbf79b2 commit 21d9dbe
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
56 changes: 50 additions & 6 deletions app/src/main/java/com/gsnathan/pdfviewer/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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());

}

Expand Down Expand Up @@ -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
Expand All @@ -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("[email protected]")
.withSystemInfo()
.build()
.start();
}

private void showLibs()
{
AttributionPresenter attributionPresenter = new AttributionPresenter.Builder(this)
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/message_draw.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- drawable/message_draw.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#09C" android:pathData="M18,14H10.5L12.5,12H18M6,14V11.5L12.88,4.64C13.07,4.45 13.39,4.45 13.59,4.64L15.35,6.41C15.55,6.61 15.55,6.92 15.35,7.12L8.47,14M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4C22,2.89 21.1,2 20,2Z" />
</vector>
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/star.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- drawable/star.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#09C" android:pathData="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z" />
</vector>
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
</string>
<string name="icon">Icons</string>
<string name="icon_desc">By Material Design Icons</string>
<string name="rateReview_title">Rate and Review</string>
<string name="open_license_desc">Special Thanks</string>
<string name="rate">Rate</string>
<string name="review">Review</string>


</resources>

0 comments on commit 21d9dbe

Please sign in to comment.