Fixes to notification and other

This commit is contained in:
Kevin Puertas
2017-12-07 21:38:11 +01:00
parent fd7787e296
commit f846ba7da7
5 changed files with 28 additions and 5 deletions

View File

@@ -19,12 +19,13 @@ android {
versionProps.store(versionPropsFile.newWriter(), null) versionProps.store(versionPropsFile.newWriter(), null)
// Fin de subir automáticamente la build en cada compilación // Fin de subir automáticamente la build en cada compilación
versionCode code versionCode code
versionName "1.0" versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }

View File

@@ -48,7 +48,7 @@ fun putAlarm(context: Context) {
if (P.getNotifOn()) { if (P.getNotifOn()) {
if (P.getPersNotifOn()) { /* Persistent */ if (P.getPersNotifOn()) { /* Persistent */
var intent = Intent() var intent = Intent()
intent.setAction("com.jkanetwork.st.com.jkanetwork.st.frasesdeanime.notif") intent.setAction("com.jkanetwork.st.frasesdeanime.notif")
context.sendBroadcast(intent) context.sendBroadcast(intent)
}else{ /* At x hour every day */ }else{ /* At x hour every day */
@@ -59,6 +59,7 @@ fun putAlarm(context: Context) {
/* Add a day */ /* Add a day */
time.add(Calendar.DATE, 1) time.add(Calendar.DATE, 1)
} }
time.set(Calendar.HOUR_OF_DAY, P.getHour()) time.set(Calendar.HOUR_OF_DAY, P.getHour())
time.set(Calendar.MINUTE, P.getMinute()) time.set(Calendar.MINUTE, P.getMinute())
time.set(Calendar.SECOND, 0) time.set(Calendar.SECOND, 0)

View File

@@ -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 txt_sentence.setMovementMethod(ScrollingMovementMethod()) //Make sentence text scrollable

View File

@@ -8,7 +8,7 @@ import android.content.SharedPreferences
* Help of: http://blog.teamtreehouse.com/making-sharedpreferences-easy-with-kotlin * Help of: http://blog.teamtreehouse.com/making-sharedpreferences-easy-with-kotlin
*/ */
class Prefs (context: Context){ 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 { fun getHour(): Int {
return prefs.getInt("HOUR", 8) return prefs.getInt("HOUR", 8)
@@ -51,4 +51,14 @@ class Prefs (context: Context){
return false; 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()
}
} }

View File

@@ -1,2 +1,2 @@
#Sun Dec 03 14:16:06 CET 2017 #Thu Dec 07 21:34:37 CET 2017
VERSION_CODE=847 VERSION_CODE=873