Initial commit
This commit is contained in:
278
sources/com/ubt/jimu/ar/view/GameListActivity.java
Normal file
278
sources/com/ubt/jimu/ar/view/GameListActivity.java
Normal file
@@ -0,0 +1,278 @@
|
||||
package com.ubt.jimu.ar.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.AnimationSet;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.ar.contract.GameListContract$Presenter;
|
||||
import com.ubt.jimu.ar.contract.GameListContract$View;
|
||||
import com.ubt.jimu.ar.presenter.GameListPresenterImp;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.widgets.NavigationBarView;
|
||||
import com.ubtech.view.dialog.SimpleDialog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GameListActivity extends BaseActivity implements GameListContract$View, View.OnClickListener {
|
||||
private NavigationBarView a;
|
||||
private ImageView b;
|
||||
private ImageView c;
|
||||
private ImageView d;
|
||||
private ImageView e;
|
||||
private View f;
|
||||
private ImageView g;
|
||||
private TextView h;
|
||||
private RelativeLayout i;
|
||||
private GameListContract$Presenter j;
|
||||
private AnimationDrawable k;
|
||||
private Handler l;
|
||||
public Package m;
|
||||
private volatile int o;
|
||||
private DownloadTask q;
|
||||
private Runnable n = new Runnable() { // from class: com.ubt.jimu.ar.view.GameListActivity.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
GameListActivity.this.F0();
|
||||
}
|
||||
};
|
||||
private boolean p = false;
|
||||
|
||||
private void E0() {
|
||||
this.j.a("dujiaoshou");
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void F0() {
|
||||
AnimationSet animationSet = new AnimationSet(true);
|
||||
AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
|
||||
alphaAnimation.setDuration(5000L);
|
||||
animationSet.addAnimation(alphaAnimation);
|
||||
animationSet.setFillAfter(true);
|
||||
this.i.startAnimation(animationSet);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
setContentView(R.layout.activity_ar_game_list);
|
||||
this.a = (NavigationBarView) findViewById(R.id.nbv_bar);
|
||||
this.a.setTitleColor(-1);
|
||||
this.b = (ImageView) findViewById(R.id.iv_butterfly1);
|
||||
this.c = (ImageView) findViewById(R.id.iv_butterfly2);
|
||||
this.d = (ImageView) findViewById(R.id.iv_butterfly3);
|
||||
this.e = (ImageView) findViewById(R.id.iv_butterfly4);
|
||||
findViewById(R.id.img_rainbow_world).setOnClickListener(this);
|
||||
findViewById(R.id.img_flower_world).setOnClickListener(this);
|
||||
this.f = findViewById(R.id.fl_download);
|
||||
this.f.setVisibility(8);
|
||||
this.g = (ImageView) findViewById(R.id.iv_loading);
|
||||
this.h = (TextView) findViewById(R.id.tv_progress);
|
||||
this.i = (RelativeLayout) findViewById(R.id.rl_warning);
|
||||
}
|
||||
|
||||
public void D0() {
|
||||
new SimpleDialog.Builder(this).d(R.string.ok).b(new DialogInterface.OnClickListener(this) { // from class: com.ubt.jimu.ar.view.GameListActivity.5
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).a((CharSequence) getString(R.string.device_not_support_ar)).a().show();
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.img_flower_world) {
|
||||
this.o = 2;
|
||||
if (this.j.h()) {
|
||||
E0();
|
||||
return;
|
||||
} else {
|
||||
D0();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (id != R.id.img_rainbow_world) {
|
||||
Log.e(this.TAG, "");
|
||||
return;
|
||||
}
|
||||
this.o = 1;
|
||||
if (this.j.h()) {
|
||||
E0();
|
||||
} else {
|
||||
D0();
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
initView();
|
||||
this.j = new GameListPresenterImp(this);
|
||||
this.l = new Handler(getMainLooper());
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
this.m = (Package) intent.getSerializableExtra("PACKAGE");
|
||||
}
|
||||
if (this.m == null) {
|
||||
this.i.setVisibility(8);
|
||||
} else {
|
||||
this.i.setVisibility(0);
|
||||
this.l.postDelayed(this.n, 5000L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onDestroy() {
|
||||
DownloadTask downloadTask = this.q;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
this.q = null;
|
||||
}
|
||||
this.b.clearAnimation();
|
||||
this.c.clearAnimation();
|
||||
this.d.clearAnimation();
|
||||
this.e.clearAnimation();
|
||||
this.i.clearAnimation();
|
||||
this.l.removeCallbacks(this.n);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void onDownloadFail() {
|
||||
this.p = false;
|
||||
toastError(getString(R.string.tips_download_failed));
|
||||
View view = this.f;
|
||||
if (view != null) {
|
||||
view.setVisibility(8);
|
||||
}
|
||||
this.g.clearAnimation();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (i == 4 && this.p) {
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
if (i == 1) {
|
||||
this.h.setText(i3 + "%");
|
||||
return;
|
||||
}
|
||||
int i4 = 100 / i;
|
||||
int i5 = (i2 * i4) - (((100 - i3) * i4) / 100);
|
||||
this.h.setText(i5 + "%");
|
||||
Log.i(this.TAG, "percent:" + i5);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void onStartDownload() {
|
||||
this.p = true;
|
||||
this.f.setVisibility(0);
|
||||
RotateAnimation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
|
||||
rotateAnimation.setRepeatCount(-1);
|
||||
rotateAnimation.setDuration(800L);
|
||||
rotateAnimation.setInterpolator(new LinearInterpolator());
|
||||
rotateAnimation.setRepeatMode(1);
|
||||
this.g.startAnimation(rotateAnimation);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.Window.Callback
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
super.onWindowFocusChanged(z);
|
||||
if (z) {
|
||||
this.k = (AnimationDrawable) this.b.getDrawable();
|
||||
this.k.start();
|
||||
this.k = (AnimationDrawable) this.e.getDrawable();
|
||||
this.k.start();
|
||||
this.l.postDelayed(new Runnable() { // from class: com.ubt.jimu.ar.view.GameListActivity.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
GameListActivity gameListActivity = GameListActivity.this;
|
||||
gameListActivity.k = (AnimationDrawable) gameListActivity.c.getDrawable();
|
||||
GameListActivity.this.k.start();
|
||||
GameListActivity gameListActivity2 = GameListActivity.this;
|
||||
gameListActivity2.k = (AnimationDrawable) gameListActivity2.d.getDrawable();
|
||||
GameListActivity.this.k.start();
|
||||
}
|
||||
}, 300L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void b(Robot robot) {
|
||||
Package r0;
|
||||
if (robot != null && (r0 = this.m) != null) {
|
||||
this.j.a(r0, robot);
|
||||
}
|
||||
int i = this.o;
|
||||
if (i == 1) {
|
||||
d(robot);
|
||||
} else if (i != 2) {
|
||||
Log.e(this.TAG, "Invalid gameId, do nothing");
|
||||
} else {
|
||||
c(robot);
|
||||
}
|
||||
}
|
||||
|
||||
public void c(final Robot robot) {
|
||||
runOnUiThread(new Runnable() { // from class: com.ubt.jimu.ar.view.GameListActivity.4
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
UnityActivity.gotoFlowerWorldGamePage(GameListActivity.this, robot);
|
||||
GameListActivity.this.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void d(final Robot robot) {
|
||||
runOnUiThread(new Runnable() { // from class: com.ubt.jimu.ar.view.GameListActivity.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
UnityActivity.gotoRainbowWorldGamePage(GameListActivity.this, robot);
|
||||
GameListActivity.this.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void a(DownloadTask downloadTask) {
|
||||
this.q = downloadTask;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void a(Robot robot) {
|
||||
if (this.q != null) {
|
||||
this.q = null;
|
||||
}
|
||||
View view = this.f;
|
||||
if (view != null) {
|
||||
view.setVisibility(8);
|
||||
this.g.clearAnimation();
|
||||
}
|
||||
b(robot);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public Context b() {
|
||||
return getApplicationContext();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user