Initial commit

This commit is contained in:
2026-07-26 22:33:09 -06:00
commit 895760cb5d
69 changed files with 6315 additions and 0 deletions

20
.gitignore vendored Normal file
View File

@@ -0,0 +1,20 @@
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
/app/build
/app/release
opencode.txt
*.apk
*.aab
*.jks
*.keystore
*/build/
*.log
*.hprof

220
README.md Executable file
View File

@@ -0,0 +1,220 @@
# Recordatorios
App Android de notas y recordatorios con Material 3 Dynamic Colors (Monet).
## Funcionalidades
- **Notas** con título y contenido multilínea
- **Recordatorios** con fecha y hora exacta (AlarmManager)
- **Recurrencia**: diaria, semanal, mensual, anual
- **Notificaciones** push al cumplirse la fecha, incluso con la app cerrada
- **Tabs**: Hoy (tareas del día), Pendientes (futuros), Eliminados (papelera)
- **Check**: completa una nota y la envía a Eliminados; si es recurrente, adelanta al próximo período
- **Buscador** por título y contenido en tiempo real
- **Papelera** con restauración y borrado permanente
## Requisitos
- Android Studio Hedgehog (2023.1.1) o superior
- JDK 17
- Gradle 8.0
- compileSdk 34, minSdk 26
## Cómo ejecutar
```bash
git clone <repo>
cd Recordatorios
./gradlew assembleDebug
```
El APK se genera en `app/build/outputs/apk/debug/app-debug.apk`.
Si el SDK no está en `~/Android/Sdk`, crear `local.properties`:
```
sdk.dir=/ruta/al/Android/Sdk
```
## Estructura del proyecto
```
app/src/main/java/com/recordatorios/app/
├── MainActivity.kt # Actividad principal, maneja tabs, editor, filtros
├── Note.kt # Modelo de datos (data class)
├── NotesManager.kt # Persistencia con SharedPreferences + Gson
├── NoteAdapter.kt # RecyclerView adapter con expand/colapsar
├── ReminderReceiver.kt # BroadcastReceiver para notificaciones + recurrencia
└── ReminderScheduler.kt # AlarmManager (setExactAndAllowWhileIdle)
app/src/main/res/
├── layout/
│ ├── activity_main.xml # Toolbar, tabs, buscador, RecyclerView, FAB
│ ├── item_note.xml # Card con expand, check, fecha, acciones
│ └── dialog_note_editor.xml # Editor: título, contenido, recordatorio, recurrencia
├── drawable/ # Iconos vectoriales (pencil, trash, sun, clock, bell, check)
└── values/
├── themes.xml # Theme.Material3.DynamicColors.DayNight + NoActionBar
├── colors.xml
└── strings.xml # Español
```
## Flujo de desarrollo
1. **Modelo** → modificar `Note.kt` (agregar/quitar campos)
2. **Persistencia**`NotesManager.kt` (SharedPreferences + Gson)
3. **UI** → layout XML + binding en `MainActivity.kt`
4. **Adapter**`NoteAdapter.kt` para cambios en la lista
5. **Recordatorios**`ReminderScheduler.kt` + `ReminderReceiver.kt`
6. **Compilar**`./gradlew assembleDebug`
Si se agrega un campo a `Note.kt`, Gson lo serializa automáticamente. No hay migraciones de base de datos.
## Estilo
- Tema: `Theme.Material3.DynamicColors.DayNight` (colores dinámicos del wallpaper)
- Cards: `MaterialCardView`, 12dp radius, 2dp elevation
- TextFields: `OutlinedBox`
- Tabs con iconos vectoriales
- Sin ActionBar nativa — solo Toolbar personalizada
---
## Guía de Uso
### Introducción
Recordatorios es una aplicación Android para gestionar notas y recordatorios con un diseño moderno usando Material 3 y colores dinámicos.
### Pestañas
#### ☀️ Hoy
Muestra los recordatorios programados para el día actual y los que ya vencieron.
- **Tareas del día**: Recordatorios con fecha de hoy
- **Vencidos**: Recordatorios que ya pasaron su fecha
- Las notas se agrupan en secciones para fácil identificación
#### 🕐 Pendientes
Muestra los recordatorios futuros, aquellos programados para fechas posteriores a hoy.
- Solo muestra recordatorios que aún no han llegado
- Ordenados cronológicamente
#### 📅 Calendario
Vista de calendario mensual con indicadores visuales.
- **Puntos de color**: Indican recordatorios en ese día
- **Tap simple**: Muestra los recordatorios del día seleccionado
- **Triple tap**: Crea un nuevo recordatorio para esa fecha
- **Swipe horizontal**: Cambia entre meses
- **Lista inferior**: Muestra todos los recordatorios del mes actual
#### 🗑️ Basurero
Papelera donde van las notas completadas o eliminadas.
- **Restaurar**: Devuelve la nota a la lista principal
- **Eliminar permanentemente**: Borra la nota definitivamente
- Las notas recurrentes completadas adelantan al próximo período
#### ⚙️ Configuración
Ajustes de la aplicación.
### Funcionalidades Principales
#### Crear una Nota
1. Presiona el botón **+** en la esquina inferior derecha
2. Escribe un título y/o contenido
3. Activa el switch de recordatorio si deseas una notificación
4. Selecciona fecha y hora
5. Elige la recurrencia (diaria, semanal, mensual, anual)
6. Selecciona una categoría (opcional)
7. Agrega una foto (opcional)
8. Presiona **Guardar**
#### Nota por Voz
1. Presiona el botón de **micrófono** junto al botón +
2. Di tu recordatorio
3. La app parseará automáticamente lo dicho
#### Editar una Nota
1. Expande la nota presionando la flecha ▼
2. Presiona **Editar**
3. Modifica los campos necesarios
4. Presiona **Guardar**
#### Completar una Nota
- Presiona el botón de **check** ✓ en la card
- La nota se mueve al basurero
- Si es recurrente, se programa automáticamente para el próximo período
#### Eliminar una Nota
1. Expande la nota
2. Presiona **Eliminar**
3. Confirma la eliminación
4. La nota va al basurero
#### Buscar Notas
- Usa el campo de búsqueda en la parte superior
- Busca por título o contenido en tiempo real
#### Filtrar por Categoría
- En la pestaña de Pendientes, selecciona las categorías deseadas
- Los filtros se guardan automáticamente
### Categorías
#### Crear Categoría
1. En el editor de notas, presiona **Administrar categorías**
2. Presiona **Agregar categoría**
3. Escribe un nombre
4. Selecciona un color
5. Presiona **Guardar**
#### Editar/Eliminar Categoría
- En el administrador de categorías, usa los botones de lápiz o basura
### Configuración
#### Biometría
- Activa el desbloqueo con huella dactilar o reconocimiento facial
- Solo se solicita una vez al abrir la app
#### Tema
- **Sistema**: Sigue el tema del dispositivo
- **Claro**: Siempre tema claro
- **Oscuro**: Siempre tema oscuro
#### Fondo Personalizado
- Selecciona una imagen de tu galería como fondo
- Se aplica un efecto de blur para mejor legibilidad
#### Notificaciones
- Mostrar imagen en notificaciones (activado por defecto)
#### Limpieza Automática de Basurero
- Configura cuánto tiempo permanecen las notas en el basurero
- Opciones: Desactivado, 1 día, 3 días, 7 días, 30 días
#### Datos
- **Exportar**: Guarda todas las notas y categorías en un archivo JSON
- **Importar**: Restaura desde un archivo de backup
### Gestos
- **Swipe horizontal**: Cambia entre pestañas
- **Swipe en calendario**: Cambia de mes
### Consejos
1. **Recurrencia**: Usa recordatorios recurrentes para tareas periódicas
2. **Categorías**: Organiza tus notas por colores para identificarlas rápidamente
3. **Bordes de color**: Las cards muestran el color de su categoría en el borde
4. **Backup**: Exporta regularmente tus datos para no perder información
5. **Búsqueda**: Usa la búsqueda para encontrar notas antiguas rápidamente
---
## Repositorio Oficial
**[https://git.nakano47.com/nino/Recordatorios-app](https://git.nakano47.com/nino/Recordatorios-app)**

50
app/build.gradle Executable file
View File

@@ -0,0 +1,50 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.recordatorios.app'
compileSdk 34
defaultConfig {
applicationId "com.recordatorios.app"
minSdk 26
targetSdk 34
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'androidx.activity:activity-ktx:1.8.2'
implementation 'androidx.biometric:biometric:1.1.0'
implementation 'androidx.security:security-crypto:1.1.0-alpha06'
}

1
app/proguard-rules.pro vendored Executable file
View File

@@ -0,0 +1 @@
# Add project specific ProGuard rules here.

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Recordatorios">
<activity
android:name=".MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".ReminderReceiver"
android:exported="false" />
<receiver
android:name=".TodayWidgetProvider"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_today" />
</receiver>
<activity
android:name=".WidgetConfigActivity"
android:exported="true"
android:theme="@style/Theme.Recordatorios"
android:taskAffinity=""
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
</application>
</manifest>

156
app/src/main/assets/guide.md Executable file
View File

@@ -0,0 +1,156 @@
# Guía de Uso - Recordatorios
## Introducción
Recordatorios es una aplicación Android para gestionar notas y recordatorios con un diseño moderno usando Material 3 y colores dinámicos.
---
## Pestañas
### ☀️ Hoy
Muestra los recordatorios programados para el día actual y los que ya vencieron.
- **Tareas del día**: Recordatorios con fecha de hoy
- **Vencidos**: Recordatorios que ya pasaron su fecha
- Las notas se agrupan en secciones para fácil identificación
### 🕐 Pendientes
Muestra los recordatorios futuros, aquellos programados para fechas posteriores a hoy.
- Solo muestra recordatorios que aún no han llegado
- Ordenados cronológicamente
### 📅 Calendario
Vista de calendario mensual con indicadores visuales.
- **Puntos de color**: Indican recordatorios en ese día
- **Tap simple**: Muestra los recordatorios del día seleccionado
- **Triple tap**: Crea un nuevo recordatorio para esa fecha
- **Swipe horizontal**: Cambia entre meses
- **Lista inferior**: Muestra todos los recordatorios del mes actual
### 🗑️ Basurero
Papelera donde van las notas completadas o eliminadas.
- **Restaurar**: Devuelve la nota a la lista principal
- **Eliminar permanentemente**: Borra la nota definitivamente
- Las notas recurrentes completadas adelantan al próximo período
### ⚙️ Configuración
Ajustes de la aplicación.
---
## Funcionalidades Principales
### Crear una Nota
1. Presiona el botón **+** en la esquina inferior derecha
2. Escribe un título y/o contenido
3. Activa el switch de recordatorio si deseas una notificación
4. Selecciona fecha y hora
5. Elige la recurrencia (diaria, semanal, mensual, anual)
6. Selecciona una categoría (opcional)
7. Agrega una foto (opcional)
8. Presiona **Guardar**
### Nota por Voz
1. Presiona el botón de **micrófono** junto al botón +
2. Di tu recordatorio
3. La app parseará automáticamente lo dicho
### Editar una Nota
1. Expande la nota presionando la flecha ▼
2. Presiona **Editar**
3. Modifica los campos necesarios
4. Presiona **Guardar**
### Completar una Nota
- Presiona el botón de **check** ✓ en la card
- La nota se mueve al basurero
- Si es recurrente, se programa automáticamente para el próximo período
### Eliminar una Nota
1. Expande la nota
2. Presiona **Eliminar**
3. Confirma la eliminación
4. La nota va al basurero
### Buscar Notas
- Usa el campo de búsqueda en la parte superior
- Busca por título o contenido en tiempo real
### Filtrar por Categoría
- En la pestaña de Pendientes, selecciona las categorías deseadas
- Los filtros se guardan automáticamente
---
## Categorías
### Crear Categoría
1. En el editor de notas, presiona **Administrar categorías**
2. Presiona **Agregar categoría**
3. Escribe un nombre
4. Selecciona un color
5. Presiona **Guardar**
### Editar/Eliminar Categoría
- En el administrador de categorías, usa los botones de lápiz o basura
---
## Configuración
### Biometría
- Activa el desbloqueo con huella dactilar o reconocimiento facial
- Solo se solicita una vez al abrir la app
### Tema
- **Sistema**: Sigue el tema del dispositivo
- **Claro**: Siempre tema claro
- **Oscuro**: Siempre tema oscuro
### Fondo Personalizado
- Selecciona una imagen de tu galería como fondo
- Se aplica un efecto de blur para mejor legibilidad
### Notificaciones
- Mostrar imagen en notificaciones (activado por defecto)
### Limpieza Automática de Basurero
- Configura cuánto tiempo permanecen las notas en el basurero
- Opciones: Desactivado, 1 día, 3 días, 7 días, 30 días
### Datos
- **Exportar**: Guarda todas las notas y categorías en un archivo JSON
- **Importar**: Restaura desde un archivo de backup
---
## Gestos
- **Swipe horizontal**: Cambia entre pestañas
- **Swipe en calendario**: Cambia de mes
---
## Consejos
1. **Recurrencia**: Usa recordatorios recurrentes para tareas periódicas
2. **Categorías**: Organiza tus notas por colores para identificarlas rápidamente
3. **Bordes de color**: Las cards muestran el color de su categoría en el borde
4. **Backup**: Exporta regularmente tus datos para no perder información
5. **Búsqueda**: Usa la búsqueda para encontrar notas antiguas rápidamente
---
## Repositorio Oficial
El código fuente está disponible en:
**[https://git.nakano47.com/nino/Recordatorios-app](https://git.nakano47.com/nino/Recordatorios-app)**
---
*Versión 1.0*

View File

@@ -0,0 +1,30 @@
package com.recordatorios.app
data class Category(
val id: String = java.util.UUID.randomUUID().toString(),
var name: String,
var color: Int
) {
companion object {
val DEFAULT_COLORS = listOf(
0xFFF44336.toInt(), // red
0xFFE91E63.toInt(), // pink
0xFF9C27B0.toInt(), // purple
0xFF673AB7.toInt(), // deep purple
0xFF3F51B5.toInt(), // indigo
0xFF2196F3.toInt(), // blue
0xFF03A9F4.toInt(), // light blue
0xFF00BCD4.toInt(), // cyan
0xFF009688.toInt(), // teal
0xFF4CAF50.toInt(), // green
0xFF8BC34A.toInt(), // light green
0xFFFFEB3B.toInt(), // yellow
0xFFFF9800.toInt(), // orange
0xFFFF5722.toInt(), // deep orange
0xFF795548.toInt(), // brown
0xFF607D8B.toInt(), // blue grey
0xFF9E9E9E.toInt(), // grey
0xFF000000.toInt(), // black
)
}
}

View File

@@ -0,0 +1,139 @@
package com.recordatorios.app
import android.content.Context
import android.content.SharedPreferences
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
class CategoryManager private constructor(context: Context) {
private var prefs: SharedPreferences =
context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
private val gson = Gson()
private var securityManager: SecurityManager? = null
private var categories: MutableList<Category> = mutableListOf()
fun setSecurityManager(securityManager: SecurityManager) {
this.securityManager = securityManager
val json = getPrefs().getString(KEY_CATEGORIES, null)
if (json != null) {
val type = object : TypeToken<MutableList<Category>>() {}.type
val loadedCategories = gson.fromJson<MutableList<Category>>(json, type)
if (loadedCategories != null && loadedCategories.isNotEmpty()) {
categories = loadedCategories
return
}
}
if (categories.isEmpty()) {
createDefaults()
}
}
fun reload() {
val json = getPrefs().getString(KEY_CATEGORIES, null)
if (json != null) {
val type = object : TypeToken<MutableList<Category>>() {}.type
categories = gson.fromJson(json, type) ?: mutableListOf()
}
if (categories.isEmpty()) {
createDefaults()
}
}
private fun getPrefs(): SharedPreferences {
return securityManager?.getEncryptedPrefs() ?: prefs
}
init {
loadCategories()
if (categories.isEmpty()) {
createDefaults()
}
}
private fun createDefaults() {
val defaults = listOf(
Category(name = "Personal", color = 0xFF2196F3.toInt()),
Category(name = "Trabajo", color = 0xFFFF9800.toInt()),
Category(name = "Estudio", color = 0xFF4CAF50.toInt()),
Category(name = "Salud", color = 0xFFF44336.toInt()),
Category(name = "Finanzas", color = 0xFF9C27B0.toInt()),
Category(name = "Otros", color = 0xFF607D8B.toInt()),
)
categories.addAll(defaults)
saveCategories()
}
private fun loadCategories() {
val json = getPrefs().getString(KEY_CATEGORIES, null) ?: return
val type = object : TypeToken<MutableList<Category>>() {}.type
categories = gson.fromJson(json, type) ?: mutableListOf()
}
private fun saveCategories() {
getPrefs().edit().putString(KEY_CATEGORIES, gson.toJson(categories)).apply()
}
fun getAllCategories(): List<Category> = categories.toList()
fun getCategory(id: String): Category? = categories.find { it.id == id }
fun addCategory(category: Category) {
categories.add(category)
saveCategories()
}
fun updateCategory(id: String, name: String, color: Int) {
val cat = categories.find { it.id == id } ?: return
cat.name = name
cat.color = color
saveCategories()
}
fun deleteCategory(id: String) {
categories.removeAll { it.id == id }
saveCategories()
}
fun getNoneCategoryId(): String? = categories.find { it.name == "Sin categoría" }?.id
fun exportToJson(): String {
return gson.toJson(categories)
}
fun importFromJson(json: String, merge: Boolean = true) {
val type = object : TypeToken<List<Category>>() {}.type
val importedCategories = gson.fromJson<List<Category>>(json, type) ?: return
if (importedCategories.isEmpty()) return
if (!merge) {
categories.clear()
categories.addAll(importedCategories)
} else {
for (category in importedCategories) {
val existing = categories.indexOfFirst { it.id == category.id || it.name.equals(category.name, ignoreCase = true) }
if (existing != -1) {
categories[existing] = category.copy(id = categories[existing].id)
} else {
categories.add(category)
}
}
}
saveCategories()
}
companion object {
private const val PREFS_NAME = "categories_prefs"
private const val KEY_CATEGORIES = "categories"
@Volatile
private var instance: CategoryManager? = null
fun getInstance(context: Context): CategoryManager {
return instance ?: synchronized(this) {
instance ?: CategoryManager(context.applicationContext).also { instance = it }
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
package com.recordatorios.app
import java.io.Serializable
enum class RecurrenceType {
NONE, DAILY, WEEKLY, MONTHLY, YEARLY
}
data class Note(
val id: Long = System.currentTimeMillis(),
var title: String = "",
var content: String = "",
var createdAt: Long = System.currentTimeMillis(),
var reminderDate: Long? = null,
var recurrence: RecurrenceType = RecurrenceType.NONE,
var isCompleted: Boolean = false,
var deletedAt: Long? = null,
var category: String = "",
var photoPath: String = ""
) : Serializable

View File

@@ -0,0 +1,379 @@
package com.recordatorios.app
import android.content.Context
import android.graphics.Bitmap
import androidx.core.content.ContextCompat
import android.graphics.Color
import android.view.View
import android.view.ViewGroup
import android.view.LayoutInflater
import android.view.animation.DecelerateInterpolator
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.recordatorios.app.databinding.ItemNoteBinding
import com.recordatorios.app.databinding.ItemSectionHeaderBinding
import java.lang.ref.WeakReference
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date
import java.util.Locale
class NoteAdapter(
private val onEdit: (Note) -> Unit,
private val onDelete: (Note) -> Unit,
private val onToggleComplete: (Note) -> Unit,
private val onRestore: (Note) -> Unit,
private val onPermanentDelete: (Note) -> Unit
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var notes = mutableListOf<Note>()
private var showDeleted = false
private var categoryFilter: String? = null
private var categories: List<Category> = emptyList()
private val expandedIds = mutableSetOf<Long>()
private var showTodaySection = false
private var staggerPending = false
private var rvRef: WeakReference<RecyclerView>? = null
companion object {
private const val TYPE_NOTE = 0
private const val TYPE_HEADER = 1
}
private val dateFormat = SimpleDateFormat("dd/MM/yyyy", Locale.getDefault())
private val timeFormat = SimpleDateFormat("HH:mm", Locale.getDefault())
private val headerDateFormat = SimpleDateFormat("EEEE dd/MM/yyyy", Locale.getDefault())
init {
setHasStableIds(true)
}
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
super.onAttachedToRecyclerView(recyclerView)
rvRef = WeakReference(recyclerView)
}
override fun getItemId(position: Int): Long {
if (!showTodaySection) return notes[position].id
if (getItemViewType(position) == TYPE_HEADER) {
return -1L - position
}
val note = getNoteAtPosition(position)
return note.id
}
fun submitList(list: List<Note>, isTodayTab: Boolean = false, animate: Boolean = false) {
showTodaySection = isTodayTab
staggerPending = animate
notes = list.toMutableList()
notifyDataSetChanged()
if (animate) {
rvRef?.get()?.addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
override fun onLayoutChange(v: View, left: Int, top: Int, right: Int, bottom: Int,
oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int) {
v.removeOnLayoutChangeListener(this)
performStaggerAnimation()
}
})
}
}
fun setShowDeleted(show: Boolean) {
if (showDeleted != show) {
showDeleted = show
expandedIds.clear()
}
}
fun setCategories(cats: List<Category>) {
categories = cats
}
override fun getItemCount(): Int {
if (!showTodaySection) return notes.size
val todayNotes = notes.filter { isToday(it) }
val overdueNotes = notes.filter { !isToday(it) }
return when {
todayNotes.isNotEmpty() && overdueNotes.isNotEmpty() -> todayNotes.size + 1 + overdueNotes.size + 1
todayNotes.isNotEmpty() -> todayNotes.size + 1
overdueNotes.isNotEmpty() -> overdueNotes.size + 1
else -> 0
}
}
override fun getItemViewType(position: Int): Int {
if (!showTodaySection) return TYPE_NOTE
val todayNotes = notes.filter { isToday(it) }
val overdueNotes = notes.filter { !isToday(it) }
var currentIndex = 0
if (todayNotes.isNotEmpty()) {
if (position == currentIndex) return TYPE_HEADER
currentIndex++
if (position < currentIndex + todayNotes.size) return TYPE_NOTE
currentIndex += todayNotes.size
}
if (overdueNotes.isNotEmpty()) {
if (position == currentIndex) return TYPE_HEADER
currentIndex++
if (position < currentIndex + overdueNotes.size) return TYPE_NOTE
}
return TYPE_NOTE
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return if (viewType == TYPE_HEADER) {
val binding = ItemSectionHeaderBinding.inflate(
LayoutInflater.from(parent.context), parent, false
)
SectionHeaderViewHolder(binding)
} else {
val binding = ItemNoteBinding.inflate(
LayoutInflater.from(parent.context), parent, false
)
NoteViewHolder(binding)
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is SectionHeaderViewHolder) {
holder.bind(position)
} else if (holder is NoteViewHolder) {
holder.bind(getNoteAtPosition(position))
}
}
override fun onViewAttachedToWindow(holder: RecyclerView.ViewHolder) {
super.onViewAttachedToWindow(holder)
if (staggerPending) {
val pos = holder.layoutPosition.coerceAtLeast(0)
holder.itemView.alpha = 0f
holder.itemView.translationY = 200f
holder.itemView.animate()
.alpha(1f)
.translationY(0f)
.translationZ(10f)
.setDuration(500)
.setStartDelay((pos * 100L).coerceAtMost(800L))
.setInterpolator(DecelerateInterpolator())
.withEndAction {
holder.itemView.translationZ = 0f
}
.start()
}
}
override fun onViewDetachedFromWindow(holder: RecyclerView.ViewHolder) {
super.onViewDetachedFromWindow(holder)
holder.itemView.animate().cancel()
holder.itemView.alpha = 1f
holder.itemView.translationY = 0f
holder.itemView.translationZ = 0f
}
private fun performStaggerAnimation() {
staggerPending = false
val rv = rvRef?.get() ?: return
for (i in 0 until rv.childCount) {
val child = rv.getChildAt(i)
if (child.alpha < 0.01f) continue
val holder = rv.getChildViewHolder(child)
val pos = holder.layoutPosition.coerceAtLeast(0)
child.alpha = 0f
child.translationY = 200f
child.animate()
.alpha(1f)
.translationY(0f)
.translationZ(10f)
.setDuration(500)
.setStartDelay((pos * 100L).coerceAtMost(800L))
.setInterpolator(DecelerateInterpolator())
.withEndAction { child.translationZ = 0f }
.start()
}
}
private fun isToday(note: Note): Boolean {
val todayStart = Calendar.getInstance().apply {
set(Calendar.HOUR_OF_DAY, 0); set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0); set(Calendar.MILLISECOND, 0)
}.timeInMillis
val todayEnd = todayStart + 86400000L
return note.reminderDate != null && note.reminderDate!! >= todayStart && note.reminderDate!! < todayEnd
}
private fun getNoteAtPosition(position: Int): Note {
if (!showTodaySection) return notes[position]
val todayNotes = notes.filter { isToday(it) }
val overdueNotes = notes.filter { !isToday(it) }
var currentIndex = 0
if (todayNotes.isNotEmpty()) {
currentIndex++ // skip header
if (position < currentIndex + todayNotes.size) {
return todayNotes[position - currentIndex]
}
currentIndex += todayNotes.size
}
if (overdueNotes.isNotEmpty()) {
currentIndex++ // skip header
if (position < currentIndex + overdueNotes.size) {
return overdueNotes[position - currentIndex]
}
}
return notes.firstOrNull() ?: notes[0]
}
inner class SectionHeaderViewHolder(private val binding: ItemSectionHeaderBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bind(position: Int) {
val todayNotes = notes.filter { isToday(it) }
if (todayNotes.isNotEmpty() && position == 0) {
binding.textSectionTitle.text = "Hoy"
binding.textSectionDate.text = headerDateFormat.format(Date(System.currentTimeMillis()))
binding.textSectionDate.visibility = View.VISIBLE
} else {
binding.textSectionTitle.text = "Vencidos"
binding.textSectionDate.visibility = View.GONE
}
}
}
inner class NoteViewHolder(private val binding: ItemNoteBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bind(note: Note) {
binding.textTitle.text = note.title.ifBlank { "Sin t\u00edtulo" }
val ta = binding.root.context.theme.obtainStyledAttributes(intArrayOf(android.R.attr.textColorPrimary))
binding.textTitle.setTextColor(ta.getColor(0, Color.WHITE))
ta.recycle()
val cat = categories.find { it.id == note.category }
if (cat != null) {
binding.categoryDot.visibility = View.VISIBLE
binding.categoryDot.setBackgroundResource(R.drawable.circle_category)
binding.categoryDot.background.setTint(cat.color)
binding.root.strokeColor = cat.color
binding.root.strokeWidth = 4
} else {
binding.categoryDot.visibility = View.GONE
binding.root.strokeColor = Color.TRANSPARENT
binding.root.strokeWidth = 0
}
if (note.reminderDate != null) {
binding.textDate.text = dateFormat.format(Date(note.reminderDate!!))
binding.textDate.visibility = View.VISIBLE
} else {
binding.textDate.visibility = View.GONE
}
val isExpanded = expandedIds.contains(note.id)
binding.btnExpand.rotation = if (isExpanded) 180f else 0f
val toggleExpand = {
if (expandedIds.contains(note.id)) expandedIds.remove(note.id)
else expandedIds.add(note.id)
notifyItemChanged(layoutPosition)
}
binding.btnExpand.setOnClickListener { toggleExpand() }
binding.textTitle.setOnClickListener { toggleExpand() }
if (showDeleted) {
binding.btnMarkComplete.visibility = View.GONE
binding.chipRecurrence.visibility = View.GONE
binding.textTitle.alpha = 0.5f
binding.root.alpha = 1.0f
binding.textContent.visibility = View.VISIBLE
binding.textReminder.visibility = View.GONE
binding.detailsSection.visibility = if (isExpanded) View.VISIBLE else View.GONE
binding.textContent.text = note.content.ifBlank { "Sin contenido" }
binding.btnEdit.visibility = View.GONE
binding.btnDelete.visibility = View.GONE
binding.btnRestore.visibility = View.VISIBLE
binding.btnPermanentDelete.visibility = View.VISIBLE
binding.btnMarkComplete.setOnClickListener { onToggleComplete(note) }
binding.btnEdit.setOnClickListener { onEdit(note) }
binding.btnDelete.setOnClickListener { onDelete(note) }
binding.btnRestore.setOnClickListener { onRestore(note) }
binding.btnPermanentDelete.setOnClickListener { onPermanentDelete(note) }
hidePhoto()
} else {
binding.btnMarkComplete.visibility = View.VISIBLE
binding.btnEdit.visibility = View.VISIBLE
binding.btnDelete.visibility = View.VISIBLE
binding.btnRestore.visibility = View.GONE
binding.btnPermanentDelete.visibility = View.GONE
binding.textTitle.alpha = 1.0f
binding.detailsSection.visibility = if (isExpanded) View.VISIBLE else View.GONE
binding.btnMarkComplete.alpha =
if (note.isCompleted) 1.0f else 0.5f
binding.root.alpha = if (note.isCompleted) 0.4f else 1.0f
binding.textContent.text = note.content.ifBlank { "Sin contenido" }
if (note.reminderDate != null) {
val timeStr = timeFormat.format(Date(note.reminderDate!!))
binding.textReminder.text = "$timeStr"
binding.textReminder.visibility = View.VISIBLE
binding.textReminder.setCompoundDrawablesWithIntrinsicBounds(
com.recordatorios.app.R.drawable.ic_bell, 0, 0, 0
)
binding.textReminder.compoundDrawablePadding = 6
binding.chipRecurrence.visibility = View.VISIBLE
binding.chipRecurrence.text = when (note.recurrence) {
RecurrenceType.DAILY -> "Diario"
RecurrenceType.WEEKLY -> "Semanal"
RecurrenceType.MONTHLY -> "Mensual"
RecurrenceType.YEARLY -> "Anual"
RecurrenceType.NONE -> null
}
if (note.recurrence == RecurrenceType.NONE) {
binding.chipRecurrence.visibility = View.GONE
}
} else {
binding.textReminder.visibility = View.GONE
binding.chipRecurrence.visibility = View.GONE
}
binding.btnMarkComplete.setOnClickListener { onToggleComplete(note) }
binding.btnEdit.setOnClickListener { onEdit(note) }
binding.btnDelete.setOnClickListener { onDelete(note) }
loadPhoto(note.photoPath)
}
}
private fun loadPhoto(photoPath: String) {
if (photoPath.isBlank()) {
hidePhoto()
return
}
val ctx = binding.root.context
val blurred = PhotoUtils.loadBlurredBitmap(ctx, photoPath)
if (blurred != null) {
binding.ivPhotoBlur.setImageBitmap(blurred)
binding.ivPhotoBlur.visibility = View.VISIBLE
binding.photoScrim.visibility = View.VISIBLE
val isDark = (ctx.resources.configuration.uiMode and android.content.res.Configuration.UI_MODE_NIGHT_MASK) == android.content.res.Configuration.UI_MODE_NIGHT_YES
binding.photoScrim.setBackgroundColor(if (isDark) 0x44000000.toInt() else 0x55FFFFFF.toInt())
} else {
hidePhoto()
}
}
private fun hidePhoto() {
binding.ivPhotoBlur.visibility = View.GONE
binding.photoScrim.visibility = View.GONE
binding.ivPhotoBlur.setImageBitmap(null)
}
}
}

View File

@@ -0,0 +1,116 @@
package com.recordatorios.app
import android.content.Context
import android.content.SharedPreferences
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
class NotesManager private constructor(context: Context) {
private var prefs: SharedPreferences =
context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
private val gson = Gson()
private var securityManager: SecurityManager? = null
fun setSecurityManager(securityManager: SecurityManager) {
this.securityManager = securityManager
}
private fun getPrefs(): SharedPreferences {
return securityManager?.getEncryptedPrefs() ?: prefs
}
fun getAllNotes(): MutableList<Note> {
val json = getPrefs().getString(KEY_NOTES, null) ?: return mutableListOf()
val type = object : TypeToken<MutableList<Note>>() {}.type
return gson.fromJson(json, type) ?: mutableListOf()
}
fun saveNotes(notes: List<Note>) {
getPrefs().edit().putString(KEY_NOTES, gson.toJson(notes)).apply()
}
fun addNote(note: Note) {
val notes = getAllNotes()
notes.add(0, note)
saveNotes(notes)
}
fun updateNote(note: Note) {
val notes = getAllNotes()
val index = notes.indexOfFirst { it.id == note.id }
if (index != -1) {
notes[index] = note
saveNotes(notes)
}
}
fun softDeleteNote(noteId: Long) {
val notes = getAllNotes()
val note = notes.find { it.id == noteId } ?: return
note.deletedAt = System.currentTimeMillis()
saveNotes(notes)
}
fun restoreNote(noteId: Long) {
val notes = getAllNotes()
val note = notes.find { it.id == noteId } ?: return
note.deletedAt = null
note.isCompleted = false
saveNotes(notes)
}
fun permanentlyDeleteNote(noteId: Long) {
val notes = getAllNotes()
notes.removeAll { it.id == noteId }
saveNotes(notes)
}
fun getNote(noteId: Long): Note? {
return getAllNotes().find { it.id == noteId }
}
fun toggleComplete(noteId: Long) {
val notes = getAllNotes()
val note = notes.find { it.id == noteId } ?: return
note.isCompleted = true
note.deletedAt = System.currentTimeMillis()
saveNotes(notes)
}
fun exportToJson(): String {
return gson.toJson(getAllNotes())
}
fun importFromJson(json: String) {
val type = object : TypeToken<List<Note>>() {}.type
val importedNotes = gson.fromJson<List<Note>>(json, type) ?: return
val existingNotes = getAllNotes()
val existingIds = existingNotes.map { it.id }.toSet()
for (note in importedNotes) {
if (note.id !in existingIds) {
existingNotes.add(note)
} else {
val index = existingNotes.indexOfFirst { it.id == note.id }
if (index != -1) {
existingNotes[index] = note
}
}
}
saveNotes(existingNotes)
}
companion object {
private const val PREFS_NAME = "recordatorios_prefs"
private const val KEY_NOTES = "notes"
@Volatile
private var INSTANCE: NotesManager? = null
fun getInstance(context: Context): NotesManager {
return INSTANCE ?: synchronized(this) {
INSTANCE ?: NotesManager(context.applicationContext).also { INSTANCE = it }
}
}
}
}

View File

@@ -0,0 +1,99 @@
@file:Suppress("DEPRECATION")
package com.recordatorios.app
import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import android.renderscript.Allocation
import android.renderscript.Element
import android.renderscript.RenderScript
import android.renderscript.ScriptIntrinsicBlur
import android.util.LruCache
import java.io.File
import java.io.FileOutputStream
object PhotoUtils {
private const val MAX_WIDTH = 300
private const val BLUR_RADIUS = 8f
private val bitmapCache = LruCache<String, Bitmap>(40)
fun copyToInternalStorage(context: Context, uri: Uri): String? {
return try {
val dir = File(context.filesDir, "photos")
dir.mkdirs()
val file = File(dir, "photo_${System.currentTimeMillis()}.jpg")
context.contentResolver.openInputStream(uri)?.use { input ->
FileOutputStream(file).use { output ->
input.copyTo(output)
}
}
file.absolutePath
} catch (e: Exception) {
null
}
}
fun loadPhotoBitmap(path: String, maxWidth: Int = MAX_WIDTH): Bitmap? {
if (path.isBlank()) return null
val cacheKey = "${path}_${maxWidth}_${BLUR_RADIUS}"
bitmapCache.get(cacheKey)?.let { return it }
return try {
val options = BitmapFactory.Options().apply {
inJustDecodeBounds = true
}
BitmapFactory.decodeFile(path, options)
val scaleFactor = maxOf(options.outWidth / maxWidth, 1)
val decodeOptions = BitmapFactory.Options().apply {
inSampleSize = scaleFactor
}
val bitmap = BitmapFactory.decodeFile(path, decodeOptions) ?: return null
bitmapCache.put(cacheKey, bitmap)
bitmap
} catch (e: Exception) {
null
}
}
fun loadBlurredBitmap(context: Context, path: String, maxWidth: Int = MAX_WIDTH, radius: Float = BLUR_RADIUS): Bitmap? {
if (path.isBlank()) return null
val cacheKey = "${path}_${maxWidth}_${radius}_blurred"
bitmapCache.get(cacheKey)?.let { return it }
val bitmap = loadPhotoBitmap(path, maxWidth) ?: return null
val blurred = applyBlur(context, bitmap, radius)
if (blurred != null) {
bitmapCache.put(cacheKey, blurred)
}
return blurred
}
private fun applyBlur(context: Context, bitmap: Bitmap, radius: Float): Bitmap? {
return try {
val rs = RenderScript.create(context)
val input = Allocation.createFromBitmap(rs, bitmap)
val output = Allocation.createTyped(rs, input.type)
val script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs))
script.setRadius(radius.coerceIn(0f, 25f))
script.setInput(input)
script.forEach(output)
output.copyTo(bitmap)
rs.destroy()
bitmap
} catch (e: Exception) {
null
}
}
fun deletePhoto(path: String) {
if (path.isNotBlank()) {
try { File(path).delete() } catch (_: Exception) {}
}
}
}

View File

@@ -0,0 +1,175 @@
package com.recordatorios.app
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import java.util.Calendar
class ReminderReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val action = intent.action
val noteId = intent.getLongExtra(EXTRA_NOTE_ID, -1L)
if (action == ACTION_SNOOZE || action == ACTION_COMPLETE) {
handleNotificationAction(context, action, noteId)
return
}
val noteTitle = intent.getStringExtra(EXTRA_NOTE_TITLE) ?: "Recordatorio"
val noteContent = intent.getStringExtra(EXTRA_NOTE_CONTENT) ?: ""
val photoPath = intent.getStringExtra(EXTRA_PHOTO_PATH) ?: ""
if (noteId == -1L) return
createNotificationChannel(context)
val openIntent = Intent(context, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
val pendingIntent = PendingIntent.getActivity(
context, noteId.toInt(), openIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val snoozeIntent = Intent(context, ReminderReceiver::class.java).apply {
setAction(ACTION_SNOOZE)
putExtra(EXTRA_NOTE_ID, noteId)
putExtra(EXTRA_NOTE_TITLE, noteTitle)
}
val snoozePendingIntent = PendingIntent.getBroadcast(
context, (noteId + 1000).toInt(), snoozeIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val completeIntent = Intent(context, ReminderReceiver::class.java).apply {
setAction(ACTION_COMPLETE)
putExtra(EXTRA_NOTE_ID, noteId)
putExtra(EXTRA_NOTE_TITLE, noteTitle)
}
val completePendingIntent = PendingIntent.getBroadcast(
context, (noteId + 2000).toInt(), completeIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val notificationBuilder = NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(android.R.drawable.ic_dialog_info)
.setContentTitle(noteTitle)
.setContentText(noteContent.ifBlank { "Tienes un recordatorio pendiente" })
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.addAction(R.drawable.ic_clock, "Posponer 10 min", snoozePendingIntent)
.addAction(R.drawable.ic_check, "Completar", completePendingIntent)
if (photoPath.isNotBlank()) {
val bitmap = BitmapFactory.decodeFile(photoPath)
if (bitmap != null) {
@Suppress("DEPRECATION")
val bigPictureStyle = NotificationCompat.BigPictureStyle()
.bigPicture(bitmap)
bigPictureStyle.bigLargeIcon(null as Bitmap?)
notificationBuilder.setStyle(bigPictureStyle)
}
}
try {
NotificationManagerCompat.from(context).notify(noteId.toInt(), notificationBuilder.build())
} catch (e: SecurityException) {
// Permission not granted
}
// Schedule next occurrence if recurring
val recurrenceStr = intent.getStringExtra(EXTRA_RECURRENCE) ?: RecurrenceType.NONE.name
val recurrence = try { RecurrenceType.valueOf(recurrenceStr) } catch (e: Exception) { RecurrenceType.NONE }
if (recurrence != RecurrenceType.NONE) {
val originalTime = intent.getLongExtra(EXTRA_REMINDER_TIME, 0L)
if (originalTime > 0) {
val nextTime = calculateNextRecurrence(originalTime, recurrence)
val notesManager = NotesManager.getInstance(context)
val note = notesManager.getNote(noteId)
if (note != null) {
val updatedNote = note.copy(reminderDate = nextTime)
notesManager.updateNote(updatedNote)
ReminderScheduler.scheduleReminder(context, updatedNote)
}
}
}
}
private fun handleNotificationAction(context: Context, action: String, noteId: Long) {
if (noteId == -1L) return
val notesManager = NotesManager.getInstance(context)
val note = notesManager.getNote(noteId) ?: return
if (action == ACTION_SNOOZE) {
val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
val snoozeMinutes = prefs.getInt("snooze_minutes", 10)
val newTime = System.currentTimeMillis() + snoozeMinutes * 60 * 1000
val updatedNote = note.copy(reminderDate = newTime)
notesManager.updateNote(updatedNote)
ReminderScheduler.scheduleReminder(context, updatedNote)
NotificationManagerCompat.from(context).cancel(noteId.toInt())
} else if (action == ACTION_COMPLETE) {
if (note.recurrence != RecurrenceType.NONE) {
val nextTime = calculateNextRecurrence(note.reminderDate ?: System.currentTimeMillis(), note.recurrence)
val updatedNote = note.copy(reminderDate = nextTime)
notesManager.updateNote(updatedNote)
ReminderScheduler.scheduleReminder(context, updatedNote)
} else {
notesManager.toggleComplete(noteId)
}
NotificationManagerCompat.from(context).cancel(noteId.toInt())
}
}
private fun calculateNextRecurrence(currentTime: Long, recurrence: RecurrenceType): Long {
val cal = Calendar.getInstance().apply { timeInMillis = currentTime }
return when (recurrence) {
RecurrenceType.DAILY -> cal.apply { add(Calendar.DAY_OF_YEAR, 1) }.timeInMillis
RecurrenceType.WEEKLY -> cal.apply { add(Calendar.WEEK_OF_YEAR, 1) }.timeInMillis
RecurrenceType.MONTHLY -> cal.apply { add(Calendar.MONTH, 1) }.timeInMillis
RecurrenceType.YEARLY -> cal.apply { add(Calendar.YEAR, 1) }.timeInMillis
else -> currentTime
}
}
private fun createNotificationChannel(context: Context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
CHANNEL_ID,
context.getString(R.string.reminder_channel_name),
NotificationManager.IMPORTANCE_HIGH
).apply {
description = context.getString(R.string.reminder_channel_desc)
}
val notificationManager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(channel)
}
}
companion object {
const val CHANNEL_ID = "recordatorios_channel"
const val EXTRA_NOTE_ID = "note_id"
const val EXTRA_NOTE_TITLE = "note_title"
const val EXTRA_NOTE_CONTENT = "note_content"
const val EXTRA_RECURRENCE = "recurrence"
const val EXTRA_REMINDER_TIME = "reminder_time"
const val EXTRA_PHOTO_PATH = "photo_path"
const val ACTION_SNOOZE = "com.recordatorios.app.ACTION_SNOOZE"
const val ACTION_COMPLETE = "com.recordatorios.app.ACTION_COMPLETE"
}
}

View File

@@ -0,0 +1,58 @@
package com.recordatorios.app
import android.app.AlarmManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.os.Build
import androidx.core.content.edit
object ReminderScheduler {
fun scheduleReminder(context: Context, note: Note) {
val reminderTime = note.reminderDate ?: return
val currentTime = System.currentTimeMillis()
if (reminderTime < currentTime) return
val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
val showImageInNotif = prefs.getBoolean("notif_show_image", true)
val intent = Intent(context, ReminderReceiver::class.java).apply {
putExtra(ReminderReceiver.EXTRA_NOTE_ID, note.id)
putExtra(ReminderReceiver.EXTRA_NOTE_TITLE, note.title.ifBlank { "Recordatorio" })
putExtra(ReminderReceiver.EXTRA_NOTE_CONTENT, note.content)
putExtra(ReminderReceiver.EXTRA_RECURRENCE, note.recurrence.name)
putExtra(ReminderReceiver.EXTRA_REMINDER_TIME, reminderTime)
if (showImageInNotif) putExtra(ReminderReceiver.EXTRA_PHOTO_PATH, note.photoPath)
}
val pendingIntent = PendingIntent.getBroadcast(
context, note.id.toInt(), intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setExactAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP, reminderTime, pendingIntent
)
} else {
alarmManager.setExact(
AlarmManager.RTC_WAKEUP, reminderTime, pendingIntent
)
}
}
fun cancelReminder(context: Context, note: Note) {
val intent = Intent(context, ReminderReceiver::class.java)
val pendingIntent = PendingIntent.getBroadcast(
context, note.id.toInt(), intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
alarmManager.cancel(pendingIntent)
pendingIntent.cancel()
}
}

View File

@@ -0,0 +1,138 @@
package com.recordatorios.app
import android.content.Context
import android.content.SharedPreferences
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricPrompt
import androidx.core.content.ContextCompat
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKey
import java.security.KeyStore
import javax.crypto.Cipher
class SecurityManager private constructor(private val context: Context) {
private val keyStore = KeyStore.getInstance("AndroidKeyStore").apply { load(null) }
private var encryptedPrefs: SharedPreferences? = null
private var isUnlocked = false
private var authCallback: ((Boolean) -> Unit)? = null
init {
initializeKeystoreKey()
}
private fun initializeKeystoreKey() {
try {
val masterKey = MasterKey.Builder(context)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.setUserAuthenticationRequired(true)
.build()
encryptedPrefs = EncryptedSharedPreferences.create(
context,
PREFS_NAME,
masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
} catch (e: Exception) {
e.printStackTrace()
}
}
fun isBiometricAvailable(): Boolean {
val biometricManager = BiometricManager.from(context)
return when (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)) {
BiometricManager.BIOMETRIC_SUCCESS -> true
else -> false
}
}
fun authenticateBiometric(activity: androidx.appcompat.app.AppCompatActivity, onResult: (Boolean) -> Unit) {
if (isUnlocked) {
onResult(true)
return
}
authCallback = onResult
val promptInfo = BiometricPrompt.PromptInfo.Builder()
.setTitle("Desbloquear Recordatorios")
.setSubtitle("Confirma tu huella o rostro para acceder a tus datos")
.setNegativeButtonText("Cancelar")
.build()
val executor = ContextCompat.getMainExecutor(context)
val prompt = BiometricPrompt(
activity,
executor,
object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
isUnlocked = true
authCallback?.invoke(true)
authCallback = null
}
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
if (errorCode == BiometricPrompt.ERROR_NEGATIVE_BUTTON ||
errorCode == BiometricPrompt.ERROR_USER_CANCELED) {
authCallback?.invoke(false)
} else {
authCallback?.invoke(false)
}
authCallback = null
}
override fun onAuthenticationFailed() {
// Reintentar automáticamente
}
}
)
prompt.authenticate(promptInfo)
}
fun getEncryptedPrefs(): SharedPreferences? {
return encryptedPrefs
}
fun isUnlocked(): Boolean {
return isUnlocked
}
fun lock() {
isUnlocked = false
}
fun migrateData() {
val oldNotesPrefs = context.getSharedPreferences("recordatorios_prefs", Context.MODE_PRIVATE)
val oldCategoriesPrefs = context.getSharedPreferences("categories_prefs", Context.MODE_PRIVATE)
val encrypted = encryptedPrefs ?: return
val notesData = oldNotesPrefs.getString("notes", null)
if (notesData != null && !encrypted.contains("notes")) {
encrypted.edit().putString("notes", notesData).apply()
}
val categoriesData = oldCategoriesPrefs.getString("categories", null)
if (categoriesData != null && !encrypted.contains("categories")) {
encrypted.edit().putString("categories", categoriesData).apply()
}
}
companion object {
private const val PREFS_NAME = "encrypted_recordatorios_prefs"
@Volatile
private var INSTANCE: SecurityManager? = null
fun getInstance(context: Context): SecurityManager {
return INSTANCE ?: synchronized(this) {
INSTANCE ?: SecurityManager(context.applicationContext).also { INSTANCE = it }
}
}
}
}

View File

@@ -0,0 +1,109 @@
package com.recordatorios.app
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.widget.RemoteViews
import android.widget.RemoteViewsService
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date
import java.util.Locale
class TodayWidgetFactory(
private val context: Context,
private val appWidgetId: Int,
private val showTime: Boolean,
private val showCategory: Boolean,
private val maxItems: Int
) : RemoteViewsService.RemoteViewsFactory {
private var notes: List<Note> = emptyList()
private var categories: List<Category> = emptyList()
private val timeFormat = SimpleDateFormat("HH:mm", Locale.getDefault())
override fun onCreate() {
loadData()
}
override fun onDataSetChanged() {
loadData()
}
override fun onDestroy() {}
override fun getCount(): Int = notes.size
override fun getViewAt(position: Int): RemoteViews {
val note = notes[position]
val item = RemoteViews(context.packageName, R.layout.widget_note_item)
item.setTextViewText(R.id.widgetItemTitle, note.title.ifBlank { "Sin t\u00edtulo" })
if (showTime && note.reminderDate != null) {
item.setTextViewText(R.id.widgetItemTime, timeFormat.format(Date(note.reminderDate!!)))
item.setViewVisibility(R.id.widgetItemTime, android.view.View.VISIBLE)
} else {
item.setViewVisibility(R.id.widgetItemTime, android.view.View.GONE)
}
if (showCategory) {
val cat = categories.find { it.id == note.category }
if (cat != null) {
item.setViewVisibility(R.id.widgetItemDot, android.view.View.VISIBLE)
item.setInt(R.id.widgetItemDot, "setColorFilter", cat.color)
} else {
item.setViewVisibility(R.id.widgetItemDot, android.view.View.GONE)
}
} else {
item.setViewVisibility(R.id.widgetItemDot, android.view.View.GONE)
}
val fillIntent = Intent().apply {
putExtra("note_id", note.id)
}
item.setOnClickFillInIntent(R.id.widgetItemTitle, fillIntent)
return item
}
override fun getLoadingView(): RemoteViews? = null
override fun getViewTypeCount(): Int = 1
override fun getItemId(position: Int): Long = notes[position].id
override fun hasStableIds(): Boolean = true
private fun loadData() {
categories = CategoryManager.getInstance(context).getAllCategories()
val allNotes = NotesManager.getInstance(context)
.getAllNotes()
.filter { !it.isCompleted && it.deletedAt == null }
val todayStart = Calendar.getInstance().apply {
set(Calendar.HOUR_OF_DAY, 0)
set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
val todayEnd = todayStart + 86400000L
val todayNotes = allNotes.filter { note ->
note.reminderDate != null && note.reminderDate!! >= todayStart && note.reminderDate!! < todayEnd
}
val overdueNotes = allNotes.filter { note ->
note.reminderDate != null && note.reminderDate!! < todayStart
}
notes = (todayNotes + overdueNotes)
.sortedByDescending { it.reminderDate ?: 0L }
if (maxItems > 0 && notes.size > maxItems) {
notes = notes.take(maxItems)
}
}
}

View File

@@ -0,0 +1,72 @@
package com.recordatorios.app
import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.widget.RemoteViews
class TodayWidgetProvider : AppWidgetProvider() {
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
for (appWidgetId in appWidgetIds) {
updateWidget(context, appWidgetManager, appWidgetId)
}
}
override fun onDeleted(context: Context, appWidgetIds: IntArray) {
val prefs = context.getSharedPreferences(PREFS_WIDGET, Context.MODE_PRIVATE)
for (id in appWidgetIds) {
prefs.edit().remove("widget_${id}_show_time")
.remove("widget_${id}_show_category")
.remove("widget_${id}_max_items")
.apply()
}
}
companion object {
const val PREFS_WIDGET = "widget_preferences"
fun updateAllWidgets(context: Context) {
val manager = AppWidgetManager.getInstance(context)
val ids = manager.getAppWidgetIds(
ComponentName(context, TodayWidgetProvider::class.java)
)
for (id in ids) {
updateWidget(context, manager, id)
}
}
private fun updateWidget(context: Context, manager: AppWidgetManager, appWidgetId: Int) {
val prefs = context.getSharedPreferences(PREFS_WIDGET, Context.MODE_PRIVATE)
val showTime = prefs.getBoolean("widget_${appWidgetId}_show_time", true)
val showCategory = prefs.getBoolean("widget_${appWidgetId}_show_category", true)
val maxItems = prefs.getInt("widget_${appWidgetId}_max_items", 10)
val views = RemoteViews(context.packageName, R.layout.widget_today_info)
views.setTextViewText(R.id.widgetItemCount, "")
val intent = Intent(context, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
}
val pi = PendingIntent.getActivity(
context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
views.setOnClickPendingIntent(R.id.widgetNoteList, pi)
val serviceIntent = Intent(context, TodayWidgetService::class.java).apply {
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
putExtra("show_time", showTime)
putExtra("show_category", showCategory)
putExtra("max_items", maxItems)
}
views.setRemoteAdapter(R.id.widgetNoteList, serviceIntent)
views.setEmptyView(R.id.widgetNoteList, R.id.widgetEmptyView)
manager.updateAppWidget(appWidgetId, views)
}
}
}

View File

@@ -0,0 +1,17 @@
package com.recordatorios.app
import android.content.Intent
import android.widget.RemoteViewsService
class TodayWidgetService : RemoteViewsService() {
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
val appWidgetId = intent.getIntExtra(
android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID,
android.appwidget.AppWidgetManager.INVALID_APPWIDGET_ID
)
val showTime = intent.getBooleanExtra("show_time", true)
val showCategory = intent.getBooleanExtra("show_category", true)
val maxItems = intent.getIntExtra("max_items", 10)
return TodayWidgetFactory(applicationContext, appWidgetId, showTime, showCategory, maxItems)
}
}

View File

@@ -0,0 +1,295 @@
package com.recordatorios.app
import java.util.Calendar
data class ParsedVoiceNote(
val title: String,
val content: String,
val reminderDate: Long?,
val categoryName: String? = null,
val recurrence: RecurrenceType = RecurrenceType.NONE
)
object VoiceNoteParser {
private val numberWords = mapOf(
"uno" to 1, "una" to 1,
"dos" to 2,
"tres" to 3,
"cuatro" to 4,
"cinco" to 5,
"seis" to 6,
"siete" to 7,
"ocho" to 8,
"nueve" to 9,
"diez" to 10,
"once" to 11,
"doce" to 12,
"trece" to 13,
"catorce" to 14,
"quince" to 15,
"dieciseis" to 16, "dieciséis" to 16,
"diecisiete" to 17,
"dieciocho" to 18,
"diecinueve" to 19,
"veinte" to 20,
"veintiuno" to 21, "veintiuna" to 21,
"veintidos" to 22, "veintidós" to 22,
"veintitres" to 23, "veintitrés" to 23,
"veinticuatro" to 24
)
private val monthNames = mapOf(
"enero" to 0, "febrero" to 1, "marzo" to 2, "abril" to 3,
"mayo" to 4, "junio" to 5, "julio" to 6, "agosto" to 7,
"septiembre" to 8, "octubre" to 9, "noviembre" to 10, "diciembre" to 11,
"ener" to 0, "febr" to 1, "marz" to 2, "abr" to 3,
"may" to 4, "jun" to 5, "jul" to 6, "ago" to 7,
"sept" to 8, "oct" to 9, "nov" to 10, "dic" to 11
)
private val dayNames = mapOf(
"domingo" to Calendar.SUNDAY, "dom" to Calendar.SUNDAY,
"lunes" to Calendar.MONDAY, "lun" to Calendar.MONDAY,
"martes" to Calendar.TUESDAY, "mar" to Calendar.TUESDAY,
"miercoles" to Calendar.WEDNESDAY, "mie" to Calendar.WEDNESDAY,
"jueves" to Calendar.THURSDAY, "jue" to Calendar.THURSDAY,
"viernes" to Calendar.FRIDAY, "vie" to Calendar.FRIDAY,
"sabado" to Calendar.SATURDAY, "sab" to Calendar.SATURDAY,
"sábado" to Calendar.SATURDAY
)
fun parse(text: String, availableCategories: List<String> = emptyList()): ParsedVoiceNote {
val lower = text.lowercase().trim()
val now = Calendar.getInstance()
var reminderDate: Long? = null
var datePhrase = ""
var timePhrase = ""
var cleanedText = lower
var categoryName: String? = null
var recurrence: RecurrenceType = RecurrenceType.NONE
val categoryResult = extractCategory(lower, availableCategories)
if (categoryResult != null) {
categoryName = categoryResult.name
cleanedText = cleanedText.replace(categoryResult.phrase, "").trim()
}
val recurrenceResult = extractRecurrence(lower)
if (recurrenceResult != null) {
recurrence = recurrenceResult.type
cleanedText = cleanedText.replace(recurrenceResult.phrase, "").trim()
}
val timeResult = extractTime(lower)
if (timeResult != null) {
timePhrase = timeResult.phrase
cleanedText = cleanedText.replace(timePhrase, "").trim()
}
val dateResult = extractDate(cleanedText, timeResult?.millis)
if (dateResult != null) {
datePhrase = dateResult.phrase
cleanedText = cleanedText.replace(datePhrase, "").trim()
reminderDate = dateResult.millis
} else if (timeResult != null) {
val cal = Calendar.getInstance().apply { timeInMillis = timeResult.millis }
if (cal.after(now)) {
reminderDate = cal.timeInMillis
} else {
cal.add(Calendar.DAY_OF_YEAR, 1)
reminderDate = cal.timeInMillis
}
}
val title = buildTitle(cleanedText, text)
val content = text.trim()
return ParsedVoiceNote(
title = title,
content = content,
reminderDate = reminderDate,
categoryName = categoryName,
recurrence = recurrence
)
}
private fun buildTitle(cleanedText: String, originalText: String): String {
val words = cleanedText.split(Regex("\\s+")).filter { it.isNotBlank() }
val titleWords = words.take(8)
if (titleWords.isEmpty()) {
val origWords = originalText.trim().split(Regex("\\s+")).filter { it.isNotBlank() }
return origWords.take(8).joinToString(" ").replaceFirstChar { it.uppercase() }
.take(50)
}
return titleWords.joinToString(" ").replaceFirstChar { it.uppercase() }.take(50)
}
private data class TimeInfo(val phrase: String, val millis: Long)
private fun extractTime(text: String): TimeInfo? {
val patterns = listOf(
Regex("a las? (\\d{1,2})(?::(\\d{2}))?\\s*(de la manana|de la mañana|de la tarde|de la noche)?", RegexOption.IGNORE_CASE),
Regex("a las? (\\d{1,2})\\s*(de la manana|de la mañana|de la tarde|de la noche)?", RegexOption.IGNORE_CASE),
Regex("(\\d{1,2})(?::(\\d{2}))?\\s*(de la manana|de la mañana|de la tarde|de la noche)?", RegexOption.IGNORE_CASE),
Regex("a las? (${numberWords.keys.joinToString("|")})\\s*(de la manana|de la mañana|de la tarde|de la noche)?", RegexOption.IGNORE_CASE),
Regex("a las? (${numberWords.keys.joinToString("|")}) y (\\d{1,2})\\s*(de la manana|de la mañana|de la tarde|de la noche)?", RegexOption.IGNORE_CASE)
)
for (pattern in patterns) {
val match = pattern.find(text) ?: continue
var hour = match.groupValues[1].toIntOrNull()
if (hour == null) {
hour = numberWords[match.groupValues[1].lowercase()]
}
if (hour == null) continue
val minute = match.groupValues.getOrElse(2) { "" }.toIntOrNull() ?: 0
val period = match.groupValues.drop(2).find { it.isNotEmpty() }?.lowercase() ?: ""
var finalHour = hour
if (period.contains("tarde") && hour < 12) finalHour = hour + 12
if (period.contains("noche") && hour < 12) finalHour = hour + 12
if (period.contains("mañana") && hour == 12) finalHour = 0
if (period.contains("manana") && hour == 12) finalHour = 0
val cal = Calendar.getInstance().apply {
set(Calendar.HOUR_OF_DAY, finalHour)
set(Calendar.MINUTE, minute)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}
return TimeInfo(match.value, cal.timeInMillis)
}
return null
}
private data class DateInfo(val phrase: String, val millis: Long)
private fun extractDate(text: String, timeMillis: Long?): DateInfo? {
val now = Calendar.getInstance()
val baseTime = timeMillis ?: now.timeInMillis
val baseCal = Calendar.getInstance().apply { timeInMillis = baseTime }
val baseHour = baseCal.get(Calendar.HOUR_OF_DAY)
val baseMinute = baseCal.get(Calendar.MINUTE)
val relativePatterns = listOf(
"pasado manana" to 2,
"pasado mañana" to 2,
"manana" to 1,
"mañana" to 1,
"hoy" to 0
)
for ((phrase, days) in relativePatterns) {
if (text.contains(phrase, ignoreCase = true)) {
val cal = Calendar.getInstance().apply { timeInMillis = baseTime }
cal.add(Calendar.DAY_OF_YEAR, days)
cal.set(Calendar.HOUR_OF_DAY, baseHour)
cal.set(Calendar.MINUTE, baseMinute)
return DateInfo(phrase, cal.timeInMillis)
}
}
val dayMonthPattern = Regex("""(el\s+)?(\d{1,2})\s*(de)?\s*(${monthNames.keys.joinToString("|")})""", RegexOption.IGNORE_CASE)
val dayMonthMatch = dayMonthPattern.find(text)
if (dayMonthMatch != null) {
val day = dayMonthMatch.groupValues[2].toIntOrNull() ?: return null
val monthName = dayMonthMatch.groupValues[3].lowercase()
val month = monthNames[monthName] ?: return null
val cal = Calendar.getInstance().apply {
timeInMillis = baseTime
set(Calendar.DAY_OF_MONTH, day)
set(Calendar.MONTH, month)
set(Calendar.HOUR_OF_DAY, baseHour)
set(Calendar.MINUTE, baseMinute)
}
if (cal.before(Calendar.getInstance())) {
cal.add(Calendar.YEAR, 1)
}
return DateInfo(dayMonthMatch.value, cal.timeInMillis)
}
val dayOfWeekPattern = Regex("""(el\s+)?(${dayNames.keys.joinToString("|")})\s*(que viene|próximo|próxima|proximo|proxima)?""", RegexOption.IGNORE_CASE)
val dayOfWeekMatch = dayOfWeekPattern.find(text)
if (dayOfWeekMatch != null) {
val dayName = dayOfWeekMatch.groupValues[2].lowercase()
val targetDay = dayNames[dayName] ?: return null
val cal = Calendar.getInstance().apply {
timeInMillis = baseTime
val currentDay = get(Calendar.DAY_OF_WEEK)
var diff = targetDay - currentDay
if (diff <= 0) diff += 7
add(Calendar.DAY_OF_YEAR, diff)
set(Calendar.HOUR_OF_DAY, baseHour)
set(Calendar.MINUTE, baseMinute)
}
return DateInfo(dayOfWeekMatch.value, cal.timeInMillis)
}
return null
}
private data class RecurrenceInfo(val phrase: String, val type: RecurrenceType)
private fun extractRecurrence(text: String): RecurrenceInfo? {
// Patrones para repetición
val patterns = listOf(
// Diaria
Regex("""repetir\s+diariamente""", RegexOption.IGNORE_CASE) to RecurrenceType.DAILY,
Regex("""todos?\s+los?\s*d[ií]as""", RegexOption.IGNORE_CASE) to RecurrenceType.DAILY,
Regex("""cada\s+d[ií]a""", RegexOption.IGNORE_CASE) to RecurrenceType.DAILY,
Regex("""diariamente""", RegexOption.IGNORE_CASE) to RecurrenceType.DAILY,
// Semanal
Regex("""repetir\s+semanalmente""", RegexOption.IGNORE_CASE) to RecurrenceType.WEEKLY,
Regex("""todas?\s+las?\s*semanas""", RegexOption.IGNORE_CASE) to RecurrenceType.WEEKLY,
Regex("""cada\s+semana""", RegexOption.IGNORE_CASE) to RecurrenceType.WEEKLY,
Regex("""semanalmente""", RegexOption.IGNORE_CASE) to RecurrenceType.WEEKLY,
// Mensual
Regex("""repetir\s+mensualmente""", RegexOption.IGNORE_CASE) to RecurrenceType.MONTHLY,
Regex("""todos?\s+los?\s*meses""", RegexOption.IGNORE_CASE) to RecurrenceType.MONTHLY,
Regex("""cada\s+mes""", RegexOption.IGNORE_CASE) to RecurrenceType.MONTHLY,
Regex("""mensualmente""", RegexOption.IGNORE_CASE) to RecurrenceType.MONTHLY,
// Anual
Regex("""repetir\s+anualmente""", RegexOption.IGNORE_CASE) to RecurrenceType.YEARLY,
Regex("""todos?\s+los?\s*a[nñ]os""", RegexOption.IGNORE_CASE) to RecurrenceType.YEARLY,
Regex("""cada\s+a[nñ]o""", RegexOption.IGNORE_CASE) to RecurrenceType.YEARLY,
Regex("""anualmente""", RegexOption.IGNORE_CASE) to RecurrenceType.YEARLY
)
for ((pattern, type) in patterns) {
val match = pattern.find(text)
if (match != null) {
return RecurrenceInfo(match.value, type)
}
}
return null
}
private data class CategoryInfo(val phrase: String, val name: String)
private fun extractCategory(text: String, availableCategories: List<String>): CategoryInfo? {
// Patron 1: "categoria personal", "categoría trabajo" (espacio simple)
// Patron 2: "categoria: personal", "categoría: trabajo" (con dos puntos)
// Patron 3: "categoria - personal", "categoría - trabajo" (con guion)
val categoryPattern = Regex("""categor(?:ia|ía)\s*[:\-]?\s*([a-zA-ZáéíóúñÁÉÍÓÚÑ]+(?:\s+[a-zA-ZáéíóúñÁÉÍÓÚÑ]+)*)""", RegexOption.IGNORE_CASE)
val match = categoryPattern.find(text)
if (match != null) {
val capturedName = match.groupValues[1].trim().lowercase()
// Buscar coincidencia exacta con las categorias disponibles
val matchingCategory = availableCategories.find {
it.lowercase() == capturedName
}
if (matchingCategory != null) {
return CategoryInfo(match.value, matchingCategory)
}
}
return null
}
}

View File

@@ -0,0 +1,54 @@
package com.recordatorios.app
import android.appwidget.AppWidgetManager
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.recordatorios.app.databinding.ActivityWidgetConfigBinding
class WidgetConfigActivity : AppCompatActivity() {
private lateinit var binding: ActivityWidgetConfigBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityWidgetConfigBinding.inflate(layoutInflater)
setContentView(binding.root)
val appWidgetId = intent?.getIntExtra(
AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID
) ?: AppWidgetManager.INVALID_APPWIDGET_ID
if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
finish()
return
}
binding.btnConfigSave.setOnClickListener {
val prefs = getSharedPreferences(TodayWidgetProvider.PREFS_WIDGET, Context.MODE_PRIVATE)
prefs.edit()
.putBoolean("widget_${appWidgetId}_show_time", binding.configShowTime.isChecked)
.putBoolean("widget_${appWidgetId}_show_category", binding.configShowCategory.isChecked)
.putInt(
"widget_${appWidgetId}_max_items",
when (binding.configChipGroupMax.checkedChipId) {
R.id.configMax5 -> 5
R.id.configMax15 -> 15
R.id.configMaxAll -> 0
else -> 10
}
)
.apply()
val result = Intent().apply {
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
}
setResult(RESULT_OK, result)
TodayWidgetProvider.updateAllWidgets(this)
finish()
}
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape android:shape="oval">
<solid android:color="@android:color/white" />
<stroke android:width="3dp" android:color="@android:color/black" />
<padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" />
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="@android:color/white" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M19,3h-1V1h-2v2H8V1H6v2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2zM19,19H5V8h14v11zM5,5v0h14v0H5zM7,11h2v2H7V11zM11,11h2v2h-2V11zM15,11h2v2h-2V11z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67V7z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M10,18h4v-2h-4v2zM3,6v2h18V6H3zM6,13h12v-2H6v2z" />
</vector>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group
android:translateX="27"
android:translateY="27"
android:scaleX="2.5"
android:scaleY="2.5">
<path
android:fillColor="#FFFFFF"
android:pathData="M18,2H6C4.9,2 4,2.9 4,4v16c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zM17,13h-3v3h-2v-3H9v-2h3V8h2v3h3v2z" />
</group>
</vector>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M12,14c1.66,0 3,-1.34 3,-3V5c0,-1.66 -1.34,-3 -3,-3S9,3.34 9,5v6C9,12.66 10.34,14 12,14z" />
<path
android:fillColor="@android:color/white"
android:pathData="M17,11c0,2.76 -2.24,5 -5,5s-5,-2.24 -5,-5H5c0,3.53 2.61,6.43 6,6.92V21h2v-3.08c3.39,-0.49 6,-3.39 6,-6.92H17z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M18,2H6C4.9,2 4,2.9 4,4v16c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zM17,13h-3v3h-2v-3H9v-2h3V8h2v3h3v2z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58a0.49,0.49 0,0 0,0.12 -0.61l-1.92,-3.32a0.49,0.49 0,0 0,-0.59 -0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81a0.48,0.48 0,0 0,-0.47 -0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35c-0.59,0.24 -1.13,0.57 -1.62,0.94l-2.39,-0.96c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87c-0.12,0.21 -0.08,0.47 0.12,0.61l2.03,1.58c-0.05,0.3 -0.07,0.62 -0.07,0.94s0.02,0.64 0.07,0.94l-2.03,1.58a0.49,0.49 0,0 0,-0.12 0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61l-2.01,-1.58zM12,15.6A3.6,3.6 0,1 1,12 8.4a3.6,3.6 0,0 1,0 7.2z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M12,9c-1.65,0 -3,1.35 -3,3s1.35,3 3,3 3,-1.35 3,-3 -1.35,-3 -3,-3zM13,1h-2v3h2V1zM13,20h-2v3h2V20zM3.51,3.51l1.42,-1.42 2.12,2.12 -1.42,1.42 -2.12,-2.12zM16.95,19.78l1.42,-1.42 2.12,2.12 -1.42,1.42 -2.12,-2.12zM1,11h3v2H1V11zM20,11h3v2h-3V11zM5.63,18.37l-2.12,2.12 -1.42,-1.42 2.12,-2.12 1.42,1.42zM19.78,5.05l-2.12,2.12 -1.42,-1.42 2.12,-2.12 1.42,1.42z" />
</vector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z" />
</vector>

View File

@@ -0,0 +1,720 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Recordatorios">
<ImageView
android:id="@+id/ivBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:visibility="gone" />
<View
android:id="@+id/backgroundScrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="?attr/colorPrimaryContainer"
app:tabTextColor="?attr/colorOnPrimaryContainer"
app:tabSelectedTextColor="?attr/colorOnPrimaryContainer"
app:tabIndicatorColor="?attr/colorOnPrimaryContainer"
app:tabIndicatorHeight="2dp"
app:tabIconTint="?attr/colorOnPrimaryContainer"
app:tabMode="fixed">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_sun" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_clock" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_calendar" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_trash" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_settings" />
</com.google.android.material.tabs.TabLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/searchLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Buscar..."
app:endIconMode="clear_text"
app:endIconDrawable="@android:drawable/ic_menu_close_clear_cancel"
app:startIconDrawable="@android:drawable/ic_menu_search">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:imeOptions="actionSearch" />
</com.google.android.material.textfield.TextInputLayout>
<ImageButton
android:id="@+id/btnFilter"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="4dp"
android:src="@drawable/ic_filter"
android:contentDescription="Filtro avanzado"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="centerInside"
android:tint="?attr/colorOnSurface"
android:visibility="gone" />
</LinearLayout>
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroupFilter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginBottom="1dp"
app:singleSelection="false"
app:selectionRequired="false"
app:chipSpacing="4dp"
android:visibility="gone" />
<FrameLayout
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="8dp" />
<TextView
android:id="@+id/emptyView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/no_notes"
android:textSize="16sp"
android:textColor="?attr/colorOnSurfaceVariant"
android:visibility="gone" />
<LinearLayout
android:id="@+id/calendarContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
android:padding="8dp">
<LinearLayout
android:id="@+id/calendarContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textMonthYear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="?attr/colorOnSurface"
android:paddingVertical="8dp" />
<LinearLayout
android:id="@+id/calendarDayNames"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" />
<GridLayout
android:id="@+id/calendarDaysGrid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="7" />
<TextView
android:id="@+id/labelMonthNotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginHorizontal="8dp"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?attr/colorOnSurface" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/monthNotesList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clipToPadding="false"
android:padding="4dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/settingsContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="?attr/colorOnSurface"
android:layout_marginBottom="24dp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/biometric_title"
android:textSize="16sp"
android:textColor="?attr/colorOnSurface" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/biometric_summary"
android:textSize="12sp"
android:textColor="?attr/colorOnSurfaceVariant"
android:layout_marginTop="4dp" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchBiometric"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/theme_title"
android:textSize="16sp"
android:textColor="?attr/colorOnSurface" />
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroupTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:singleSelection="true"
app:selectionRequired="true"
app:chipSpacing="8dp">
<com.google.android.material.chip.Chip
android:id="@+id/chipThemeSystem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/theme_system"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipThemeLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/theme_light"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipThemeDark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/theme_dark"
android:checkable="true" />
</com.google.android.material.chip.ChipGroup>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/background_title"
android:textSize="16sp"
android:textColor="?attr/colorOnSurface" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="12dp"
android:gravity="center_vertical">
<com.google.android.material.button.MaterialButton
android:id="@+id/btnPickBackground"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/background_pick"
android:icon="@android:drawable/ic_menu_gallery" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnRemoveBackground"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/background_remove"
android:icon="@drawable/ic_trash"
android:textColor="?attr/colorError"
app:iconTint="?attr/colorError" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notif_image_title"
android:textSize="16sp"
android:textColor="?attr/colorOnSurface" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notif_image_summary"
android:textSize="12sp"
android:textColor="?attr/colorOnSurfaceVariant"
android:layout_marginTop="4dp" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchNotifImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/snooze_title"
android:textSize="16sp"
android:textColor="?attr/colorOnSurface" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/snooze_summary"
android:textSize="12sp"
android:textColor="?attr/colorOnSurfaceVariant"
android:layout_marginTop="4dp" />
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroupSnooze"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:singleSelection="true"
app:selectionRequired="true"
app:chipSpacing="8dp">
<com.google.android.material.chip.Chip
android:id="@+id/chipSnooze10Min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/snooze_10min"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipSnooze30Min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/snooze_30min"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipSnooze1Hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/snooze_1hour"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipSnooze2Hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/snooze_2hours"
android:checkable="true" />
</com.google.android.material.chip.ChipGroup>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/trash_title"
android:textSize="16sp"
android:textColor="?attr/colorOnSurface" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/trash_auto_clean"
android:textSize="12sp"
android:textColor="?attr/colorOnSurfaceVariant"
android:layout_marginTop="4dp" />
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroupTrash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:singleSelection="true"
app:selectionRequired="true"
app:chipSpacing="8dp">
<com.google.android.material.chip.Chip
android:id="@+id/chipTrashOff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/trash_disabled"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipTrash1Day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/trash_1day"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipTrash3Days"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/trash_3days"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipTrash7Days"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/trash_7days"
android:checkable="true" />
<com.google.android.material.chip.Chip
android:id="@+id/chipTrash30Days"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/trash_30days"
android:checkable="true" />
</com.google.android.material.chip.ChipGroup>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ayuda"
android:textSize="16sp"
android:textColor="?attr/colorOnSurface" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Guía de uso de la aplicación"
android:textSize="12sp"
android:textColor="?attr/colorOnSurfaceVariant"
android:layout_marginTop="4dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnHelpGuide"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="Ver guía de uso"
android:icon="@android:drawable/ic_menu_help" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Datos"
android:textSize="16sp"
android:textColor="?attr/colorOnSurface" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exportar o importar notas y categorías"
android:textSize="12sp"
android:textColor="?attr/colorOnSurfaceVariant"
android:layout_marginTop="4dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="12dp"
android:gravity="center_vertical">
<com.google.android.material.button.MaterialButton
android:id="@+id/btnExport"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Exportar"
android:icon="@android:drawable/ic_menu_save" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnImport"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Importar"
android:icon="@android:drawable/ic_menu_upload" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="1dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnVoiceAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:contentDescription="Agregar nota por voz"
android:src="@drawable/ic_mic"
app:tint="?attr/colorOnSecondaryContainer"
app:backgroundTint="?attr/colorSecondaryContainer"
app:fabSize="mini" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/add_note"
android:src="@android:drawable/ic_input_add"
app:tint="?attr/colorOnSecondaryContainer"
app:backgroundTint="?attr/colorSecondaryContainer" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_config_title"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginBottom="24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_config_show_time"
android:textSize="16sp" />
<CheckBox
android:id="@+id/configShowTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_config_show_category"
android:textSize="16sp"
android:layout_marginTop="12dp" />
<CheckBox
android:id="@+id/configShowCategory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_config_max_items"
android:textSize="16sp"
android:layout_marginTop="12dp" />
<com.google.android.material.chip.ChipGroup
android:id="@+id/configChipGroupMax"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
app:singleSelection="true"
app:selectionRequired="true"
app:chipSpacing="8dp">
<com.google.android.material.chip.Chip
android:id="@+id/configMax5"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5" />
<com.google.android.material.chip.Chip
android:id="@+id/configMax10"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10"
android:checked="true" />
<com.google.android.material.chip.Chip
android:id="@+id/configMax15"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15" />
<com.google.android.material.chip.Chip
android:id="@+id/configMaxAll"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_config_max_all" />
</com.google.android.material.chip.ChipGroup>
<Button
android:id="@+id/btnConfigSave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/save" />
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,42 @@
<?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="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:minWidth="320dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilCategoryName"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/category_name">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etCategoryName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:imeOptions="actionDone" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/select_color"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?attr/colorPrimary" />
<LinearLayout
android:id="@+id/colorSwatches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical" />
</LinearLayout>

View File

@@ -0,0 +1,24 @@
<?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="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:minWidth="320dp">
<LinearLayout
android:id="@+id/categoryList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnAddCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
style="@style/Widget.Material3.Button.OutlinedButton"
android:text="@string/new_category"
android:icon="@android:drawable/ic_input_add" />
</LinearLayout>

View File

@@ -0,0 +1,291 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:minWidth="300dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilTitle"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/title">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:imeOptions="actionNext" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilContent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="@string/content">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="120dp"
android:inputType="textMultiLine"
android:gravity="top" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:id="@+id/voiceNoteRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:visibility="visible">
<ImageButton
android:id="@+id/btnVoiceRecord"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/voice_note"
android:src="@drawable/ic_mic"
android:scaleType="center"
android:focusable="false"
android:focusableInTouchMode="false" />
<TextView
android:id="@+id/textVoiceStatus"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:text="@string/voice_note"
android:textSize="14sp"
android:textColor="?attr/colorOnSurfaceVariant" />
</LinearLayout>
<LinearLayout
android:id="@+id/photoRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:visibility="visible">
<ImageButton
android:id="@+id/btnAddPhoto"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/photo_add"
android:src="@android:drawable/ic_menu_gallery"
android:scaleType="center"
android:focusable="false"
android:focusableInTouchMode="false" />
<TextView
android:id="@+id/textPhotoStatus"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:text="@string/photo_add"
android:textSize="14sp"
android:textColor="?attr/colorOnSurfaceVariant" />
<ImageView
android:id="@+id/imgPhotoPreview"
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="centerCrop"
android:visibility="gone" />
<ImageButton
android:id="@+id/btnRemovePhoto"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/photo_remove"
android:src="@android:drawable/ic_menu_close_clear_cancel"
android:scaleType="center"
android:visibility="gone"
android:focusable="false"
android:focusableInTouchMode="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="16dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/category"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?attr/colorPrimary" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnManageCategories"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/manage_categories"
android:textSize="12sp" />
</LinearLayout>
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroupCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
app:singleSelection="true"
app:selectionRequired="false"
app:chipSpacing="4dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/set_reminder"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?attr/colorPrimary" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switchReminder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/set_reminder" />
<LinearLayout
android:id="@+id/reminderFields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:visibility="gone">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilDate"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="4dp"
android:hint="@string/reminder_date"
android:focusable="false"
android:clickable="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
android:focusable="false"
android:clickable="true"
android:cursorVisible="false" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilTime"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="4dp"
android:hint="@string/reminder_time"
android:focusable="false"
android:clickable="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
android:focusable="false"
android:clickable="true"
android:cursorVisible="false" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<TextView
android:id="@+id/labelRecurrence"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/recurrence"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?attr/colorPrimary"
android:visibility="gone" />
<RadioGroup
android:id="@+id/radioRecurrence"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:orientation="vertical"
android:visibility="gone">
<RadioButton
android:id="@+id/radioNone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/recurrence_none"
android:checked="true" />
<RadioButton
android:id="@+id/radioDaily"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/recurrence_daily" />
<RadioButton
android:id="@+id/radioWeekly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/recurrence_weekly" />
<RadioButton
android:id="@+id/radioMonthly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/recurrence_monthly" />
<RadioButton
android:id="@+id/radioYearly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/recurrence_yearly" />
</RadioGroup>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
style="@style/Widget.MaterialComponents.CardView">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="true">
<ImageView
android:id="@+id/ivPhotoBlur"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:visibility="gone" />
<View
android:id="@+id/photoScrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageButton
android:id="@+id/btnExpand"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Expandir"
android:focusable="false"
android:focusableInTouchMode="false"
android:scaleType="center"
android:src="@android:drawable/arrow_down_float"
android:tint="?attr/colorOnSurfaceVariant" />
<View
android:id="@+id/categoryDot"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginEnd="6dp"
android:background="@drawable/circle_category"
android:visibility="gone" />
<TextView
android:id="@+id/textTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?attr/colorOnSurface"
android:textSize="16sp"
android:textStyle="bold" />
<com.google.android.material.chip.Chip
android:id="@+id/chipRecurrence"
style="@style/Widget.Material3.Chip.Assist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<ImageButton
android:id="@+id/btnMarkComplete"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/mark_completed"
android:focusable="false"
android:focusableInTouchMode="false"
android:scaleType="center"
android:src="@drawable/ic_check"
android:tint="?attr/colorOnSurface" />
</LinearLayout>
<TextView
android:id="@+id/textDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/colorPrimary"
android:textSize="12sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/detailsSection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/textContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textColor="?attr/colorOnSurfaceVariant"
android:textSize="14sp" />
<TextView
android:id="@+id/textReminder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:drawablePadding="4dp"
android:textColor="?attr/colorPrimary"
android:textSize="12sp" />
<LinearLayout
android:id="@+id/actionsRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="end"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/btnEdit"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_pencil"
android:text="@string/edit_note"
app:iconTint="?attr/colorOnSurface" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnDelete"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_trash"
android:text="@string/delete"
android:textColor="?attr/colorError"
app:iconTint="?attr/colorError" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnRestore"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@android:drawable/ic_menu_revert"
android:text="@string/restore"
android:visibility="gone" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnPermanentDelete"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_trash"
android:text="@string/delete_permanently"
android:visibility="gone"
app:iconTint="?attr/colorError" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</com.google.android.material.card.MaterialCardView>

View File

@@ -0,0 +1,40 @@
<?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="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/colorOutline" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/textSectionTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textSectionDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:textColor="?attr/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingHorizontal="4dp"
android:paddingVertical="0dp">
<ImageView
android:id="@+id/tabIcon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginEnd="4dp"
android:scaleType="fitCenter"
android:importantForAccessibility="no" />
<TextView
android:id="@+id/tabLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="?attr/colorOnPrimaryContainer"
android:maxLines="1" />
</LinearLayout>

View File

@@ -0,0 +1,40 @@
<?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="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingHorizontal="12dp"
android:paddingVertical="8dp">
<ImageView
android:id="@+id/widgetItemDot"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_marginEnd="10dp"
android:src="@drawable/circle_category"
android:scaleType="fitXY"
android:visibility="gone" />
<TextView
android:id="@+id/widgetItemTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:textColor="?android:attr/textColorPrimary"
android:maxLines="2"
android:ellipsize="end"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" />
<TextView
android:id="@+id/widgetItemTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:textSize="12sp"
android:textColor="?android:attr/textColorSecondary"
android:visibility="gone"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" />
</LinearLayout>

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@android:style/Theme.DeviceDefault.DayNight">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
android:background="@android:drawable/alert_light_frame">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp">
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginEnd="6dp"
android:src="@android:drawable/ic_menu_today"
android:contentDescription="@null" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/widget_today_header"
android:textSize="13sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" />
<TextView
android:id="@+id/widgetItemCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="11sp"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider" />
<ListView
android:id="@+id/widgetNoteList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@null"
android:dividerHeight="0dp"
android:listSelector="@android:color/transparent"
android:padding="0dp" />
<TextView
android:id="@+id/widgetEmptyView"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="@string/widget_empty"
android:textSize="13sp"
android:textColor="?android:attr/textColorSecondary"
android:visibility="gone"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" />
</LinearLayout>
</FrameLayout>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_view_completed"
android:title="Completadas"
android:icon="@android:drawable/ic_menu_edit"
app:showAsAction="never" />
</menu>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/purple_500" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/purple_500" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="notification_channel">#FF6200EE</color>
</resources>

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Recordatorios</string>
<string name="add_note">Agregar nota</string>
<string name="edit_note">Editar nota</string>
<string name="delete_note">Eliminar nota</string>
<string name="delete_confirm">¿Estás seguro de eliminar esta nota?</string>
<string name="cancel">Cancelar</string>
<string name="save">Guardar</string>
<string name="delete">Eliminar</string>
<string name="title">Título</string>
<string name="content">Contenido</string>
<string name="no_notes">No hay notas aún.\nPresiona + para crear una.</string>
<string name="set_reminder">Establecer recordatorio</string>
<string name="reminder_date">Fecha del recordatorio</string>
<string name="reminder_time">Hora del recordatorio</string>
<string name="recurrence">Repetición</string>
<string name="recurrence_none">No repetir</string>
<string name="recurrence_daily">Diario</string>
<string name="recurrence_weekly">Semanal</string>
<string name="recurrence_monthly">Mensual</string>
<string name="recurrence_yearly">Anual</string>
<string name="reminder_title">Recordatorio</string>
<string name="reminder_channel_name">Recordatorios</string>
<string name="reminder_channel_desc">Notificaciones de recordatorios</string>
<string name="select_date">Seleccionar fecha</string>
<string name="select_time">Seleccionar hora</string>
<string name="remove_reminder">Quitar recordatorio</string>
<string name="mark_completed">Marcar como completada</string>
<string name="unmark_completed">Marcar como pendiente</string>
<string name="tab_today">Hoy</string>
<string name="tab_pending">Pendientes</string>
<string name="tab_calendar">Calendario</string>
<string name="tab_deleted">Eliminados</string>
<string name="no_notes_today">No hay tareas para hoy</string>
<string name="no_reminders_pending">No hay recordatorios pendientes</string>
<string name="restore">Restaurar</string>
<string name="delete_permanently">Eliminar permanentemente</string>
<string name="category">Categoría</string>
<string name="category_all">Todas</string>
<string name="category_none">Sin categoría</string>
<string name="manage_categories">Administrar categorías</string>
<string name="new_category">Nueva categoría</string>
<string name="edit_category">Editar categoría</string>
<string name="category_name">Nombre de la categoría</string>
<string name="category_delete_confirm">¿Eliminar esta categoría? Las notas con esta categoría quedarán sin categoría.</string>
<string name="select_color">Seleccionar color</string>
<string name="voice_note">Nota de voz</string>
<string name="voice_recording">Grabando…</string>
<string name="voice_unavailable">Reconocimiento de voz no disponible</string>
<string name="photo_add">Agregar foto</string>
<string name="photo_remove">Quitar foto</string>
<string name="photo_error">Error al cargar la foto</string>
<string name="tab_settings">Configuración</string>
<string name="settings">Configuración</string>
<string name="biometric_title">Bloqueo biométrico</string>
<string name="biometric_summary">Usar huella dactilar para desbloquear la app</string>
<string name="biometric_no_hardware">No hay sensor biométrico disponible</string>
<string name="biometric_not_enrolled">No hay huellas registradas en el dispositivo</string>
<string name="biometric_prompt_title">Desbloquear Recordatorios</string>
<string name="biometric_prompt_subtitle">Usa tu huella dactilar</string>
<string name="biometric_prompt_cancel">Cancelar</string>
<string name="theme_title">Tema</string>
<string name="theme_system">Sistema</string>
<string name="theme_light">Claro</string>
<string name="theme_dark">Oscuro</string>
<string name="background_title">Imagen de fondo</string>
<string name="background_pick">Seleccionar imagen</string>
<string name="background_remove">Quitar fondo</string>
<string name="notif_image_title">Imagen en notificación</string>
<string name="notif_image_summary">Mostrar la imagen de la nota en la notificación</string>
<string name="snooze_title">Tiempo de posponer</string>
<string name="snooze_summary">Duración para posponer recordatorios desde notificación</string>
<string name="snooze_10min">10 minutos</string>
<string name="snooze_30min">30 minutos</string>
<string name="snooze_1hour">1 hora</string>
<string name="snooze_2hours">2 horas</string>
<string name="trash_title">Papelera</string>
<string name="trash_auto_clean">Vaciar automáticamente después de</string>
<string name="trash_disabled">Desactivado</string>
<string name="trash_1day">1 día</string>
<string name="trash_3days">3 días</string>
<string name="trash_7days">7 días</string>
<string name="trash_30days">30 días</string>
<string name="urgent">Urgente</string>
<!-- Widget -->
<string name="widget_today_desc">Lista de tareas de hoy</string>
<string name="widget_today_header">Hoy</string>
<string name="widget_empty">Sin tareas para hoy</string>
<string name="widget_config_title">Personalizar widget</string>
<string name="widget_config_show_time">Mostrar hora</string>
<string name="widget_config_show_category">Mostrar color de categoría</string>
<string name="widget_config_max_items">Máximo de notas</string>
<string name="widget_config_max_all">Todas</string>
</resources>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Recordatorios" parent="Theme.Material3.DynamicColors.DayNight">
<item name="android:statusBarColor">?attr/colorPrimary</item>
<item name="android:navigationBarColor">?attr/colorSurface</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
<item name="android:windowLightNavigationBar">?attr/isLightTheme</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">?attr/colorSurface</item>
</style>
</resources>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="110dp"
android:minHeight="110dp"
android:targetCellWidth="2"
android:targetCellHeight="2"
android:minResizeWidth="40dp"
android:minResizeHeight="110dp"
android:updatePeriodMillis="0"
android:initialLayout="@layout/widget_today_info"
android:configure="com.recordatorios.app.WidgetConfigActivity"
android:widgetCategory="home_screen"
android:resizeMode="horizontal|vertical"
android:description="@string/widget_today_desc" />

4
build.gradle Executable file
View File

@@ -0,0 +1,4 @@
plugins {
id 'com.android.application' version '8.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
}

5
gradle.properties Executable file
View File

@@ -0,0 +1,5 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
android.suppressUnsupportedCompileSdk=34

BIN
gradle/wrapper/gradle-wrapper.jar vendored Executable file

Binary file not shown.

6
gradle/wrapper/gradle-wrapper.properties vendored Executable file
View File

@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

244
gradlew vendored Executable file
View File

@@ -0,0 +1,244 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

92
gradlew.bat vendored Executable file
View File

@@ -0,0 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

BIN
keqing.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 KiB

16
settings.gradle Executable file
View File

@@ -0,0 +1,16 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Recordatorios"
include ':app'