正在查看: Biko v2.0.23 应用的 FakeVideoCallActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 FakeVideoCallActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.misc;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.camera.core.Camera;
import androidx.camera.core.CameraSelector;
import androidx.camera.core.Preview;
import androidx.camera.core.UseCase;
import androidx.camera.core.UseCaseGroup;
import androidx.camera.core.ViewPort;
import androidx.camera.lifecycle.ProcessCameraProvider;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleOwner;
import androidx.media3.common.MediaItem;
import androidx.media3.common.Player;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.ui.PlayerView;
import app.callpe.common.utils.Constants;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.extensions.ViewExtKt;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.Balance;
import app.callpe.data.model.StreamerModel;
import app.callpe.data.model.VideoDetailModel;
import app.callpe.databinding.ActivityFakeVideoCallBinding;
import app.callpe.ui.SplashActivity;
import app.callpe.ui.call.CallActivity;
import app.callpe.ui.dialog.RechargeDialog;
import app.callpe.ui.home.BaseActivity;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.facebook.internal.NativeProtocol;
import com.google.android.material.snackbar.Snackbar;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.gson.Gson;
import dagger.hilt.android.AndroidEntryPoint;
import java.io.File;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import timber.log.Timber;
@Metadata(d1 = {"\u0000n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u0004\u001a\u00020\u0005H\u0002J\b\u0010\u001a\u001a\u00020\u0019H\u0002J\b\u0010\u001b\u001a\u00020\u0019H\u0017J\u001a\u0010\u001c\u001a\u00020\u00192\b\u0010\u001d\u001a\u0004\u0018\u00010\u001e2\u0006\u0010\u001f\u001a\u00020 H\u0002J\b\u0010!\u001a\u00020\"H\u0002J\b\u0010#\u001a\u00020\"H\u0002J\u0010\u0010$\u001a\u00020\u00022\u0006\u0010%\u001a\u00020&H\u0016J\b\u0010'\u001a\u00020\u0019H\u0002J\u0012\u0010(\u001a\u00020\u00192\b\u0010)\u001a\u0004\u0018\u00010*H\u0014J\b\u0010+\u001a\u00020\u0019H\u0014J\b\u0010,\u001a\u00020\u0019H\u0002J\u0010\u0010-\u001a\u00020\u00192\u0006\u0010.\u001a\u00020\u0011H\u0007J\u001c\u0010/\u001a\u00020\u00192\b\u00100\u001a\u0004\u0018\u0001012\b\b\u0002\u0010\u001f\u001a\u00020 H\u0002J\u0012\u00102\u001a\u00020\u00192\b\b\u0002\u0010\u001f\u001a\u00020 H\u0002J\u0012\u00103\u001a\u00020\u00192\b\u00104\u001a\u0004\u0018\u000101H\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u0006\u001a\u00020\u0007X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\b\u0010\t\"\u0004\b\n\u0010\u000bR\u000e\u0010\f\u001a\u00020\rX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u0019\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00110\u0010¢\u0006\n\n\u0002\u0010\u0014\u001a\u0004\b\u0012\u0010\u0013R(\u0010\u0015\u001a\u001c\u0012\u0018\u0012\u0016\u0012\u0004\u0012\u00020\u0011 \u0017*\n\u0012\u0004\u0012\u00020\u0011\u0018\u00010\u00100\u00100\u0016X\u0082\u0004¢\u0006\u0002\n\u0000¨\u00065"}, d2 = {"Lapp/callpe/ui/misc/FakeVideoCallActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityFakeVideoCallBinding;", "()V", "cameraProvider", "Landroidx/camera/lifecycle/ProcessCameraProvider;", "count", "", "getCount", "()I", "setCount", "(I)V", "exoPlayer", "Landroidx/media3/exoplayer/ExoPlayer;", "lensFacing", NativeProtocol.RESULT_ARGS_PERMISSIONS, "", "", "getPermissions", "()[Ljava/lang/String;", "[Ljava/lang/String;", "requestPermissionLauncher", "Landroidx/activity/result/ActivityResultLauncher;", "kotlin.jvm.PlatformType", "bindPreview", "", "checkPermission", "finish", "getVideoDetails", "intent", "Landroid/content/Intent;", "videoLength", "", "hasBackCamera", "", "hasFrontCamera", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "setCameraProviderListener", "setVideoPath", "url", "showRechargeDialog", "videoDetails", "Lapp/callpe/data/model/VideoDetailModel;", "showRechargeMessage", "showRechargePopup", "data", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class FakeVideoCallActivity extends BaseActivity<ActivityFakeVideoCallBinding> {
private ProcessCameraProvider cameraProvider;
private int count;
private ExoPlayer exoPlayer;
private int lensFacing;
private final String[] permissions = {"android.permission.CAMERA", "android.permission.RECORD_AUDIO"};
private final ActivityResultLauncher<String[]> requestPermissionLauncher;
public FakeVideoCallActivity() {
ActivityResultLauncher<String[]> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.RequestMultiplePermissions(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
FakeVideoCallActivity.requestPermissionLauncher$lambda$2(FakeVideoCallActivity.this, (Map) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul…)\n }\n }");
this.requestPermissionLauncher = registerForActivityResult;
}
@Override
public ActivityFakeVideoCallBinding inflateLayout(LayoutInflater layoutInflater) {
Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
ActivityFakeVideoCallBinding inflate = ActivityFakeVideoCallBinding.inflate(layoutInflater);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
return inflate;
}
public final int getCount() {
return this.count;
}
public final void setCount(int i) {
this.count = i;
}
public final String[] getPermissions() {
return this.permissions;
}
public static final void requestPermissionLauncher$lambda$2(final FakeVideoCallActivity fakeVideoCallActivity, Map map) {
Intrinsics.checkNotNullParameter(fakeVideoCallActivity, "this$0");
Intrinsics.checkNotNullExpressionValue(map, NativeProtocol.RESULT_ARGS_PERMISSIONS);
boolean z = true;
if (!map.isEmpty()) {
Iterator it = map.entrySet().iterator();
while (true) {
if (!it.hasNext()) {
break;
} else if (!((Boolean) ((Map.Entry) it.next()).getValue()).booleanValue()) {
z = false;
break;
}
}
}
if (z) {
fakeVideoCallActivity.setCameraProviderListener();
} else {
Snackbar.make(fakeVideoCallActivity.getBinding().getRoot(), "Camera permission required", -2).setAction(fakeVideoCallActivity.getString(2131952579), new View.OnClickListener() {
@Override
public final void onClick(View view) {
FakeVideoCallActivity.requestPermissionLauncher$lambda$2$lambda$1(FakeVideoCallActivity.this, view);
}
}).show();
}
}
public static final void requestPermissionLauncher$lambda$2$lambda$1(FakeVideoCallActivity fakeVideoCallActivity, View view) {
Intrinsics.checkNotNullParameter(fakeVideoCallActivity, "this$0");
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.addFlags(268435456);
Uri fromParts = Uri.fromParts("package", fakeVideoCallActivity.getPackageName(), null);
Intrinsics.checkNotNullExpressionValue(fromParts, "fromParts(\"package\", packageName, null)");
intent.setData(fromParts);
fakeVideoCallActivity.startActivity(intent);
fakeVideoCallActivity.finish();
}
private final void checkPermission() {
this.requestPermissionLauncher.launch(this.permissions);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
Unit unit;
super.onCreate(savedInstanceState);
getWindow().addFlags(69730304);
String string = SharedPref.getString((Context) this, PrefKeys.BOT_FILE);
if (string != null) {
long duration = Helper.getDuration(new File(string));
if (duration == 0) {
duration = 10;
}
getVideoDetails(getIntent(), duration);
setVideoPath(string);
((ActivityFakeVideoCallBinding) getBinding()).timerLeft.setStartTime(System.currentTimeMillis());
unit = Unit.INSTANCE;
} else {
unit = null;
}
if (unit == null) {
finish();
}
checkPermission();
onClicks();
}
private final void getVideoDetails(Intent intent, long videoLength) {
String stringExtra;
final VideoDetailModel videoDetailModel;
String str;
String name;
if (intent == null || intent.getExtras() == null || (stringExtra = intent.getStringExtra(Constants.FCM_DATA)) == null || (videoDetailModel = (VideoDetailModel) new Gson().fromJson(stringExtra, VideoDetailModel.class)) == null) {
return;
}
showRechargeMessage(videoLength);
showRechargeDialog(videoDetailModel, videoLength);
RequestManager with = Glide.with((FragmentActivity) this);
StreamerModel streamerDetails = videoDetailModel.getStreamerDetails();
if (streamerDetails == null || (str = StreamerModel.getProfile$default(streamerDetails, false, 1, null)) == null) {
str = "";
}
with.load(str).into(getBinding().pic);
TextView textView = getBinding().userName;
StreamerModel userDetails = videoDetailModel.getUserDetails();
textView.setText((userDetails == null || (name = userDetails.getName()) == null) ? "" : name);
getBinding().rechargeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FakeVideoCallActivity.getVideoDetails$lambda$5(FakeVideoCallActivity.this, videoDetailModel, view);
}
});
}
public static final void getVideoDetails$lambda$5(FakeVideoCallActivity fakeVideoCallActivity, VideoDetailModel videoDetailModel, View view) {
Intrinsics.checkNotNullParameter(fakeVideoCallActivity, "this$0");
fakeVideoCallActivity.showRechargePopup(videoDetailModel);
}
public final void setVideoPath(String url) {
Intrinsics.checkNotNullParameter(url, "url");
Timber.e("video url " + url, new Object[0]);
ExoPlayer build = new ExoPlayer.Builder(getBinding().getRoot().getContext()).build();
Intrinsics.checkNotNullExpressionValue(build, "Builder(context).build()");
this.exoPlayer = build;
ExoPlayer exoPlayer = null;
if (build == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
build = null;
}
build.addListener(new Player.Listener() {
public void onPlaybackStateChanged(int playbackState) {
super.onPlaybackStateChanged(playbackState);
}
});
PlayerView playerView = getBinding().videoView;
ExoPlayer exoPlayer2 = this.exoPlayer;
if (exoPlayer2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer2 = null;
}
playerView.setPlayer((Player) exoPlayer2);
ExoPlayer exoPlayer3 = this.exoPlayer;
if (exoPlayer3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer3 = null;
}
exoPlayer3.seekTo(0L);
ExoPlayer exoPlayer4 = this.exoPlayer;
if (exoPlayer4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer4 = null;
}
exoPlayer4.setRepeatMode(2);
MediaItem fromUri = MediaItem.fromUri(Uri.fromFile(new File(url)));
Intrinsics.checkNotNullExpressionValue(fromUri, "fromUri(uri)");
ExoPlayer exoPlayer5 = this.exoPlayer;
if (exoPlayer5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer5 = null;
}
exoPlayer5.setMediaItem(fromUri);
ExoPlayer exoPlayer6 = this.exoPlayer;
if (exoPlayer6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer6 = null;
}
exoPlayer6.prepare();
ExoPlayer exoPlayer7 = this.exoPlayer;
if (exoPlayer7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer7 = null;
}
exoPlayer7.setPlayWhenReady(true);
ExoPlayer exoPlayer8 = this.exoPlayer;
if (exoPlayer8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
} else {
exoPlayer = exoPlayer8;
}
exoPlayer.play();
}
static void showRechargeDialog$default(FakeVideoCallActivity fakeVideoCallActivity, VideoDetailModel videoDetailModel, long j, int i, Object obj) {
if ((i & 2) != 0) {
j = 10;
}
fakeVideoCallActivity.showRechargeDialog(videoDetailModel, j);
}
private final void showRechargeDialog(VideoDetailModel videoDetails, long videoLength) {
BuildersKt.launch$default(CoroutineScopeKt.CoroutineScope(Dispatchers.getMain()), (CoroutineContext) null, (CoroutineStart) null, new FakeVideoCallActivity$showRechargeDialog$1(videoLength, this, videoDetails, null), 3, (Object) null);
}
static void showRechargeMessage$default(FakeVideoCallActivity fakeVideoCallActivity, long j, int i, Object obj) {
if ((i & 1) != 0) {
j = 10;
}
fakeVideoCallActivity.showRechargeMessage(j);
}
private final void showRechargeMessage(long videoLength) {
BuildersKt.launch$default(CoroutineScopeKt.CoroutineScope(Dispatchers.getMain()), (CoroutineContext) null, (CoroutineStart) null, new FakeVideoCallActivity$showRechargeMessage$1(this, videoLength, null), 3, (Object) null);
}
public final void showRechargePopup(VideoDetailModel data) {
StreamerModel streamerDetails;
try {
ExoPlayer exoPlayer = this.exoPlayer;
String str = null;
if (exoPlayer != null) {
if (exoPlayer == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer = null;
}
exoPlayer.stop();
ExoPlayer exoPlayer2 = this.exoPlayer;
if (exoPlayer2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer2 = null;
}
exoPlayer2.release();
}
FrameLayout frameLayout = ((ActivityFakeVideoCallBinding) getBinding()).blurView;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.blurView");
frameLayout.setVisibility(0);
Balance balanceDto = data != null ? data.getBalanceDto() : null;
if (data != null && (streamerDetails = data.getStreamerDetails()) != null) {
str = StreamerModel.getProfile$default(streamerDetails, false, 1, null);
}
RechargeDialog rechargeDialog = new RechargeDialog(data, balanceDto, str, null, null, new Function0<Unit>() {
public final void m1930invoke() {
}
public Object invoke() {
m1930invoke();
return Unit.INSTANCE;
}
}, new Function0<Unit>() {
{
super(0);
}
public Object invoke() {
m1931invoke();
return Unit.INSTANCE;
}
public final void m1931invoke() {
FakeVideoCallActivity.this.finish();
}
}, 24, null);
rechargeDialog.setCancelable(false);
if (!rechargeDialog.isAdded() && !rechargeDialog.isVisible()) {
rechargeDialog.show(getSupportFragmentManager(), "RechargeDialog");
}
} catch (Exception unused) {
String string = getString(2131951993);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.error_unknown)");
ActivityExtKt.toast((Activity) this, string);
}
}
private final void onClicks() {
getBinding().btnEndcall.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FakeVideoCallActivity.onClicks$lambda$6(FakeVideoCallActivity.this, view);
}
});
getBinding().btnPauseVideo.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FakeVideoCallActivity.onClicks$lambda$7(FakeVideoCallActivity.this, view);
}
});
getBinding().btnMute.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FakeVideoCallActivity.onClicks$lambda$8(FakeVideoCallActivity.this, view);
}
});
getBinding().btnSwitchCamera.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FakeVideoCallActivity.onClicks$lambda$10(FakeVideoCallActivity.this, view);
}
});
}
public static final void onClicks$lambda$6(FakeVideoCallActivity fakeVideoCallActivity, View view) {
Intrinsics.checkNotNullParameter(fakeVideoCallActivity, "this$0");
if (fakeVideoCallActivity.isTaskRoot()) {
fakeVideoCallActivity.getIntent().putExtra(CallActivity.SCREEN_CLOSED, true);
Intent intent = new Intent((Context) fakeVideoCallActivity, (Class<?>) SplashActivity.class);
intent.addFlags(67108864);
fakeVideoCallActivity.startActivity(intent);
return;
}
fakeVideoCallActivity.finish();
}
public static final void onClicks$lambda$7(FakeVideoCallActivity fakeVideoCallActivity, View view) {
Intrinsics.checkNotNullParameter(fakeVideoCallActivity, "this$0");
fakeVideoCallActivity.getBinding().btnPauseVideo.setActivated(!fakeVideoCallActivity.getBinding().btnPauseVideo.isActivated());
View view2 = fakeVideoCallActivity.getBinding().preview;
Intrinsics.checkNotNullExpressionValue(view2, "binding.preview");
ViewExtKt.showOrGone(view2, !fakeVideoCallActivity.getBinding().btnPauseVideo.isActivated());
View view3 = fakeVideoCallActivity.getBinding().blurLocalPreviewLayout;
Intrinsics.checkNotNullExpressionValue(view3, "binding.blurLocalPreviewLayout");
ViewExtKt.showOrGone(view3, fakeVideoCallActivity.getBinding().btnPauseVideo.isActivated());
}
public static final void onClicks$lambda$8(FakeVideoCallActivity fakeVideoCallActivity, View view) {
Intrinsics.checkNotNullParameter(fakeVideoCallActivity, "this$0");
fakeVideoCallActivity.getBinding().btnMute.setActivated(!fakeVideoCallActivity.getBinding().btnMute.isActivated());
}
public static final void onClicks$lambda$10(FakeVideoCallActivity fakeVideoCallActivity, View view) {
Intrinsics.checkNotNullParameter(fakeVideoCallActivity, "this$0");
fakeVideoCallActivity.getBinding().btnSwitchCamera.setActivated(!fakeVideoCallActivity.getBinding().btnSwitchCamera.isActivated());
fakeVideoCallActivity.lensFacing = fakeVideoCallActivity.lensFacing != 0 ? 0 : 1;
ProcessCameraProvider processCameraProvider = fakeVideoCallActivity.cameraProvider;
if (processCameraProvider != null) {
fakeVideoCallActivity.bindPreview(processCameraProvider);
}
}
protected void onDestroy() {
ExoPlayer exoPlayer = this.exoPlayer;
if (exoPlayer != null) {
ExoPlayer exoPlayer2 = null;
if (exoPlayer == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer = null;
}
exoPlayer.stop();
ExoPlayer exoPlayer3 = this.exoPlayer;
if (exoPlayer3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
} else {
exoPlayer2 = exoPlayer3;
}
exoPlayer2.release();
}
super.onDestroy();
}
public void finish() {
try {
ProcessCameraProvider processCameraProvider = this.cameraProvider;
if (processCameraProvider != null) {
processCameraProvider.shutdown();
}
ProcessCameraProvider processCameraProvider2 = this.cameraProvider;
if (processCameraProvider2 != null) {
processCameraProvider2.unbindAll();
}
} catch (Exception e) {
Timber.e(e);
}
super.finish();
}
private final void setCameraProviderListener() {
Context context = (Context) this;
final ListenableFuture processCameraProvider = ProcessCameraProvider.getInstance(context);
Intrinsics.checkNotNullExpressionValue(processCameraProvider, "getInstance(this)");
processCameraProvider.addListener(new Runnable() {
@Override
public final void run() {
FakeVideoCallActivity.setCameraProviderListener$lambda$12(FakeVideoCallActivity.this, processCameraProvider);
}
}, ContextCompat.getMainExecutor(context));
}
public static final void setCameraProviderListener$lambda$12(FakeVideoCallActivity fakeVideoCallActivity, ListenableFuture listenableFuture) {
Intrinsics.checkNotNullParameter(fakeVideoCallActivity, "this$0");
Intrinsics.checkNotNullParameter(listenableFuture, "$cameraProviderFuture");
try {
ProcessCameraProvider processCameraProvider = (ProcessCameraProvider) listenableFuture.get();
fakeVideoCallActivity.cameraProvider = processCameraProvider;
if (processCameraProvider != null) {
fakeVideoCallActivity.bindPreview(processCameraProvider);
}
} catch (InterruptedException e) {
Timber.e(e);
} catch (ExecutionException e2) {
Timber.e(e2);
}
}
private final boolean hasBackCamera() {
ProcessCameraProvider processCameraProvider = this.cameraProvider;
if (processCameraProvider != null) {
return processCameraProvider.hasCamera(CameraSelector.DEFAULT_BACK_CAMERA);
}
return false;
}
private final boolean hasFrontCamera() {
ProcessCameraProvider processCameraProvider = this.cameraProvider;
if (processCameraProvider != null) {
return processCameraProvider.hasCamera(CameraSelector.DEFAULT_FRONT_CAMERA);
}
return false;
}
private final void bindPreview(ProcessCameraProvider cameraProvider) {
int i;
try {
if (hasFrontCamera()) {
i = 0;
} else if (!hasBackCamera()) {
return;
} else {
i = 1;
}
this.lensFacing = i;
CameraSelector build = new CameraSelector.Builder().requireLensFacing(this.lensFacing).build();
Intrinsics.checkNotNullExpressionValue(build, "Builder().requireLensFacing(lensFacing).build()");
UseCase build2 = new Preview.Builder().build();
Intrinsics.checkNotNullExpressionValue(build2, "Builder().build()");
build2.setSurfaceProvider(getBinding().preview.getSurfaceProvider());
ViewPort viewPort = getBinding().preview.getViewPort();
if (viewPort != null) {
UseCaseGroup build3 = new UseCaseGroup.Builder().addUseCase(build2).setViewPort(viewPort).build();
Intrinsics.checkNotNullExpressionValue(build3, "Builder().addUseCase(pre…iewPort(viewPort).build()");
cameraProvider.unbindAll();
Intrinsics.checkNotNull(this, "null cannot be cast to non-null type androidx.lifecycle.LifecycleOwner");
Camera bindToLifecycle = cameraProvider.bindToLifecycle((LifecycleOwner) this, build, build3);
Intrinsics.checkNotNullExpressionValue(bindToLifecycle, "cameraProvider.bindToLif…seGroup\n )");
Intrinsics.checkNotNullExpressionValue(bindToLifecycle.getCameraControl(), "camera.cameraControl");
}
} catch (Exception e) {
Timber.e(e);
}
}
}