-
Notifications
You must be signed in to change notification settings - Fork 1
v1.4 – New UI design and visual improvements #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
D4vRAM369
wants to merge
5
commits into
main
Choose a base branch
from
v1.4_new-design
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Approved design for: - Dashboard with stats cards, chart, and patterns - CBD/THC toggle with orange/amber theme for THC - Backup system (auto + manual with AES-256) - Improved CSV with substance tracking Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Principales cambios: - Contadores separados para CBD y THC con selector de modo activo - Nueva CalendarActivity con vista mensual y leyenda de emojis - BackupManager: sistema de backup/restore en ZIP con datos y audios - EdgeToEdgeUtils para diseño inmersivo - UI renovada: chips de selección, colores diferenciados por sustancia - Migración automática de datos legacy a formato v1.4 - Mejoras en Settings: sección de backup, más opciones - Eliminada StatsActivity (reemplazada por CalendarActivity) Archivos: MainActivity, Prefs, SettingsActivity, CalendarActivity, BackupManager, EdgeToEdgeUtils, layouts y recursos visuales. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Las infusiones de weed/polen ahora siempre incrementan el contador THC independientemente del modo activo seleccionado. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PROBLEMA DETECTADO: =================== 1. App crasheaba al iniciar con ClassCastException 2. App crasheaba al abrir pantalla Stats con SecurityException 3. Estadísticas mostraban ceros después de importar CSV ROOT CAUSE ANALYSIS: ==================== Bug #1: ClassCastException en MainActivity.initViews() ------------------------------------------------------- - Error: 'Chip cannot be cast to MaterialButton' - Causa: Desajuste entre tipos declarados en Kotlin y tipos en XML - Archivos afectados: * statsButton: declarado MaterialButton, pero es Chip en XML * settingsButton: declarado MaterialButton, pero es ImageButton en XML * exportButton: declarado MaterialButton, pero es ImageButton en XML * importButton: declarado MaterialButton, pero es ImageButton en XML * searchButton: declarado MaterialButton, pero es ImageButton en XML Bug #2: SecurityException en DashboardActivity.onResume() ---------------------------------------------------------- - Error: 'RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified' - Causa: Android 13+ (API 33) requiere flag de seguridad al registrar BroadcastReceivers - Archivos afectados: * DashboardActivity.kt línea 97 * MainActivity.kt línea 182 Bug #3: Estadísticas en ceros (ya corregido en commit anterior) ---------------------------------------------------------------- - Causa: Uso de claves obsoletas count_$date en lugar de count_cbd_$date y count_thc_$date - Archivos afectados: * DashboardActivity.kt (4 funciones) * EvolutionActivity.kt (1 función) * CalendarActivity.kt (1 función) SOLUCIÓN IMPLEMENTADA: ====================== 1. Corregir tipos de variables en MainActivity.kt: - statsButton: MaterialButton → Chip - settingsButton, exportButton, importButton, searchButton: MaterialButton → ImageButton 2. Agregar flag RECEIVER_NOT_EXPORTED en registerReceiver(): - DashboardActivity: registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED) - MainActivity: registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED) Nota PBL: RECEIVER_NOT_EXPORTED indica que el receptor es PRIVADO (solo nuestra app puede enviar broadcasts). Usar RECEIVER_EXPORTED solo si otras apps necesitan comunicarse con nosotros. 3. Actualizar acceso a datos en Activities de estadísticas: - Usar Prefs.getTotalCount() en lugar de sharedPrefs.getInt("count_$date", 0) - Usar Prefs.getAllDatesWithData() en lugar de iterar sharedPrefs.all CONCEPTOS APRENDIDOS (PBL): =========================== 1. Type Safety en Android: - findViewById<T> hace cast implícito al tipo T - Si el tipo real en XML no coincide con T → ClassCastException - Solución: Declarar variables con el tipo exacto del XML 2. BroadcastReceiver Security (Android 13+): - RECEIVER_NOT_EXPORTED: Receptor privado (comunicación interna) - RECEIVER_EXPORTED: Receptor público (otras apps pueden enviar) - Razón: Prevenir que apps maliciosas envíen broadcasts falsos 3. Data Migration Best Practices: - Centralizar acceso a datos en funciones helper (Prefs.kt) - Evita duplicación de lógica de migración - Facilita cambios futuros en estructura de datos TESTING: ======== ✅ Build exitoso ✅ App inicia sin crashes ✅ Pantalla Stats abre correctamente ⏳ Pendiente: Verificar estadísticas después de importar CSV ARCHIVOS MODIFICADOS: ===================== - MainActivity.kt: Tipos de botones + BroadcastReceiver flag - DashboardActivity.kt: BroadcastReceiver flag + Stats con Prefs helpers - EvolutionActivity.kt: Stats con Prefs helpers - CalendarActivity.kt: Stats con Prefs helpers - CBDWidgetProvider.kt: (cambios menores de baseline)
PROBLEMA: Las notas con espacios o comas se exportaban mal en CSV, dividiéndose en múltiples columnas en lugar de una sola. Ejemplo: Antes: 23/08/2025,5,0,Nueva feature de notas Ahora: 23/08/2025,5,0,"Nueva feature de notas" CAUSA: escapeCsvField() usaba escape con backslash (\,) en lugar del estándar RFC 4180 que requiere comillas dobles. SOLUCIÓN: - Actualizar escapeCsvField() para usar RFC 4180: * Campos con comas/saltos/comillas → entre comillas dobles * Comillas internas se duplican: " → "" - Actualizar unescapeCsvField() para: * Parsear nuevo formato RFC 4180 (comillas dobles) * Mantener compatibilidad con formato antiguo (backslash) IMPACTO: ✅ Export CSV ahora genera archivos estándar ✅ Import CSV sigue funcionando con ambos formatos ✅ Compatible con Excel, LibreOffice, Google Sheets ARCHIVOS: - MainActivity.kt: escapeCsvField() y unescapeCsvField() - docs/: Exportados 10 artifacts .md con fecha 2026-01-19
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Changes in v1.4
🧪 Testing
ℹ️ Notes
This PR only affects visual/design aspects. No logic or data handling changes.