SkyWebView - Custom WebView

Custom view representing a sky with star and interactive buttons.

This custom view includes a WebView to display an image of the sky, buttons for adding stars, resetting the sky, and a listener to monitor the state of the sky's fullness.

Features

  • Sky Manager: Manages the state and operations related to the sky.
  • WebView: Displays the image of the sky.
  • Small Star Button: Adds small stars to the sky.
  • Big Star Button: Adds big stars to the sky.
  • Reset Button: Resets the state of the stars in the sky.
  • Local Data Management: The SkyWebView custom WebView utilizes SharedPreferences to locally store the list of stars. This ensures that the star information persists across app sessions
  • Unit Test: The SkyWebView custom WebView comes with a comprehensive set of unit tests to ensure the stability and correctness of its functionality. These tests cover various scenarios, including the handling of star additions, resets, and the management of the local star list.

Usage

  1. Include the SkyWebView custom view in your layout XML file.

    <com.alicimsamil.starproject.skywebview.SkyWebView
        android:id="@+id/skyWebView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    
  2. In your activity or fragment, find the view. (optional)

    var skyWebView = findViewById(R.id.skyWebView)
    
  3. Integrate SkyWebView with the activity's lifecycle by incorporating the following code. This implementation will not only display a toast message, indicating that the sky is filled with stars, but also ensure that your current stars are saved when the app enters a terminated state. (optional)

    lifecycle.addObserver(skyWebView)
    
  4. Add a star to the SkyWebView upon activity creation. (optional)

    skyWebView.addStarInterface(StarSize.Small)
    

Media

Screeshots

Log Output