Migración a toolchain moderna y eliminación de Anko
Gradle 8.11.1, AGP 8.10.0, Kotlin 2.2.10, compile/targetSdk 36 (requisito Play 2026), minSdk 24 (exige ads 25.5.0), AdMob 25.5.0. anko-sqlite -> SQLiteOpenHelper nativo, commons -> helpers propios, layouts DSL -> XML + ViewBinding. Fixes: PendingIntent FLAG_IMMUTABLE, canal de notificaciones STN, ID de unidad correcto en RewardedAd.load, startService sobre receiver -> sendBroadcast, POST_NOTIFICATIONS en manifest.
This commit is contained in:
1 parent
8dd05334ec
commit
5a01a42cd7
18 files changed
+316
-283
No files matched your search
@@ -2,6 +2,8 @@
|
||||
|
||||
Aplicación Android (Kotlin) que muestra cada día una frase de una serie o película anime en tus notificaciones. Puedes revisar frases de días anteriores, marcarlas como favoritas y compartirlas.
|
||||
|
||||
Publicada en Google Play: `com.jkanetwork.st.frasesdeanime`.
|
||||
|
||||
## Características
|
||||
|
||||
- Frase diaria en notificación, a la hora que configures (persistente opcional)
|
||||
@@ -13,13 +15,15 @@ Aplicación Android (Kotlin) que muestra cada día una frase de una serie o pel
|
||||
|
||||
## Compilar
|
||||
|
||||
- JDK 11 (Gradle 7.2 no arranca en JDK 17+)
|
||||
- Android Studio Arctic Fox o superior, o directamente `./gradlew assembleDebug`
|
||||
- compileSdk 31 / minSdk 21 / targetSdk 31
|
||||
- JDK 17
|
||||
- Android SDK con `platforms;android-36` y build-tools 34+
|
||||
- `./gradlew assembleDebug` (o Android Studio)
|
||||
|
||||
Toolchain: Gradle 8.11.1 · AGP 8.10.0 · Kotlin 2.2.10 · compileSdk/targetSdk 36 · minSdk 24 (exigido por play-services-ads 25).
|
||||
|
||||
### Claves de AdMob
|
||||
|
||||
`app/src/main/res/values/admob.xml` está ignorado por git (contiene los IDs reales de AdMob). Sin ese fichero el build falla por recursos inexistentes. Créalo así:
|
||||
`app/src/main/res/values/admob.xml` está ignorado por git (contiene los IDs reales). Sin ese fichero el build falla por recursos inexistentes. Créalo así:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
@@ -30,16 +34,26 @@ Aplicación Android (Kotlin) que muestra cada día una frase de una serie o pel
|
||||
</resources>
|
||||
```
|
||||
|
||||
- `admob_id` — ID de aplicación (meta-data del manifest, solo AdMob lo lee)
|
||||
- `admob_videoid` — ID de unidad del anuncio recompensado (el que se pasa a `RewardedAd.load`)
|
||||
- `admob_bannerid` — ID de unidad del banner (layout `activity_main.xml`)
|
||||
|
||||
### Firmar release
|
||||
|
||||
El APK release sale sin firmar (`app-release-unsigned.apk`); fírmalo con tu keystore (`apksigner` o el signing config de Android Studio). El `versionCode` se autoincrementa en cada build vía `app/versioncode.count`.
|
||||
|
||||
## Estructura del código
|
||||
|
||||
| Fichero | Responsabilidad |
|
||||
|---|---|
|
||||
| `MainActivity.kt` | Frase del día, favoritos, compartir, anuncio recompensado |
|
||||
| `AlarmNotif.kt` + `App.kt` (`putAlarm`) | Alarma diaria y notificación |
|
||||
| `AlarmNotif.kt` + `App.kt` (`putAlarm`) | Alarma diaria y notificación (canal "STN") |
|
||||
| `SQLiteHelper.kt` + `res/raw/loadsqlfile` | Base de datos de frases (SQL precargado) |
|
||||
| `OptsActivity.kt` | Configuración (hora de notificación, notificación persistente) |
|
||||
| `FavsActivity.kt` / `AnimesSelActivity.kt` / `AboutActivity.kt` | Favoritos, selección de animes, acerca de |
|
||||
|
||||
Sin Anko desde la migración de 2026: los helpers que lo sustituyen (`toast`, `share`, `browse`, `startActivity<T>`, `putAlarm`) viven en `App.kt`; la BD usa `SQLiteOpenHelper` nativo; los layouts DSL pasaron a XML + ViewBinding.
|
||||
|
||||
## Licencia
|
||||
|
||||
GPL. Ver `LICENSE.md` para detalles.
|
||||
+17
-31
@@ -1,17 +1,16 @@
|
||||
def anko_version = '0.10.8'
|
||||
def kotlin_version = '1.5.20'
|
||||
ext.kotlin_version = '1.5.20'
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android' // apply kotlin android plugin
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'kotlin-android'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.jkanetwork.st.frasesdeanime'
|
||||
compileSdk 36
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.jkanetwork.st.frasesdeanime"
|
||||
minSdkVersion 21
|
||||
compileSdk 31
|
||||
targetSdkVersion 31
|
||||
minSdk 24
|
||||
targetSdk 36
|
||||
// Sube automáticamente la build en cada compilacion
|
||||
def versionPropsFile = file('versioncode.count')
|
||||
def Properties versionProps = new Properties()
|
||||
@@ -21,7 +20,7 @@ android {
|
||||
versionProps.store(versionPropsFile.newWriter(), null)
|
||||
// Fin de subir automáticamente la build en cada compilación
|
||||
versionCode code
|
||||
versionName "1.4.6"
|
||||
versionName "1.4.7"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
@@ -34,9 +33,13 @@ android {
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
productFlavors {
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
namespace 'com.jkanetwork.st.frasesdeanime'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -44,24 +47,7 @@ sourceSets {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation "org.jetbrains.anko:anko-sqlite:$anko_version"
|
||||
implementation "org.jetbrains.anko:anko-commons:$anko_version"
|
||||
// Anko Layouts
|
||||
implementation "org.jetbrains.anko:anko-sdk25:$anko_version"
|
||||
// sdk15, sdk19, sdk21, sdk23 are also available
|
||||
implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
|
||||
// Coroutine listeners for Anko Layouts
|
||||
implementation "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
|
||||
implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
|
||||
implementation 'com.github.mirrajabi:kotlin-preferences-extensions:1.0.1'
|
||||
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
|
||||
implementation 'com.google.android.gms:play-services-ads:21.0.0'
|
||||
//testImplementation 'junit:junit:4.12'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'com.google.android.gms:play-services-ads:25.5.0'
|
||||
}
|
||||
|
||||
configurations.configureEach() {
|
||||
resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<!-- Notificaciones: permiso de runtime desde API 33, sin él no se muestra ninguna -->
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<!-- For Admob -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
||||
@@ -2,35 +2,20 @@ package com.jkanetwork.st.frasesdeanime
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import android.widget.ImageView
|
||||
import android.view.View
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import org.jetbrains.anko.*
|
||||
import com.jkanetwork.st.frasesdeanime.databinding.ActivityAboutBinding
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 30/08/17.
|
||||
* Layout DSL de Anko migrado a XML (activity_about.xml) + ViewBinding
|
||||
*/
|
||||
class AboutActivity : AppCompatActivity(){
|
||||
|
||||
private lateinit var binding: ActivityAboutBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
//Anko DSL Layout
|
||||
verticalLayout {
|
||||
textView{
|
||||
text = "¡Gracias por usar Frases de Anime! \nIdea por Alba García y desarrollada por JKANetwork!"
|
||||
textSize = 22f
|
||||
textColor = Color.BLACK
|
||||
textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
}.lparams(width=wrapContent, height=wrapContent){padding= dip(12)}
|
||||
imageView{
|
||||
setImageResource(R.drawable.cerebro)
|
||||
}.lparams(width=matchParent, height=matchParent){}
|
||||
background = ColorDrawable(Color.parseColor("#F8F2F2"))
|
||||
}
|
||||
binding = ActivityAboutBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jkanetwork.st.frasesdeanime
|
||||
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
@@ -9,6 +10,7 @@ import java.util.Calendar
|
||||
import android.app.AlarmManager
|
||||
import androidx.core.app.NotificationCompat
|
||||
import android.app.PendingIntent
|
||||
import android.os.Build
|
||||
|
||||
/*
|
||||
Help of: https://github.com/okwrtdsh/AlarmTest/blob/master/app/src/main/kotlin/com/github/okwrtdsh/alarmtest/AlarmBroadcastReceiver.kt
|
||||
@@ -26,13 +28,21 @@ class AlarmNotif : BroadcastReceiver() {
|
||||
val alarmMgr = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
|
||||
nm.cancel(1);
|
||||
|
||||
/* Canal de notificación: obligatorio desde API 26, sin él la notificación no se muestra */
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val channel = NotificationChannel("STN", "Frase del día", NotificationManager.IMPORTANCE_DEFAULT)
|
||||
channel.description = "Notificación diaria con la frase de anime"
|
||||
nm.createNotificationChannel(channel)
|
||||
}
|
||||
|
||||
val notificationBuilder = NotificationCompat.Builder(context, "STN")
|
||||
.setContentTitle(anime)
|
||||
.setStyle(NotificationCompat.BigTextStyle().bigText(frase))
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setContentText(frase)
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setContentIntent(PendingIntent.getActivity(context, 0, Intent(context, MainActivity::class.java), 0))
|
||||
.setContentIntent(PendingIntent.getActivity(context, 0, Intent(context, MainActivity::class.java), PendingIntent.FLAG_IMMUTABLE))
|
||||
|
||||
var noti = notificationBuilder.build();
|
||||
|
||||
@@ -48,7 +58,7 @@ class AlarmNotif : BroadcastReceiver() {
|
||||
time.set(Calendar.HOUR_OF_DAY, 0)
|
||||
time.set(Calendar.MINUTE, 0)
|
||||
time.set(Calendar.SECOND, 1)
|
||||
val sender = PendingIntent.getBroadcast(context, 1, Intent(context, AlarmNotif::class.java), 0)
|
||||
val sender = PendingIntent.getBroadcast(context, 1, Intent(context, AlarmNotif::class.java), PendingIntent.FLAG_IMMUTABLE)
|
||||
alarmMgr.setRepeating(AlarmManager.RTC, time.getTimeInMillis(), AlarmManager.INTERVAL_DAY, sender) // Repeat every day
|
||||
}else{ /* For boot actions */
|
||||
putAlarm(context)
|
||||
|
||||
@@ -1,61 +1,34 @@
|
||||
package com.jkanetwork.st.frasesdeanime
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.view.View
|
||||
import android.widget.SimpleAdapter
|
||||
import android.widget.ListView
|
||||
import android.widget.TextView
|
||||
import android.widget.Button
|
||||
import org.jetbrains.anko.*
|
||||
import org.jetbrains.anko.support.v4.UI
|
||||
import org.jetbrains.anko.support.v4.find
|
||||
import android.widget.Toast
|
||||
import android.util.Log
|
||||
|
||||
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import android.content.Intent
|
||||
import android.widget.AdapterView
|
||||
|
||||
import android.widget.CheckBox
|
||||
import com.jkanetwork.st.frasesdeanime.databinding.ActivityAnimesSelBinding
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 25/07/17.
|
||||
* Help: https://www.youtube.com/watch?v=x-M1L6tcsLo
|
||||
* Layout DSL de Anko migrado a XML (activity_animes_sel.xml) + ViewBinding
|
||||
*/
|
||||
class AnimesSelActivity : AppCompatActivity(){
|
||||
val act = this /* Activity Context */
|
||||
|
||||
/* For DSL bind */
|
||||
lateinit var view_list : ListView
|
||||
lateinit var btn_exit : Button
|
||||
lateinit var btn_sel : Button
|
||||
private lateinit var binding: ActivityAnimesSelBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
var db = SQLiteHelper(applicationContext) //Database connection
|
||||
|
||||
/** Layout in DSL */
|
||||
verticalLayout {
|
||||
linearLayout {
|
||||
btn_exit = button("Volver")
|
||||
btn_sel = button("Seleccionar todos").lparams(width = matchParent)
|
||||
}
|
||||
view_list = listView {
|
||||
}.lparams(width = matchParent, height = matchParent) { }
|
||||
}
|
||||
binding = ActivityAnimesSelBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
val db = SQLiteHelper(applicationContext) //Database connection
|
||||
|
||||
if (db.getAllAnimeSel()){ //If all selected
|
||||
btn_sel.setText("Deseleccionar todos")
|
||||
binding.btnSel.setText("Deseleccionar todos")
|
||||
}else{
|
||||
btn_sel.setText("Seleccionar todos")
|
||||
binding.btnSel.setText("Seleccionar todos")
|
||||
}
|
||||
|
||||
//Load ids and Names
|
||||
val arrayIDs = db.getAllAnimeIDs()
|
||||
var arrayNames = db.getAllAnimeNames()
|
||||
val arrayNames = db.getAllAnimeNames()
|
||||
val length = arrayIDs.size
|
||||
|
||||
//Init List of objets
|
||||
@@ -66,36 +39,37 @@ class AnimesSelActivity : AppCompatActivity(){
|
||||
listNames += listOf(arrayNames[i])
|
||||
}
|
||||
|
||||
// Load adapter for view_list with an ANKO DSL style directy, and fill with data.
|
||||
// CustomListAdapter class is in "CustomListAdapter.kt"
|
||||
view_list.adapter = CustomListAdapter<String>({ listNames }) {
|
||||
index, listNames, view ->
|
||||
linearLayout {
|
||||
checkBox {
|
||||
text = listNames[index]
|
||||
setOnClickListener { db.setAnimeSel(db.getIDAnimeFromName(listNames[index])) }
|
||||
setChecked(listSel[index])
|
||||
textSize = 18f
|
||||
|
||||
}.lparams(){topMargin = dip(6);bottomMargin = dip(6)}
|
||||
}
|
||||
// Load adapter for view_list. CustomListAdapter class is in "CustomListAdapter.kt"
|
||||
binding.viewList.adapter = CustomListAdapter<String>({ listNames }) {
|
||||
index, listNames, view ->
|
||||
val checkBox = CheckBox(this)
|
||||
checkBox.text = listNames[index]
|
||||
checkBox.setOnClickListener { db.setAnimeSel(db.getIDAnimeFromName(listNames[index])) }
|
||||
checkBox.isChecked = listSel[index]
|
||||
checkBox.textSize = 18f
|
||||
checkBox.setPadding(0, dpToPx(6), 0, dpToPx(6))
|
||||
checkBox
|
||||
}
|
||||
|
||||
btn_sel.setOnClickListener() {
|
||||
binding.btnSel.setOnClickListener() {
|
||||
db.setAllAnimeSel()
|
||||
restartActivity(act)
|
||||
restartActivity(this)
|
||||
}
|
||||
|
||||
//"Return" to main
|
||||
btn_exit.setOnClickListener() {
|
||||
binding.btnExit.setOnClickListener() {
|
||||
startActivity<MainActivity>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun dpToPx(dp: Int): Int =
|
||||
(dp * resources.displayMetrics.density).toInt()
|
||||
|
||||
/** On back go to main */
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
startActivity<MainActivity>()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,14 @@ package com.jkanetwork.st.frasesdeanime
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.app.PendingIntent
|
||||
import java.util.Calendar
|
||||
import android.app.AlarmManager
|
||||
import android.util.Log
|
||||
import android.app.Notification
|
||||
import android.app.NotificationManager
|
||||
import android.widget.Toast
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 18/07/17.
|
||||
@@ -30,31 +29,54 @@ fun restartActivity(act: AppCompatActivity){
|
||||
act.startActivity(intent)
|
||||
}
|
||||
|
||||
/* Helpers que sustituyen a org.jetbrains.anko:anko-commons */
|
||||
|
||||
/** Toast corto, equivalente al toast() de Anko */
|
||||
fun Context.toast(message: String) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
/** Lanza el chooser de compartir, equivalente al share() de Anko */
|
||||
fun Context.share(text: String) {
|
||||
val intent = Intent(Intent.ACTION_SEND).apply {
|
||||
type = "text/plain"
|
||||
putExtra(Intent.EXTRA_TEXT, text)
|
||||
}
|
||||
startActivity(Intent.createChooser(intent, null))
|
||||
}
|
||||
|
||||
/** Abre una URL, equivalente al browse() de Anko */
|
||||
fun Context.browse(url: String) {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
||||
}
|
||||
|
||||
/** inline reified para mantener la sintaxis startActivity<T>() de Anko */
|
||||
inline fun <reified T : android.app.Activity> Context.startActivity() {
|
||||
startActivity(Intent(this, T::class.java))
|
||||
}
|
||||
|
||||
|
||||
/* Call for putting alarm */
|
||||
fun putAlarm(context: Context) {
|
||||
var P = Prefs(context)
|
||||
//val nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
val P = Prefs(context)
|
||||
/* Common vars for alarm config */
|
||||
val alarmMgr = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
val sender = PendingIntent.getBroadcast(context, 1, Intent(context, AlarmNotif::class.java), 0)
|
||||
val sender = PendingIntent.getBroadcast(context, 1, Intent(context, AlarmNotif::class.java), PendingIntent.FLAG_IMMUTABLE)
|
||||
|
||||
/* Cancel alarm first */
|
||||
alarmMgr.cancel(sender)
|
||||
//nm.cancel(1);
|
||||
|
||||
|
||||
var time = Calendar.getInstance()
|
||||
val time = Calendar.getInstance()
|
||||
if (P.getNotifOn()) {
|
||||
if (P.getPersNotifOn()) { /* Persistent */
|
||||
var intent = Intent()
|
||||
val intent = Intent()
|
||||
intent.setAction("com.jkanetwork.st.frasesdeanime.notif")
|
||||
context.sendBroadcast(intent)
|
||||
|
||||
}else{ /* At x hour every day */
|
||||
|
||||
/* Here set the alarm to one time a day in selected date. Default: 8AM */
|
||||
/* Shedechule Alarm for tomorrow instead before now if alarm set to before. */
|
||||
/* Schedule Alarm for tomorrow instead before now if alarm set to before. */
|
||||
if (time.get(Calendar.HOUR_OF_DAY) > P.getHour() || ( time.get(Calendar.HOUR_OF_DAY) == P.getHour() && time.get(Calendar.MINUTE) > P.getMinute())) {
|
||||
/* Add a day */
|
||||
time.add(Calendar.DATE, 1)
|
||||
@@ -66,19 +88,13 @@ fun putAlarm(context: Context) {
|
||||
Log.d("STLOG (Next)", time.getTime().toString())
|
||||
alarmMgr.setRepeating(AlarmManager.RTC, time.getTimeInMillis(), AlarmManager.INTERVAL_DAY, sender) // Repeat every day
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class App : Application() {
|
||||
|
||||
companion object {
|
||||
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,41 +3,29 @@ package com.jkanetwork.st.frasesdeanime
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import android.widget.SimpleAdapter
|
||||
import android.widget.ListView
|
||||
import android.widget.TextView
|
||||
import android.view.ContextMenu
|
||||
import android.view.MenuItem
|
||||
import android.widget.AdapterView
|
||||
import android.content.ClipboardManager
|
||||
import android.content.ClipData
|
||||
import org.jetbrains.anko.*
|
||||
|
||||
//import kotlinx.android.synthetic.main.activity_simplelistview.*
|
||||
import com.jkanetwork.st.frasesdeanime.databinding.ActivityListBinding
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 25/07/17.
|
||||
* Help: https://www.youtube.com/watch?v=x-M1L6tcsLo
|
||||
* Layout DSL de Anko migrado a XML (activity_list.xml) + ViewBinding
|
||||
*/
|
||||
class FavsActivity : AppCompatActivity(){
|
||||
|
||||
/* For DSL bind */
|
||||
lateinit var view_list : ListView
|
||||
private lateinit var binding: ActivityListBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
/** Layout in DSL */
|
||||
verticalLayout {
|
||||
view_list = listView {
|
||||
}.lparams(width = matchParent, height = matchParent) {
|
||||
}
|
||||
}
|
||||
binding = ActivityListBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
val data = ArrayList<HashMap<String,String>>()
|
||||
var db = SQLiteHelper(applicationContext)
|
||||
val db = SQLiteHelper(applicationContext)
|
||||
val listIDFrases = db.getAllIDFavs()
|
||||
val length = listIDFrases.size
|
||||
|
||||
@@ -48,14 +36,14 @@ class FavsActivity : AppCompatActivity(){
|
||||
data.add(item)
|
||||
}
|
||||
|
||||
view_list.adapter = SimpleAdapter(this,data,android.R.layout.simple_list_item_2,
|
||||
binding.viewList.adapter = android.widget.SimpleAdapter(this,data,android.R.layout.simple_list_item_2,
|
||||
arrayOf("sentence","anime"), intArrayOf(android.R.id.text1,android.R.id.text2))
|
||||
|
||||
registerForContextMenu(view_list)
|
||||
registerForContextMenu(binding.viewList)
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateContextMenu(menu: ContextMenu, v: View,
|
||||
override fun onCreateContextMenu(menu: ContextMenu, v: android.view.View,
|
||||
menuInfo: ContextMenu.ContextMenuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo)
|
||||
val inflater = getMenuInflater()
|
||||
@@ -65,7 +53,7 @@ class FavsActivity : AppCompatActivity(){
|
||||
|
||||
override fun onContextItemSelected(item: MenuItem): Boolean {
|
||||
val info = item.getMenuInfo() as AdapterView.AdapterContextMenuInfo
|
||||
val obj = view_list.getItemAtPosition(info.position) as HashMap<String, String>
|
||||
val obj = binding.viewList.getItemAtPosition(info.position) as HashMap<String, String>
|
||||
|
||||
when (item.getItemId()) {
|
||||
R.id.copy -> {
|
||||
@@ -90,5 +78,4 @@ class FavsActivity : AppCompatActivity(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,20 +2,18 @@ package com.jkanetwork.st.frasesdeanime
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import org.jetbrains.anko.*
|
||||
import android.util.Log
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.view.Menu
|
||||
import android.view.View
|
||||
import android.view.MenuItem
|
||||
import java.util.Calendar
|
||||
import java.text.DateFormatSymbols
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Toast
|
||||
|
||||
/* Ads */
|
||||
import com.google.android.gms.ads.AdRequest
|
||||
import com.google.android.gms.ads.MobileAds
|
||||
import com.google.android.gms.ads.rewarded.RewardedAd;
|
||||
|
||||
|
||||
@@ -47,7 +45,7 @@ class MainActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
setContentView(R.layout.activity_main);
|
||||
setContentView(binding.root)
|
||||
|
||||
P = Prefs(applicationContext)
|
||||
db = SQLiteHelper(applicationContext)
|
||||
@@ -55,9 +53,11 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
/* Ads */
|
||||
// Initialize the Mobile Ads SDK.
|
||||
MobileAds.initialize(this) { }
|
||||
|
||||
var adRequest = AdRequest.Builder().build()
|
||||
RewardedAd.load(this,this.getString(R.string.admob_id), adRequest, object : RewardedAdLoadCallback() {
|
||||
// Cargar el anuncio recompensado con el ID de UNIDAD (videoid), no el de app
|
||||
val adRequest = AdRequest.Builder().build()
|
||||
RewardedAd.load(this, this.getString(R.string.admob_videoid), adRequest, object : RewardedAdLoadCallback() {
|
||||
override fun onAdFailedToLoad(adError: LoadAdError) {
|
||||
rewardedAd = null
|
||||
}
|
||||
@@ -67,34 +67,34 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
})
|
||||
|
||||
val extras = Bundle()
|
||||
|
||||
extras.putString("max_ad_content_rating", "PG") //Non adult ads
|
||||
|
||||
|
||||
/* Check if first time or not, for welcoming user */
|
||||
if (P.getFirstTime() == true){
|
||||
alert("Bienvenido a Frases de anime! Un lugar donde puedes descubrir las frases de tus animes favoritos, todos los días!\n" +
|
||||
"Selecciona de la siguiente lista los que más te gusten para empezar."){
|
||||
positiveButton("Empezemos") {startActivity<AnimesSelActivity>()}
|
||||
}.show()
|
||||
androidx.appcompat.app.AlertDialog.Builder(this)
|
||||
.setMessage("Bienvenido a Frases de anime! Un lugar donde puedes descubrir las frases de tus animes favoritos, todos los días!\n" +
|
||||
"Selecciona de la siguiente lista los que más te gusten para empezar.")
|
||||
.setPositiveButton("Empezemos") { _, _ -> startActivity<AnimesSelActivity>() }
|
||||
.show()
|
||||
|
||||
}else {
|
||||
/* Check if no anime is selected */
|
||||
if (db.getCountAnimeSel() == 0) {
|
||||
alert("No tienes ningún anime seleccionado, ¿Quieres seleccionarlos ahora?", "No hay animes seleccionados") {
|
||||
positiveButton("Si") { startActivity<AnimesSelActivity>() }
|
||||
negativeButton("No") { }
|
||||
}.show()
|
||||
androidx.appcompat.app.AlertDialog.Builder(this)
|
||||
.setTitle("No hay animes seleccionados")
|
||||
.setMessage("No tienes ningún anime seleccionado, ¿Quieres seleccionarlos ahora?")
|
||||
.setPositiveButton("Si") { _, _ -> startActivity<AnimesSelActivity>() }
|
||||
.setNegativeButton("No") { _, _ -> }
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
//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()
|
||||
androidx.appcompat.app.AlertDialog.Builder(this)
|
||||
.setMessage("¿Te gusta la apliación? ¿Crees que la falta algo?")
|
||||
.setPositiveButton("Danos tu opinión") { _, _ -> browse("https://play.google.com/store/apps/details?id=com.jkanetwork.st.frasesdeanime") }
|
||||
.setNegativeButton("Más tarde") { _, _ -> }
|
||||
.show()
|
||||
P.setRateCountdown(); //To -1, if not..you know
|
||||
}else{
|
||||
P.setRateCountdown(); //Countdown one
|
||||
@@ -121,33 +121,31 @@ class MainActivity : AppCompatActivity() {
|
||||
rewardedAd?.let { ad ->
|
||||
ad.show(this, OnUserEarnedRewardListener { rewardItem ->
|
||||
// Handle the reward. ANUNCIO VISTO CORRECTAMENTE.
|
||||
alert {
|
||||
customView {
|
||||
linearLayout {
|
||||
imageView {
|
||||
imageResource = R.drawable.gato
|
||||
}.lparams(width = matchParent) {
|
||||
margin = dip(4)
|
||||
}
|
||||
val gato = ImageView(this@MainActivity)
|
||||
gato.setImageResource(R.drawable.gato)
|
||||
val padding = (4 * resources.displayMetrics.density).toInt()
|
||||
gato.setPadding(padding, padding, padding, padding)
|
||||
androidx.appcompat.app.AlertDialog.Builder(this@MainActivity)
|
||||
.setView(gato)
|
||||
.setPositiveButton("Cambiar la frase") { _, _ ->
|
||||
/* First remove sentence, then load a new one, and change data */
|
||||
db.delSentence(yearS,monthS, dayS)
|
||||
IDFraseS = db.getIDFrase(yearS,monthS, dayS)
|
||||
changeData()
|
||||
}
|
||||
}
|
||||
positiveButton("Cambiar la frase") {
|
||||
/* First remove sentence, then load a new one, and change data */
|
||||
db.delSentence(yearS,monthS, dayS)
|
||||
IDFraseS = db.getIDFrase(yearS,monthS, dayS)
|
||||
changeData()
|
||||
}
|
||||
}.show()
|
||||
.show()
|
||||
})
|
||||
} ?: run {
|
||||
alert("Aún no hay un anuncio disponible, espere") {
|
||||
positiveButton("Ok") { }
|
||||
}.show()
|
||||
androidx.appcompat.app.AlertDialog.Builder(this)
|
||||
.setMessage("Aún no hay un anuncio disponible, espere")
|
||||
.setPositiveButton("Ok") { _, _ -> }
|
||||
.show()
|
||||
}
|
||||
}else{ // if (IDFraseS <= 0) {
|
||||
alert("Aquí no puedes ver una frase aún, no sirve de nada pulsar el botón") {
|
||||
positiveButton("Ok") { }
|
||||
}.show()
|
||||
androidx.appcompat.app.AlertDialog.Builder(this)
|
||||
.setMessage("Aquí no puedes ver una frase aún, no sirve de nada pulsar el botón")
|
||||
.setPositiveButton("Ok") { _, _ -> }
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,6 +211,7 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
/** "Close" app on back button */
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
moveTaskToBack(true)
|
||||
}
|
||||
@@ -220,7 +219,7 @@ class MainActivity : AppCompatActivity() {
|
||||
/** It returns the month name */
|
||||
fun getMonth(month: Int): String {
|
||||
val str = DateFormatSymbols().getMonths()[month - 1]
|
||||
return str.capitalize()
|
||||
return str.replaceFirstChar { it.uppercase() }
|
||||
}
|
||||
|
||||
/** This function replaces texts of main activity to sentence using IDFraseS var
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.jkanetwork.st.frasesdeanime
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.content.Context
|
||||
import android.widget.ArrayAdapter
|
||||
import org.jetbrains.anko.*
|
||||
import android.content.Intent
|
||||
import java.util.*
|
||||
import android.content.BroadcastReceiver
|
||||
import android.app.NotificationManager
|
||||
import com.jkanetwork.st.frasesdeanime.databinding.ActivityOptsBinding
|
||||
|
||||
/**
|
||||
@@ -69,11 +69,12 @@ class OptsActivity : AppCompatActivity(){
|
||||
P.setNotifOn(binding.chkAlarm.isChecked())
|
||||
P.setPersNotifOn(binding.chkPersistent.isChecked())
|
||||
|
||||
val nm = applicationContext.notificationManager
|
||||
nm.cancel(1); //Canel notif before service going on, for persistent notification problems
|
||||
val nm = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
nm.cancel(1); //Cancel notif before service going on, for persistent notification problems
|
||||
putAlarm(this)
|
||||
if (binding.chkPersistent.isChecked() && binding.chkAlarm.isChecked()) {
|
||||
this.startService(Intent(this, AlarmNotif::class.java))
|
||||
// Disparar la notificación persistente vía broadcast (AlarmNotif es un receiver, no un service)
|
||||
sendBroadcast(Intent(this, AlarmNotif::class.java))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.jkanetwork.st.frasesdeanime
|
||||
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import android.database.sqlite.SQLiteDatabase
|
||||
import org.jetbrains.anko.db.*
|
||||
import android.database.sqlite.SQLiteOpenHelper
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
@@ -11,15 +12,17 @@ import android.util.Log
|
||||
|
||||
/**
|
||||
* Created by kprkpr on 18/07/17.
|
||||
* Migrado de anko-sqlite (ManagedSQLiteOpenHelper) a SQLiteOpenHelper nativo.
|
||||
*/
|
||||
|
||||
/** ctx, DB.NAME, null, DB.Version */
|
||||
class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite", null, 8) {
|
||||
class SQLiteHelper(ctx: Context) : SQLiteOpenHelper(ctx, "otaku.sqlite", null, 8) {
|
||||
val context = ctx
|
||||
val db = this.getWritableDatabase()
|
||||
|
||||
// Hacer que los números al pasar a String tengan X digitos
|
||||
fun Int.format(digits: Int) = java.lang.String.format("%0${digits}d", this)
|
||||
|
||||
companion object {
|
||||
private var instance: SQLiteHelper? = null
|
||||
|
||||
@@ -38,13 +41,11 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||
"TDay TEXT NOT NULL UNIQUE," +
|
||||
"IDFrase INTEGER)")
|
||||
db.createTable("FRASESFAV", true,
|
||||
"IDFrase" to INTEGER + UNIQUE)
|
||||
db.createTable("ANIMESON", true,
|
||||
"IDAnime" to INTEGER + UNIQUE)
|
||||
db.execSQL("CREATE TABLE FRASESFAV (IDFrase INTEGER UNIQUE)")
|
||||
db.execSQL("CREATE TABLE ANIMESON (IDAnime INTEGER UNIQUE)")
|
||||
|
||||
//Load animes and sentences
|
||||
var queries: List<String> = readSqldata(R.raw.loadsqlfile).split(";\n");
|
||||
val queries: List<String> = readSqldata(R.raw.loadsqlfile).split(";\n");
|
||||
for (query in queries){
|
||||
if (!query.isBlank())
|
||||
db.execSQL(query);
|
||||
@@ -53,7 +54,7 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
|
||||
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
// Here you can upgrade tables, as usual
|
||||
var queries: List<String> = readSqldata(R.raw.loadsqlfile).split(";\n");
|
||||
val queries: List<String> = readSqldata(R.raw.loadsqlfile).split(";\n");
|
||||
for (query in queries){
|
||||
if (!query.isBlank())
|
||||
db.execSQL(query);
|
||||
@@ -86,11 +87,7 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
val query = db.rawQuery("SELECT IDFrase FROM FRASESFAV WHERE IDFrase = '$IDFrase'", null)
|
||||
val res = query.getCount()
|
||||
query.close()
|
||||
if (res > 0){
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
return res > 0
|
||||
}
|
||||
|
||||
/** Changes the state of fav of a sentence
|
||||
@@ -98,7 +95,9 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
*/
|
||||
fun setFav (IDFrase: Int) {
|
||||
if (getFav(IDFrase) == false){
|
||||
db.insert("FRASESFAV","IDFrase" to IDFrase)
|
||||
val values = ContentValues()
|
||||
values.put("IDFrase", IDFrase)
|
||||
db.insert("FRASESFAV", null, values)
|
||||
}else{
|
||||
db.execSQL("DELETE FROM FRASESFAV WHERE IDFrase='$IDFrase'")
|
||||
}
|
||||
@@ -125,8 +124,11 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
}
|
||||
|
||||
fun getIDAnimeFromName (Name: String): Int {
|
||||
var query = db.select("ANIMES", "IDAnime").whereArgs("Name = '$Name'")
|
||||
return query.parseSingle(IntParser)
|
||||
val c = db.rawQuery("SELECT IDAnime FROM ANIMES WHERE Name = '$Name'", null)
|
||||
c.moveToFirst()
|
||||
val ret = c.getInt(0)
|
||||
c.close()
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
@@ -148,9 +150,10 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
try {
|
||||
query = db.rawQuery("SELECT IDFrase FROM FRASES WHERE IDAnime IN (SELECT IDAnime FROM ANIMESON) AND IDFrase NOT IN (SELECT IDFrase FROM FRASESVI) ORDER BY RANDOM() LIMIT 1", null)
|
||||
query.moveToFirst()
|
||||
db.insert("FRASESVI",
|
||||
"TDay" to diaArg,
|
||||
"IDFrase" to query.getString(0))
|
||||
val values = ContentValues()
|
||||
values.put("TDay", diaArg)
|
||||
values.put("IDFrase", query.getString(0))
|
||||
db.insert("FRASESVI", null, values)
|
||||
val ret = query.getInt(0)
|
||||
query.close()
|
||||
return ret
|
||||
@@ -170,20 +173,26 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
}
|
||||
|
||||
fun getAllIDFavs(): Array<Int>{
|
||||
var query = db.select("FRASESFAV", "IDFrase")
|
||||
var list = query.parseList(IntParser)
|
||||
val c = db.rawQuery("SELECT IDFrase FROM FRASESFAV", null)
|
||||
val list = ArrayList<Int>()
|
||||
while (c.moveToNext()) list.add(c.getInt(0))
|
||||
c.close()
|
||||
return list.toTypedArray()
|
||||
}
|
||||
|
||||
fun getAllAnimeIDs(): Array<Int>{
|
||||
var query = db.select("ANIMES", "IDAnime").orderBy("Name", SqlOrderDirection.ASC)
|
||||
var list = query.parseList(IntParser)
|
||||
val c = db.rawQuery("SELECT IDAnime FROM ANIMES ORDER BY Name ASC", null)
|
||||
val list = ArrayList<Int>()
|
||||
while (c.moveToNext()) list.add(c.getInt(0))
|
||||
c.close()
|
||||
return list.toTypedArray()
|
||||
}
|
||||
|
||||
fun getAllAnimeNames(): Array<String>{
|
||||
var query = db.select("ANIMES", "Name").orderBy("Name", SqlOrderDirection.ASC)
|
||||
var list = query.parseList(StringParser)
|
||||
val c = db.rawQuery("SELECT Name FROM ANIMES ORDER BY Name ASC", null)
|
||||
val list = ArrayList<String>()
|
||||
while (c.moveToNext()) list.add(c.getString(0))
|
||||
c.close()
|
||||
return list.toTypedArray()
|
||||
}
|
||||
|
||||
@@ -192,11 +201,7 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
val query = db.rawQuery("SELECT IDAnime FROM ANIMESON WHERE IDAnime = '$IDA'", null)
|
||||
val res = query.getCount()
|
||||
query.close()
|
||||
if (res > 0){
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
return res > 0
|
||||
}
|
||||
|
||||
/** Changes the state of a selected or not anime
|
||||
@@ -204,7 +209,9 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
*/
|
||||
fun setAnimeSel (IDAnime: Int) {
|
||||
if (getAnimeSel(IDAnime) == false){
|
||||
db.insert("ANIMESON","IDAnime" to IDAnime)
|
||||
val values = ContentValues()
|
||||
values.put("IDAnime", IDAnime)
|
||||
db.insert("ANIMESON", null, values)
|
||||
}else{
|
||||
db.execSQL("DELETE FROM ANIMESON WHERE IDAnime='$IDAnime'")
|
||||
}
|
||||
@@ -233,23 +240,24 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
|
||||
/** This funcion selects or desselects all animes from selected to show */
|
||||
fun setAllAnimeSel(){
|
||||
var selectAll = getAllAnimeSel(); //Know if anyone is select (true/false)
|
||||
val selectAll = getAllAnimeSel(); //Know if anyone is select (true/false)
|
||||
//First, unset all, and after that, select all if they were not before. (Why? Because if someone are select, inserting again will crash)
|
||||
db.execSQL("DELETE FROM ANIMESON")
|
||||
if (selectAll == false){ //Set all
|
||||
var animeIDs = getAllAnimeIDs()
|
||||
val animeIDs = getAllAnimeIDs()
|
||||
|
||||
for (pos in animeIDs){
|
||||
db.insert("ANIMESON",
|
||||
"IDAnime" to animeIDs[pos-1]) //Pos is a count, arrays start at 0
|
||||
val values = ContentValues()
|
||||
values.put("IDAnime", animeIDs[pos-1]) //Pos is a count, arrays start at 0
|
||||
db.insert("ANIMESON", null, values)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** It returns if all animes are selected or not */
|
||||
fun getAllAnimeSel(): Boolean{
|
||||
var set = getCountAnimeSel();
|
||||
var countanime = getAllAnimeIDs().size;
|
||||
val set = getCountAnimeSel();
|
||||
val countanime = getAllAnimeIDs().size;
|
||||
if (set == countanime){
|
||||
return true;
|
||||
}else{
|
||||
@@ -269,4 +277,4 @@ class SQLiteHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "otaku.sqlite",
|
||||
|
||||
// Access property for Context
|
||||
val Context.database: SQLiteHelper
|
||||
get() = SQLiteHelper.getInstance(applicationContext)
|
||||
get() = SQLiteHelper.getInstance(applicationContext)
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#F8F2F2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="¡Gracias por usar Frases de Anime! \nIdea por Alba García y desarrollada por JKANetwork!"
|
||||
android:textSize="22sp"
|
||||
android:textColor="#000000"
|
||||
android:textAlignment="center"
|
||||
android:padding="12dp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/cerebro"
|
||||
android:contentDescription="Logo" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_exit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Volver" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_sel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Seleccionar todos" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/view_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Layout genérico de lista, sustituye al DSL verticalLayout{listView{}} de Anko -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/view_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,2 +1,2 @@
|
||||
#Sun Apr 07 19:54:23 CEST 2024
|
||||
VERSION_CODE=1354
|
||||
#Mon Oct 12 10:42:32 CEST 2026
|
||||
VERSION_CODE=1361
|
||||
+2
-35
@@ -1,38 +1,5 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven { url 'https://jitpack.io' }
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.5.20'
|
||||
id 'com.android.application' version '8.10.0' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '2.2.10' apply false
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
compileTestKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
jcenter()
|
||||
google()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1 +1,16 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
include ':app'
|
||||
Reference in new issue
Block a user