giphy-viewer-kotlin

Giphy Viewer app for Android written in Kotlin

APACHE-2.0 License

Stars
6

Giphy Viewer Android app written in Kotlin

You can find an in-depth exploration of this project in this blog post on developerlife.com.

Design

  • MyApplication.kt is the custom Application class that acts as a dependency injection component that provides various objects that are needed in various places throughout the app.

  • State.kt contains sealed classes that represent various events and state representations that are used throughout the app.

  • Util.kt contains a set of extension function expressions and typedefs that are used throughout the app. Coroutine functions are included here as well.

  • MyViewModel.kt contains the AndroidViewModel that holds the data that's loaded from the network service, and also exposes the network service end points to the rest of the app.

  • NetworkService.kt contains the integration w/ the Giphy Android SDK. Calls from the ViewModel are passed on the methods of GiphyClient, which ends up making calls to the Giphy Android API.

  • RecyclerViewManager.kt contains the RecyclerView data adapter, RowViewModel implementation, and configuration w/ the StaggeredGridLayoutManager. It also hooks into the ViewModel's observable to react to changes in the underlying data (as a result of network service request being made from various parts of the app).

  • NetworkServiceTest.kt contains the classes that connect to web services to load data over the network (GiphyClient SDK).

  • Unit tests (test/) test classes in State.kt and some functions in NetworkService (using Roboelectric).

  • Instrumented tests (androidTest/) test classes in NetworkServiceTest.kt over the network.

Video of app in action

References

ViewModel testing, MockK, Espresso (AndroidJUnit4)

Kotlin object expressions, declarations, constructors, constants, coroutines

Anko logging

Android testing overview (w/ Kotlin)

Roboelectric (and unit tests)

Testing async code in tests

Removing deprecations from androidTestImplementation

AssertJ

Change master to main

The Internet Engineering Task Force (IETF) points out that "Master-slave is an oppressive metaphor that will and should never become fully detached from history" as well as "In addition to being inappropriate and arcane, the master-slave metaphor is both technically and historically inaccurate." There's lots of more accurate options depending on context and it costs me nothing to change my vocabulary, especially if it is one less little speed bump to getting a new person excited about tech.

You might say, "I'm all for not using master in master-slave technical relationships, but this is clearly an instance of master-copy, not master-slave" but that may not be the case. Turns out the original usage of master in Git very likely came from another version control system (BitKeeper) that explicitly had a notion of slave branches.

#blacklivesmatter