mirror of
https://gitlab.com/SoftwareTalent/FrasesDeAnime.git
synced 2026-03-13 05:42:07 +01:00
Fixes to notification and other
This commit is contained in:
@@ -48,7 +48,7 @@ fun putAlarm(context: Context) {
|
||||
if (P.getNotifOn()) {
|
||||
if (P.getPersNotifOn()) { /* Persistent */
|
||||
var intent = Intent()
|
||||
intent.setAction("com.jkanetwork.st.com.jkanetwork.st.frasesdeanime.notif")
|
||||
intent.setAction("com.jkanetwork.st.frasesdeanime.notif")
|
||||
context.sendBroadcast(intent)
|
||||
|
||||
}else{ /* At x hour every day */
|
||||
@@ -59,6 +59,7 @@ fun putAlarm(context: Context) {
|
||||
/* Add a day */
|
||||
time.add(Calendar.DATE, 1)
|
||||
}
|
||||
|
||||
time.set(Calendar.HOUR_OF_DAY, P.getHour())
|
||||
time.set(Calendar.MINUTE, P.getMinute())
|
||||
time.set(Calendar.SECOND, 0)
|
||||
|
||||
@@ -84,6 +84,17 @@ class MainActivity : AppCompatActivity(), RewardedVideoAdListener {
|
||||
}
|
||||
}
|
||||
|
||||
//For "Vote us in Play Store"
|
||||
if (P.getRateCountdown() == 0){
|
||||
alert("¿Te gusta la apliación? ¿Crees que la falta algo?"){
|
||||
positiveButton("Danos tu opinión") {browse("https://play.google.com/store/apps/details?id=com.jkanetwork.st.frasesdeanime")}
|
||||
negativeButton("Más tarde") { }
|
||||
}.show()
|
||||
}else{
|
||||
P.setRateCountdown(); //Countdown one
|
||||
}
|
||||
|
||||
|
||||
|
||||
txt_sentence.setMovementMethod(ScrollingMovementMethod()) //Make sentence text scrollable
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import android.content.SharedPreferences
|
||||
* Help of: http://blog.teamtreehouse.com/making-sharedpreferences-easy-with-kotlin
|
||||
*/
|
||||
class Prefs (context: Context){
|
||||
var prefs: SharedPreferences = context.getSharedPreferences("com.jkanetwork.st.com.jkanetwork.st.frasesdeanime.PREFS", 0);
|
||||
var prefs: SharedPreferences = context.getSharedPreferences("com.jkanetwork.st.frasesdeanime.PREFS", 0);
|
||||
|
||||
fun getHour(): Int {
|
||||
return prefs.getInt("HOUR", 8)
|
||||
@@ -51,4 +51,14 @@ class Prefs (context: Context){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//For countdown to rate us dialog
|
||||
fun getRateCountdown(): Int {
|
||||
return prefs.getInt("RATECOUNTDOWN", 6)
|
||||
}
|
||||
|
||||
fun setRateCountdown() {
|
||||
prefs.edit().putInt("RATECOUNTDOWN", (getRateCountdown()-1)).commit()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user