class="same-code nl-2 ol-2">
import ai.pai.lensman.R;
+import butterknife.BindView;
+import butterknife.ButterKnife;
public class SessionRecyclerAdapter extends RecyclerView.Adapter<SessionRecyclerAdapter.MyViewHolder> {
@@ -65,11 +67,7 @@ public class SessionRecyclerAdapter extends RecyclerView.Adapter<SessionRecycler
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
- View view = mInflater.inflate(R.layout.session_item,parent,false);
- MyViewHolder viewHolder = new MyViewHolder(view);
- viewHolder.photo = (ImageView) view.findViewById(R.id.iv_session_item);
- viewHolder.sesseionSeq = (TextView)view.findViewById(R.id.tv_session_seq);
- return viewHolder;
+ return new MyViewHolder(mInflater.inflate(R.layout.session_item,parent,false));
}
@Override
@@ -103,12 +101,13 @@ public class SessionRecyclerAdapter extends RecyclerView.Adapter<SessionRecycler
class MyViewHolder extends RecyclerView.ViewHolder{
- private ImageView photo;
+ @BindView(R.id.iv_session_item) ImageView photo;
- private TextView sesseionSeq;
+ @BindView(R.id.tv_session_seq) TextView sesseionSeq;
public MyViewHolder(View view){
super(view);
+ ButterKnife.bind(this, view);
}
}
}
@@ -12,51 +12,30 @@ import android.widget.TextView; |
||
| 12 | 12 |
import java.util.ArrayList; |
| 13 | 13 |
|
| 14 | 14 |
import ai.pai.lensman.R; |
| 15 |
+import butterknife.BindView; |
|
| 16 |
+import butterknife.ButterKnife; |
|
| 17 |
+import butterknife.OnClick; |
|
| 15 | 18 |
|
| 16 | 19 |
public class UploadActivity extends AppCompatActivity implements UploadContract.UploadView{
|
| 17 | 20 |
|
| 18 |
- private TextView btStatusTextView; |
|
| 19 |
- private ImageView btStatusImageView; |
|
| 20 |
- private View noDataLayout; |
|
| 21 |
+ @BindView(R.id.tv_bt_status) TextView btStatusTextView; |
|
| 22 |
+ @BindView(R.id.iv_bt_status) ImageView btStatusImageView; |
|
| 23 |
+ @BindView(R.id.icon_no_data) View noDataLayout; |
|
| 24 |
+ @BindView(R.id.recycler_view_sessions) RecyclerView sessionsRecyclerView; |
|
| 21 | 25 |
private SessionRecyclerAdapter adapter; |
| 22 |
- private RecyclerView sessionsRecyclerView; |
|
| 23 | 26 |
private UploadContract.UploadPresenter presenter; |
| 24 | 27 |
|
| 25 | 28 |
@Override |
| 26 | 29 |
protected void onCreate(Bundle savedInstanceState) {
|
| 27 | 30 |
super.onCreate(savedInstanceState); |
| 28 | 31 |
setContentView(R.layout.activity_upload); |
| 32 |
+ ButterKnife.bind(this); |
|
| 29 | 33 |
|
| 30 | 34 |
presenter = new UploadPresenterImpl(this,this); |
| 31 |
- noDataLayout = findViewById(R.id.icon_no_data); |
|
| 32 |
- btStatusImageView = (ImageView)findViewById(R.id.iv_bt_status); |
|
| 33 |
- btStatusTextView = (TextView)findViewById(R.id.tv_bt_status); |
|
| 34 |
- sessionsRecyclerView = (RecyclerView)findViewById(R.id.recycler_view_sessions); |
|
| 35 | 35 |
adapter = new SessionRecyclerAdapter(this); |
| 36 | 36 |
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this,2,LinearLayoutManager.VERTICAL,false); |
| 37 | 37 |
sessionsRecyclerView.setLayoutManager(layoutManager); |
| 38 | 38 |
sessionsRecyclerView.setAdapter(adapter); |
| 39 |
- findViewById(R.id.iv_briefs).setOnClickListener(new View.OnClickListener(){
|
|
| 40 |
- @Override |
|
| 41 |
- public void onClick(View view) {
|
|
| 42 |
- presenter.jumpToBriefs(); |
|
| 43 |
- } |
|
| 44 |
- }); |
|
| 45 |
- |
|
| 46 |
- findViewById(R.id.iv_add_session).setOnClickListener(new View.OnClickListener(){
|
|
| 47 |
- @Override |
|
| 48 |
- public void onClick(View view) {
|
|
| 49 |
- presenter.jumpToNewSession(); |
|
| 50 |
- } |
|
| 51 |
- }); |
|
| 52 |
- |
|
| 53 |
- btStatusImageView.setOnClickListener(new View.OnClickListener(){
|
|
| 54 |
- @Override |
|
| 55 |
- public void onClick(View view) {
|
|
| 56 |
- presenter.checkBTStatus(); |
|
| 57 |
- } |
|
| 58 |
- }); |
|
| 59 |
- |
|
| 60 | 39 |
} |
| 61 | 40 |
|
| 62 | 41 |
@Override |
@@ -71,6 +50,22 @@ public class UploadActivity extends AppCompatActivity implements UploadContract. |
||
| 71 | 50 |
presenter.stop(); |
| 72 | 51 |
} |
| 73 | 52 |
|
| 53 |
+ @OnClick(R.id.iv_briefs) |
|
| 54 |
+ void jumpToBriefs(){
|
|
| 55 |
+ |
|
| 56 |
+ } |
|
| 57 |
+ |
|
| 58 |
+ @OnClick(R.id.iv_add_session) |
|
| 59 |
+ void jumpToNewSession(){
|
|
| 60 |
+ presenter.jumpToNewSession(); |
|
| 61 |
+ } |
|
| 62 |
+ |
|
| 63 |
+ @OnClick(R.id.iv_bt_status) |
|
| 64 |
+ void checkBTStatus(){
|
|
| 65 |
+ presenter.checkBTStatus(); |
|
| 66 |
+ } |
|
| 67 |
+ |
|
| 68 |
+ |
|
| 74 | 69 |
@Override |
| 75 | 70 |
public void addNewSessionView(SessionBean bean) {
|
| 76 | 71 |
|
@@ -6,7 +6,7 @@ buildscript {
|
||
| 6 | 6 |
} |
| 7 | 7 |
dependencies {
|
| 8 | 8 |
classpath 'com.android.tools.build:gradle:2.1.2' |
| 9 |
- |
|
| 9 |
+ classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' |
|
| 10 | 10 |
// NOTE: Do not place your application dependencies here; they belong |
| 11 | 11 |
// in the individual module build.gradle files |
| 12 | 12 |
} |