How yvescheung/uinspector works
Main Components
• Core Inspector API (api module): This module exposes the key interfaces and classes (e.g., UInspector.kt, various plugins for hierarchy, properties, lifecycle, and touch events) that constitute the inspection logic.
• Default Implementations (impl module): Contains the default behaviors for panels, accessibility, view properties, hierarchy extra information, and targets (e.g., UInspectorDefaultChildPanelPlugin, UInspectorHierarchyPanel). This module implements the interfaces defined in the API.
• Demo/Application Module (app module): This sample app demonstrates the integration of the inspector. It includes the UI elements, Android manifest for launching activities (e.g., MainActivity, demo dialog and gallery windows) and interacts with the core UInspector.
• Optional Integrations (optional module): Divided into submodules like compose, fresco, glide, lottie, multitype and viewmodel, each providing additional parsing, inspection, or UI capabilities for popular third-party libraries or frameworks.
Relationships and Data Flow
• Once a view is tapped (using single-tap interception and double-tap for normal click propagation), the inspector queries the hierarchy, properties, and state of the view.
• The core API redirects this event to the appropriate panel or plugin, which may be implemented either by default (from the impl module) or extended through optional integrations.
Architectural Patterns and Principles
• Modular Design: The separation into modules (api, impl, app, optional) allows for independent development and testing. Each module has clear responsibilities and defined entry points (e.g., the UInspector creation call, Notification Service integration).
• Event Interception and Dispatching: Emphasize that the inspector intercepts UI touch events (with a fallback on double-taps to allow normal clicks), then processes and displays data visualizations of the view information.
Relevant Technologies and Frameworks
• Android SDK: Components such as Activities, Fragments, AndroidManifest entries, and resources (layouts, drawables, strings).
• Gradle Build System: Note the existence of build scripts at multiple levels (e.g., build.gradle in app, api, impl, and each optional module).
• Optional frameworks: Jetpack Compose, Fresco, Glide, Lottie, MultiType, and ViewModel – indicate their optional dependency paths that extend the core functionality.
Elements
• Each module (api, impl, app, optional) should be represented as a container.
• Within the API module, include components such as the main Inspector class (UInspector.kt), hierarchy parsers, properties parsers, lifecycle management, and plugin service interfaces.
• Within the Impl module, list key default implementations that tie into the API’s interfaces.
• The Demo Application should be shown as a consumer of the API (illustrating the flow from Android system events to inspector activation).