Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c42b46d

Browse files
Update butterknife
1 parent cd9e16a commit c42b46d

25 files changed

+153
-105
lines changed

‎app/build.gradle‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ext {
2222
retrofitVersion = "2.0.0"
2323
sdkVersion = 24
2424
supportLibVersion = "24.2.1"
25+
butterKnifeVersion = '8.5.1'
2526
}
2627

2728
dependencies {
@@ -30,7 +31,8 @@ dependencies {
3031
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
3132

3233
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"
3436
compile 'com.jakewharton.timber:timber:2.4.2'
3537
compile "com.squareup.retrofit2:retrofit:${retrofitVersion}"
3638
compile "com.squareup.retrofit2:converter-gson:${retrofitVersion}"

‎app/src/main/java/com/morihacky/android/rxjava/fragments/BufferDemoFragment.java‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
import java.util.List;
1919
import java.util.concurrent.TimeUnit;
2020

21-
import butterknife.Bind;
21+
import butterknife.BindView;
2222
import butterknife.ButterKnife;
2323
import hu.akarnokd.rxjava.interop.RxJavaInterop;
24+
import butterknife.Unbinder;
2425
import io.reactivex.android.schedulers.AndroidSchedulers;
2526
import io.reactivex.disposables.Disposable;
2627
import io.reactivex.observers.DisposableObserver;
@@ -43,13 +44,14 @@
4344
public class BufferDemoFragment
4445
extends BaseFragment {
4546

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;
4849

4950
private LogAdapter _adapter;
5051
private List<String> _logs;
5152

5253
private Disposable _disposable;
54+
private Unbinder unbinder;
5355

5456
@Override
5557
public void onResume() {
@@ -74,13 +76,13 @@ public View onCreateView(LayoutInflater inflater,
7476
@Nullable ViewGroup container,
7577
@Nullable Bundle savedInstanceState) {
7678
View layout = inflater.inflate(R.layout.fragment_buffer, container, false);
77-
ButterKnife.bind(this, layout);
79+
unbinder = ButterKnife.bind(this, layout);
7880
return layout;
7981
}
8082

8183
@Override public void onDestroyView() {
8284
super.onDestroyView();
83-
ButterKnife.unbind(this);
85+
unbinder.unbind();
8486
}
8587

8688
// -----------------------------------------------------------------------------------

‎app/src/main/java/com/morihacky/android/rxjava/fragments/ConcurrencyWithSchedulersDemoFragment.java‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
import android.widget.ArrayAdapter;
1212
import android.widget.ListView;
1313
import android.widget.ProgressBar;
14-
import butterknife.Bind;
14+
import butterknife.BindView;
1515
import butterknife.ButterKnife;
1616
import butterknife.OnClick;
1717
import com.morihacky.android.rxjava.R;
18+
19+
import butterknife.Unbinder;
1820
import io.reactivex.Observable;
1921
import io.reactivex.android.schedulers.AndroidSchedulers;
2022
import io.reactivex.disposables.CompositeDisposable;
@@ -27,17 +29,18 @@
2729
public class ConcurrencyWithSchedulersDemoFragment
2830
extends BaseFragment {
2931

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;
3234

3335
private LogAdapter _adapter;
3436
private List<String> _logs;
3537
private CompositeDisposable _disposables = new CompositeDisposable();
38+
private Unbinder unbinder;
3639

3740
@Override
3841
public void onDestroy() {
3942
super.onDestroy();
40-
ButterKnife.unbind(this);
43+
unbinder.unbind();
4144
_disposables.clear();
4245
}
4346

@@ -52,7 +55,7 @@ public View onCreateView(LayoutInflater inflater,
5255
@Nullable ViewGroup container,
5356
@Nullable Bundle savedInstanceState) {
5457
View layout = inflater.inflate(R.layout.fragment_concurrency_schedulers, container, false);
55-
ButterKnife.bind(this, layout);
58+
unbinder = ButterKnife.bind(this, layout);
5659
return layout;
5760
}
5861

‎app/src/main/java/com/morihacky/android/rxjava/fragments/DebounceSearchEmitterFragment.java‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
import java.util.List;
2121
import java.util.concurrent.TimeUnit;
2222

23-
import butterknife.Bind;
23+
import butterknife.BindView;
2424
import butterknife.ButterKnife;
2525
import butterknife.OnClick;
2626
import hu.akarnokd.rxjava.interop.RxJavaInterop;
27+
import butterknife.Unbinder;
2728
import io.reactivex.android.schedulers.AndroidSchedulers;
2829
import io.reactivex.disposables.Disposable;
2930
import io.reactivex.observers.DisposableObserver;
@@ -35,27 +36,28 @@
3536
public class DebounceSearchEmitterFragment
3637
extends BaseFragment {
3738

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;
4041

4142
private LogAdapter _adapter;
4243
private List<String> _logs;
4344

4445
private Disposable _disposable;
46+
private Unbinder unbinder;
4547

4648
@Override
4749
public void onDestroy() {
4850
super.onDestroy();
4951
_disposable.dispose();
50-
ButterKnife.unbind(this);
52+
unbinder.unbind();
5153
}
5254

5355
@Override
5456
public View onCreateView(LayoutInflater inflater,
5557
@Nullable ViewGroup container,
5658
@Nullable Bundle savedInstanceState) {
5759
View layout = inflater.inflate(R.layout.fragment_debounce, container, false);
58-
ButterKnife.bind(this, layout);
60+
unbinder = ButterKnife.bind(this, layout);
5961
return layout;
6062
}
6163

‎app/src/main/java/com/morihacky/android/rxjava/fragments/DoubleBindingTextViewFragment.java‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
import android.view.ViewGroup;
88
import android.widget.EditText;
99
import android.widget.TextView;
10-
import butterknife.Bind;
10+
import butterknife.BindView;
1111
import butterknife.ButterKnife;
1212
import butterknife.OnTextChanged;
1313
import com.morihacky.android.rxjava.R;
14+
15+
import butterknife.Unbinder;
1416
import io.reactivex.disposables.Disposable;
1517
import io.reactivex.processors.PublishProcessor;
1618

@@ -20,19 +22,20 @@
2022
public class DoubleBindingTextViewFragment
2123
extends BaseFragment {
2224

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;
2628

2729
Disposable _disposable;
2830
PublishProcessor<Float> _resultEmitterSubject;
31+
private Unbinder unbinder;
2932

3033
@Override
3134
public View onCreateView(LayoutInflater inflater,
3235
@Nullable ViewGroup container,
3336
@Nullable Bundle savedInstanceState) {
3437
View layout = inflater.inflate(R.layout.fragment_double_binding_textview, container, false);
35-
ButterKnife.bind(this, layout);
38+
unbinder = ButterKnife.bind(this, layout);
3639

3740
_resultEmitterSubject = PublishProcessor.create();
3841

@@ -66,6 +69,6 @@ public void onNumberChanged() {
6669
public void onDestroyView() {
6770
super.onDestroyView();
6871
_disposable.dispose();
69-
ButterKnife.unbind(this);
72+
unbinder.unbind();
7073
}
7174
}

‎app/src/main/java/com/morihacky/android/rxjava/fragments/ExponentialBackoffFragment.java‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
import android.view.View;
88
import android.view.ViewGroup;
99
import android.widget.ListView;
10-
import butterknife.Bind;
10+
11+
import butterknife.BindView;
1112
import butterknife.ButterKnife;
1213
import butterknife.OnClick;
1314
import com.morihacky.android.rxjava.R;
1415
import com.morihacky.android.rxjava.wiring.LogAdapter;
1516
import hu.akarnokd.rxjava.interop.RxJavaInterop;
17+
18+
import butterknife.Unbinder;
1619
import io.reactivex.Flowable;
1720
import io.reactivex.disposables.CompositeDisposable;
1821
import io.reactivex.functions.Function;
@@ -30,17 +33,18 @@
3033
public class ExponentialBackoffFragment
3134
extends BaseFragment {
3235

33-
@Bind(R.id.list_threading_log) ListView _logList;
36+
@BindView(R.id.list_threading_log) ListView _logList;
3437
private LogAdapter _adapter;
3538
private CompositeDisposable _disposables = new CompositeDisposable();
3639
private List<String> _logs;
40+
Unbinder unbinder;
3741

3842
@Override
3943
public View onCreateView(LayoutInflater inflater,
4044
@Nullable ViewGroup container,
4145
@Nullable Bundle savedInstanceState) {
4246
View layout = inflater.inflate(R.layout.fragment_exponential_backoff, container, false);
43-
ButterKnife.bind(this, layout);
47+
unbinder = ButterKnife.bind(this, layout);
4448
return layout;
4549
}
4650

@@ -60,7 +64,7 @@ public void onPause() {
6064
@Override
6165
public void onDestroyView() {
6266
super.onDestroyView();
63-
ButterKnife.unbind(this);
67+
unbinder.unbind();
6468
}
6569

6670
// -----------------------------------------------------------------------------------

‎app/src/main/java/com/morihacky/android/rxjava/fragments/FormValidationCombineLatestFragment.java‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
import android.view.ViewGroup;
88
import android.widget.EditText;
99
import android.widget.TextView;
10-
import butterknife.Bind;
10+
import butterknife.BindView;
1111
import butterknife.ButterKnife;
1212
import com.jakewharton.rxbinding.widget.RxTextView;
1313
import com.morihacky.android.rxjava.R;
14+
15+
import butterknife.Unbinder;
1416
import hu.akarnokd.rxjava.interop.RxJavaInterop;
1517
import io.reactivex.Flowable;
1618
import io.reactivex.subscribers.DisposableSubscriber;
@@ -23,32 +25,33 @@
2325
public class FormValidationCombineLatestFragment
2426
extends BaseFragment {
2527

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;
3032

3133
private DisposableSubscriber<Boolean> _disposableObserver = null;
3234
private Flowable<CharSequence> _emailChangeObservable;
3335
private Flowable<CharSequence> _numberChangeObservable;
3436
private Flowable<CharSequence> _passwordChangeObservable;
37+
private Unbinder unbinder;
3538

3639
@Override
3740
public View onCreateView(LayoutInflater inflater,
3841
@Nullable ViewGroup container,
3942
@Nullable Bundle savedInstanceState) {
4043
View layout = inflater.inflate(R.layout.fragment_form_validation_comb_latest, container, false);
41-
ButterKnife.bind(this, layout);
44+
unbinder = ButterKnife.bind(this, layout);
4245

4346
_emailChangeObservable = RxJavaInterop.toV2Flowable(RxTextView
44-
.textChanges(_email)
45-
.skip(1));
47+
.textChanges(_email)
48+
.skip(1));
4649
_passwordChangeObservable = RxJavaInterop.toV2Flowable(RxTextView
47-
.textChanges(_password)
48-
.skip(1));
50+
.textChanges(_password)
51+
.skip(1));
4952
_numberChangeObservable = RxJavaInterop.toV2Flowable(RxTextView
50-
.textChanges(_number)
51-
.skip(1));
53+
.textChanges(_number)
54+
.skip(1));
5255

5356
_combineLatestEvents();
5457

@@ -58,7 +61,7 @@ public View onCreateView(LayoutInflater inflater,
5861
@Override
5962
public void onDestroyView() {
6063
super.onDestroyView();
61-
ButterKnife.unbind(this);
64+
unbinder.unbind();
6265
_disposableObserver.dispose();
6366
}
6467

‎app/src/main/java/com/morihacky/android/rxjava/fragments/MainFragment.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import android.view.ViewGroup;
1010
import butterknife.ButterKnife;
1111
import butterknife.OnClick;
12+
import butterknife.Unbinder;
13+
1214
import com.morihacky.android.rxjava.R;
1315
import com.morihacky.android.rxjava.pagination.PaginationAutoFragment;
1416
import com.morihacky.android.rxjava.rxbus.RxBusDemoFragment;
@@ -17,19 +19,20 @@
1719
public class MainFragment
1820
extends BaseFragment {
1921

22+
private Unbinder unbinder;
2023
@Override
2124
public View onCreateView(LayoutInflater inflater,
2225
@Nullable ViewGroup container,
2326
@Nullable Bundle savedInstanceState) {
2427
View layout = inflater.inflate(R.layout.fragment_main, container, false);
25-
ButterKnife.bind(this, layout);
28+
unbinder = ButterKnife.bind(this, layout);
2629
return layout;
2730
}
2831

2932
@Override
3033
public void onDestroyView() {
3134
super.onDestroyView();
32-
ButterKnife.unbind(this);
35+
unbinder.unbind();
3336
}
3437

3538
@OnClick(R.id.btn_demo_schedulers)

‎app/src/main/java/com/morihacky/android/rxjava/fragments/NetworkDetectorFragment.java‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
import android.view.ViewGroup;
1616
import android.widget.ArrayAdapter;
1717
import android.widget.ListView;
18-
import butterknife.Bind;
18+
import butterknife.BindView;
1919
import butterknife.ButterKnife;
2020
import com.morihacky.android.rxjava.R;
21+
22+
import butterknife.Unbinder;
2123
import io.reactivex.android.schedulers.AndroidSchedulers;
2224
import io.reactivex.disposables.Disposable;
2325
import io.reactivex.processors.PublishProcessor;
@@ -27,26 +29,27 @@
2729
public class NetworkDetectorFragment
2830
extends BaseFragment {
2931

30-
@Bind(R.id.list_threading_log) ListView logsList;
32+
@BindView(R.id.list_threading_log) ListView logsList;
3133

3234
private LogAdapter adapter;
3335
private BroadcastReceiver broadcastReceiver;
3436
private List<String> logs;
3537
private Disposable disposable;
3638
private PublishProcessor<Boolean> publishProcessor;
39+
private Unbinder unbinder;
3740

3841
@Override
3942
public void onDestroy() {
4043
super.onDestroy();
41-
ButterKnife.unbind(this);
44+
unbinder.unbind();
4245
}
4346

4447
@Override
4548
public View onCreateView(LayoutInflater inflater,
4649
@Nullable ViewGroup container,
4750
@Nullable Bundle savedInstanceState) {
4851
View layout = inflater.inflate(R.layout.fragment_network_detector, container, false);
49-
ButterKnife.bind(this, layout);
52+
unbinder = ButterKnife.bind(this, layout);
5053
return layout;
5154
}
5255

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /