Skip to content

D4vRAM369/CBDcounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

107 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 CBD & THC Counter

Personal harm-reduction tracker for CBD and THC intake β€” built with Kotlin & Material Expressive 3.

icono_cbdcounter2_cleaned

Version Android Kotlin license minSdk targetSdk privacy

πŸ‡ͺπŸ‡Έ VersiΓ³n en espaΓ±ol


What is this?

CBD & THC Counter is a private, offline-first personal tracking app. No account required, no data leaves your device. It helps you monitor your daily CBD and THC intake with a clean, expressive UI β€” so you can make informed, mindful decisions about your consumption.

⚠️ This app doesn't work as a medical device. It does not provide medical advice and does not promote substance use. Use responsibly and always consult a healthcare professional for health-related decisions, and DYOR (DoYourOwnResearch) ALWAYS.

This app does not promote substance use at all, but here is a message: everybody is free to do whatever they want with their body and mind (as long as their actions don't cause harm to others), and getting real information about it without political bias, and promoting to you and others harm reduction and responsible use. Everyone is free, as long as their actions don't cause harm to others: "Non-Aggression Principle: Libertarian Foundation"


Screenshoots

Comming soon!

Features

πŸ”’ Dual Counter

  • Separate CBD and THC counters for the same day
  • Quick +1 button to count CBD.
  • Infused add β€” log a session tagged as weed 🌿 or pollen 🍫 (always counts as THC)
  • βˆ’1 correction with confirmation dialog and chance to delete or keep the note linked to it, if there is any; feedback shown if counter is already at 0
  • Reset with confirmation β€” resets only the active substance for today

πŸ“… Calendar View

  • Monthly grid with a mood emoji on each day reflecting that day's total intake
  • Tap any day to open a Day Modal with full breakdown (CBD, THC, voice note, timestamp log)
  • Previous/next month navigation
  • Emoji legend β€” full intake scale explained at a glance

πŸ“Š Statistics Dashboard (β†’ πŸ“Š EstadΓ­sticas chip)

  • Today / Week / Average / Clean streak metric cards β€” ME3 Expressive colors:
    • Today β†’ ice blue Β· Week β†’ warm orange Β· Average β†’ lime green Β· Streak β†’ lavender
  • Patterns section β€” busiest day of the week by average intake
  • Embedded mini line chart (7D / 14D / 30D)

πŸ“ˆ Evolution Chart

  • Full-screen smooth line chart: 7D Β· 14D Β· 30D Β· 60D ranges
  • Navigate backwards in time with ← β†’ arrow buttons
  • Value labels with smart label-skip for crowded 30D/60D views

πŸŽ™οΈ Voice Notes

  • Record a short audio note for any day directly from the history or Day Modal
  • Playback and delete β€” stored privately on-device (M4A format)
  • Handles RECORD_AUDIO permission request on first use

πŸ“€ Import / Export CSV

  • Export all history as a .csv file (shareable with any spreadsheet app)
  • Import from a .csv β€” restores or merges per-day data
  • Access from top-right icons (↑ export Β· ↓ import, and yeah is reversed as usual icons are about this, but I don't agree seeing it as contradictory when it's actually inverted)

β˜€οΈ Light / Dark Theme Toggle

  • Full redesigned Material Expressive 3 day/night theme, till v1.5
  • Toggle β˜€οΈ/πŸŒ™ button always visible in the top-right icon column
  • Status bar icons adapt automatically (dark in light mode, light in dark mode)
  • Preference persisted across sessions

🏠 Home Screen Widget (2Γ—2)

  • ME3 card design: solid purple #6750A4 (light) / deep indigo #1E1640 (dark)
  • Shows: date Β· CBD/THC mode badge Β· mood emoji Β· total counter
  • Four action buttons: 🌿 Weed Β· β†Ί Reset Β· 🍫 Pollen Β· +1
  • Midnight auto-refresh via AlarmManager

βš™οΈ Settings

  • Switch default tracking mode: CBD ↔ THC (this part of the app need to be improved to offer a proper design if only THC is selected)
  • Customize emojis for each intake level (reflected on counter, calendar, widget)
  • CSV export/import for backup & restore

Tech Stack

Layer Technology
Language Kotlin 2.0
UI Material Design 3 / Material Expressive 3
Architecture Single-Activity + Fragments + BottomSheetDialogFragment
Storage SharedPreferences (zero dependencies, offline-first)
Audio MediaRecorder API β€” M4A/AAC
Chart Custom LineChartView β€” Canvas API, Catmull-Rom spline
Widget AppWidgetProvider + RemoteViews
Theme system AppCompatDelegate DayNight + values-night/ token overrides
Min SDK API 26 (Android 8.0 Oreo)
Target SDK API 35 (Android 15)

Project Structure

app/src/main/
β”œβ”€β”€ java/com/d4vram/cbdcounter/
β”‚   β”œβ”€β”€ MainActivity.kt           # Main counter + history
β”‚   β”œβ”€β”€ DashboardActivity.kt      # Stats dashboard + mini chart
β”‚   β”œβ”€β”€ CalendarActivity.kt       # Monthly emoji calendar
β”‚   β”œβ”€β”€ EvolutionActivity.kt      # Full-screen evolution chart
β”‚   β”œβ”€β”€ DayModalFragment.kt       # Per-day detail bottom sheet
β”‚   β”œβ”€β”€ VoiceNoteBottomSheet.kt   # Audio recording/playback
β”‚   β”œβ”€β”€ CBDWidgetProvider.kt      # Home screen widget provider
β”‚   β”œβ”€β”€ Prefs.kt                  # SharedPrefs wrapper (all data I/O)
β”‚   β”œβ”€β”€ EmojiUtils.kt             # Emoji scale engine
β”‚   └── LineChartView.kt          # Custom Canvas line chart
└── res/
    β”œβ”€β”€ values/                   # Light theme colors + all strings (es)
    β”œβ”€β”€ values-night/             # Dark theme color token overrides
    └── drawable[-night]/         # Shape drawables (dual-theme)

Versioning

Version Highlights
v1.5 Material Expressive 3 Β· Light/Dark toggle β˜€οΈπŸŒ™ Β· ME3 Dashboard cards Β· Widget ME3 redesign Β· Evolution 14D/60D Β· label-skip chart fix
v1.4.1 Calendar + emoji map Β· Statistics dashboard Β· Voice notes crash fix Β· CSV import/export Β· broken buttons replaced
v1.4 Dual CBD/THC counter Β· History tabs (Week / Month / All) Β· Day Modal
v1.3 Home screen widget Β· Settings & emoji customization
v1.0–1.2 Initial release Β· Basic counter Β· Simple history

Installation

Build from source

git clone https://github.com/d4vram/CBDcounter2.git
cd CBDcounter2
git checkout main          # stable release

Open in Android Studio Ladybug 2024.2+ and run on device/emulator with API 26+.

Releases

Pre-built APKs available on the Releases page.


Privacy

  • βœ… 100% offline β€” no internet permission declared
  • βœ… No analytics, no crash reporting, no tracking
  • βœ… All data lives in SharedPreferences and private app storage. Working on SAF (Storage Access Framework) to be able to save the data in the folder you want to choose, and not in android/data/ by default (not accessible without root permission in phone)
  • βœ… Voice notes stored in private internal storage β€” inaccessible to other apps

Known Limitations / Roadmap

  • i18n: ~30 hardcoded Spanish strings in layouts β€” needs migration to strings.xml + values-en/
  • Responsive widget layouts for 2Γ—3 (show CBDΒ·THC split line when widget is enlarged)
  • Dark mode auto-follow system setting (currently manual toggle only)
  • Room DB migration for larger data sets (currently SharedPreferences)

License

GPL-3.0 β€” see LICENSE.


Medical Disclaimer

This application is a personal tracking tool only, as I stated at the beginning of the doc. It is not a medical device, does not provide medical advice and does not promote or facilitate the purchase or sale of any substance. Always consult a qualified healthcare professional for health-related decisions, and take good decisions by your own with the correct information and measure.

''If you don't use your mind, no worries: other people will use it for you''