Initial commit
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
package com.ubt.jimu.discover.view;
|
||||
|
||||
import android.app.DialogFragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.ActionResult;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.discover.IAccomplishEventListener;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubtech.utils.DensityUtils;
|
||||
import com.ubtech.view.widget.UButton;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AccomplishWithoutUserDialog extends DialogFragment implements View.OnClickListener {
|
||||
private Course a;
|
||||
private ActionResult b;
|
||||
private IAccomplishEventListener c;
|
||||
private Button d;
|
||||
private Button e;
|
||||
private UButton f;
|
||||
private LinearLayout g;
|
||||
private TextView h;
|
||||
private TextView i;
|
||||
private FrameLayout j;
|
||||
private TextView k;
|
||||
private TextView l;
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btn_play_continue) {
|
||||
IAccomplishEventListener iAccomplishEventListener = this.c;
|
||||
if (iAccomplishEventListener != null) {
|
||||
iAccomplishEventListener.onPlayContinue(this.a);
|
||||
}
|
||||
CourseListActivity.start(getActivity(), "AstroBot");
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
if (id == R.id.btn_play_again) {
|
||||
IAccomplishEventListener iAccomplishEventListener2 = this.c;
|
||||
if (iAccomplishEventListener2 != null) {
|
||||
iAccomplishEventListener2.onPlayAgain(this.a);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.DialogFragment, android.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setStyle(0, android.R.style.Theme.Translucent.NoTitleBar.Fullscreen);
|
||||
Bundle arguments = getArguments();
|
||||
this.a = (Course) arguments.getSerializable("course");
|
||||
this.b = (ActionResult) arguments.getSerializable(UnityActivity.RESULT);
|
||||
}
|
||||
|
||||
@Override // android.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
View inflate = layoutInflater.inflate(R.layout.accomplish_without_user_dialog, viewGroup, false);
|
||||
this.d = (Button) inflate.findViewById(R.id.btn_play_continue);
|
||||
this.e = (Button) inflate.findViewById(R.id.btn_play_again);
|
||||
this.g = (LinearLayout) inflate.findViewById(R.id.layout_exp_score);
|
||||
this.h = (TextView) inflate.findViewById(R.id.expTextView);
|
||||
this.k = (TextView) inflate.findViewById(R.id.expTipTextView);
|
||||
this.i = (TextView) inflate.findViewById(R.id.scoreTextView);
|
||||
this.l = (TextView) inflate.findViewById(R.id.scoreTipTextView);
|
||||
this.f = (UButton) inflate.findViewById(R.id.bsl_play);
|
||||
this.f.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.discover.view.AccomplishWithoutUserDialog.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (AccomplishWithoutUserDialog.this.c != null) {
|
||||
AccomplishWithoutUserDialog.this.c.onPlayContinue(AccomplishWithoutUserDialog.this.a);
|
||||
}
|
||||
CourseListActivity.start(AccomplishWithoutUserDialog.this.getActivity(), "AstroBot");
|
||||
AccomplishWithoutUserDialog.this.dismiss();
|
||||
}
|
||||
});
|
||||
this.d.setOnClickListener(this);
|
||||
this.e.setOnClickListener(this);
|
||||
this.j = (FrameLayout) inflate.findViewById(R.id.layout_center_card);
|
||||
int[] a = DensityUtils.a(inflate.getContext());
|
||||
int min = Math.min(a[0], a[1]);
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.j.getLayoutParams();
|
||||
layoutParams.height = (int) (min * (JimuApplication.l().i() ? 0.55f : 0.75f));
|
||||
layoutParams.width = (int) (layoutParams.height * 1.34d);
|
||||
a(this.b);
|
||||
return inflate;
|
||||
}
|
||||
|
||||
@Override // android.app.Fragment
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // android.app.Fragment
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override // android.app.Fragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
public void a(IAccomplishEventListener iAccomplishEventListener) {
|
||||
this.c = iAccomplishEventListener;
|
||||
}
|
||||
|
||||
public static AccomplishWithoutUserDialog a(Course course) {
|
||||
AccomplishWithoutUserDialog accomplishWithoutUserDialog = new AccomplishWithoutUserDialog();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("course", course);
|
||||
accomplishWithoutUserDialog.setArguments(bundle);
|
||||
accomplishWithoutUserDialog.setCancelable(false);
|
||||
return accomplishWithoutUserDialog;
|
||||
}
|
||||
|
||||
public static AccomplishWithoutUserDialog a(Course course, ActionResult actionResult) {
|
||||
AccomplishWithoutUserDialog accomplishWithoutUserDialog = new AccomplishWithoutUserDialog();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("course", course);
|
||||
bundle.putSerializable(UnityActivity.RESULT, actionResult);
|
||||
accomplishWithoutUserDialog.setArguments(bundle);
|
||||
accomplishWithoutUserDialog.setCancelable(false);
|
||||
return accomplishWithoutUserDialog;
|
||||
}
|
||||
|
||||
public void a(ActionResult actionResult) {
|
||||
if (actionResult == null || actionResult.getCourse() == null) {
|
||||
return;
|
||||
}
|
||||
LinearLayout linearLayout = this.g;
|
||||
if (linearLayout != null) {
|
||||
linearLayout.setVisibility(0);
|
||||
}
|
||||
ActionResult.AbValue course = actionResult.getCourse();
|
||||
if (course == null) {
|
||||
return;
|
||||
}
|
||||
if (this.h != null && course.getExp() > 0) {
|
||||
this.h.setVisibility(0);
|
||||
this.k.setVisibility(0);
|
||||
this.h.setText(String.valueOf(course.getExp()));
|
||||
}
|
||||
if (this.i == null || course.getScore() <= 0) {
|
||||
return;
|
||||
}
|
||||
this.l.setVisibility(0);
|
||||
this.i.setVisibility(0);
|
||||
this.i.setText(String.valueOf(course.getScore()));
|
||||
}
|
||||
|
||||
public void a(FragmentManager fragmentManager, String str, ActionResult actionResult) {
|
||||
super.show(fragmentManager, str);
|
||||
if (actionResult == null || actionResult.getCourse() == null) {
|
||||
return;
|
||||
}
|
||||
LinearLayout linearLayout = this.g;
|
||||
if (linearLayout != null) {
|
||||
linearLayout.setVisibility(0);
|
||||
}
|
||||
ActionResult.AbValue course = actionResult.getCourse();
|
||||
TextView textView = this.h;
|
||||
if (textView != null) {
|
||||
textView.setVisibility(0);
|
||||
this.k.setVisibility(0);
|
||||
this.h.setText(String.valueOf(course.getExp()));
|
||||
}
|
||||
if (this.i != null) {
|
||||
this.l.setVisibility(0);
|
||||
this.i.setVisibility(0);
|
||||
this.i.setText(String.valueOf(course.getScore()));
|
||||
}
|
||||
}
|
||||
}
|
508
sources/com/ubt/jimu/discover/view/CourseListActivity.java
Normal file
508
sources/com/ubt/jimu/discover/view/CourseListActivity.java
Normal file
@@ -0,0 +1,508 @@
|
||||
package com.ubt.jimu.discover.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.PointF;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearSmoothScroller;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.cache.Constants;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.discover.contract.CourseContract$Presenter;
|
||||
import com.ubt.jimu.discover.contract.CourseContract$View;
|
||||
import com.ubt.jimu.discover.presenter.CoursePresenter;
|
||||
import com.ubt.jimu.discover.view.adapter.CourseListAdapter;
|
||||
import com.ubt.jimu.discover.view.adapter.ScaleInAnimatorAdapter;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.user.view.LoginActivity;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.widgets.player.UbtPlayer;
|
||||
import com.ubtech.utils.AndroidVersionCheckUtils;
|
||||
import com.ubtech.utils.PermissionHelper;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseListActivity extends BaseActivity implements CourseContract$View {
|
||||
private static final String p = CourseListActivity.class.getSimpleName();
|
||||
private static String q;
|
||||
View a;
|
||||
ImageView b;
|
||||
TextView c;
|
||||
RecyclerView courseRecyclerView;
|
||||
Package d;
|
||||
private CourseListAdapter f;
|
||||
private ScaleInAnimatorAdapter g;
|
||||
private Course h;
|
||||
private CourseContract$Presenter j;
|
||||
private AlertDialog k;
|
||||
private DownloadTask n;
|
||||
View rootView;
|
||||
private List<Course> e = new ArrayList();
|
||||
private String i = "AstroBot";
|
||||
private Handler l = new Handler();
|
||||
private int m = -1;
|
||||
private boolean o = false;
|
||||
|
||||
private class SpeedLayoutManager extends LinearLayoutManager {
|
||||
private float H;
|
||||
|
||||
public SpeedLayoutManager(CourseListActivity courseListActivity, Context context) {
|
||||
super(context);
|
||||
this.H = 0.3f;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public int a(int i, RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
float f = i;
|
||||
int a = super.a((int) (this.H * f), recycler, state);
|
||||
return a == ((int) (this.H * f)) ? i : a;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void a(RecyclerView recyclerView, RecyclerView.State state, int i) {
|
||||
super.a(recyclerView, state, i);
|
||||
LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()) { // from class: com.ubt.jimu.discover.view.CourseListActivity.SpeedLayoutManager.1
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.SmoothScroller
|
||||
public PointF a(int i2) {
|
||||
return SpeedLayoutManager.this.a(i2);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearSmoothScroller
|
||||
protected float a(DisplayMetrics displayMetrics) {
|
||||
return SpeedLayoutManager.this.H / displayMetrics.density;
|
||||
}
|
||||
};
|
||||
linearSmoothScroller.c(i);
|
||||
b(linearSmoothScroller);
|
||||
}
|
||||
|
||||
public void a(float f) {
|
||||
this.H = f;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void D0() {
|
||||
try {
|
||||
SharedPreferences.Editor edit = getSharedPreferences(Constants.FOO_FILE, 0).edit();
|
||||
edit.putBoolean(Constants.KEY_COURSE_ALERT_LOGIN, true);
|
||||
edit.commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void E0() {
|
||||
try {
|
||||
SharedPreferences.Editor edit = getSharedPreferences(Constants.FOO_FILE, 0).edit();
|
||||
edit.putBoolean(Constants.KEY_COURSE_HAVE_PLAY_VIDEO, true);
|
||||
edit.commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void F0() {
|
||||
this.a = findViewById(R.id.downloadViewStub);
|
||||
this.b = (ImageView) findViewById(R.id.iv_loading);
|
||||
this.c = (TextView) findViewById(R.id.tv_progress);
|
||||
this.a.setOnClickListener(new View.OnClickListener(this) { // from class: com.ubt.jimu.discover.view.CourseListActivity.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
}
|
||||
});
|
||||
final SpeedLayoutManager speedLayoutManager = new SpeedLayoutManager(this, this);
|
||||
speedLayoutManager.a(0.65f);
|
||||
speedLayoutManager.k(0);
|
||||
this.courseRecyclerView.setLayoutManager(speedLayoutManager);
|
||||
this.f = new CourseListAdapter(this, this.e);
|
||||
this.f.a(new CourseListAdapter.Callback() { // from class: com.ubt.jimu.discover.view.CourseListActivity.2
|
||||
@Override // com.ubt.jimu.discover.view.adapter.CourseListAdapter.Callback
|
||||
public void a(Course course) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.view.adapter.CourseListAdapter.Callback
|
||||
public void a(Course course, View view, TextView textView, boolean z) {
|
||||
if (Cache.getInstance().getLoginUserIntId() > 0 || CourseListActivity.this.G0()) {
|
||||
CourseListActivity.this.b(course);
|
||||
} else {
|
||||
CourseListActivity.this.a(course);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.g = new ScaleInAnimatorAdapter(this.f);
|
||||
this.courseRecyclerView.setAdapter(this.g);
|
||||
this.courseRecyclerView.a(new RecyclerView.OnScrollListener() { // from class: com.ubt.jimu.discover.view.CourseListActivity.3
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
public void a(RecyclerView recyclerView, int i) {
|
||||
super.a(recyclerView, i);
|
||||
int H = speedLayoutManager.H();
|
||||
speedLayoutManager.J();
|
||||
CourseListActivity.this.e.size();
|
||||
if (i != 0 || CourseListActivity.this.m < H || CourseListActivity.this.m > speedLayoutManager.J()) {
|
||||
return;
|
||||
}
|
||||
if (CourseListActivity.this.m != 0) {
|
||||
CourseListActivity courseListActivity = CourseListActivity.this;
|
||||
courseListActivity.a(speedLayoutManager.c(courseListActivity.m));
|
||||
} else if (((Course) CourseListActivity.this.e.get(0)).getCurrentStatus() == 1) {
|
||||
CourseListActivity.this.a(speedLayoutManager.c(0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
public void a(RecyclerView recyclerView, int i, int i2) {
|
||||
super.a(recyclerView, i, i2);
|
||||
}
|
||||
});
|
||||
Intent intent = getIntent();
|
||||
this.i = intent.getStringExtra("story_name");
|
||||
this.d = (Package) intent.getSerializableExtra("PACKAGE");
|
||||
if (this.d != null) {
|
||||
LogUtils.c("currentPackageName:" + intent.getStringExtra(Constant.SelectRobot.PACKAGE_NAME_KEY));
|
||||
}
|
||||
if (TextUtils.isEmpty(q)) {
|
||||
q = intent.getStringExtra("story_intro_video");
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public boolean G0() {
|
||||
return getSharedPreferences(Constants.FOO_FILE, 0).getBoolean(Constants.KEY_COURSE_ALERT_LOGIN, false);
|
||||
}
|
||||
|
||||
private boolean H0() {
|
||||
return getSharedPreferences(Constants.FOO_FILE, 0).getBoolean(Constants.KEY_COURSE_HAVE_PLAY_VIDEO, false);
|
||||
}
|
||||
|
||||
private void I0() {
|
||||
new CoursePresenter(this, this);
|
||||
}
|
||||
|
||||
private void J0() {
|
||||
if (H0() || TextUtils.isEmpty(q)) {
|
||||
return;
|
||||
}
|
||||
UbtPlayer.a(this, "", q);
|
||||
E0();
|
||||
}
|
||||
|
||||
private void i(final List<Course> list) {
|
||||
this.l.post(new Runnable() { // from class: com.ubt.jimu.discover.view.CourseListActivity.6
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
int i;
|
||||
try {
|
||||
int size = list.size();
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (true) {
|
||||
if (i3 >= size) {
|
||||
break;
|
||||
}
|
||||
if (((Course) list.get(i3)).getCurrentStatus() == 1) {
|
||||
LogUtils.c("pos:" + i3);
|
||||
i2 = i3;
|
||||
break;
|
||||
}
|
||||
i3++;
|
||||
}
|
||||
int i4 = i2 + i2;
|
||||
if (i4 > 0 && i4 <= (i = (size + size) - 1)) {
|
||||
CourseListActivity.this.m = i4;
|
||||
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) CourseListActivity.this.courseRecyclerView.getLayoutManager();
|
||||
int I = linearLayoutManager.I();
|
||||
if (i4 >= I) {
|
||||
int H = I - linearLayoutManager.H();
|
||||
if ((H / 2) + i4 <= i) {
|
||||
i4 += H / 2;
|
||||
}
|
||||
CourseListActivity.this.courseRecyclerView.j(i4);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void start(Context context, String str) {
|
||||
Intent intent = new Intent(context, (Class<?>) CourseListActivity.class);
|
||||
intent.putExtra("story_name", str);
|
||||
intent.putExtra("story_intro_video", q);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$View
|
||||
public String I() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$View
|
||||
public String d0() {
|
||||
Package r0 = this.d;
|
||||
if (r0 == null) {
|
||||
return null;
|
||||
}
|
||||
String packageName = r0.getPackageName();
|
||||
LogUtils.c("packageName:" + packageName);
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public void onBackAction(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
@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.activity_course_list);
|
||||
ButterKnife.a(this);
|
||||
F0();
|
||||
I0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
this.j.unSubscribe();
|
||||
DownloadTask downloadTask = this.n;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
this.n = null;
|
||||
}
|
||||
Handler handler = this.l;
|
||||
if (handler != null) {
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$View
|
||||
public void onDownloadFail() {
|
||||
this.o = false;
|
||||
toastError(getString(R.string.tips_download_failed));
|
||||
View view = this.a;
|
||||
if (view != null) {
|
||||
view.setVisibility(8);
|
||||
}
|
||||
this.b.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.o) {
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$View
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
if (i == 1) {
|
||||
this.c.setText(i3 + "%");
|
||||
return;
|
||||
}
|
||||
int i4 = 100 / i;
|
||||
int i5 = (i2 * i4) - (((100 - i3) * i4) / 100);
|
||||
this.c.setText(i5 + "%");
|
||||
Log.i(p, "percent:" + i5);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (!AndroidVersionCheckUtils.e() || PermissionHelper.a(this, "android.permission.READ_EXTERNAL_STORAGE")) {
|
||||
J0();
|
||||
this.j.subscribe();
|
||||
} else {
|
||||
J0();
|
||||
this.j.o();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$View
|
||||
public void onStartDownload() {
|
||||
this.o = true;
|
||||
this.a.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.b.startAnimation(rotateAnimation);
|
||||
}
|
||||
|
||||
protected void onStoryVideoAction(View view) {
|
||||
if (TextUtils.isEmpty(q)) {
|
||||
return;
|
||||
}
|
||||
UbtPlayer.a(this, "", q);
|
||||
JimuAnalytics.b().a("click_P13_1");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity
|
||||
public void relayout() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$View
|
||||
public void showCourseList(List<Course> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.e.clear();
|
||||
this.e.addAll(list);
|
||||
this.f.notifyDataSetChanged();
|
||||
i(this.e);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void b(Course course) {
|
||||
this.h = course;
|
||||
this.j.d(course.getModelId());
|
||||
}
|
||||
|
||||
public static void a(Context context, Course course, String str, String str2) {
|
||||
Intent intent = new Intent(context, (Class<?>) CourseListActivity.class);
|
||||
intent.putExtra("story_name", str);
|
||||
intent.putExtra("buildResult", str2);
|
||||
intent.putExtra("course", course);
|
||||
intent.putExtra("story_intro_video", q);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void a(Context context, String str, String str2, Package r5) {
|
||||
Intent intent = new Intent(context, (Class<?>) CourseListActivity.class);
|
||||
intent.putExtra("story_name", str);
|
||||
intent.putExtra("story_intro_video", str2);
|
||||
intent.putExtra("PACKAGE", r5);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void setPresenter(CourseContract$Presenter courseContract$Presenter) {
|
||||
this.j = courseContract$Presenter;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(View view) {
|
||||
ImageView imageView;
|
||||
if (view == null || (imageView = (ImageView) view.findViewById(R.id.content_bg_image_view)) == null) {
|
||||
return;
|
||||
}
|
||||
a(imageView);
|
||||
}
|
||||
|
||||
private void a(ImageView imageView) {
|
||||
imageView.setVisibility(0);
|
||||
RotateAnimation rotateAnimation = new RotateAnimation(0.0f, 360.0f, 1, 0.5f, 1, 0.5f);
|
||||
rotateAnimation.setDuration(5000L);
|
||||
rotateAnimation.setFillAfter(true);
|
||||
rotateAnimation.setInterpolator(new LinearInterpolator());
|
||||
rotateAnimation.setRepeatMode(1);
|
||||
rotateAnimation.setRepeatCount(-1);
|
||||
imageView.startAnimation(rotateAnimation);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(Course course) {
|
||||
View inflate = LayoutInflater.from(this).inflate(R.layout.alert_login_layout, (ViewGroup) null);
|
||||
if (this.k == null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.b(inflate);
|
||||
this.k = builder.a();
|
||||
inflate.findViewById(R.id.cancel_button).setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.discover.view.CourseListActivity.4
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
CourseListActivity.this.k.dismiss();
|
||||
CourseListActivity.this.D0();
|
||||
}
|
||||
});
|
||||
((TextView) inflate.findViewById(R.id.titleTextView)).setText(R.string.tips_not_login_yet);
|
||||
((TextView) inflate.findViewById(R.id.ok_button)).setText(R.string.login);
|
||||
((TextView) inflate.findViewById(R.id.cancel_button)).setText(R.string.i_got_it);
|
||||
inflate.findViewById(R.id.ok_button).setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.discover.view.CourseListActivity.5
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
CourseListActivity.this.k.dismiss();
|
||||
CourseListActivity.this.D0();
|
||||
LoginActivity.start(CourseListActivity.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
AlertDialog alertDialog = this.k;
|
||||
if (alertDialog == null || alertDialog.isShowing()) {
|
||||
return;
|
||||
}
|
||||
this.k.show();
|
||||
}
|
||||
|
||||
private void a(Package r4, Robot robot) {
|
||||
if (r4 != null && robot != null) {
|
||||
Cache.getInstance().setPackageName(r4.getPackageName());
|
||||
Cache.getInstance().setPackageId(r4.getId());
|
||||
Cache.getInstance().setPackageImagePath(r4.getPackageImage());
|
||||
Cache.getInstance().setRobot(robot);
|
||||
return;
|
||||
}
|
||||
Log.e(this.TAG, "Package or robot is null. package:" + r4 + " robot:" + robot);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$View
|
||||
public void a(DownloadTask downloadTask) {
|
||||
this.n = downloadTask;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$View
|
||||
public void a(Robot robot) {
|
||||
this.o = false;
|
||||
Course course = this.h;
|
||||
if (course == null || TextUtils.isEmpty(course.getFinishedFlag())) {
|
||||
return;
|
||||
}
|
||||
if (this.n != null) {
|
||||
this.n = null;
|
||||
}
|
||||
View view = this.a;
|
||||
if (view != null) {
|
||||
view.setVisibility(8);
|
||||
this.b.clearAnimation();
|
||||
}
|
||||
if (this.d != null && robot != null) {
|
||||
Log.i(this.TAG, "选定星际探险课程,设置外面选定的机器人为星际探险模型");
|
||||
a(this.d, robot);
|
||||
}
|
||||
UnityActivity.startUnityActivity(this, robot, this.h, 2, !this.h.getFinishedFlag().equals("build") ? 1 : 0, UnityActivity.BLOCKLY_TYPE_STAR_TREK);
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
package com.ubt.jimu.discover.view;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.DebouncingOnClickListener;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseListActivity_ViewBinding implements Unbinder {
|
||||
private CourseListActivity b;
|
||||
private View c;
|
||||
private View d;
|
||||
|
||||
public CourseListActivity_ViewBinding(final CourseListActivity courseListActivity, View view) {
|
||||
this.b = courseListActivity;
|
||||
courseListActivity.rootView = Utils.a(view, R.id.rootView, "field 'rootView'");
|
||||
courseListActivity.courseRecyclerView = (RecyclerView) Utils.b(view, R.id.courseRecyclerView, "field 'courseRecyclerView'", RecyclerView.class);
|
||||
View a = Utils.a(view, R.id.img_back, "method 'onBackAction'");
|
||||
this.c = a;
|
||||
a.setOnClickListener(new DebouncingOnClickListener(this) { // from class: com.ubt.jimu.discover.view.CourseListActivity_ViewBinding.1
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
courseListActivity.onBackAction(view2);
|
||||
}
|
||||
});
|
||||
View a2 = Utils.a(view, R.id.storyVideo, "method 'onStoryVideoAction'");
|
||||
this.d = a2;
|
||||
a2.setOnClickListener(new DebouncingOnClickListener(this) { // from class: com.ubt.jimu.discover.view.CourseListActivity_ViewBinding.2
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
courseListActivity.onStoryVideoAction(view2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
CourseListActivity courseListActivity = this.b;
|
||||
if (courseListActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
courseListActivity.rootView = null;
|
||||
courseListActivity.courseRecyclerView = null;
|
||||
this.c.setOnClickListener(null);
|
||||
this.c = null;
|
||||
this.d.setOnClickListener(null);
|
||||
this.d = null;
|
||||
}
|
||||
}
|
25
sources/com/ubt/jimu/discover/view/ViewHelper.java
Normal file
25
sources/com/ubt/jimu/discover/view/ViewHelper.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.ubt.jimu.discover.view;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ViewHelper {
|
||||
public static void a(View view) {
|
||||
ViewCompat.a(view, 1.0f);
|
||||
ViewCompat.i(view, 1.0f);
|
||||
ViewCompat.h(view, 1.0f);
|
||||
ViewCompat.k(view, 0.0f);
|
||||
ViewCompat.j(view, 0.0f);
|
||||
ViewCompat.e(view, 0.0f);
|
||||
ViewCompat.g(view, 0.0f);
|
||||
ViewCompat.f(view, 0.0f);
|
||||
ViewCompat.d(view, view.getMeasuredHeight() / 2);
|
||||
ViewCompat.c(view, view.getMeasuredWidth() / 2);
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(view);
|
||||
a.a((Interpolator) null);
|
||||
a.b(0L);
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
package com.ubt.jimu.discover.view.adapter;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.ubt.jimu.discover.view.ViewHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AnimatorAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private RecyclerView.Adapter<RecyclerView.ViewHolder> a;
|
||||
private int b = 300;
|
||||
private Interpolator c = new LinearInterpolator();
|
||||
private int d = -1;
|
||||
private boolean e = false;
|
||||
|
||||
public AnimatorAdapter(RecyclerView.Adapter<RecyclerView.ViewHolder> adapter) {
|
||||
this.a = adapter;
|
||||
}
|
||||
|
||||
protected abstract Animator[] a(View view);
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
return this.a.getItemCount();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public long getItemId(int i) {
|
||||
return this.a.getItemId(i);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
return this.a.getItemViewType(i);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
|
||||
this.a.onBindViewHolder(viewHolder, i);
|
||||
int adapterPosition = viewHolder.getAdapterPosition();
|
||||
if (this.e && adapterPosition <= this.d) {
|
||||
ViewHelper.a(viewHolder.itemView);
|
||||
return;
|
||||
}
|
||||
for (Animator animator : a(viewHolder.itemView)) {
|
||||
animator.setDuration(this.b).start();
|
||||
animator.setInterpolator(this.c);
|
||||
}
|
||||
this.d = adapterPosition;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
return this.a.onCreateViewHolder(viewGroup, i);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onViewRecycled(RecyclerView.ViewHolder viewHolder) {
|
||||
this.a.onViewRecycled(viewHolder);
|
||||
super.onViewRecycled(viewHolder);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver adapterDataObserver) {
|
||||
super.registerAdapterDataObserver(adapterDataObserver);
|
||||
this.a.registerAdapterDataObserver(adapterDataObserver);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void unregisterAdapterDataObserver(RecyclerView.AdapterDataObserver adapterDataObserver) {
|
||||
super.unregisterAdapterDataObserver(adapterDataObserver);
|
||||
this.a.unregisterAdapterDataObserver(adapterDataObserver);
|
||||
}
|
||||
}
|
@@ -0,0 +1,309 @@
|
||||
package com.ubt.jimu.discover.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private Context a;
|
||||
private boolean b = JimuApplication.l().i();
|
||||
private List<Course> c;
|
||||
private LayoutInflater d;
|
||||
private Callback e;
|
||||
|
||||
class CBHolder extends RecyclerView.ViewHolder {
|
||||
ImageView contentBgImageView;
|
||||
TextView courseNameTextView;
|
||||
TextView downloadProgressTextView;
|
||||
ImageView imageView;
|
||||
ImageView lockImageView;
|
||||
View maskView;
|
||||
ImageView typeImageView;
|
||||
|
||||
public CBHolder(CourseListAdapter courseListAdapter, View view) {
|
||||
super(view);
|
||||
ButterKnife.a(this, view);
|
||||
}
|
||||
}
|
||||
|
||||
public class CBHolder_ViewBinding implements Unbinder {
|
||||
private CBHolder b;
|
||||
|
||||
public CBHolder_ViewBinding(CBHolder cBHolder, View view) {
|
||||
this.b = cBHolder;
|
||||
cBHolder.imageView = (ImageView) Utils.b(view, R.id.content_image_view, "field 'imageView'", ImageView.class);
|
||||
cBHolder.typeImageView = (ImageView) Utils.b(view, R.id.type_image_view, "field 'typeImageView'", ImageView.class);
|
||||
cBHolder.lockImageView = (ImageView) Utils.b(view, R.id.lock_image_view, "field 'lockImageView'", ImageView.class);
|
||||
cBHolder.contentBgImageView = (ImageView) Utils.b(view, R.id.content_bg_image_view, "field 'contentBgImageView'", ImageView.class);
|
||||
cBHolder.courseNameTextView = (TextView) Utils.b(view, R.id.courseNameTextView, "field 'courseNameTextView'", TextView.class);
|
||||
cBHolder.maskView = Utils.a(view, R.id.maskView, "field 'maskView'");
|
||||
cBHolder.downloadProgressTextView = (TextView) Utils.b(view, R.id.downloadProgressTextView, "field 'downloadProgressTextView'", TextView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
CBHolder cBHolder = this.b;
|
||||
if (cBHolder == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
cBHolder.imageView = null;
|
||||
cBHolder.typeImageView = null;
|
||||
cBHolder.lockImageView = null;
|
||||
cBHolder.contentBgImageView = null;
|
||||
cBHolder.courseNameTextView = null;
|
||||
cBHolder.maskView = null;
|
||||
cBHolder.downloadProgressTextView = null;
|
||||
}
|
||||
}
|
||||
|
||||
class CTHolder extends RecyclerView.ViewHolder {
|
||||
ImageView contentBgImageView;
|
||||
TextView courseNameTextView;
|
||||
TextView downloadProgressTextView;
|
||||
ImageView imageView;
|
||||
ImageView lockImageView;
|
||||
View maskView;
|
||||
ImageView typeImageView;
|
||||
|
||||
public CTHolder(CourseListAdapter courseListAdapter, View view) {
|
||||
super(view);
|
||||
ButterKnife.a(this, view);
|
||||
}
|
||||
}
|
||||
|
||||
public class CTHolder_ViewBinding implements Unbinder {
|
||||
private CTHolder b;
|
||||
|
||||
public CTHolder_ViewBinding(CTHolder cTHolder, View view) {
|
||||
this.b = cTHolder;
|
||||
cTHolder.imageView = (ImageView) Utils.b(view, R.id.content_image_view, "field 'imageView'", ImageView.class);
|
||||
cTHolder.typeImageView = (ImageView) Utils.b(view, R.id.type_image_view, "field 'typeImageView'", ImageView.class);
|
||||
cTHolder.lockImageView = (ImageView) Utils.b(view, R.id.lock_image_view, "field 'lockImageView'", ImageView.class);
|
||||
cTHolder.contentBgImageView = (ImageView) Utils.b(view, R.id.content_bg_image_view, "field 'contentBgImageView'", ImageView.class);
|
||||
cTHolder.courseNameTextView = (TextView) Utils.b(view, R.id.courseNameTextView, "field 'courseNameTextView'", TextView.class);
|
||||
cTHolder.maskView = Utils.a(view, R.id.maskView, "field 'maskView'");
|
||||
cTHolder.downloadProgressTextView = (TextView) Utils.b(view, R.id.downloadProgressTextView, "field 'downloadProgressTextView'", TextView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
CTHolder cTHolder = this.b;
|
||||
if (cTHolder == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
cTHolder.imageView = null;
|
||||
cTHolder.typeImageView = null;
|
||||
cTHolder.lockImageView = null;
|
||||
cTHolder.contentBgImageView = null;
|
||||
cTHolder.courseNameTextView = null;
|
||||
cTHolder.maskView = null;
|
||||
cTHolder.downloadProgressTextView = null;
|
||||
}
|
||||
}
|
||||
|
||||
public interface Callback {
|
||||
void a(Course course);
|
||||
|
||||
void a(Course course, View view, TextView textView, boolean z);
|
||||
}
|
||||
|
||||
class DDHolder extends RecyclerView.ViewHolder {
|
||||
public DDHolder(CourseListAdapter courseListAdapter, View view) {
|
||||
super(view);
|
||||
}
|
||||
}
|
||||
|
||||
class DUHolder extends RecyclerView.ViewHolder {
|
||||
public DUHolder(CourseListAdapter courseListAdapter, View view) {
|
||||
super(view);
|
||||
}
|
||||
}
|
||||
|
||||
public CourseListAdapter(Context context, List<Course> list) {
|
||||
new String[]{"Build Astron", "Wake-up Astron", "Working test", "Planet landing", "Go ahead", "Explore onwards", "Send a signal", "Looking for clues", "Save\\U00a0Rover", "Radar detection", "Move forward and back", "Turn left and right", "Rotating in Place", "Command operations", "Escaping the Ambush", "Wait for the attack", "AstroBot\\U00a0returns", "Recover", "Collecting Parts", "Moving Parts", "Looking for Parts", "Launching an Attack", "The Final Battle", "Celebrate the victory"};
|
||||
this.a = context;
|
||||
this.c = list;
|
||||
this.d = LayoutInflater.from(context);
|
||||
DisplayUtil.a(context, this.b ? 235.0f : 135.0f);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
return (this.c.size() + this.c.size()) - 1;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
}
|
||||
return i % 2 == 0 ? i % 4 == 0 ? 0 : 1 : (i + 1) % 4 == 0 ? 3 : 2;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
|
||||
final Course course = this.c.get(i / 2);
|
||||
boolean z = viewHolder instanceof CBHolder;
|
||||
int i2 = R.drawable.course_type_code_pad;
|
||||
int i3 = R.drawable.course_type_video_pad;
|
||||
if (z) {
|
||||
CBHolder cBHolder = (CBHolder) viewHolder;
|
||||
cBHolder.courseNameTextView.setText(course.getCourseName());
|
||||
int currentStatus = course.getCurrentStatus();
|
||||
if (currentStatus == 0) {
|
||||
Glide.e(this.a).a(a(course.getCourseThumbnailLock(), course.getUpdatedTime())).a(cBHolder.imageView);
|
||||
cBHolder.lockImageView.setVisibility(0);
|
||||
cBHolder.contentBgImageView.setVisibility(8);
|
||||
} else if (currentStatus == 1) {
|
||||
Glide.e(this.a).a(a(course.getCourseThumbnail(), course.getUpdatedTime())).a(cBHolder.imageView);
|
||||
cBHolder.lockImageView.setVisibility(8);
|
||||
a(cBHolder.contentBgImageView);
|
||||
} else if (currentStatus == 2) {
|
||||
Glide.e(this.a).a(a(course.getCourseThumbnail(), course.getUpdatedTime())).a(cBHolder.imageView);
|
||||
cBHolder.lockImageView.setVisibility(8);
|
||||
cBHolder.contentBgImageView.setVisibility(8);
|
||||
}
|
||||
final TextView textView = cBHolder.downloadProgressTextView;
|
||||
final View view = cBHolder.maskView;
|
||||
cBHolder.imageView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.discover.view.adapter.CourseListAdapter.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view2) {
|
||||
if (course.getIsAvailable() == 0) {
|
||||
if (CourseListAdapter.this.e != null) {
|
||||
CourseListAdapter.this.e.a(course);
|
||||
}
|
||||
} else {
|
||||
if (CourseListAdapter.this.e == null || course.getCurrentStatus() <= 0) {
|
||||
return;
|
||||
}
|
||||
CourseListAdapter.this.e.a(course, view, textView, !r0.getRobotDownloaded());
|
||||
}
|
||||
}
|
||||
});
|
||||
int courseType = course.getCourseType();
|
||||
if (courseType == 0) {
|
||||
ImageView imageView = cBHolder.typeImageView;
|
||||
if (!this.b) {
|
||||
i3 = R.drawable.course_type_video;
|
||||
}
|
||||
imageView.setImageResource(i3);
|
||||
return;
|
||||
}
|
||||
if (courseType != 1) {
|
||||
return;
|
||||
}
|
||||
ImageView imageView2 = cBHolder.typeImageView;
|
||||
if (!this.b) {
|
||||
i2 = R.drawable.course_type_code;
|
||||
}
|
||||
imageView2.setImageResource(i2);
|
||||
return;
|
||||
}
|
||||
if (viewHolder instanceof CTHolder) {
|
||||
CTHolder cTHolder = (CTHolder) viewHolder;
|
||||
cTHolder.courseNameTextView.setText(course.getCourseName());
|
||||
int currentStatus2 = course.getCurrentStatus();
|
||||
if (currentStatus2 == 0) {
|
||||
Glide.e(this.a).a(a(course.getCourseThumbnailLock(), course.getUpdatedTime())).a(cTHolder.imageView);
|
||||
cTHolder.lockImageView.setVisibility(0);
|
||||
cTHolder.contentBgImageView.setVisibility(8);
|
||||
} else if (currentStatus2 == 1) {
|
||||
Glide.e(this.a).a(a(course.getCourseThumbnail(), course.getUpdatedTime())).a(cTHolder.imageView);
|
||||
cTHolder.lockImageView.setVisibility(8);
|
||||
a(cTHolder.contentBgImageView);
|
||||
} else if (currentStatus2 == 2) {
|
||||
Glide.e(this.a).a(a(course.getCourseThumbnail(), course.getUpdatedTime())).a(cTHolder.imageView);
|
||||
cTHolder.lockImageView.setVisibility(8);
|
||||
cTHolder.contentBgImageView.setVisibility(8);
|
||||
}
|
||||
final TextView textView2 = cTHolder.downloadProgressTextView;
|
||||
final View view2 = cTHolder.maskView;
|
||||
cTHolder.imageView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.discover.view.adapter.CourseListAdapter.2
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view3) {
|
||||
if (course.getIsAvailable() == 0) {
|
||||
if (CourseListAdapter.this.e != null) {
|
||||
CourseListAdapter.this.e.a(course);
|
||||
}
|
||||
} else {
|
||||
if (CourseListAdapter.this.e == null || course.getCurrentStatus() <= 0) {
|
||||
return;
|
||||
}
|
||||
CourseListAdapter.this.e.a(course, view2, textView2, !r0.getRobotDownloaded());
|
||||
}
|
||||
}
|
||||
});
|
||||
int courseType2 = course.getCourseType();
|
||||
if (courseType2 == 0) {
|
||||
ImageView imageView3 = cTHolder.typeImageView;
|
||||
if (!this.b) {
|
||||
i3 = R.drawable.course_type_video;
|
||||
}
|
||||
imageView3.setImageResource(i3);
|
||||
return;
|
||||
}
|
||||
if (courseType2 != 1) {
|
||||
return;
|
||||
}
|
||||
ImageView imageView4 = cTHolder.typeImageView;
|
||||
if (!this.b) {
|
||||
i2 = R.drawable.course_type_code;
|
||||
}
|
||||
imageView4.setImageResource(i2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
if (i == 0) {
|
||||
return new CBHolder(this, this.d.inflate(R.layout.course_item_content_b, viewGroup, false));
|
||||
}
|
||||
if (i == 1) {
|
||||
return new CTHolder(this, this.d.inflate(R.layout.course_item_content_t, viewGroup, false));
|
||||
}
|
||||
if (i == 2) {
|
||||
return new DUHolder(this, this.d.inflate(R.layout.course_item_divider_u, viewGroup, false));
|
||||
}
|
||||
if (i != 3) {
|
||||
return null;
|
||||
}
|
||||
return new DDHolder(this, this.d.inflate(R.layout.course_item_divider_d, viewGroup, false));
|
||||
}
|
||||
|
||||
public void a(Callback callback) {
|
||||
this.e = callback;
|
||||
}
|
||||
|
||||
private String a(String str, long j) {
|
||||
return str + "?t=" + String.valueOf(j);
|
||||
}
|
||||
|
||||
private void a(ImageView imageView) {
|
||||
imageView.setVisibility(0);
|
||||
RotateAnimation rotateAnimation = new RotateAnimation(0.0f, 360.0f, 1, 0.5f, 1, 0.5f);
|
||||
rotateAnimation.setDuration(10000L);
|
||||
rotateAnimation.setFillAfter(true);
|
||||
rotateAnimation.setInterpolator(new LinearInterpolator());
|
||||
rotateAnimation.setRepeatMode(1);
|
||||
rotateAnimation.setRepeatCount(-1);
|
||||
imageView.startAnimation(rotateAnimation);
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.ubt.jimu.discover.view.adapter;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScaleInAnimatorAdapter extends AnimatorAdapter {
|
||||
private final float f;
|
||||
|
||||
public ScaleInAnimatorAdapter(RecyclerView.Adapter adapter) {
|
||||
this(adapter, 0.5f);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.view.adapter.AnimatorAdapter
|
||||
protected Animator[] a(View view) {
|
||||
return new ObjectAnimator[]{ObjectAnimator.ofFloat(view, "scaleX", this.f, 1.0f), ObjectAnimator.ofFloat(view, "scaleY", this.f, 1.0f)};
|
||||
}
|
||||
|
||||
public ScaleInAnimatorAdapter(RecyclerView.Adapter adapter, float f) {
|
||||
super(adapter);
|
||||
this.f = f;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user