forked from upstream-mirrors/quik
Merge pull request #203 from l3d00m/rate_dialog
Add non intrusive rate snackbar
This commit is contained in:
@@ -2,6 +2,7 @@ apply plugin: 'com.android.application'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -74,6 +75,7 @@ dependencies {
|
||||
compile 'com.googlecode.ez-vcard:ez-vcard:0.9.6'
|
||||
compile 'com.google.code.gson:gson:2.3'
|
||||
compile 'com.koushikdutta.ion:ion:1.1.7'
|
||||
compile 'org.ligi:snackengage:0.4'
|
||||
|
||||
// Google libraries
|
||||
compile 'com.android.support:appcompat-v7:22.2.1'
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.moez.QKSMS.common;
|
||||
|
||||
import com.moez.QKSMS.R;
|
||||
|
||||
import org.ligi.snackengage.conditions.AfterNumberOfOpportunities;
|
||||
import org.ligi.snackengage.conditions.NeverAgainWhenClickedOnce;
|
||||
import org.ligi.snackengage.snacks.RateSnack;
|
||||
|
||||
/* https://github.com/ligi/SnackEngage
|
||||
* "This shows a snackbar after MainActivity was created *10* times and never again when once clicked on Rate" */
|
||||
|
||||
public class QKRateSnack extends RateSnack {
|
||||
public QKRateSnack() {
|
||||
withConditions(new NeverAgainWhenClickedOnce(), new AfterNumberOfOpportunities(10));
|
||||
}
|
||||
|
||||
@Override public String getText(){
|
||||
return getString(R.string.rate_title);
|
||||
}
|
||||
|
||||
@Override public String getActionText(){
|
||||
return getString(R.string.rate_action);
|
||||
}
|
||||
}
|
||||
@@ -26,10 +26,12 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.google.android.mms.pdu_alt.PduHeaders;
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.common.ConversationPrefsHelper;
|
||||
import com.moez.QKSMS.common.DonationManager;
|
||||
import com.moez.QKSMS.common.QKRateSnack;
|
||||
import com.moez.QKSMS.common.google.DraftCache;
|
||||
import com.moez.QKSMS.common.utils.KeyboardUtils;
|
||||
import com.moez.QKSMS.common.utils.MessageUtils;
|
||||
@@ -56,6 +58,9 @@ import com.moez.QKSMS.ui.welcome.WelcomeActivity;
|
||||
import com.nispok.snackbar.Snackbar;
|
||||
import com.nispok.snackbar.listeners.ActionClickListener;
|
||||
|
||||
import org.ligi.snackengage.SnackEngage;
|
||||
import org.ligi.snackengage.snacks.BaseSnack;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -121,6 +126,10 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
onNewIntent(getIntent());
|
||||
|
||||
showDialogIfNeeded(savedInstanceState);
|
||||
|
||||
//Adds a small/non intrusive snackbar that asks the user to rate the app
|
||||
SnackEngage.from(this).withSnack(new QKRateSnack().withDuration(BaseSnack.DURATION_LONG))
|
||||
.build().engageWhenAppropriate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
<string name="details_body">Inhalt</string>
|
||||
<string name="details_date_sent">Gesendet</string>
|
||||
<string name="details_date_received">Empfangen</string>
|
||||
<string name="rate_title">Gefällt dir QKSMS?</string>
|
||||
<string name="rate_action">Bewerten</string>
|
||||
<string name="pref_category_appearance">Erscheinungsbild</string>
|
||||
<string name="pref_category_summary_appearance">Themen, Schriften, Farben, Avatare und mehr</string>
|
||||
<string name="pref_category_general">Allgemein</string>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<item>Jacob Klinker</item>
|
||||
<item>Jeff Gilfelt</item>
|
||||
<item>Melnykov Oleksandr</item>
|
||||
<item>ligi</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="contributor_githubs">
|
||||
@@ -39,6 +40,7 @@
|
||||
<item>github.com/klinker41</item>
|
||||
<item>github.com/jgilfelt</item>
|
||||
<item>github.com/makovkastar</item>
|
||||
<item>github.com/ligi</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="contributor_projects">
|
||||
@@ -48,6 +50,7 @@
|
||||
<item>android-smsmms\nandroid-chips</item>
|
||||
<item>SystemBarTint</item>
|
||||
<item>FloatingActionButton</item>
|
||||
<item>SnackEngage</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="changelog_versions">
|
||||
|
||||
@@ -101,6 +101,10 @@
|
||||
<string name="details_date_sent">Date sent</string>
|
||||
<!--Title for date received of a message in message details popup-->
|
||||
<string name="details_date_received">Date received</string>
|
||||
<!--Title for rate snackbar-->
|
||||
<string name="rate_title">Like QKSMS?</string>
|
||||
<!--Title for rate button-->
|
||||
<string name="rate_action">Rate</string>
|
||||
|
||||
<string name="pref_category_appearance">Appearance</string>
|
||||
<string name="pref_category_summary_appearance">Themes, fonts, colors, avatars, and more</string>
|
||||
|
||||
Reference in New Issue
Block a user