GeezerVison is showing github.com — feat: setup RxBus Demo fragments · linked-k/Android-RxJava@35939b8
File treeExpand file treeCollapse file tree Open diff view settings java/com/morihacky/android/rxjava
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/MainFragment.java +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | import butterknife.ButterKnife; | 10 | 10 | import butterknife.OnClick; | 11 | 11 | import com.morihacky.android.rxjava.app.R; | | 12 | +import com.morihacky.android.rxjava.rxbus.RxBusDemoFragment; | 12 | 13 |
| 13 | 14 | public class MainFragment | 14 | 15 | extends Fragment { | @@ -76,6 +77,15 @@ public void demoPolling() { | 76 | 77 | .commit(); | 77 | 78 | } | 78 | 79 |
| | 80 | + @OnClick(R.id.btn_demo_rxbus) | | 81 | + public void demoRxBus() { | | 82 | + getActivity().getSupportFragmentManager() | | 83 | + .beginTransaction() | | 84 | + .addToBackStack(this.toString()) | | 85 | + .replace(R.id.activity_main, new RxBusDemoFragment(), this.toString()) | | 86 | + .commit(); | | 87 | + } | | 88 | + | 79 | 89 | //@OnClick(R.id.btn_demo_subject_timeout) | 80 | 90 | public void demoTimeout() { | 81 | 91 | getActivity().getSupportFragmentManager() | |
Collapse file Copy file name to clipboard +36Lines changed: 36 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +package com.morihacky.android.rxjava.rxbus; | | 2 | + | | 3 | +import android.os.Bundle; | | 4 | +import android.support.annotation.Nullable; | | 5 | +import android.support.v4.app.Fragment; | | 6 | +import android.view.LayoutInflater; | | 7 | +import android.view.View; | | 8 | +import android.view.ViewGroup; | | 9 | +import butterknife.ButterKnife; | | 10 | +import com.morihacky.android.rxjava.app.R; | | 11 | + | | 12 | +public class RxBusDemoFragment | | 13 | + extends Fragment { | | 14 | + | | 15 | + @Override | | 16 | + public View onCreateView(LayoutInflater inflater, | | 17 | + @Nullable ViewGroup container, | | 18 | + @Nullable Bundle savedInstanceState) { | | 19 | + View layout = inflater.inflate(R.layout.fragment_rxbus_demo, container, false); | | 20 | + ButterKnife.inject(this, layout); | | 21 | + return layout; | | 22 | + } | | 23 | + | | 24 | + @Override | | 25 | + public void onActivityCreated(@Nullable Bundle savedInstanceState) { | | 26 | + super.onActivityCreated(savedInstanceState); | | 27 | + | | 28 | + getActivity().getSupportFragmentManager() | | 29 | + .beginTransaction() | | 30 | + .replace(R.id.demo_rxbus_frag_1, new RxBusFrag1()) | | 31 | + .replace(R.id.demo_rxbus_frag_2, new RxBusFrag2()) | | 32 | + .replace(R.id.demo_rxbus_frag_3, new RxBusFrag3()) | | 33 | + .commit(); | | 34 | + } | | 35 | + | | 36 | +} |
Collapse file Copy file name to clipboard +23Lines changed: 23 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +package com.morihacky.android.rxjava.rxbus; | | 2 | + | | 3 | +import android.os.Bundle; | | 4 | +import android.support.annotation.Nullable; | | 5 | +import android.support.v4.app.Fragment; | | 6 | +import android.view.LayoutInflater; | | 7 | +import android.view.View; | | 8 | +import android.view.ViewGroup; | | 9 | +import butterknife.ButterKnife; | | 10 | +import com.morihacky.android.rxjava.app.R; | | 11 | + | | 12 | +public class RxBusFrag1 | | 13 | + extends Fragment { | | 14 | + | | 15 | + @Override | | 16 | + public View onCreateView(LayoutInflater inflater, | | 17 | + @Nullable ViewGroup container, | | 18 | + @Nullable Bundle savedInstanceState) { | | 19 | + View layout = inflater.inflate(R.layout.fragment_rxbus_frag1, container, false); | | 20 | + ButterKnife.inject(this, layout); | | 21 | + return layout; | | 22 | + } | | 23 | +} |
Collapse file Copy file name to clipboard +23Lines changed: 23 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +package com.morihacky.android.rxjava.rxbus; | | 2 | + | | 3 | +import android.os.Bundle; | | 4 | +import android.support.annotation.Nullable; | | 5 | +import android.support.v4.app.Fragment; | | 6 | +import android.view.LayoutInflater; | | 7 | +import android.view.View; | | 8 | +import android.view.ViewGroup; | | 9 | +import butterknife.ButterKnife; | | 10 | +import com.morihacky.android.rxjava.app.R; | | 11 | + | | 12 | +public class RxBusFrag2 | | 13 | + extends Fragment { | | 14 | + | | 15 | + @Override | | 16 | + public View onCreateView(LayoutInflater inflater, | | 17 | + @Nullable ViewGroup container, | | 18 | + @Nullable Bundle savedInstanceState) { | | 19 | + View layout = inflater.inflate(R.layout.fragment_rxbus_frag2, container, false); | | 20 | + ButterKnife.inject(this, layout); | | 21 | + return layout; | | 22 | + } | | 23 | +} |
Collapse file Copy file name to clipboard +23Lines changed: 23 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +package com.morihacky.android.rxjava.rxbus; | | 2 | + | | 3 | +import android.os.Bundle; | | 4 | +import android.support.annotation.Nullable; | | 5 | +import android.support.v4.app.Fragment; | | 6 | +import android.view.LayoutInflater; | | 7 | +import android.view.View; | | 8 | +import android.view.ViewGroup; | | 9 | +import butterknife.ButterKnife; | | 10 | +import com.morihacky.android.rxjava.app.R; | | 11 | + | | 12 | +public class RxBusFrag3 | | 13 | + extends Fragment { | | 14 | + | | 15 | + @Override | | 16 | + public View onCreateView(LayoutInflater inflater, | | 17 | + @Nullable ViewGroup container, | | 18 | + @Nullable Bundle savedInstanceState) { | | 19 | + View layout = inflater.inflate(R.layout.fragment_rxbus_frag3, container, false); | | 20 | + ButterKnife.inject(this, layout); | | 21 | + return layout; | | 22 | + } | | 23 | +} |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/layout/fragment_main.xml +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 50 | 50 | android:layout_height="wrap_content" | 51 | 51 | android:layout_width="match_parent" | 52 | 52 | android:text="@string/btn_demo_polling"/> | | 53 | + | | 54 | + <Button | | 55 | + android:id="@+id/btn_demo_rxbus" | | 56 | + android:layout_height="wrap_content" | | 57 | + android:layout_width="match_parent" | | 58 | + android:text="@string/btn_demo_rxbus"/> | 53 | 59 | </LinearLayout> | 54 | 60 | </ScrollView> |
Collapse file Copy file name to clipboard +33Lines changed: 33 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | + | | 3 | +<RelativeLayout | | 4 | + android:layout_height="match_parent" | | 5 | + android:layout_width="match_parent" | | 6 | + xmlns:android="http://schemas.android.com/apk/res/android"> | | 7 | + | | 8 | + <LinearLayout | | 9 | + android:id="@+id/demo_rxbus_frag_12" | | 10 | + android:baselineAligned="false" | | 11 | + android:orientation="horizontal" | | 12 | + android:layout_height="wrap_content" | | 13 | + android:layout_width="match_parent" | | 14 | + android:minHeight="100dp"> | | 15 | + <FrameLayout | | 16 | + android:id="@+id/demo_rxbus_frag_1" | | 17 | + android:layout_weight="1" | | 18 | + android:layout_height="match_parent" | | 19 | + android:layout_width="0dp"/> | | 20 | + <FrameLayout | | 21 | + android:id="@+id/demo_rxbus_frag_2" | | 22 | + android:layout_weight="1" | | 23 | + android:layout_height="match_parent" | | 24 | + android:layout_width="0dp"/> | | 25 | + </LinearLayout> | | 26 | + | | 27 | + | | 28 | + <FrameLayout | | 29 | + android:id="@+id/demo_rxbus_frag_3" | | 30 | + android:layout_height="match_parent" | | 31 | + android:layout_width="match_parent" | | 32 | + android:layout_below="@id/demo_rxbus_frag_12"/> | | 33 | +</RelativeLayout> |
Collapse file Copy file name to clipboard +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | +<FrameLayout | | 3 | + android:background="@color/green" | | 4 | + android:layout_height="match_parent" | | 5 | + android:layout_width="match_parent" | | 6 | + xmlns:android="http://schemas.android.com/apk/res/android"> | | 7 | + | | 8 | + | | 9 | + | | 10 | + | | 11 | +</FrameLayout> |
Collapse file Copy file name to clipboard +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | +<FrameLayout | | 3 | + android:background="@color/blue" | | 4 | + android:layout_height="match_parent" | | 5 | + android:layout_width="match_parent" | | 6 | + xmlns:android="http://schemas.android.com/apk/res/android"> | | 7 | + | | 8 | +</FrameLayout> |
Collapse file Copy file name to clipboard +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | +<FrameLayout | | 3 | + android:background="@color/red" | | 4 | + android:layout_height="match_parent" | | 5 | + android:layout_width="match_parent" | | 6 | + xmlns:android="http://schemas.android.com/apk/res/android"> | | 7 | + | | 8 | +</FrameLayout> |
|