RxJava (RxAndroid) + RxBus + Data Binding + room sample (based on Java1.7) on Android.

Introduction

This article is the 13th day of Android Beginner Advent Calendar 2018.

About a month after the first Android development, The following story was raised at the company.

** The app you are developing is legacy, so let's renew the structure! **

So, I summarized the results of researching and studying for the past two months in a sample app. Based on this, what kind of structure will be made? We plan to have a conversation within the team on how to change it.

Operation confirmed version

App structure

--Use the following design patterns MVVM

--Use the following libraries

Prerequisites

It does not mean that it will be the production code as it is It is just a sample for discussion within the team.

Purpose of the sample

Breaking away from God Activity (Fragment)

――The app you are currently developing in business is too god Activity (Fragment) --Activity (Fragment) inheritance hell ――It's too tightly coupled to write a test

Nullpo measures

The app can't keep up with the life cycle and often dies. I want to be relieved.

Love more legacy

The samples on the net are all the codes that are premised on using kotlin and RetroLambda. For those who only use Java 1.7 but want to use RxJava. (Of course I want to use kotlin, but in reality it is difficult in terms of cost and quality ...)

The story of studying! But the purpose is not to study, so For the time being, I would be happy if there is something that I can understand, something that works, and something that I can study with my current knowledge.

Output of my study results

I would be happy if I could get Masakari from a strong Android engineer. The architecture and way of thinking are self-taught, so I would like to know if there is a good mechanism.

Other points of concern

--Is it better to use Repository pattern to wrap data source (file, DB)? So far, it's only sqlite, and I'm wondering if it's okay to leave it in the room. Maybe it's not too painful to switch ... I also feel that if it is too much from the beginning, it will become rigid.

--I don't understand the convenience of dagger2 and can't use it. I studied a little and asked at the Mokumokukai, I don't know how happy it is to use it ... You just don't realize you're in trouble? I would be happy if there was specific source code.

--The existence of problems with other functions has not been verified. It has not been verified whether this mechanism is good for billing function, GoogleMap embedding, camera function, etc. I feel like it's going to happen, and I think it's okay to proceed, I want to verify it first if possible.

Source of the created sample app

The source is from the following Github. https://github.com/fortegp05/SampleAndroidApps

Functions implemented in the app

--Asynchronous communication function (RxJava2 (RxBus), RxAndroid) Ability to search and list Github repositories Ability to search and list connpass events (Api is heavy and often times out)

--SQLite operation by room Ability to save data in SQLite Ability to retrieve and display data from SQLite

--Linking View and ViewModel with Data Binding

--Implementation of Navigation Drawer

--Test implementation --Unit test --UI test

What you want to do in the future

--Further modernization --kotlin --Using RetroLambda --Enhancement --Make the part that passes an arbitrary character string bidirectional with Data Binding when searching --Real-time search --Get the next data when scrolling the RecyclerView --Added SQLite operations --Update

in conclusion

From the next time, I will output what I did while actually giving a code example. Next, I plan to challenge the explanation of asynchronous processing by RxJava.

Recommended Posts

RxJava (RxAndroid) + RxBus + Data Binding + room sample (based on Java1.7) on Android.
Asynchronous processing by RxJava (RxAndroid) on Android
Event handling with RxBus on Android
Android Studio data binding study summary
Java9 (based on Oracle JVM) catchup
Notes on Android (java) thread processing