Uber RIBs Architecture -Part 2
Creation of RIB View
All parts in this series.
Part 1: Introduction to RIBs
Part 2: Creation of View for logged out RIBPart 3: Creation of Router and Interactor for logged out RIB
Part 4: Creation of Builder for logged out RIB
Part 5: Integrating Builder, Router and Interactor for logged out RIB
Setup
We will work in the module present in android/tutorials/tutorial1 of this repo.
Current directory structure looks like this.
We have RootActivity and root RIB present in the project. We are going to establish what is taught in https://github.com/uber/RIBs/wiki/Android-Tutorial-1, but without using any code generator, so that we learn what is happening here.
Lets make our hands dirty now.
Create a new dir inside root directory named loggedout.
This will contains all the code for loggedout RIB.
Now create a LoggedOutView file, which is a custom ViewGroup extending any ViewGroup like LinearLayout.
Our code now look like this.
Lets create a xml file for our loggedout RIB which will contains LoggedOutView as a root element.
<?xml version="1.0" encoding="utf-8"?>
<com.uber.rib.root.loggedout.LoggedOutView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="This is UI inflated by LoggedOut RIB" />
</com.uber.rib.root.loggedout.LoggedOutView>
Now our basic RIB view is ready.
In the future parts we will write Interactor, Router and Builder.
All parts in this series.
Part 1: Introduction to RIBs
Part 2: Creation of View for logged out RIBPart 3: Creation of Router and Interactor for logged out RIB
Part 4: Creation of Builder for logged out RIB
Part 5: Integrating Builder, Router and Interactor for logged out RIB