123 lines
4.3 KiB
Java
123 lines
4.3 KiB
Java
package com.huawei.hms.adapter.ui;
|
|
|
|
import android.app.Activity;
|
|
import android.app.Dialog;
|
|
import android.content.DialogInterface;
|
|
import android.content.Intent;
|
|
import android.view.KeyEvent;
|
|
import com.huawei.hms.activity.IBridgeActivityDelegate;
|
|
import com.huawei.hms.adapter.sysobs.SystemManager;
|
|
import com.huawei.hms.support.log.HMSLog;
|
|
import com.huawei.hms.update.ui.NotInstalledHmsDialogHelper;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class NotInstalledHmsAdapter implements IBridgeActivityDelegate {
|
|
private static final Object c = new Object();
|
|
private static boolean d;
|
|
private Activity a;
|
|
private Dialog b;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static class a implements DialogInterface.OnCancelListener {
|
|
private final Activity a;
|
|
|
|
public a(Activity activity) {
|
|
this.a = activity;
|
|
}
|
|
|
|
@Override // android.content.DialogInterface.OnCancelListener
|
|
public void onCancel(DialogInterface dialogInterface) {
|
|
HMSLog.i("NotInstalledHmsAdapter", "<Dialog onCancel>");
|
|
SystemManager.getInstance().notifyUpdateResult(13);
|
|
this.a.finish();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static class b implements DialogInterface.OnClickListener {
|
|
private final Activity a;
|
|
|
|
public b(Activity activity) {
|
|
this.a = activity;
|
|
}
|
|
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
HMSLog.i("NotInstalledHmsAdapter", "<Dialog onClick>");
|
|
SystemManager.getInstance().notifyUpdateResult(30);
|
|
this.a.finish();
|
|
}
|
|
}
|
|
|
|
private void a(Activity activity) {
|
|
Dialog dialog = this.b;
|
|
if (dialog != null && dialog.isShowing()) {
|
|
this.b.setOnCancelListener(null);
|
|
this.b.cancel();
|
|
}
|
|
this.b = NotInstalledHmsDialogHelper.getDialogBuilder(activity).setPositiveButton(NotInstalledHmsDialogHelper.getConfirmResId(activity), new b(activity)).setOnCancelListener(new a(activity)).show();
|
|
}
|
|
|
|
public static boolean getShowLock() {
|
|
synchronized (c) {
|
|
StringBuilder sb = new StringBuilder("<canShowDialog> sIsShowingDialog: ");
|
|
sb.append(d);
|
|
HMSLog.i("NotInstalledHmsAdapter", sb.toString());
|
|
if (d) {
|
|
return false;
|
|
}
|
|
d = true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
@Override // com.huawei.hms.activity.IBridgeActivityDelegate
|
|
public int getRequestCode() {
|
|
HMSLog.i("NotInstalledHmsAdapter", "<getRequestCode>");
|
|
return 0;
|
|
}
|
|
|
|
@Override // com.huawei.hms.activity.IBridgeActivityDelegate
|
|
public void onBridgeActivityCreate(Activity activity) {
|
|
HMSLog.i("NotInstalledHmsAdapter", "<onBridgeActivityCreate>");
|
|
if (activity != null && !activity.isFinishing()) {
|
|
this.a = activity;
|
|
a(activity);
|
|
} else {
|
|
HMSLog.e("NotInstalledHmsAdapter", "<onBridgeActivityCreate> activity is null or finishing");
|
|
}
|
|
}
|
|
|
|
@Override // com.huawei.hms.activity.IBridgeActivityDelegate
|
|
public void onBridgeActivityDestroy() {
|
|
HMSLog.i("NotInstalledHmsAdapter", "<onBridgeActivityDestroy>");
|
|
synchronized (c) {
|
|
d = false;
|
|
}
|
|
}
|
|
|
|
@Override // com.huawei.hms.activity.IBridgeActivityDelegate
|
|
public boolean onBridgeActivityResult(int i, int i2, Intent intent) {
|
|
HMSLog.i("NotInstalledHmsAdapter", "<onBridgeActivityResult>");
|
|
return false;
|
|
}
|
|
|
|
@Override // com.huawei.hms.activity.IBridgeActivityDelegate
|
|
public void onBridgeConfigurationChanged() {
|
|
HMSLog.i("NotInstalledHmsAdapter", "<onBridgeConfigurationChanged>");
|
|
Activity activity = this.a;
|
|
if (activity != null && !activity.isFinishing()) {
|
|
a(this.a);
|
|
} else {
|
|
HMSLog.e("NotInstalledHmsAdapter", "<onBridgeConfigurationChanged> mActivity is null or finishing");
|
|
}
|
|
}
|
|
|
|
@Override // com.huawei.hms.activity.IBridgeActivityDelegate
|
|
public void onKeyUp(int i, KeyEvent keyEvent) {
|
|
HMSLog.i("NotInstalledHmsAdapter", "<onKeyUp>");
|
|
}
|
|
}
|