The in.scrollless.android.ui.model package serves as the “UI Model” layer of the application. These are not raw database entities; they are designed to be consumed directly by Jetpack Compose screens.This module bridges the gap between the raw data (milliseconds of usage, pixels scrolled) and the user-facing interface, ensuring that the UI remains “dumb” and focused solely on rendering.
AppUsageUiItem: Represents how long a user spent in an app. It includes limitInfo to indicate if the user is approaching a self-imposed digital wellbeing cap.
AppScrollUiItem: A specialized model for the “Scrollless” core feature. It tracks vertical and horizontal scroll distances, allowing the UI to visualize “infinite scroll” habits.
AppOpenUiItem: Focuses on frequency (how many times an app was launched) rather than duration.
NotificationTreemapItem: Specifically structured for a Treemap visualization. It includes a Color and Drawable icon to facilitate complex canvas drawing of notification density.
AppDailyDetailData: A time-series model used for rendering historical charts, combining usage time, active time, and scroll units for a specific date.
These models are immutable data classes. When the underlying data changes (e.g., the user scrolls more), the pattern dictates that a new instance of the model is created and emitted via a .
Interestingly, most models use java.io.File? for icons instead of direct Bitmaps or Drawables. This suggests a performance optimization where app icons are cached to disk and loaded asynchronously by the UI (likely using a library like Coil), preventing .
Almost every item contains an isInstalled: Boolean flag. This allows the UI to handle “Ghost Apps”—apps that have historical data in the database but have since been deleted from the device.