Skip to content

kaushikgopal/movies-usf-android

Repository files navigation

Movie search using a unidirectional state flow pattern

This is an attempt at coming up with a unidirectional state flow pattern that uses the concepts of patterns like Redux, Cycle.js, MVI etc.

Many of my contemporaries have already done amazing work in this area and I've drawn a lot of lessons and learnings from their work already:

I wanted to achieve the benefits of this pattern without introducing any new libraries or a new framework. How would one familiar with an MVVM model today leverage the principles/benefits of a unidirectional state/data flow? I hope to demo those concepts with this app.

usf_animation.gif "picture showing the USF animation"

The app is a simple movie search app. Clicking the movie result populates a history list. While this is not an extremely complex app, it isn't a silly Hello World one either, so the hope is that it'll cover regular use cases for a basic application.

I've also started meaninful test cases in the repo.

Setting up your OMDB API KEY

We use the wonderful OMDB api to fetch movie information.

There are quotas on this api, so please don't use mine :)

  1. Get an api key for OMDB here
  2. Add it to you local.properties file (which shouldn't be checked in to a VCS) like so:
# local.properties
OMDB_API_KEY="<API_KEY_GOES_HERE>"

For great movie recommendations, ping me @kau.sh (seriously, I watch a lot of movies).

I gave a talk at MBLT}Dev 2018 on how I went about building this app. Slides can be found here.

Getting Started

This project now uses ksp to reduce the boilerplate in wiring up a new feature. This PR has the details for how this change was made.

All that's needed is writing the implementation of your ViewModel so MyFeatureViewModelImpl: UsfViewModelImpl<E, R, VS, VE> and adding the @UsfViewModel annotation. Your ViewModel boilerplate code will be auto-generated.

Take a look at MSMovieViewModelImpl for the View Model logic and MSMovieActivity to see how the viewModel is invoked.

iOS app

I gave another talk at Mobilization IX showing how we can use the same concepts on iOS too and wrote my first iOS app to demonstrate these concepts - You can check that out here.

About

Movie searching using a Unidirectional State Flow pattern for Android

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages