Skip to content

sdfgsdfgd/template2023

Repository files navigation

< 2023 - Template Codebase: Kotlin Traditional Views Template >

This is kotlin views template, please prefer to use Compose Template instead.

Screenshot 2023-02-01 at 12 27 48

This is a template codebase in both Kotlin Traditional View implementation and Compose (WIP)

Initial structure is made up of nested navigation graphs, 3 initial bottom navigation bar tabs, a basic initial Dependency Injection structure via Hilt and further examples of the Jetpack libraries that are included.

Home tab includes a Data-bound Recyclerview (RecyclerView) of SpaceX launches using the SpaceX API v5.

  • extra folder includes all utilities and extensions, as well as convenience classes and bindings / binding adapters.
  • The UI layer
    • HomeViewModel and HomeFragment make use of, and observe StateFlow and LiveData for management of the UI states and adapter management.
    • Data-bound list: Implementation favors data-bound RecyclerView which is built with data bindings (and Advanced Data Binding concept BR.item) that are setup by the layout (see below attachment) and HomeViewModel, marked by config comment. stocks LiveData contains the item list, which can also be a sealed type that enables expanding with different types of UI containers within layout provider of ViewModel for different item types. The actual bindings' implementations all reside under extra/recyclerview
    • DiffUtil is also utilized under the listview, which by default enables item change animations, crossfade and even item swap animations.

Getting Started

Run

Build system uses Gradle and build scripts are written in Gradle Kotlin DSL

For building or installing, use the gradlew build and gradlew install after importing and synchronizing the project.

Tests (Deprecated)

Right click the test (unit test) folder under xxx to run all the unit tests inside TestHilt.

or

use command ./gradlew testDebugUnitTest --tests "net.sdfgsdfg.domain.TestHilt"

...check the test results:

Dependencies

  • AppCompat - Degrade gracefully on older versions of Android.
  • Android KTX - Write more concise, idiomatic Kotlin code.
  • Architecture - A collection of libraries that help you design robust, testable, and maintainable apps. Start with classes for managing your UI component lifecycle and handling data persistence.
  • Data Binding - Declaratively bind observable data to UI elements.
  • Lifecycles - Create a UI that automatically responds to lifecycle events.
  • LiveData - Build data objects that notify views when the underlying database changes.
  • Navigation - Handle everything needed for in-app navigation.
  • ViewModel - Store UI-related data that isn't destroyed on app rotations. Easily schedule asynchronous tasks for optimal execution.
  • UI - Details on why and how to use UI Components in your apps - together or separate
  • Fragment - A basic unit of composable UI.
  • Hilt: for dependency injection
  • Kotlin Coroutines for managing background threads with simplified code and reducing needs for callbacks
  • Moshi for parsing the data layer POJOs

Contact

Kaan Osmanagaoglu

[email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages