package csdk.gluads; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.view.ViewGroup; import android.widget.ProgressBar; import androidx.annotation.NonNull; import csdk.gluads.util.Common; import java.util.concurrent.Callable; /* loaded from: classes4.dex */ public class LoadingScreen { private Callable mActivityGetter; private Context mCurrentContext; private boolean mInitialized = false; private CustomProgressBar mLoadingScreen; public boolean isInitialized() { return this.mInitialized; } public void initialize(@NonNull Callable callable) { this.mActivityGetter = callable; Context context = (Context) Common.call(callable); this.mCurrentContext = context; CustomProgressBar customProgressBar = new CustomProgressBar(context); this.mLoadingScreen = customProgressBar; customProgressBar.setCancelable(true); this.mLoadingScreen.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: csdk.gluads.LoadingScreen.1 @Override // android.content.DialogInterface.OnCancelListener public void onCancel(DialogInterface dialogInterface) { } }); this.mLoadingScreen.addContentView(new ProgressBar(context), new ViewGroup.LayoutParams(-2, -2)); this.mInitialized = true; } public void show() { if (!this.mInitialized || isShowing()) { return; } if (((Context) Common.call(this.mActivityGetter)) != this.mCurrentContext) { initialize(this.mActivityGetter); } this.mLoadingScreen.show(); } public boolean isShowing() { return this.mInitialized && this.mLoadingScreen.isShowing(); } public void dismiss() { if (isShowing()) { this.mLoadingScreen.dismiss(); } } public class CustomProgressBar extends Dialog { public CustomProgressBar(Context context) { super(context, R.style.CustomProgressBar); } } }