Summary
This feature provides users with granular analytics about their digital habits. It splits into two main views: a Global Scroll Detail view that aggregates physical scrolling distance across all apps, and a Single App Detail view that offers a deep dive into a specific app’s usage patterns. It solves the problem of vague screen time data by distinguishing between “passive” scrolling and “active” usage, while visualizing the physical toll of infinite scrolling in meters and kilometers.How It Works
Single App Deep Dive
When a user selects a specific app from their dashboard, the app launches a detailed analytics screen. This screen combines historical data with “smart insights” to tell a story about how the user interacts with that specific application.Initialization & Metadata Loading
When the screen opens, the ViewModel immediately identifies the app package. It retrieves the app’s name, icon, and current visibility settings (whether it is hidden or tracked). It also checks if there are any active time limits set for this app.
Data Retrieval & Charting
The system fetches usage data for the current week. This includes three distinct metrics:
- Total Time: How long the app was open.
- Active Time: How long the user was actually touching the screen or typing.
- Scroll Distance: The physical distance scrolled (converted from pixels to meters).
Generating Insights
The system analyzes the raw data to generate human-readable “Insights.” It compares the current week’s performance to the previous week. For example, if the user scrolled 50% less than last week, it generates a positive comparison card. It also calculates “Focus Quality” by comparing Active Time vs. Total Time.
Global Scroll Analytics
This view aggregates data from all apps to show the user the total physical distance they have scrolled on their device.Aggregation & Conversion
The ScrollDetailViewModel pulls scroll data for every app in the database. It uses a utility to convert raw screen pixels into physical units (meters or kilometers) based on the device’s screen density (DPI).
Heatmap Visualization
The data is mapped onto a Calendar Heatmap. Days with heavy scrolling appear darker, allowing the user to spot trends over the month. Users can tap specific dates to filter the data below.
Ranking & Categorization
The screen displays a list of apps sorted by how much they contributed to the total scroll distance. It separates currently installed apps from “Removed Apps” (apps the user deleted but still have historical data for), ensuring the total distance remains accurate even after uninstallation.
Data Stored
This feature processes and visualizes the following data points:| Field | Type | Description |
|---|---|---|
usageTimeMillis | Long | Total duration the app was in the foreground (milliseconds). |
activeTimeMillis | Long | Duration of active input (touch/type) within the app. |
scrollUnits | Long | Raw distance scrolled (pixels or micrometers). |
openCount | Integer | Number of times the app was launched. |
date | String | The specific date for the record (YYYY-MM-DD). |
isInstalled | Boolean | Flag indicating if the app is currently on the device. |
Key Components
AppDetailScreen
The main UI container for a single app’s analytics. It orchestrates the chart, insight grid, and quick action buttons.
UsageBarScrollLineChart
A custom-drawn canvas component that visualizes usage time (bars) and scroll intensity (background heatmap) simultaneously.
AppDetailInsightsGrid
A “Bento-box” style layout engine that dynamically arranges insight cards (like “Focus Quality” or “Frequency”) based on available data.
ScrollDetailViewModel
The logic engine for the global view. It handles the complex task of aggregating pixel data across all apps and converting it to physical distance.