Initial commit
This commit is contained in:
368
sources/com/ubt/jimu/pack/view/BarCodeScanActivity.java
Normal file
368
sources/com/ubt/jimu/pack/view/BarCodeScanActivity.java
Normal file
@@ -0,0 +1,368 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.android.AmbientLightManager;
|
||||
import com.google.zxing.client.android.BeepManager;
|
||||
import com.google.zxing.client.android.CaptureActivityHandler;
|
||||
import com.google.zxing.client.android.DecodeFormatManager;
|
||||
import com.google.zxing.client.android.FinishListener;
|
||||
import com.google.zxing.client.android.ICaptureView;
|
||||
import com.google.zxing.client.android.InactivityTimer;
|
||||
import com.google.zxing.client.android.ViewfinderView;
|
||||
import com.google.zxing.client.android.camera.CameraManager;
|
||||
import com.google.zxing.client.android.result.ResultHandler;
|
||||
import com.google.zxing.client.android.result.ResultHandlerFactory;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.pack.presenter.BarCodeScanPresenter;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class BarCodeScanActivity extends BaseActivity implements ICaptureView, IBarCodeScanView, SurfaceHolder.Callback, SensorEventListener {
|
||||
private ViewfinderView a;
|
||||
private CameraManager b;
|
||||
private boolean c;
|
||||
private InactivityTimer d;
|
||||
private BeepManager e;
|
||||
private AmbientLightManager f;
|
||||
private TextView g;
|
||||
private CaptureActivityHandler h;
|
||||
private SurfaceHolder i;
|
||||
private BarCodeScanPresenter j;
|
||||
private SensorManager k;
|
||||
private Sensor l;
|
||||
private int m;
|
||||
|
||||
private void D0() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(getString(R.string.scan_name));
|
||||
builder.setMessage(getString(R.string.msg_camera_framework_bug));
|
||||
builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
|
||||
builder.setOnCancelListener(new FinishListener(this));
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private void E0() {
|
||||
this.b = new CameraManager(getApplication());
|
||||
ViewfinderView viewfinderView = this.a;
|
||||
if (viewfinderView != null) {
|
||||
viewfinderView.setCameraManager(this.b);
|
||||
}
|
||||
AmbientLightManager ambientLightManager = this.f;
|
||||
if (ambientLightManager != null) {
|
||||
ambientLightManager.a(this.b);
|
||||
}
|
||||
}
|
||||
|
||||
private void F0() {
|
||||
this.c = false;
|
||||
this.d = new InactivityTimer(this);
|
||||
this.e = new BeepManager(this);
|
||||
this.f = new AmbientLightManager(this);
|
||||
}
|
||||
|
||||
private void G0() {
|
||||
this.j = new BarCodeScanPresenter(this);
|
||||
}
|
||||
|
||||
private void H0() {
|
||||
this.k = (SensorManager) getSystemService("sensor");
|
||||
this.l = this.k.getDefaultSensor(3);
|
||||
}
|
||||
|
||||
private void I0() {
|
||||
this.i = ((SurfaceView) findViewById(R.id.preview_view)).getHolder();
|
||||
if (this.c) {
|
||||
a(this.i);
|
||||
} else {
|
||||
this.i.addCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void J0() {
|
||||
this.a = (ViewfinderView) findViewById(R.id.viewfinder_view);
|
||||
this.g = (TextView) findViewById(R.id.status_view);
|
||||
((Button) findViewById(R.id.btn_back)).setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.pack.view.BarCodeScanActivity.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
BarCodeScanActivity.this.K0();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void K0() {
|
||||
finish();
|
||||
}
|
||||
|
||||
private void L0() {
|
||||
this.g.setText(getResources().getString(R.string.scan_default_status));
|
||||
this.g.setVisibility(0);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x0028 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:18:0x0034 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private void l(int r4) {
|
||||
/*
|
||||
r3 = this;
|
||||
com.google.zxing.client.android.camera.CameraManager r0 = r3.b
|
||||
boolean r0 = r0.f()
|
||||
if (r0 == 0) goto L4a
|
||||
r0 = 0
|
||||
if (r4 == 0) goto L14
|
||||
r1 = 1
|
||||
if (r4 == r1) goto L1c
|
||||
r1 = 2
|
||||
if (r4 == r1) goto L19
|
||||
r1 = 3
|
||||
if (r4 == r1) goto L16
|
||||
L14:
|
||||
r4 = 0
|
||||
goto L1e
|
||||
L16:
|
||||
r4 = 270(0x10e, float:3.78E-43)
|
||||
goto L1e
|
||||
L19:
|
||||
r4 = 180(0xb4, float:2.52E-43)
|
||||
goto L1e
|
||||
L1c:
|
||||
r4 = 90
|
||||
L1e:
|
||||
com.google.zxing.client.android.camera.CameraManager r1 = r3.b
|
||||
com.google.zxing.client.android.camera.open.CameraFacing r1 = r1.b()
|
||||
com.google.zxing.client.android.camera.open.CameraFacing r2 = com.google.zxing.client.android.camera.open.CameraFacing.BACK
|
||||
if (r1 != r2) goto L34
|
||||
com.google.zxing.client.android.camera.CameraManager r0 = r3.b
|
||||
int r0 = r0.e()
|
||||
int r0 = r0 - r4
|
||||
int r0 = r0 + 360
|
||||
int r0 = r0 % 360
|
||||
goto L45
|
||||
L34:
|
||||
com.google.zxing.client.android.camera.open.CameraFacing r2 = com.google.zxing.client.android.camera.open.CameraFacing.FRONT
|
||||
if (r1 != r2) goto L45
|
||||
com.google.zxing.client.android.camera.CameraManager r0 = r3.b
|
||||
int r0 = r0.e()
|
||||
int r0 = r0 + r4
|
||||
int r0 = r0 % 360
|
||||
int r4 = 360 - r0
|
||||
int r0 = r4 % 360
|
||||
L45:
|
||||
com.google.zxing.client.android.camera.CameraManager r4 = r3.b
|
||||
r4.b(r0)
|
||||
L4a:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.pack.view.BarCodeScanActivity.l(int):void");
|
||||
}
|
||||
|
||||
private void o(String str) {
|
||||
this.g.setText(str);
|
||||
}
|
||||
|
||||
private void p(String str) {
|
||||
ToastView.a(this, str, ToastView.Type.NORMAL).a();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public ViewfinderView J() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public CameraManager b0() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public Handler getHandler() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.view.IBarCodeScanView
|
||||
public void k0() {
|
||||
p(getResources().getString(R.string.scan_match_failed));
|
||||
a(3000L);
|
||||
}
|
||||
|
||||
@Override // android.hardware.SensorEventListener
|
||||
public void onAccuracyChanged(Sensor sensor, int i) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.barcode_scan);
|
||||
J0();
|
||||
G0();
|
||||
E0();
|
||||
F0();
|
||||
H0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
InactivityTimer inactivityTimer = this.d;
|
||||
if (inactivityTimer != null) {
|
||||
inactivityTimer.d();
|
||||
}
|
||||
BarCodeScanPresenter barCodeScanPresenter = this.j;
|
||||
if (barCodeScanPresenter != null) {
|
||||
barCodeScanPresenter.a();
|
||||
this.j = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onPause() {
|
||||
SurfaceHolder surfaceHolder;
|
||||
CaptureActivityHandler captureActivityHandler = this.h;
|
||||
if (captureActivityHandler != null) {
|
||||
captureActivityHandler.a();
|
||||
this.h = null;
|
||||
}
|
||||
this.d.b();
|
||||
this.f.a();
|
||||
this.e.close();
|
||||
CameraManager cameraManager = this.b;
|
||||
if (cameraManager != null) {
|
||||
cameraManager.a();
|
||||
}
|
||||
if (!this.c && (surfaceHolder = this.i) != null) {
|
||||
surfaceHolder.removeCallback(this);
|
||||
}
|
||||
this.k.unregisterListener(this);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
this.e.b();
|
||||
this.d.c();
|
||||
I0();
|
||||
this.k.registerListener(this, this.l, 3);
|
||||
this.m = getWindowManager().getDefaultDisplay().getRotation();
|
||||
}
|
||||
|
||||
@Override // android.hardware.SensorEventListener
|
||||
public void onSensorChanged(SensorEvent sensorEvent) {
|
||||
int rotation = getWindowManager().getDefaultDisplay().getRotation();
|
||||
if (this.m != rotation) {
|
||||
l(rotation);
|
||||
this.m = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.SurfaceHolder.Callback
|
||||
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
|
||||
}
|
||||
|
||||
@Override // android.view.SurfaceHolder.Callback
|
||||
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||
if (surfaceHolder == null) {
|
||||
Log.e("BarCodeScanActivity", "*** WARNING *** surfaceCreated() gave us a null surface!");
|
||||
}
|
||||
if (this.c) {
|
||||
return;
|
||||
}
|
||||
this.c = true;
|
||||
a(surfaceHolder);
|
||||
}
|
||||
|
||||
@Override // android.view.SurfaceHolder.Callback
|
||||
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
|
||||
this.c = false;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public void w() {
|
||||
this.a.a();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public void a(Result result, Bitmap bitmap, float f) {
|
||||
this.d.a();
|
||||
ResultHandler a = ResultHandlerFactory.a(this, this, result);
|
||||
if (bitmap != null) {
|
||||
this.e.a();
|
||||
}
|
||||
a(result, a);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.view.IBarCodeScanView
|
||||
public void o() {
|
||||
p(getResources().getString(R.string.loading_error));
|
||||
a(5000L);
|
||||
}
|
||||
|
||||
private void a(Result result, ResultHandler resultHandler) {
|
||||
o(getResources().getString(R.string.scan_wait));
|
||||
this.j.a(getApplicationContext(), result.a(), resultHandler.e().toString());
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.client.android.ICaptureView
|
||||
public void a(long j) {
|
||||
CaptureActivityHandler captureActivityHandler = this.h;
|
||||
if (captureActivityHandler != null) {
|
||||
captureActivityHandler.sendEmptyMessageDelayed(R.id.restart_preview, j);
|
||||
}
|
||||
L0();
|
||||
}
|
||||
|
||||
private void a(SurfaceHolder surfaceHolder) {
|
||||
if (surfaceHolder != null) {
|
||||
if (this.b.f()) {
|
||||
Log.w("BarCodeScanActivity", "initCamera() while already open -- late SurfaceView callback?");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.b.a(surfaceHolder);
|
||||
if (this.h == null) {
|
||||
this.h = new CaptureActivityHandler(this, this, DecodeFormatManager.b, null, null, this.b);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
Log.w("BarCodeScanActivity", e);
|
||||
D0();
|
||||
return;
|
||||
} catch (RuntimeException e2) {
|
||||
Log.w("BarCodeScanActivity", "Unexpected error initializing camera", e2);
|
||||
D0();
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("No SurfaceHolder provided");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.view.IBarCodeScanView
|
||||
public void a(Package r3) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("scan_result_package", r3);
|
||||
setResult(-1, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
387
sources/com/ubt/jimu/pack/view/DownloadRobotActivity.java
Normal file
387
sources/com/ubt/jimu/pack/view/DownloadRobotActivity.java
Normal file
@@ -0,0 +1,387 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.SuperActivity;
|
||||
import com.ubt.jimu.base.UbtActivityStack;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.download.Downloader;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.discover.CourseRepository;
|
||||
import com.ubt.jimu.unity.bluetooth.MyUnityListener;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubt.jimu.utils.RxSchedulers;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DownloadRobotActivity extends SuperActivity implements Downloader.IDownloadJimuRobotListener, View.OnClickListener {
|
||||
private Robot a;
|
||||
private long b;
|
||||
private DownloadTask c;
|
||||
private Map<String, Integer> d;
|
||||
private int h;
|
||||
private int i;
|
||||
ImageView im_download_image;
|
||||
private String j;
|
||||
private String k;
|
||||
private View l;
|
||||
private String n;
|
||||
int o;
|
||||
ProgressBar pgDownloadModel;
|
||||
RelativeLayout rl_load_error;
|
||||
TextView tvModelDescription;
|
||||
TextView tvProgress;
|
||||
ViewStub viewStub_download_error;
|
||||
private int e = 0;
|
||||
private int f = 0;
|
||||
private int g = 0;
|
||||
private CompositeDisposable m = new CompositeDisposable();
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void D0() {
|
||||
JimuSimpleDialog.showWifiOnlyDialog(this, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.pack.view.b
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
DownloadRobotActivity.b(dialogInterface, i);
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.pack.view.a
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
DownloadRobotActivity.this.a(dialogInterface, i);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void E0() {
|
||||
DownloadTask downloadTask = this.c;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
}
|
||||
if (UbtActivityStack.getInstance().isTopStack(DownloadRobotActivity.class)) {
|
||||
UnityActivity.startUnityActivity(this, this.a, this.h, this.i, this.j);
|
||||
}
|
||||
setResult(8);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void F0() {
|
||||
View view = this.l;
|
||||
if (view != null) {
|
||||
view.setVisibility(0);
|
||||
return;
|
||||
}
|
||||
this.l = this.viewStub_download_error.inflate();
|
||||
((TextView) this.l.findViewById(R.id.tv_cancel_download)).setOnClickListener(this);
|
||||
((TextView) this.l.findViewById(R.id.tv_re_download)).setOnClickListener(this);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void G0() {
|
||||
RobotSelectActivity.a(this, this.n, this.b, null, this.h, this.i);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void H0() {
|
||||
Robot robot = this.a;
|
||||
if (robot == null || this.b < 0) {
|
||||
return;
|
||||
}
|
||||
c(robot);
|
||||
}
|
||||
|
||||
private void I0() {
|
||||
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(this.a.getFilePath());
|
||||
a.a(new RequestListener<Drawable>() { // from class: com.ubt.jimu.pack.view.DownloadRobotActivity.2
|
||||
@Override // com.bumptech.glide.request.RequestListener
|
||||
public boolean a(GlideException glideException, Object obj, Target<Drawable> target, boolean z) {
|
||||
DownloadRobotActivity.this.rl_load_error.setVisibility(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.request.RequestListener
|
||||
public boolean a(Drawable drawable, Object obj, Target<Drawable> target, DataSource dataSource, boolean z) {
|
||||
DownloadRobotActivity.this.rl_load_error.setVisibility(8);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
a.a(new RequestOptions().b(R.drawable.image_load_error).a(R.drawable.image_load_error).b());
|
||||
a.a(this.im_download_image);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void J0() {
|
||||
I0();
|
||||
this.tvModelDescription.setText(this.a.getModelDescriptionLangeage());
|
||||
}
|
||||
|
||||
static /* synthetic */ void b(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initData() {
|
||||
Intent intent = getIntent();
|
||||
this.h = intent.getIntExtra(Constant.SelectRobot.BUNDLE_KEY_FROM, 0);
|
||||
this.i = intent.getIntExtra(MyUnityListener.CALLER, 0);
|
||||
this.j = intent.getStringExtra(MyUnityListener.CALLBACK);
|
||||
this.a = (Robot) intent.getSerializableExtra(Constant.SelectRobot.DOWNLAOD_ROBOT_DATA_KEY);
|
||||
this.b = intent.getLongExtra(Constant.Base.ACTIVITY_START_PACKAGE, 0L);
|
||||
this.n = intent.getStringExtra(Constant.SelectRobot.PACKAGE_NAME_KEY);
|
||||
long longExtra = intent.getLongExtra(Constant.Base.ACTIVITY_START_ROBOT, -1L);
|
||||
this.k = intent.getStringExtra(Constant.SelectRobot.PACKAGE_IMAGE_PATH_KEY);
|
||||
if (this.a != null) {
|
||||
J0();
|
||||
D0();
|
||||
} else if (longExtra > -1) {
|
||||
a(longExtra, this.b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initEvent() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
public View initView() {
|
||||
return View.inflate(this, R.layout.activity_download_robot, null);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.tv_cancel_download) {
|
||||
View view2 = this.l;
|
||||
if (view2 != null) {
|
||||
view2.setVisibility(8);
|
||||
}
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (id != R.id.tv_re_download) {
|
||||
return;
|
||||
}
|
||||
View view3 = this.l;
|
||||
if (view3 != null) {
|
||||
view3.setVisibility(8);
|
||||
}
|
||||
Observable.timer(500L, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Consumer<Long>() { // from class: com.ubt.jimu.pack.view.DownloadRobotActivity.4
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void accept(Long l) throws Exception {
|
||||
DownloadRobotActivity.this.D0();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
DownloadTask downloadTask = this.c;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
}
|
||||
this.m.dispose();
|
||||
this.m.a();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onFailed() {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("resultCode", "1-2");
|
||||
JimuAnalytics.b().a(Constant.DataStatistics.APP_PACKAGE_DOWNLOAD, hashMap);
|
||||
F0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onPrepareStart() {
|
||||
this.d = new HashMap();
|
||||
this.e = 0;
|
||||
this.f = 0;
|
||||
this.g = 0;
|
||||
NetWorkUtil.b(JimuApplication.l());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
this.g = i;
|
||||
int a = a(this.d, i2, i3);
|
||||
int i4 = a / i;
|
||||
int i5 = i * 100;
|
||||
this.e = i5 - a;
|
||||
this.f = a;
|
||||
this.tvProgress.setText(i4 + "%");
|
||||
this.pgDownloadModel.setMax(i5);
|
||||
this.pgDownloadModel.setProgress(a);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onSuccess() {
|
||||
Cache.getInstance().setRobot(this.a);
|
||||
if (this.h == 7) {
|
||||
Cache.getInstance().setPackageId(0L);
|
||||
} else {
|
||||
Cache.getInstance().setPackageId(this.b);
|
||||
}
|
||||
Cache.getInstance().setPackageName(this.n);
|
||||
Cache.getInstance().setPackageImagePath(this.k);
|
||||
a(this.e, this.f, this.g);
|
||||
SPUtils.a(Constant.SelectRobot.INTERSTELLAR_ADVENTURE_SELECT_PACKAGE_KEY, this.n);
|
||||
}
|
||||
|
||||
private void c(Robot robot) {
|
||||
this.c = Downloader.downloadJimuRobot(robot, this);
|
||||
}
|
||||
|
||||
public static void a(Context context, Robot robot, String str, long j, String str2, int i, int i2, String str3) {
|
||||
Intent intent = new Intent(context, (Class<?>) DownloadRobotActivity.class);
|
||||
intent.putExtra(Constant.SelectRobot.DOWNLAOD_ROBOT_DATA_KEY, robot);
|
||||
intent.putExtra(Constant.SelectRobot.BUNDLE_KEY_FROM, i);
|
||||
intent.putExtra(MyUnityListener.CALLER, i2);
|
||||
intent.putExtra(MyUnityListener.CALLBACK, str3);
|
||||
intent.putExtra(Constant.Base.ACTIVITY_START_PACKAGE, j);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGE_NAME_KEY, str);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGE_IMAGE_PATH_KEY, str2);
|
||||
((Activity) context).startActivityForResult(intent, 9);
|
||||
}
|
||||
|
||||
public static void a(Context context, Robot robot, String str, long j, int i) {
|
||||
Intent intent = new Intent(context, (Class<?>) DownloadRobotActivity.class);
|
||||
intent.putExtra(Constant.SelectRobot.DOWNLAOD_ROBOT_DATA_KEY, robot);
|
||||
intent.putExtra(Constant.SelectRobot.BUNDLE_KEY_FROM, i);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGE_NAME_KEY, str);
|
||||
intent.putExtra(Constant.Base.ACTIVITY_START_PACKAGE, j);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private void a(long j, long j2) {
|
||||
CourseRepository.a(this, j).compose(RxSchedulers.a()).subscribe(new Observer<Robot>() { // from class: com.ubt.jimu.pack.view.DownloadRobotActivity.1
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(Robot robot) {
|
||||
if (robot == null) {
|
||||
DownloadRobotActivity.this.G0();
|
||||
return;
|
||||
}
|
||||
DownloadRobotActivity.this.a = robot;
|
||||
DownloadRobotActivity.this.J0();
|
||||
DownloadRobotActivity.this.D0();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
th.printStackTrace();
|
||||
DownloadRobotActivity.this.G0();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DownloadRobotActivity.this.m.b(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
H0();
|
||||
}
|
||||
|
||||
private int a(Map<String, Integer> map, int i, int i2) {
|
||||
if (i2 != 0) {
|
||||
map.put(i + "", Integer.valueOf(i2));
|
||||
}
|
||||
Collection<Integer> values = map.values();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.addAll(values);
|
||||
int i3 = 0;
|
||||
for (int i4 = 0; i4 < arrayList.size(); i4++) {
|
||||
i3 += ((Integer) arrayList.get(i4)).intValue();
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
private void a(final int i, final int i2, final int i3) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("resultCode", "1-1");
|
||||
JimuAnalytics.b().a(Constant.DataStatistics.APP_PACKAGE_DOWNLOAD, hashMap);
|
||||
LogUtils.c("下载成功数据上报回调");
|
||||
if (i == 0) {
|
||||
E0();
|
||||
} else {
|
||||
this.o = 0;
|
||||
new Thread(new Runnable() { // from class: com.ubt.jimu.pack.view.DownloadRobotActivity.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
int i4 = i2;
|
||||
for (int i5 = 0; i5 < i; i5++) {
|
||||
i4++;
|
||||
DownloadRobotActivity downloadRobotActivity = DownloadRobotActivity.this;
|
||||
downloadRobotActivity.o = i4 / i3;
|
||||
downloadRobotActivity.pgDownloadModel.setProgress(i4);
|
||||
DownloadRobotActivity.this.tvProgress.post(new Runnable() { // from class: com.ubt.jimu.pack.view.DownloadRobotActivity.3.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
DownloadRobotActivity.this.tvProgress.setText(DownloadRobotActivity.this.o + "%");
|
||||
}
|
||||
});
|
||||
try {
|
||||
Thread.sleep(5L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
DownloadRobotActivity.this.E0();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DownloadRobotActivity_ViewBinding implements Unbinder {
|
||||
private DownloadRobotActivity b;
|
||||
|
||||
public DownloadRobotActivity_ViewBinding(DownloadRobotActivity downloadRobotActivity, View view) {
|
||||
this.b = downloadRobotActivity;
|
||||
downloadRobotActivity.im_download_image = (ImageView) Utils.b(view, R.id.im_download_image, "field 'im_download_image'", ImageView.class);
|
||||
downloadRobotActivity.tvModelDescription = (TextView) Utils.b(view, R.id.tvModelDescription, "field 'tvModelDescription'", TextView.class);
|
||||
downloadRobotActivity.tvProgress = (TextView) Utils.b(view, R.id.tvProgress, "field 'tvProgress'", TextView.class);
|
||||
downloadRobotActivity.pgDownloadModel = (ProgressBar) Utils.b(view, R.id.pgDownloadModel, "field 'pgDownloadModel'", ProgressBar.class);
|
||||
downloadRobotActivity.rl_load_error = (RelativeLayout) Utils.b(view, R.id.rl_load_error, "field 'rl_load_error'", RelativeLayout.class);
|
||||
downloadRobotActivity.viewStub_download_error = (ViewStub) Utils.b(view, R.id.viewStub_download_error, "field 'viewStub_download_error'", ViewStub.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
DownloadRobotActivity downloadRobotActivity = this.b;
|
||||
if (downloadRobotActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
downloadRobotActivity.im_download_image = null;
|
||||
downloadRobotActivity.tvModelDescription = null;
|
||||
downloadRobotActivity.tvProgress = null;
|
||||
downloadRobotActivity.pgDownloadModel = null;
|
||||
downloadRobotActivity.rl_load_error = null;
|
||||
downloadRobotActivity.viewStub_download_error = null;
|
||||
}
|
||||
}
|
334
sources/com/ubt/jimu/pack/view/DownloadRobotByRobotActivity.java
Normal file
334
sources/com/ubt/jimu/pack/view/DownloadRobotByRobotActivity.java
Normal file
@@ -0,0 +1,334 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.SuperActivity;
|
||||
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.download.Downloader;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.discover.CourseRepository;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubt.jimu.utils.RxSchedulers;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DownloadRobotByRobotActivity extends SuperActivity implements Downloader.IDownloadJimuRobotListener, View.OnClickListener {
|
||||
private Robot a;
|
||||
private DownloadTask b;
|
||||
private Map<String, Integer> c;
|
||||
private View g;
|
||||
ImageView im_download_image;
|
||||
int j;
|
||||
ProgressBar pgDownloadModel;
|
||||
RelativeLayout rl_load_error;
|
||||
TextView tvModelDescription;
|
||||
TextView tvProgress;
|
||||
ViewStub viewStub_download_error;
|
||||
private int d = 0;
|
||||
private int e = 0;
|
||||
private int f = 0;
|
||||
private CompositeDisposable h = new CompositeDisposable();
|
||||
private volatile boolean i = false;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void D0() {
|
||||
JimuSimpleDialog.showWifiOnlyDialog(this, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.pack.view.d
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
DownloadRobotByRobotActivity.b(dialogInterface, i);
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.pack.view.c
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
DownloadRobotByRobotActivity.this.a(dialogInterface, i);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void E0() {
|
||||
DownloadTask downloadTask = this.b;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
}
|
||||
if (this.i) {
|
||||
setResult(100);
|
||||
} else {
|
||||
setResult(-100);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private void F0() {
|
||||
View view = this.g;
|
||||
if (view != null) {
|
||||
view.setVisibility(0);
|
||||
return;
|
||||
}
|
||||
this.g = this.viewStub_download_error.inflate();
|
||||
((TextView) this.g.findViewById(R.id.tv_cancel_download)).setOnClickListener(this);
|
||||
((TextView) this.g.findViewById(R.id.tv_re_download)).setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void G0() {
|
||||
Robot robot = this.a;
|
||||
if (robot == null) {
|
||||
return;
|
||||
}
|
||||
c(robot);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void H0() {
|
||||
E0();
|
||||
}
|
||||
|
||||
private void I0() {
|
||||
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(this.a.getFilePath());
|
||||
a.a(new RequestListener<Drawable>() { // from class: com.ubt.jimu.pack.view.DownloadRobotByRobotActivity.2
|
||||
@Override // com.bumptech.glide.request.RequestListener
|
||||
public boolean a(GlideException glideException, Object obj, Target<Drawable> target, boolean z) {
|
||||
DownloadRobotByRobotActivity.this.rl_load_error.setVisibility(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.request.RequestListener
|
||||
public boolean a(Drawable drawable, Object obj, Target<Drawable> target, DataSource dataSource, boolean z) {
|
||||
DownloadRobotByRobotActivity.this.rl_load_error.setVisibility(8);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
a.a(new RequestOptions().b(R.drawable.image_load_error).a(R.drawable.image_load_error).b());
|
||||
a.a(this.im_download_image);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void J0() {
|
||||
I0();
|
||||
this.tvModelDescription.setText(this.a.getModelDescriptionLangeage());
|
||||
}
|
||||
|
||||
static /* synthetic */ void b(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initData() {
|
||||
Intent intent = getIntent();
|
||||
this.a = (Robot) intent.getSerializableExtra(Constant.SelectRobot.DOWNLAOD_ROBOT_DATA_KEY);
|
||||
long longExtra = intent.getLongExtra(Constant.Base.ACTIVITY_START_ROBOT, -1L);
|
||||
if (this.a != null) {
|
||||
J0();
|
||||
D0();
|
||||
} else if (longExtra > -1) {
|
||||
b(longExtra);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initEvent() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
public View initView() {
|
||||
return View.inflate(this, R.layout.activity_download_robot, null);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.tv_cancel_download) {
|
||||
View view2 = this.g;
|
||||
if (view2 != null) {
|
||||
view2.setVisibility(8);
|
||||
}
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (id != R.id.tv_re_download) {
|
||||
return;
|
||||
}
|
||||
View view3 = this.g;
|
||||
if (view3 != null) {
|
||||
view3.setVisibility(8);
|
||||
}
|
||||
Observable.timer(500L, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Consumer<Long>() { // from class: com.ubt.jimu.pack.view.DownloadRobotByRobotActivity.4
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void accept(Long l) throws Exception {
|
||||
DownloadRobotByRobotActivity.this.D0();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
this.h.a();
|
||||
DownloadTask downloadTask = this.b;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onFailed() {
|
||||
this.i = false;
|
||||
F0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onPrepareStart() {
|
||||
this.c = new HashMap();
|
||||
this.d = 0;
|
||||
this.e = 0;
|
||||
this.f = 0;
|
||||
NetWorkUtil.b(JimuApplication.l());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
this.f = i;
|
||||
int a = a(this.c, i2, i3);
|
||||
int i4 = a / i;
|
||||
int i5 = i * 100;
|
||||
this.d = i5 - a;
|
||||
this.e = a;
|
||||
this.tvProgress.setText(i4 + "%");
|
||||
this.pgDownloadModel.setMax(i5);
|
||||
this.pgDownloadModel.setProgress(a);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onSuccess() {
|
||||
this.i = true;
|
||||
a(this.d, this.e, this.f);
|
||||
}
|
||||
|
||||
private void b(long j) {
|
||||
CourseRepository.a(this, j).compose(RxSchedulers.a()).subscribe(new Observer<Robot>() { // from class: com.ubt.jimu.pack.view.DownloadRobotByRobotActivity.1
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(Robot robot) {
|
||||
if (robot == null) {
|
||||
DownloadRobotByRobotActivity.this.i = false;
|
||||
DownloadRobotByRobotActivity.this.H0();
|
||||
} else {
|
||||
DownloadRobotByRobotActivity.this.a = robot;
|
||||
DownloadRobotByRobotActivity.this.J0();
|
||||
DownloadRobotByRobotActivity.this.D0();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
DownloadRobotByRobotActivity.this.i = false;
|
||||
th.printStackTrace();
|
||||
DownloadRobotByRobotActivity.this.H0();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DownloadRobotByRobotActivity.this.h.b(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void c(Robot robot) {
|
||||
this.b = Downloader.downloadJimuRobot(robot, this);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
G0();
|
||||
}
|
||||
|
||||
private int a(Map<String, Integer> map, int i, int i2) {
|
||||
if (i2 != 0) {
|
||||
map.put(i + "", Integer.valueOf(i2));
|
||||
}
|
||||
Collection<Integer> values = map.values();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.addAll(values);
|
||||
int i3 = 0;
|
||||
for (int i4 = 0; i4 < arrayList.size(); i4++) {
|
||||
i3 += ((Integer) arrayList.get(i4)).intValue();
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
private void a(final int i, final int i2, final int i3) {
|
||||
if (i == 0) {
|
||||
E0();
|
||||
} else {
|
||||
this.j = 0;
|
||||
new Thread(new Runnable() { // from class: com.ubt.jimu.pack.view.DownloadRobotByRobotActivity.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
int i4 = i2;
|
||||
for (int i5 = 0; i5 < i; i5++) {
|
||||
i4++;
|
||||
DownloadRobotByRobotActivity.this.j = i4 / i3;
|
||||
LogUtils.c("progress:" + i4 + " ratio:" + DownloadRobotByRobotActivity.this.j);
|
||||
DownloadRobotByRobotActivity.this.pgDownloadModel.setProgress(i4);
|
||||
DownloadRobotByRobotActivity.this.tvProgress.post(new Runnable() { // from class: com.ubt.jimu.pack.view.DownloadRobotByRobotActivity.3.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
DownloadRobotByRobotActivity.this.tvProgress.setText(DownloadRobotByRobotActivity.this.j + "%");
|
||||
}
|
||||
});
|
||||
try {
|
||||
Thread.sleep(5L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
DownloadRobotByRobotActivity.this.E0();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DownloadRobotByRobotActivity_ViewBinding implements Unbinder {
|
||||
private DownloadRobotByRobotActivity b;
|
||||
|
||||
public DownloadRobotByRobotActivity_ViewBinding(DownloadRobotByRobotActivity downloadRobotByRobotActivity, View view) {
|
||||
this.b = downloadRobotByRobotActivity;
|
||||
downloadRobotByRobotActivity.im_download_image = (ImageView) Utils.b(view, R.id.im_download_image, "field 'im_download_image'", ImageView.class);
|
||||
downloadRobotByRobotActivity.tvModelDescription = (TextView) Utils.b(view, R.id.tvModelDescription, "field 'tvModelDescription'", TextView.class);
|
||||
downloadRobotByRobotActivity.tvProgress = (TextView) Utils.b(view, R.id.tvProgress, "field 'tvProgress'", TextView.class);
|
||||
downloadRobotByRobotActivity.pgDownloadModel = (ProgressBar) Utils.b(view, R.id.pgDownloadModel, "field 'pgDownloadModel'", ProgressBar.class);
|
||||
downloadRobotByRobotActivity.rl_load_error = (RelativeLayout) Utils.b(view, R.id.rl_load_error, "field 'rl_load_error'", RelativeLayout.class);
|
||||
downloadRobotByRobotActivity.viewStub_download_error = (ViewStub) Utils.b(view, R.id.viewStub_download_error, "field 'viewStub_download_error'", ViewStub.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
DownloadRobotByRobotActivity downloadRobotByRobotActivity = this.b;
|
||||
if (downloadRobotByRobotActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
downloadRobotByRobotActivity.im_download_image = null;
|
||||
downloadRobotByRobotActivity.tvModelDescription = null;
|
||||
downloadRobotByRobotActivity.tvProgress = null;
|
||||
downloadRobotByRobotActivity.pgDownloadModel = null;
|
||||
downloadRobotByRobotActivity.rl_load_error = null;
|
||||
downloadRobotByRobotActivity.viewStub_download_error = null;
|
||||
}
|
||||
}
|
12
sources/com/ubt/jimu/pack/view/IBarCodeScanView.java
Normal file
12
sources/com/ubt/jimu/pack/view/IBarCodeScanView.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface IBarCodeScanView {
|
||||
void a(Package r1);
|
||||
|
||||
void k0();
|
||||
|
||||
void o();
|
||||
}
|
278
sources/com/ubt/jimu/pack/view/PackSelectActivity.java
Normal file
278
sources/com/ubt/jimu/pack/view/PackSelectActivity.java
Normal file
@@ -0,0 +1,278 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.SuperActivity;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.base.dialog.LoadingDialog;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.base.event.SelectPackEvent;
|
||||
import com.ubt.jimu.discover.view.CourseListActivity;
|
||||
import com.ubt.jimu.pack.adapter.PackSelectAdapter;
|
||||
import com.ubt.jimu.pack.contract.PackageContract$Presenter;
|
||||
import com.ubt.jimu.pack.contract.PackageContract$View;
|
||||
import com.ubt.jimu.pack.presenter.PackagePresenter;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.widgets.LoadStateView;
|
||||
import com.ubt.jimu.widgets.NavigationBarView;
|
||||
import com.ubtech.permission.JimuPermissionRequest;
|
||||
import com.ubtech.permission.PermissionRequestListener;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PackSelectActivity extends SuperActivity implements PackageContract$View, PackSelectAdapter.ListItemOnClickListener, LoadStateView.RetryListener {
|
||||
RelativeLayout a;
|
||||
private PackagePresenter b;
|
||||
private PackSelectAdapter c;
|
||||
private int d;
|
||||
private long e = 0;
|
||||
private Package f;
|
||||
private LoadingDialog g;
|
||||
LoadStateView load_view;
|
||||
RecyclerView rv_pack_content;
|
||||
|
||||
private void D0() {
|
||||
RelativeLayout relativeLayout = this.a;
|
||||
if (relativeLayout != null) {
|
||||
relativeLayout.setVisibility(8);
|
||||
new SharePreferenceHelper(false).put(SharePreferenceHelper.KEY_SCAN_TIPS_READ, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void E0() {
|
||||
LoadingDialog loadingDialog = this.g;
|
||||
if (loadingDialog != null) {
|
||||
if (loadingDialog.isShowing()) {
|
||||
this.g.dismiss();
|
||||
}
|
||||
this.g = null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void F0() {
|
||||
JimuPermissionRequest.a((Context) this, new PermissionRequestListener() { // from class: com.ubt.jimu.pack.view.PackSelectActivity.2
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onDenied() {
|
||||
}
|
||||
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onGranted() {
|
||||
ARouter.b().a("/package/scan").a(PackSelectActivity.this, 11);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void l(int i) {
|
||||
LoadingDialog loadingDialog = this.g;
|
||||
if (loadingDialog != null) {
|
||||
loadingDialog.updateProgress(i + "%");
|
||||
}
|
||||
}
|
||||
|
||||
private void o(String str) {
|
||||
if (isFinishing() || isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
LoadingDialog loadingDialog = this.g;
|
||||
if (loadingDialog != null) {
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
this.g = new LoadingDialog(this);
|
||||
this.g.updateProgress(str);
|
||||
this.g.show();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void C() {
|
||||
E0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void K() {
|
||||
this.load_view.a(LoadStateView.LoadState.SUCCEED);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void W() {
|
||||
o("");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void X() {
|
||||
this.load_view.a(LoadStateView.LoadState.FAILURE);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void setPresenter(PackageContract$Presenter packageContract$Presenter) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void b(DownloadTask downloadTask) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void h(List<Package> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
this.load_view.a(LoadStateView.LoadState.EMPTY);
|
||||
}
|
||||
this.c.a(list);
|
||||
this.rv_pack_content.scheduleLayoutAnimation();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initData() {
|
||||
Intent intent = getIntent();
|
||||
this.d = intent.getIntExtra(Constant.SelectRobot.BUNDLE_KEY_FROM, 0);
|
||||
this.e = intent.getLongExtra(Constant.SelectRobot.PACKAGEID_KEY, 0L);
|
||||
this.b = new PackagePresenter(this);
|
||||
this.rv_pack_content.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(this, R.anim.recyclerview_layoutanimation));
|
||||
this.rv_pack_content.setLayoutManager(new LinearLayoutManager(this, 0, false));
|
||||
this.c = new PackSelectAdapter(this, this.e);
|
||||
this.rv_pack_content.setAdapter(this.c);
|
||||
int i = this.d;
|
||||
if (i == 10) {
|
||||
this.b.c();
|
||||
} else if (i == 11) {
|
||||
this.b.b();
|
||||
} else {
|
||||
this.b.d();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initEvent() {
|
||||
this.c.a(this);
|
||||
this.load_view.setRetryListener(this);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
public View initView() {
|
||||
getWindow().requestFeature(12);
|
||||
View inflate = View.inflate(this, R.layout.activity_pack_select, null);
|
||||
NavigationBarView navigationBarView = (NavigationBarView) inflate.findViewById(R.id.nbv_bar);
|
||||
navigationBarView.setRightIcon(R.drawable.scan_icon);
|
||||
navigationBarView.setListener(new NavigationBarView.OnActionClickListener.Stub() { // from class: com.ubt.jimu.pack.view.PackSelectActivity.1
|
||||
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
|
||||
public void onRightClick(View view) {
|
||||
PackSelectActivity.this.F0();
|
||||
}
|
||||
});
|
||||
if (!new SharePreferenceHelper(false).getBoolean(SharePreferenceHelper.KEY_SCAN_TIPS_READ, false).booleanValue()) {
|
||||
this.a = (RelativeLayout) inflate.findViewById(R.id.scan_tips);
|
||||
this.a.setVisibility(0);
|
||||
((ImageView) inflate.findViewById(R.id.iv_tips_close)).setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.pack.view.e
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
PackSelectActivity.this.a(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
return inflate;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onActivityResult(int i, int i2, Intent intent) {
|
||||
Package r13;
|
||||
super.onActivityResult(i, i2, intent);
|
||||
if (i == 11 && i2 == -1 && (r13 = (Package) intent.getSerializableExtra("scan_result_package")) != null) {
|
||||
if (9 == this.d) {
|
||||
EventBus.b().b(new SelectPackEvent(r13.getPackageName(), r13.getId(), r13.getPackageImage()));
|
||||
finish();
|
||||
return;
|
||||
} else {
|
||||
RobotSelectActivity.a(this, r13.getPackageName(), r13.getId(), r13.getPackageImage(), 5, 0);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
if (i == 9 && i2 == 8) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.LoadStateView.RetryListener
|
||||
public void p0() {
|
||||
this.b.d();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void v() {
|
||||
this.load_view.a(LoadStateView.LoadState.LOADING);
|
||||
}
|
||||
|
||||
public static void a(Context context, int i, long j) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(context, (Class<?>) PackSelectActivity.class);
|
||||
intent.putExtra(Constant.SelectRobot.BUNDLE_KEY_FROM, i);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGEID_KEY, j);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void h(int i) {
|
||||
l(i);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
D0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.adapter.PackSelectAdapter.ListItemOnClickListener
|
||||
public void a(int i, Package r10) {
|
||||
int i2 = this.d;
|
||||
if (9 == i2) {
|
||||
EventBus.b().b(new SelectPackEvent(r10.getPackageName(), r10.getId(), r10.getPackageImage()));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (i2 == 10) {
|
||||
this.f = r10;
|
||||
SPUtils.a(Constant.SelectRobot.INTERSTELLAR_ADVENTURE_SELECT_PACKAGE_KEY, this.f.getPackageName());
|
||||
this.b.a();
|
||||
return;
|
||||
}
|
||||
if (i2 == 11) {
|
||||
this.f = r10;
|
||||
Postcard a = ARouter.b().a("/game/list");
|
||||
a.a("PACKAGE", r10);
|
||||
a.t();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
RobotSelectActivity.a(this, r10.getPackageName(), r10.getId(), r10.getPackageImage(), this.d, 0);
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put(Constant.DataStatistics.DATA_STATISTICS_PACKAGE_ID, r10.getId() + "");
|
||||
JimuAnalytics.b().a("click_P2_" + (i + 1), hashMap);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.PackageContract$View
|
||||
public void a(Story story) {
|
||||
E0();
|
||||
CourseListActivity.a(this, "AstroBot", story.getStoryIntroVideo(), this.f);
|
||||
finish();
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.LoadStateView;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PackSelectActivity_ViewBinding implements Unbinder {
|
||||
private PackSelectActivity b;
|
||||
|
||||
public PackSelectActivity_ViewBinding(PackSelectActivity packSelectActivity, View view) {
|
||||
this.b = packSelectActivity;
|
||||
packSelectActivity.rv_pack_content = (RecyclerView) Utils.b(view, R.id.rv_pack_content, "field 'rv_pack_content'", RecyclerView.class);
|
||||
packSelectActivity.load_view = (LoadStateView) Utils.b(view, R.id.load_view, "field 'load_view'", LoadStateView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
PackSelectActivity packSelectActivity = this.b;
|
||||
if (packSelectActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
packSelectActivity.rv_pack_content = null;
|
||||
packSelectActivity.load_view = null;
|
||||
}
|
||||
}
|
293
sources/com/ubt/jimu/pack/view/RobotSelectActivity.java
Normal file
293
sources/com/ubt/jimu/pack/view/RobotSelectActivity.java
Normal file
@@ -0,0 +1,293 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.SuperActivity;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.pack.adapter.RobotSelectAdapter;
|
||||
import com.ubt.jimu.pack.contract.RobotContract$Presenter;
|
||||
import com.ubt.jimu.pack.contract.RobotContract$View;
|
||||
import com.ubt.jimu.pack.presenter.RobotPresenter;
|
||||
import com.ubt.jimu.unity.bluetooth.MyUnityListener;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.widgets.LoadStateView;
|
||||
import com.ubt.jimu.widgets.player.UbtPlayer;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class RobotSelectActivity extends SuperActivity implements View.OnClickListener, RobotContract$View, RobotSelectAdapter.ListItemOnClickListener, LoadStateView.RetryListener {
|
||||
private RobotSelectAdapter a;
|
||||
private int b;
|
||||
private int c;
|
||||
private long d;
|
||||
private String e;
|
||||
private String f;
|
||||
private RobotPresenter g;
|
||||
ImageView im_robot_pack;
|
||||
ImageView imgPlayPackageVideo;
|
||||
LoadStateView load_state;
|
||||
RelativeLayout rl_pack_click;
|
||||
RelativeLayout rl_play_package_video;
|
||||
RecyclerView rv_robot_list;
|
||||
|
||||
private void D0() {
|
||||
final Package a = this.g.a(this.d);
|
||||
if (a == null) {
|
||||
this.rl_play_package_video.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(a.getVideoUrl())) {
|
||||
this.rl_play_package_video.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
this.rl_play_package_video.setVisibility(0);
|
||||
this.imgPlayPackageVideo.post(new Runnable() { // from class: com.ubt.jimu.pack.view.j
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
RobotSelectActivity.this.b(a);
|
||||
}
|
||||
});
|
||||
if (a.getPlayed() > 0) {
|
||||
return;
|
||||
}
|
||||
c(a);
|
||||
}
|
||||
|
||||
private void E0() {
|
||||
RobotPresenter robotPresenter = this.g;
|
||||
if (robotPresenter != null) {
|
||||
robotPresenter.unSubscribe();
|
||||
}
|
||||
setResult(8);
|
||||
finish();
|
||||
}
|
||||
|
||||
public static void a(Context context, String str, long j, String str2, int i, int i2) {
|
||||
Intent intent = new Intent(context, (Class<?>) RobotSelectActivity.class);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGEID_KEY, j);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGE_NAME_KEY, str);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGE_IMAGE_PATH_KEY, str2);
|
||||
intent.putExtra(Constant.SelectRobot.BUNDLE_KEY_FROM, i);
|
||||
intent.putExtra(MyUnityListener.CALLER, i2);
|
||||
((Activity) context).startActivityForResult(intent, 9);
|
||||
}
|
||||
|
||||
static /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
|
||||
static /* synthetic */ void b(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
|
||||
private void c(final Package r3) {
|
||||
JimuSimpleDialog.showWifiOnlyDialog(this, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.pack.view.i
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
RobotSelectActivity.b(dialogInterface, i);
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.pack.view.g
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
RobotSelectActivity.this.a(r3, dialogInterface, i);
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.RobotContract$View
|
||||
public void Z() {
|
||||
if (this.b == 7) {
|
||||
this.rl_pack_click.setVisibility(8);
|
||||
} else {
|
||||
this.rl_pack_click.setVisibility(0);
|
||||
}
|
||||
this.load_state.a(LoadStateView.LoadState.SUCCEED);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void setPresenter(RobotContract$Presenter robotContract$Presenter) {
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(Package r2) {
|
||||
RequestBuilder<Drawable> a = Glide.a(this.imgPlayPackageVideo).a(r2.getVideoThumbnail());
|
||||
a.a(new RequestOptions().b());
|
||||
a.a(this.imgPlayPackageVideo);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initData() {
|
||||
Intent intent = getIntent();
|
||||
this.d = intent.getLongExtra(Constant.SelectRobot.PACKAGEID_KEY, 0L);
|
||||
this.e = intent.getStringExtra(Constant.SelectRobot.PACKAGE_NAME_KEY);
|
||||
this.f = intent.getStringExtra(Constant.SelectRobot.PACKAGE_IMAGE_PATH_KEY);
|
||||
this.b = intent.getIntExtra(Constant.SelectRobot.BUNDLE_KEY_FROM, 0);
|
||||
this.c = intent.getIntExtra(MyUnityListener.CALLER, 0);
|
||||
this.g = new RobotPresenter(this);
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.rv_robot_list.getLayoutParams();
|
||||
if (this.b == 7) {
|
||||
layoutParams.addRule(3, R.id.nbv_bar);
|
||||
this.rl_pack_click.setVisibility(8);
|
||||
this.rl_pack_click.setEnabled(false);
|
||||
this.g.a();
|
||||
} else {
|
||||
layoutParams.addRule(3, this.rl_pack_click.getId());
|
||||
this.g.b(this.d);
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.f)) {
|
||||
Glide.e(JimuApplication.l()).a(this.f).a(this.im_robot_pack);
|
||||
}
|
||||
this.rv_robot_list.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(this, R.anim.recyclerview_layoutanimation));
|
||||
this.rv_robot_list.setLayoutManager(new LinearLayoutManager(this, 0, false));
|
||||
this.a = new RobotSelectAdapter(this);
|
||||
this.rv_robot_list.setAdapter(this.a);
|
||||
D0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initEvent() {
|
||||
this.rl_pack_click.setOnClickListener(this);
|
||||
this.im_robot_pack.setOnClickListener(this);
|
||||
this.a.a(this);
|
||||
this.load_state.setRetryListener(this);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
public View initView() {
|
||||
getWindow().requestFeature(12);
|
||||
return View.inflate(this, R.layout.activity_select_robot_layout, null);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.RobotContract$View
|
||||
public void j(List<Robot> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
this.load_state.a(LoadStateView.LoadState.EMPTY);
|
||||
} else {
|
||||
this.rl_pack_click.setVisibility(0);
|
||||
this.a.a(list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onActivityResult(int i, int i2, Intent intent) {
|
||||
super.onActivityResult(i, i2, intent);
|
||||
if (i == 9 && i2 == 8) {
|
||||
E0();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onBackPressed() {
|
||||
finishAfterTransition();
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.im_robot_pack || id == R.id.rl_pack_click) {
|
||||
PackSelectActivity.a(this, this.b, this.d);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPlayPackageVideo(View view) {
|
||||
Package a = this.g.a(this.d);
|
||||
if (a == null || TextUtils.isEmpty(a.getVideoUrl())) {
|
||||
return;
|
||||
}
|
||||
if (a.getPlayed() > 0) {
|
||||
UbtPlayer.a(this, "", a.getVideoUrl());
|
||||
} else {
|
||||
c(a);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.LoadStateView.RetryListener
|
||||
public void p0() {
|
||||
if (this.b != 7) {
|
||||
this.g.b(this.d);
|
||||
return;
|
||||
}
|
||||
this.rl_pack_click.setVisibility(8);
|
||||
this.rl_pack_click.setEnabled(false);
|
||||
this.g.a();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.RobotContract$View
|
||||
public void q() {
|
||||
this.rl_pack_click.setVisibility(8);
|
||||
this.load_state.a(LoadStateView.LoadState.EMPTY);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.RobotContract$View
|
||||
public void v() {
|
||||
this.rl_pack_click.setVisibility(8);
|
||||
this.load_state.a(LoadStateView.LoadState.LOADING);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.contract.RobotContract$View
|
||||
public void y() {
|
||||
this.load_state.a(LoadStateView.LoadState.FAILURE);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.pack.adapter.RobotSelectAdapter.ListItemOnClickListener
|
||||
public void a(int i, final Robot robot, View view, View view2) {
|
||||
if (robot == null) {
|
||||
return;
|
||||
}
|
||||
if (robot.isAllDownloaded()) {
|
||||
Cache.getInstance().setPackageName(this.e);
|
||||
SPUtils.a(Constant.SelectRobot.INTERSTELLAR_ADVENTURE_SELECT_PACKAGE_KEY, this.e);
|
||||
Cache.getInstance().setRobot(robot);
|
||||
Cache.getInstance().setPackageId(this.d);
|
||||
Cache.getInstance().setPackageImagePath(this.f);
|
||||
UnityActivity.startUnityActivity(this, robot, this.b, this.c, "");
|
||||
E0();
|
||||
return;
|
||||
}
|
||||
JimuSimpleDialog.showWifiOnlyDialog(this, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.pack.view.h
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i2) {
|
||||
RobotSelectActivity.a(dialogInterface, i2);
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.pack.view.f
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i2) {
|
||||
RobotSelectActivity.this.a(robot, dialogInterface, i2);
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(Robot robot, DialogInterface dialogInterface, int i) {
|
||||
DownloadRobotActivity.a(this, robot, this.e, this.d, this.f, this.b, this.c, "");
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(Package r1, DialogInterface dialogInterface, int i) {
|
||||
r1.setPlayed(1);
|
||||
this.g.a(r1);
|
||||
UbtPlayer.a(this, "", r1.getVideoUrl());
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package com.ubt.jimu.pack.view;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.DebouncingOnClickListener;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.LoadStateView;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class RobotSelectActivity_ViewBinding implements Unbinder {
|
||||
private RobotSelectActivity b;
|
||||
private View c;
|
||||
private View d;
|
||||
|
||||
public RobotSelectActivity_ViewBinding(final RobotSelectActivity robotSelectActivity, View view) {
|
||||
this.b = robotSelectActivity;
|
||||
robotSelectActivity.im_robot_pack = (ImageView) Utils.b(view, R.id.im_robot_pack, "field 'im_robot_pack'", ImageView.class);
|
||||
robotSelectActivity.rv_robot_list = (RecyclerView) Utils.b(view, R.id.rv_robot_list, "field 'rv_robot_list'", RecyclerView.class);
|
||||
robotSelectActivity.rl_pack_click = (RelativeLayout) Utils.b(view, R.id.rl_pack_click, "field 'rl_pack_click'", RelativeLayout.class);
|
||||
robotSelectActivity.load_state = (LoadStateView) Utils.b(view, R.id.load_state, "field 'load_state'", LoadStateView.class);
|
||||
robotSelectActivity.rl_play_package_video = (RelativeLayout) Utils.b(view, R.id.rl_play_package_video, "field 'rl_play_package_video'", RelativeLayout.class);
|
||||
View a = Utils.a(view, R.id.img_play_package_video, "field 'imgPlayPackageVideo' and method 'onPlayPackageVideo'");
|
||||
robotSelectActivity.imgPlayPackageVideo = (ImageView) Utils.a(a, R.id.img_play_package_video, "field 'imgPlayPackageVideo'", ImageView.class);
|
||||
this.c = a;
|
||||
a.setOnClickListener(new DebouncingOnClickListener(this) { // from class: com.ubt.jimu.pack.view.RobotSelectActivity_ViewBinding.1
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
robotSelectActivity.onPlayPackageVideo(view2);
|
||||
}
|
||||
});
|
||||
View a2 = Utils.a(view, R.id.img_play, "method 'onPlayPackageVideo'");
|
||||
this.d = a2;
|
||||
a2.setOnClickListener(new DebouncingOnClickListener(this) { // from class: com.ubt.jimu.pack.view.RobotSelectActivity_ViewBinding.2
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
robotSelectActivity.onPlayPackageVideo(view2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
RobotSelectActivity robotSelectActivity = this.b;
|
||||
if (robotSelectActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
robotSelectActivity.im_robot_pack = null;
|
||||
robotSelectActivity.rv_robot_list = null;
|
||||
robotSelectActivity.rl_pack_click = null;
|
||||
robotSelectActivity.load_state = null;
|
||||
robotSelectActivity.rl_play_package_video = null;
|
||||
robotSelectActivity.imgPlayPackageVideo = null;
|
||||
this.c.setOnClickListener(null);
|
||||
this.c = null;
|
||||
this.d.setOnClickListener(null);
|
||||
this.d = null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user