Initial commit
This commit is contained in:
102
sources/com/bottle/hp/album/capture/view/PictureCaptureView.java
Normal file
102
sources/com/bottle/hp/album/capture/view/PictureCaptureView.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.bottle.hp.album.capture.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import com.bottle.hp.album.R$id;
|
||||
import com.bottle.hp.album.R$layout;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PictureCaptureView extends FrameLayout implements View.OnClickListener {
|
||||
private IPictureCaptureListener a;
|
||||
private ImageView b;
|
||||
private ImageView c;
|
||||
private ImageView d;
|
||||
private ImageView e;
|
||||
private SurfaceView f;
|
||||
|
||||
public PictureCaptureView(Context context) {
|
||||
super(context);
|
||||
a(context);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.b.setVisibility(0);
|
||||
this.c.setVisibility(4);
|
||||
this.d.setVisibility(4);
|
||||
this.e.setVisibility(8);
|
||||
}
|
||||
|
||||
public SurfaceHolder getPreviewSurfaceHolder() {
|
||||
return this.f.getHolder();
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
IPictureCaptureListener iPictureCaptureListener;
|
||||
int id = view.getId();
|
||||
if (id == R$id.imgCapture) {
|
||||
IPictureCaptureListener iPictureCaptureListener2 = this.a;
|
||||
if (iPictureCaptureListener2 != null) {
|
||||
iPictureCaptureListener2.b();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (id == R$id.imgOK) {
|
||||
IPictureCaptureListener iPictureCaptureListener3 = this.a;
|
||||
if (iPictureCaptureListener3 != null) {
|
||||
iPictureCaptureListener3.a();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (id != R$id.imgCancel || (iPictureCaptureListener = this.a) == null) {
|
||||
return;
|
||||
}
|
||||
iPictureCaptureListener.onCancel();
|
||||
}
|
||||
|
||||
public void setPictureCaptureListener(IPictureCaptureListener iPictureCaptureListener) {
|
||||
this.a = iPictureCaptureListener;
|
||||
}
|
||||
|
||||
public PictureCaptureView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
a(context);
|
||||
}
|
||||
|
||||
public PictureCaptureView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
a(context);
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.b.setVisibility(4);
|
||||
this.c.setVisibility(0);
|
||||
this.d.setVisibility(0);
|
||||
this.e.setVisibility(0);
|
||||
a(this.e, str);
|
||||
}
|
||||
|
||||
private void a(Context context) {
|
||||
View inflate = View.inflate(context, R$layout.view_picture_capture, this);
|
||||
this.b = (ImageView) inflate.findViewById(R$id.imgCapture);
|
||||
this.c = (ImageView) inflate.findViewById(R$id.imgOK);
|
||||
this.d = (ImageView) inflate.findViewById(R$id.imgCancel);
|
||||
this.e = (ImageView) inflate.findViewById(R$id.imgPreview);
|
||||
this.b.setOnClickListener(this);
|
||||
this.c.setOnClickListener(this);
|
||||
this.d.setOnClickListener(this);
|
||||
this.f = (SurfaceView) inflate.findViewById(R$id.surfaceView);
|
||||
}
|
||||
|
||||
private void a(ImageView imageView, String str) {
|
||||
Glide.e(getContext()).a(str).a(imageView);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user