GeezerVison is showing github.com — Merge pull request #99 from jonathan-caryl/update_butterknife · anggit97/RxJava-Android-Samples@6370a71
File treeExpand file treeCollapse file tree Open diff view settings src/main/java/com/morihacky/android/rxjava
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: app/build.gradle +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | retrofitVersion = "2.0.0" | 23 | 23 | sdkVersion = 24 | 24 | 24 | supportLibVersion = "24.2.1" | | 25 | + butterKnifeVersion = '8.5.1' | 25 | 26 | } | 26 | 27 |
| 27 | 28 | dependencies { | @@ -30,7 +31,8 @@ dependencies { | 30 | 31 | compile "com.android.support:recyclerview-v7:${supportLibVersion}" | 31 | 32 |
| 32 | 33 | compile 'com.github.kaushikgopal:CoreTextUtils:c703fa12b6' | 33 | | - compile 'com.jakewharton:butterknife:7.0.1' | | 34 | + compile "com.jakewharton:butterknife:$butterKnifeVersion" | | 35 | + annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion" | 34 | 36 | compile 'com.jakewharton.timber:timber:2.4.2' | 35 | 37 | compile "com.squareup.retrofit2:retrofit:${retrofitVersion}" | 36 | 38 | compile "com.squareup.retrofit2:converter-gson:${retrofitVersion}" | @@ -63,7 +65,7 @@ dependencies { | 63 | 65 |
| 64 | 66 | android { | 65 | 67 | compileSdkVersion sdkVersion | 66 | | - buildToolsVersion '23.0.3' | | 68 | + buildToolsVersion '25.0.2' | 67 | 69 |
| 68 | 70 | defaultConfig { | 69 | 71 | applicationId "com.morihacky.android.rxjava" | |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/fragments/BufferDemoFragment.java +7-5Lines changed: 7 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 18 | 18 | import java.util.List; | 19 | 19 | import java.util.concurrent.TimeUnit; | 20 | 20 |
| 21 | | -import butterknife.Bind; | | 21 | +import butterknife.BindView; | 22 | 22 | import butterknife.ButterKnife; | 23 | 23 | import hu.akarnokd.rxjava.interop.RxJavaInterop; | | 24 | +import butterknife.Unbinder; | 24 | 25 | import io.reactivex.android.schedulers.AndroidSchedulers; | 25 | 26 | import io.reactivex.disposables.Disposable; | 26 | 27 | import io.reactivex.observers.DisposableObserver; | | 43 | 44 | public class BufferDemoFragment | 44 | 45 | extends BaseFragment { | 45 | 46 |
| 46 | | - @Bind(R.id.list_threading_log) ListView _logsList; | 47 | | - @Bind(R.id.btn_start_operation) Button _tapBtn; | | 47 | + @BindView(R.id.list_threading_log) ListView _logsList; | | 48 | + @BindView(R.id.btn_start_operation) Button _tapBtn; | 48 | 49 |
| 49 | 50 | private LogAdapter _adapter; | 50 | 51 | private List<String> _logs; | 51 | 52 |
| 52 | 53 | private Disposable _disposable; | | 54 | + private Unbinder unbinder; | 53 | 55 |
| 54 | 56 | @Override | 55 | 57 | public void onResume() { | @@ -74,13 +76,13 @@ public View onCreateView(LayoutInflater inflater, | 74 | 76 | @Nullable ViewGroup container, | 75 | 77 | @Nullable Bundle savedInstanceState) { | 76 | 78 | View layout = inflater.inflate(R.layout.fragment_buffer, container, false); | 77 | | - ButterKnife.bind(this, layout); | | 79 | + unbinder = ButterKnife.bind(this, layout); | 78 | 80 | return layout; | 79 | 81 | } | 80 | 82 |
| 81 | 83 | @Override public void onDestroyView() { | 82 | 84 | super.onDestroyView(); | 83 | | - ButterKnife.unbind(this); | | 85 | + unbinder.unbind(); | 84 | 86 | } | 85 | 87 |
| 86 | 88 | // ----------------------------------------------------------------------------------- | |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/fragments/ConcurrencyWithSchedulersDemoFragment.java +8-5Lines changed: 8 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 11 | 11 | import android.widget.ArrayAdapter; | 12 | 12 | import android.widget.ListView; | 13 | 13 | import android.widget.ProgressBar; | 14 | | -import butterknife.Bind; | | 14 | +import butterknife.BindView; | 15 | 15 | import butterknife.ButterKnife; | 16 | 16 | import butterknife.OnClick; | 17 | 17 | import com.morihacky.android.rxjava.R; | | 18 | + | | 19 | +import butterknife.Unbinder; | 18 | 20 | import io.reactivex.Observable; | 19 | 21 | import io.reactivex.android.schedulers.AndroidSchedulers; | 20 | 22 | import io.reactivex.disposables.CompositeDisposable; | | 27 | 29 | public class ConcurrencyWithSchedulersDemoFragment | 28 | 30 | extends BaseFragment { | 29 | 31 |
| 30 | | - @Bind(R.id.progress_operation_running) ProgressBar _progress; | 31 | | - @Bind(R.id.list_threading_log) ListView _logsList; | | 32 | + @BindView(R.id.progress_operation_running) ProgressBar _progress; | | 33 | + @BindView(R.id.list_threading_log) ListView _logsList; | 32 | 34 |
| 33 | 35 | private LogAdapter _adapter; | 34 | 36 | private List<String> _logs; | 35 | 37 | private CompositeDisposable _disposables = new CompositeDisposable(); | | 38 | + private Unbinder unbinder; | 36 | 39 |
| 37 | 40 | @Override | 38 | 41 | public void onDestroy() { | 39 | 42 | super.onDestroy(); | 40 | | - ButterKnife.unbind(this); | | 43 | + unbinder.unbind(); | 41 | 44 | _disposables.clear(); | 42 | 45 | } | 43 | 46 |
| @@ -52,7 +55,7 @@ public View onCreateView(LayoutInflater inflater, | 52 | 55 | @Nullable ViewGroup container, | 53 | 56 | @Nullable Bundle savedInstanceState) { | 54 | 57 | View layout = inflater.inflate(R.layout.fragment_concurrency_schedulers, container, false); | 55 | | - ButterKnife.bind(this, layout); | | 58 | + unbinder = ButterKnife.bind(this, layout); | 56 | 59 | return layout; | 57 | 60 | } | 58 | 61 |
| |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/fragments/DebounceSearchEmitterFragment.java +7-5Lines changed: 7 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 20 | 20 | import java.util.List; | 21 | 21 | import java.util.concurrent.TimeUnit; | 22 | 22 |
| 23 | | -import butterknife.Bind; | | 23 | +import butterknife.BindView; | 24 | 24 | import butterknife.ButterKnife; | 25 | 25 | import butterknife.OnClick; | 26 | 26 | import hu.akarnokd.rxjava.interop.RxJavaInterop; | | 27 | +import butterknife.Unbinder; | 27 | 28 | import io.reactivex.android.schedulers.AndroidSchedulers; | 28 | 29 | import io.reactivex.disposables.Disposable; | 29 | 30 | import io.reactivex.observers.DisposableObserver; | | 35 | 36 | public class DebounceSearchEmitterFragment | 36 | 37 | extends BaseFragment { | 37 | 38 |
| 38 | | - @Bind(R.id.list_threading_log) ListView _logsList; | 39 | | - @Bind(R.id.input_txt_debounce) EditText _inputSearchText; | | 39 | + @BindView(R.id.list_threading_log) ListView _logsList; | | 40 | + @BindView(R.id.input_txt_debounce) EditText _inputSearchText; | 40 | 41 |
| 41 | 42 | private LogAdapter _adapter; | 42 | 43 | private List<String> _logs; | 43 | 44 |
| 44 | 45 | private Disposable _disposable; | | 46 | + private Unbinder unbinder; | 45 | 47 |
| 46 | 48 | @Override | 47 | 49 | public void onDestroy() { | 48 | 50 | super.onDestroy(); | 49 | 51 | _disposable.dispose(); | 50 | | - ButterKnife.unbind(this); | | 52 | + unbinder.unbind(); | 51 | 53 | } | 52 | 54 |
| 53 | 55 | @Override | 54 | 56 | public View onCreateView(LayoutInflater inflater, | 55 | 57 | @Nullable ViewGroup container, | 56 | 58 | @Nullable Bundle savedInstanceState) { | 57 | 59 | View layout = inflater.inflate(R.layout.fragment_debounce, container, false); | 58 | | - ButterKnife.bind(this, layout); | | 60 | + unbinder = ButterKnife.bind(this, layout); | 59 | 61 | return layout; | 60 | 62 | } | 61 | 63 |
| |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/fragments/DoubleBindingTextViewFragment.java +9-6Lines changed: 9 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 | import android.view.ViewGroup; | 8 | 8 | import android.widget.EditText; | 9 | 9 | import android.widget.TextView; | 10 | | -import butterknife.Bind; | | 10 | +import butterknife.BindView; | 11 | 11 | import butterknife.ButterKnife; | 12 | 12 | import butterknife.OnTextChanged; | 13 | 13 | import com.morihacky.android.rxjava.R; | | 14 | + | | 15 | +import butterknife.Unbinder; | 14 | 16 | import io.reactivex.disposables.Disposable; | 15 | 17 | import io.reactivex.processors.PublishProcessor; | 16 | 18 |
| | 20 | 22 | public class DoubleBindingTextViewFragment | 21 | 23 | extends BaseFragment { | 22 | 24 |
| 23 | | - @Bind(R.id.double_binding_num1) EditText _number1; | 24 | | - @Bind(R.id.double_binding_num2) EditText _number2; | 25 | | - @Bind(R.id.double_binding_result) TextView _result; | | 25 | + @BindView(R.id.double_binding_num1) EditText _number1; | | 26 | + @BindView(R.id.double_binding_num2) EditText _number2; | | 27 | + @BindView(R.id.double_binding_result) TextView _result; | 26 | 28 |
| 27 | 29 | Disposable _disposable; | 28 | 30 | PublishProcessor<Float> _resultEmitterSubject; | | 31 | + private Unbinder unbinder; | 29 | 32 |
| 30 | 33 | @Override | 31 | 34 | public View onCreateView(LayoutInflater inflater, | 32 | 35 | @Nullable ViewGroup container, | 33 | 36 | @Nullable Bundle savedInstanceState) { | 34 | 37 | View layout = inflater.inflate(R.layout.fragment_double_binding_textview, container, false); | 35 | | - ButterKnife.bind(this, layout); | | 38 | + unbinder = ButterKnife.bind(this, layout); | 36 | 39 |
| 37 | 40 | _resultEmitterSubject = PublishProcessor.create(); | 38 | 41 |
| @@ -66,6 +69,6 @@ public void onNumberChanged() { | 66 | 69 | public void onDestroyView() { | 67 | 70 | super.onDestroyView(); | 68 | 71 | _disposable.dispose(); | 69 | | - ButterKnife.unbind(this); | | 72 | + unbinder.unbind(); | 70 | 73 | } | 71 | 74 | } |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/fragments/ExponentialBackoffFragment.java +8-4Lines changed: 8 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 | import android.view.View; | 8 | 8 | import android.view.ViewGroup; | 9 | 9 | import android.widget.ListView; | 10 | | -import butterknife.Bind; | | 10 | + | | 11 | +import butterknife.BindView; | 11 | 12 | import butterknife.ButterKnife; | 12 | 13 | import butterknife.OnClick; | 13 | 14 | import com.morihacky.android.rxjava.R; | 14 | 15 | import com.morihacky.android.rxjava.wiring.LogAdapter; | 15 | 16 | import hu.akarnokd.rxjava.interop.RxJavaInterop; | | 17 | + | | 18 | +import butterknife.Unbinder; | 16 | 19 | import io.reactivex.Flowable; | 17 | 20 | import io.reactivex.disposables.CompositeDisposable; | 18 | 21 | import io.reactivex.functions.Function; | | 30 | 33 | public class ExponentialBackoffFragment | 31 | 34 | extends BaseFragment { | 32 | 35 |
| 33 | | - @Bind(R.id.list_threading_log) ListView _logList; | | 36 | + @BindView(R.id.list_threading_log) ListView _logList; | 34 | 37 | private LogAdapter _adapter; | 35 | 38 | private CompositeDisposable _disposables = new CompositeDisposable(); | 36 | 39 | private List<String> _logs; | | 40 | + Unbinder unbinder; | 37 | 41 |
| 38 | 42 | @Override | 39 | 43 | public View onCreateView(LayoutInflater inflater, | 40 | 44 | @Nullable ViewGroup container, | 41 | 45 | @Nullable Bundle savedInstanceState) { | 42 | 46 | View layout = inflater.inflate(R.layout.fragment_exponential_backoff, container, false); | 43 | | - ButterKnife.bind(this, layout); | | 47 | + unbinder = ButterKnife.bind(this, layout); | 44 | 48 | return layout; | 45 | 49 | } | 46 | 50 |
| @@ -60,7 +64,7 @@ public void onPause() { | 60 | 64 | @Override | 61 | 65 | public void onDestroyView() { | 62 | 66 | super.onDestroyView(); | 63 | | - ButterKnife.unbind(this); | | 67 | + unbinder.unbind(); | 64 | 68 | } | 65 | 69 |
| 66 | 70 | // ----------------------------------------------------------------------------------- | |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/fragments/FormValidationCombineLatestFragment.java +16-13Lines changed: 16 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 | import android.view.ViewGroup; | 8 | 8 | import android.widget.EditText; | 9 | 9 | import android.widget.TextView; | 10 | | -import butterknife.Bind; | | 10 | +import butterknife.BindView; | 11 | 11 | import butterknife.ButterKnife; | 12 | 12 | import com.jakewharton.rxbinding.widget.RxTextView; | 13 | 13 | import com.morihacky.android.rxjava.R; | | 14 | + | | 15 | +import butterknife.Unbinder; | 14 | 16 | import hu.akarnokd.rxjava.interop.RxJavaInterop; | 15 | 17 | import io.reactivex.Flowable; | 16 | 18 | import io.reactivex.subscribers.DisposableSubscriber; | | 23 | 25 | public class FormValidationCombineLatestFragment | 24 | 26 | extends BaseFragment { | 25 | 27 |
| 26 | | - @Bind(R.id.btn_demo_form_valid) TextView _btnValidIndicator; | 27 | | - @Bind(R.id.demo_combl_email) EditText _email; | 28 | | - @Bind(R.id.demo_combl_password) EditText _password; | 29 | | - @Bind(R.id.demo_combl_num) EditText _number; | | 28 | + @BindView(R.id.btn_demo_form_valid) TextView _btnValidIndicator; | | 29 | + @BindView(R.id.demo_combl_email) EditText _email; | | 30 | + @BindView(R.id.demo_combl_password) EditText _password; | | 31 | + @BindView(R.id.demo_combl_num) EditText _number; | 30 | 32 |
| 31 | 33 | private DisposableSubscriber<Boolean> _disposableObserver = null; | 32 | 34 | private Flowable<CharSequence> _emailChangeObservable; | 33 | 35 | private Flowable<CharSequence> _numberChangeObservable; | 34 | 36 | private Flowable<CharSequence> _passwordChangeObservable; | | 37 | + private Unbinder unbinder; | 35 | 38 |
| 36 | 39 | @Override | 37 | 40 | public View onCreateView(LayoutInflater inflater, | 38 | 41 | @Nullable ViewGroup container, | 39 | 42 | @Nullable Bundle savedInstanceState) { | 40 | 43 | View layout = inflater.inflate(R.layout.fragment_form_validation_comb_latest, container, false); | 41 | | - ButterKnife.bind(this, layout); | | 44 | + unbinder = ButterKnife.bind(this, layout); | 42 | 45 |
| 43 | 46 | _emailChangeObservable = RxJavaInterop.toV2Flowable(RxTextView | 44 | | - .textChanges(_email) | 45 | | - .skip(1)); | | 47 | + .textChanges(_email) | | 48 | + .skip(1)); | 46 | 49 | _passwordChangeObservable = RxJavaInterop.toV2Flowable(RxTextView | 47 | | - .textChanges(_password) | 48 | | - .skip(1)); | | 50 | + .textChanges(_password) | | 51 | + .skip(1)); | 49 | 52 | _numberChangeObservable = RxJavaInterop.toV2Flowable(RxTextView | 50 | | - .textChanges(_number) | 51 | | - .skip(1)); | | 53 | + .textChanges(_number) | | 54 | + .skip(1)); | 52 | 55 |
| 53 | 56 | _combineLatestEvents(); | 54 | 57 |
| @@ -58,7 +61,7 @@ public View onCreateView(LayoutInflater inflater, | 58 | 61 | @Override | 59 | 62 | public void onDestroyView() { | 60 | 63 | super.onDestroyView(); | 61 | | - ButterKnife.unbind(this); | | 64 | + unbinder.unbind(); | 62 | 65 | _disposableObserver.dispose(); | 63 | 66 | } | 64 | 67 |
| |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/fragments/MainFragment.java +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | import android.view.ViewGroup; | 10 | 10 | import butterknife.ButterKnife; | 11 | 11 | import butterknife.OnClick; | | 12 | +import butterknife.Unbinder; | | 13 | + | 12 | 14 | import com.morihacky.android.rxjava.R; | 13 | 15 | import com.morihacky.android.rxjava.pagination.PaginationAutoFragment; | 14 | 16 | import com.morihacky.android.rxjava.rxbus.RxBusDemoFragment; | | 17 | 19 | public class MainFragment | 18 | 20 | extends BaseFragment { | 19 | 21 |
| | 22 | + private Unbinder unbinder; | 20 | 23 | @Override | 21 | 24 | public View onCreateView(LayoutInflater inflater, | 22 | 25 | @Nullable ViewGroup container, | 23 | 26 | @Nullable Bundle savedInstanceState) { | 24 | 27 | View layout = inflater.inflate(R.layout.fragment_main, container, false); | 25 | | - ButterKnife.bind(this, layout); | | 28 | + unbinder = ButterKnife.bind(this, layout); | 26 | 29 | return layout; | 27 | 30 | } | 28 | 31 |
| 29 | 32 | @Override | 30 | 33 | public void onDestroyView() { | 31 | 34 | super.onDestroyView(); | 32 | | - ButterKnife.unbind(this); | | 35 | + unbinder.unbind(); | 33 | 36 | } | 34 | 37 |
| 35 | 38 | @OnClick(R.id.btn_demo_schedulers) | |
|