change to butterknife style

chengzhenyu 8 年之前
父节点
当前提交
34026547fc
共有 1 个文件被更改,包括 11 次插入9 次删除
  1. 11 9
      app/src/main/java/ai/pai/lensman/qrcode/QRCaptureActivity.java

+ 11 - 9
app/src/main/java/ai/pai/lensman/qrcode/QRCaptureActivity.java

@@ -49,8 +49,11 @@ import com.google.zxing.qrcode.QRCodeReader;
49 49
 import java.io.IOException;
50 50
 import java.lang.reflect.Field;
51 51
 import java.util.Hashtable;
52
+
52 53
 import ai.pai.lensman.R;
53 54
 import ai.pai.lensman.utils.SystemUtils;
55
+import butterknife.BindView;
56
+import butterknife.ButterKnife;
54 57
 
55 58
 
56 59
 /**
@@ -73,13 +76,13 @@ public class QRCaptureActivity extends FragmentActivity implements SurfaceHolder
73 76
 
74 77
     private BeepManager beepManager;
75 78
 
76
-    private SurfaceView scanPreview = null;
79
+    @BindView(R.id.capture_preview) SurfaceView scanPreview;
77 80
 
78
-    private RelativeLayout scanContainer;
81
+    @BindView(R.id.capture_container) RelativeLayout scanContainer;
79 82
 
80
-    private RelativeLayout scanCropView;
83
+    @BindView(R.id.capture_crop_view) RelativeLayout scanCropView;
81 84
 
82
-    private TextView   flashText;
85
+    @BindView(R.id.tv_flash_off_on) TextView   flashText;
83 86
 
84 87
     private Rect mCropRect = null;
85 88
 
@@ -95,16 +98,15 @@ public class QRCaptureActivity extends FragmentActivity implements SurfaceHolder
95 98
         Window window = getWindow();
96 99
         window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
97 100
         setContentView(R.layout.activity_qrcapture);
101
+
102
+        ButterKnife.bind(this);
103
+
98 104
         SystemUtils.setImmerseLayout(this,findViewById(R.id.title_layout));
99
-        TextView title = (TextView)findViewById(R.id.title_bar_middle_txt);
105
+        TextView title =ButterKnife.findById (this,R.id.title_bar_middle_txt);
100 106
         title.setText(R.string.scan_qr);
101 107
         findViewById(R.id.title_bar_back_layout).setOnClickListener(this);
102 108
         findViewById(R.id.layout_qr_album).setOnClickListener(this);
103 109
         findViewById(R.id.layout_qr_flash).setOnClickListener(this);
104
-        scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
105
-        scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
106
-        scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
107
-        flashText = (TextView)findViewById(R.id.tv_flash_off_on);
108 110
         beepManager = new BeepManager(this);
109 111
     }
110 112