How aritraroy/flashbar works
Main Components
• Flashbar Library Module: This contains the core functionality including:
• The Flashbar builder and its related API (Flashbar.kt, FlashbarContainerView.kt, FlashbarView.kt).
• Utility classes (under flashbar/util) and custom view elements (under flashbar/view) like FbButton, FbProgress, and ShadowView.
• Sample Application Module ("app"): This is a demo project that uses the Flashbar library to show sample alerts in Java and Kotlin. It demonstrates how to integrate and use the library.
• Android Framework Components: Since Flashbar integrates into an Activity by attaching views to the decor view, include this aspect, as well as resource management (layouts, drawables, values).
Relationships and Interactions
• The Sample Application calls the Flashbar API through a fluent Builder pattern to configure and display alerts.
• The Flashbar library internally uses container and view classes to attach overlay components to the Activity’s window.
• The Animations and utility submodules support the customization and dynamic behavior of the Flashbar before it displays or dismisses.
• Communication with the Android runtime is implied (via Activity, AndroidManifest, Gradle config for resource handling).
Architectural Patterns and Design Principles
• Modular Separation: The library code (flashbar) is kept separate from the sample app, emphasizing reusability.
• Builder Pattern: The Flashbar.Builder abstracts the configuration of the alert bar allowing chaining and flexible customization.
• Separation of Concerns: Different packages handle animations, views, utilities, and event listeners, each responsible for their domain.
Technologies and Tools
• Programming Languages: Primarily Kotlin (with Java samples).
• Build System: Gradle (files like build.gradle, settings.gradle).
• Android Nine-patch or vector drawable resources for UI components.
• Animation and event handling frameworks provided by Android and custom-built classes in flashbar/anim.
Elements
• Another for the sample app,
• Another for Android platform components.
• Configuration options (such as animations, swipe-to-dismiss, and event listener callbacks) as additional annotations near the related components.