Skip to main content

Overview

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.

Architecture & Data Flow

These models are the final output of the pipeline. They typically reside within a ’s state.

Key Components

1. Usage & Scroll Metrics

  • 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.

2. Visualization Models

  • 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.

Operational Logic

State Management

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 .

Icon Handling

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 .

Installation Awareness

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.

Data Engineering & Transformation

The transformation from raw data to these models involves several -based operations:
  • Unit Conversion: Converting raw Long milliseconds from the Android UsageStatsManager into human-readable formats or percentage-of-limit calculations.
  • Coordinate Aggregation: The AppScrollUiItem aggregates X and Y scroll units, likely captured via an .
  • Color Mapping: In the case of the Treemap, the system assigns specific colors to package names to ensure visual consistency across app sessions.

Dependencies

  • LimitInfo: A sibling model used to represent user-defined constraints on app usage.
  • Android Graphics: Uses Drawable and Color for visualization-heavy items.
  • File System: Relies on java.io.File for optimized icon rendering.
Last modified on January 22, 2026