优化细节

This commit is contained in:
Jenly
2020-04-28 22:27:59 +08:00
parent 4b8b4e8723
commit 282c3dc39e
3 changed files with 13 additions and 7 deletions

View File

@@ -55,7 +55,10 @@ public class CaptureActivity extends AppCompatActivity implements OnCaptureCallb
*/
public void initUI(){
surfaceView = findViewById(getSurfaceViewId());
viewfinderView = findViewById(getViewfinderViewId());
int viewfinderViewId = getViewfinderViewId();
if(viewfinderViewId != 0){
viewfinderView = findViewById(viewfinderViewId);
}
int ivTorchId = getIvTorchId();
if(ivTorchId != 0){
ivTorch = findViewById(ivTorchId);
@@ -88,7 +91,7 @@ public class CaptureActivity extends AppCompatActivity implements OnCaptureCallb
/**
* {@link #viewfinderView} 的 ID
* @return
* @return 默认返回{@code R.id.viewfinderView}, 如果不需要扫码框可以返回0
*/
public int getViewfinderViewId(){
return R.id.viewfinderView;