mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-18 20:07:19 +01:00
79 lines
2.5 KiB
Java
79 lines
2.5 KiB
Java
package androidx.camera.view;
|
|
|
|
import android.graphics.Bitmap;
|
|
import android.util.Size;
|
|
import android.view.View;
|
|
import android.widget.FrameLayout;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.camera.core.SurfaceRequest;
|
|
import androidx.camera.view.PreviewView;
|
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes.dex */
|
|
abstract class PreviewViewImplementation {
|
|
|
|
@NonNull
|
|
FrameLayout mParent;
|
|
|
|
@NonNull
|
|
private final PreviewTransformation mPreviewTransform;
|
|
|
|
@Nullable
|
|
Size mResolution;
|
|
private boolean mWasSurfaceProvided = false;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public interface OnSurfaceNotInUseListener {
|
|
void onSurfaceNotInUse();
|
|
}
|
|
|
|
public PreviewViewImplementation(@NonNull FrameLayout frameLayout, @NonNull PreviewTransformation previewTransformation) {
|
|
this.mParent = frameLayout;
|
|
this.mPreviewTransform = previewTransformation;
|
|
}
|
|
|
|
@Nullable
|
|
public Bitmap getBitmap() {
|
|
Bitmap previewBitmap = getPreviewBitmap();
|
|
if (previewBitmap == null) {
|
|
return null;
|
|
}
|
|
return this.mPreviewTransform.createTransformedBitmap(previewBitmap, new Size(this.mParent.getWidth(), this.mParent.getHeight()), this.mParent.getLayoutDirection());
|
|
}
|
|
|
|
@Nullable
|
|
public abstract View getPreview();
|
|
|
|
@Nullable
|
|
public abstract Bitmap getPreviewBitmap();
|
|
|
|
public abstract void initializePreview();
|
|
|
|
public abstract void onAttachedToWindow();
|
|
|
|
public abstract void onDetachedFromWindow();
|
|
|
|
public void onSurfaceProvided() {
|
|
this.mWasSurfaceProvided = true;
|
|
redrawPreview();
|
|
}
|
|
|
|
public abstract void onSurfaceRequested(@NonNull SurfaceRequest surfaceRequest, @Nullable OnSurfaceNotInUseListener onSurfaceNotInUseListener);
|
|
|
|
public void redrawPreview() {
|
|
View preview = getPreview();
|
|
if (preview == null || !this.mWasSurfaceProvided) {
|
|
return;
|
|
}
|
|
this.mPreviewTransform.transformView(new Size(this.mParent.getWidth(), this.mParent.getHeight()), this.mParent.getLayoutDirection(), preview);
|
|
}
|
|
|
|
@NonNull
|
|
public abstract ListenableFuture<Void> waitForNextFrame();
|
|
|
|
public void setFrameUpdateListener(@NonNull Executor executor, @NonNull PreviewView.OnFrameUpdateListener onFrameUpdateListener) {
|
|
}
|
|
}
|