Skip to content

Commit

Permalink
修复一些问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ailiwean committed Aug 24, 2020
1 parent 735641a commit a019f25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ void takePicture() {
@Override
void setDisplayOrientation(int displayOrientation) {
mDisplayOrientation = displayOrientation;
mPreview.setDisplayOrientation(mDisplayOrientation);
if (mPreview != null)
mPreview.setDisplayOrientation(mDisplayOrientation);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ abstract class NBZxingView @JvmOverloads constructor(context: Context, attribute

override fun onPause() {
super.onPause()
scan_bar.stopAnim()
if (scan_bar != null)
scan_bar.stopAnim()
}

override fun onDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public CameraView(Context context, AttributeSet attrs, int defStyleAttr) {
} else {
mImpl = new Camera2Api23(mCallbacks, context);
}

// mImpl = new Camera1(mCallbacks, preview);
// Attributes
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CameraView, defStyleAttr,
Expand Down Expand Up @@ -219,6 +218,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// }
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (mImpl.getView() == null)
return;
// Measure the TextureView
int width = getMeasuredWidth();
int height = getMeasuredHeight();
Expand Down

0 comments on commit a019f25

Please sign in to comment.