Skip to content

paramsen/currency-android-reactive

Repository files navigation

Cewlrency, a currency converter built in Android

[Built on RxJava, fueled by awesomness and 🤓-iness]

Google Play: Cewlrency
This is a rewrite of my no-3rd-party-libs currency app HERE

Features

  • Cool concurrency fueled by Rx. The kind that you just can't build with AsyncTasks, the kind without callback hell. Yup.
  • Custom views and aggressive encapsulation. React -like architecture with View components.
  • Material Design, or at least the newest com.android.design lib & styles
  • Architecture loosely based on Fowlers Uncle Bobs Clean Architecture.
  • Functional approach to the problems of asynchronisity in Android. Not keen on the functional paradigm? Just take a look at the "CurrencyActivity" and let your heart speak for you. You might be familiar with the code from your backend systems, or even you React frontend. Well this is native Android, and for the first time, it rocks. It's fun to work with. No more horrific all knowing monolithic Android Activities. 🤓
  • Vanilla Android version without 3rd party libs of this project; https://github.com/paramsen/currency-android-vanilla [Yes, you will find AsyncTasks in there you HR person from a larger agency and yes I do know them, in fact I know them so well I rather avoid them in favor of Rx because reasons]

Look at

  • CurrencyActivity: Doesn't look like much, it's in charge of loading the initial data and showing a loader when it's slow. Also handles Network errors in an extremely graceful way.
  • CurrencyFragment: It contains all the Views one will see when opening the app, visually speaking. Notice that the Views are implemented in their own encapsulations, like CurrencyPickerViewPager, kind of like React.
  • CurrencyPickerViewPager: Encapsulates the quite complex behavior behind the "pickers", relies on a heavily hacked (and tested) ViewPager.
  • CurrencySource: Now we're talking. It's the glue between View and Data. It handles offline caching, interacts with the API layer etc.
  • AbstractEventStream: My own adaptation of otto.EventBus that uses RxJava instead. Think EventBus, but streamable and awesome. I have used this in many different projects over the past year, it's in apps used by ~1 million monthly users successfully.
  • Icon: Designed it myself using Roman Nuriks tool, awesome dude.

Architectural info

Inspired by DDD, Fowler and React.

  • Activity: Manages current View/Scene state, decides which View is showing when, reacts to events. Orchestrates Fragments.
  • Fragment: View compoents. Orchestrates Views.
  • Views: More encapsulation of View logic, think React. Views are the smallest components. Orchestrates themselves.
  • Source: The Single Source of Truth for data, i.e. the data layer and the only entry for accessing data. Sources are the glue of this architecture.
  • Dependency Injection: A Graph of dependencies, used by Dagger2. Provides inversion of control, a View that needs a Source is not coupled with the instantiation of the Source. The View merely asks for a CurrencySource and gets it. Singletons and hard coupling, good bye.

Thanks to fixer.io and github.com/lsjwzh/RecyclerViewPager for the RecyclerViewPager extensions.

About

Android | RxJava and React-like version.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages