Initial commit
This commit is contained in:
81
sources/com/ubt/jimu/discover/CourseHelper.java
Normal file
81
sources/com/ubt/jimu/discover/CourseHelper.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package com.ubt.jimu.discover;
|
||||
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.entities.ActionResult;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.utils.RxSchedulers;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseHelper {
|
||||
private IUploadCourseListener a;
|
||||
|
||||
public interface IUploadCourseListener {
|
||||
void onFailed();
|
||||
|
||||
void onFinished();
|
||||
|
||||
void onStart();
|
||||
|
||||
void onSuccess(ActionResult actionResult);
|
||||
}
|
||||
|
||||
public CourseHelper(IUploadCourseListener iUploadCourseListener) {
|
||||
this.a = iUploadCourseListener;
|
||||
}
|
||||
|
||||
private void c() {
|
||||
IUploadCourseListener iUploadCourseListener = this.a;
|
||||
if (iUploadCourseListener != null) {
|
||||
iUploadCourseListener.onStart();
|
||||
}
|
||||
}
|
||||
|
||||
private void b() {
|
||||
IUploadCourseListener iUploadCourseListener = this.a;
|
||||
if (iUploadCourseListener != null) {
|
||||
iUploadCourseListener.onFinished();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
long loginUserIntId = Cache.getInstance().getLoginUserIntId();
|
||||
if (loginUserIntId <= 0) {
|
||||
a();
|
||||
b();
|
||||
} else {
|
||||
c();
|
||||
CourseRepository.a(loginUserIntId, j, Course.STATUS_COMPLETED).compose(RxSchedulers.a()).subscribe(new Observer<ActionResult>() { // from class: com.ubt.jimu.discover.CourseHelper.1
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(ActionResult actionResult) {
|
||||
if (CourseHelper.this.a != null) {
|
||||
CourseHelper.this.a.onSuccess(actionResult);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
CourseHelper.this.a();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a() {
|
||||
IUploadCourseListener iUploadCourseListener = this.a;
|
||||
if (iUploadCourseListener != null) {
|
||||
iUploadCourseListener.onFailed();
|
||||
}
|
||||
}
|
||||
}
|
191
sources/com/ubt/jimu/discover/CourseRepository.java
Normal file
191
sources/com/ubt/jimu/discover/CourseRepository.java
Normal file
@@ -0,0 +1,191 @@
|
||||
package com.ubt.jimu.discover;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.robot.RobotDbHandler;
|
||||
import com.ubt.jimu.base.db.starcourse.StoryDbHandler;
|
||||
import com.ubt.jimu.base.entities.ActionResult;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.base.http.ApiResponse;
|
||||
import com.ubt.jimu.base.http.service.CourseService;
|
||||
import com.ubt.jimu.unity.ModelType;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.functions.BiFunction;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseRepository {
|
||||
public static Observable<ApiResponse<List<Course>>> a(String str, String str2, String str3) {
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put("userId", String.valueOf(str));
|
||||
basicParams.put("storyName", str2);
|
||||
basicParams.put(Constant.SelectRobot.PACKAGE_NAME_KEY, str3);
|
||||
if (!TextUtils.isEmpty(str) && str.equals("0")) {
|
||||
basicParams.put("token", Cache.getInstance().getUserToken());
|
||||
}
|
||||
return ((CourseService) ApiClient.getService(CourseService.class)).getUserCourseList(basicParams);
|
||||
}
|
||||
|
||||
public static Observable<ActionResult> a(long j, long j2, String str) {
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put("userId", String.valueOf(j));
|
||||
if (j > 0) {
|
||||
basicParams.put("token", Cache.getInstance().getUserToken());
|
||||
}
|
||||
basicParams.put("courseId", String.valueOf(j2));
|
||||
basicParams.put(FileDownloadModel.STATUS, str);
|
||||
return ((CourseService) ApiClient.getService(CourseService.class)).updateCourseStatus(basicParams).map(new Function<ApiResponse<ActionResult>, ActionResult>() { // from class: com.ubt.jimu.discover.CourseRepository.1
|
||||
@Override // io.reactivex.functions.Function
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public ActionResult apply(ApiResponse<ActionResult> apiResponse) throws Exception {
|
||||
return apiResponse.getModels();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static Observable<List<Story>> a() {
|
||||
Observable<List<Story>> create = Observable.create(new ObservableOnSubscribe<List<Story>>() { // from class: com.ubt.jimu.discover.CourseRepository.2
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public void subscribe(ObservableEmitter<List<Story>> observableEmitter) throws Exception {
|
||||
observableEmitter.onNext(StoryDbHandler.getStoryList());
|
||||
observableEmitter.onComplete();
|
||||
}
|
||||
});
|
||||
if (!NetWorkUtil.b(JimuApplication.l().getApplicationContext())) {
|
||||
return create;
|
||||
}
|
||||
return Observable.zip(create, ((CourseService) ApiClient.getService(CourseService.class)).getStoryList(ApiConstants.getBasicParams()).map(new Function<ApiResponse<List<Story>>, List<Story>>() { // from class: com.ubt.jimu.discover.CourseRepository.4
|
||||
@Override // io.reactivex.functions.Function
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public List<Story> apply(ApiResponse<List<Story>> apiResponse) throws Exception {
|
||||
return apiResponse.getModels();
|
||||
}
|
||||
}).doAfterNext(new Consumer<List<Story>>() { // from class: com.ubt.jimu.discover.CourseRepository.3
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void accept(List<Story> list) throws Exception {
|
||||
StoryDbHandler.save(list);
|
||||
}
|
||||
}), new BiFunction<List<Story>, List<Story>, List<Story>>() { // from class: com.ubt.jimu.discover.CourseRepository.5
|
||||
@Override // io.reactivex.functions.BiFunction
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public List<Story> apply(List<Story> list, List<Story> list2) throws Exception {
|
||||
return (list == null || list.size() == 0) ? list2 : list;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static Observable<Robot> a(Context context, final long j) {
|
||||
Observable<Robot> create = Observable.create(new ObservableOnSubscribe<Robot>() { // from class: com.ubt.jimu.discover.CourseRepository.6
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public void subscribe(ObservableEmitter<Robot> observableEmitter) throws Exception {
|
||||
Robot robotById = RobotDbHandler.getRobotById(j);
|
||||
if (robotById == null) {
|
||||
robotById = new Robot();
|
||||
robotById.setState(-100);
|
||||
}
|
||||
observableEmitter.onNext(robotById);
|
||||
observableEmitter.onComplete();
|
||||
}
|
||||
});
|
||||
if (!NetWorkUtil.b(context)) {
|
||||
return create;
|
||||
}
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put("modelId", String.valueOf(j));
|
||||
basicParams.put(UnityActivity.pModelType, String.valueOf(ModelType.DEFAULT.getType()));
|
||||
basicParams.put("pageNum", String.valueOf(1));
|
||||
basicParams.put("pageSize", String.valueOf(10));
|
||||
return Observable.zip(create, ((CourseService) ApiClient.getService(CourseService.class)).loadRobotInfoById(basicParams).map(new Function<ApiResponse<List<Robot>>, Robot>() { // from class: com.ubt.jimu.discover.CourseRepository.8
|
||||
@Override // io.reactivex.functions.Function
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public Robot apply(ApiResponse<List<Robot>> apiResponse) throws Exception {
|
||||
if (apiResponse == null || apiResponse.getModels() == null || apiResponse.getModels().size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return apiResponse.getModels().get(0);
|
||||
}
|
||||
}).doAfterNext(new Consumer<Robot>() { // from class: com.ubt.jimu.discover.CourseRepository.7
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void accept(Robot robot) throws Exception {
|
||||
if (robot != null) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.add(robot);
|
||||
RobotDbHandler.saveOrUpdate(arrayList);
|
||||
}
|
||||
}
|
||||
}), new BiFunction<Robot, Robot, Robot>() { // from class: com.ubt.jimu.discover.CourseRepository.9
|
||||
@Override // io.reactivex.functions.BiFunction
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public Robot apply(Robot robot, Robot robot2) throws Exception {
|
||||
return (robot == null || robot.getState() == -100) ? robot2 : robot;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static Observable<Robot> a(Context context, final String str) {
|
||||
Observable<Robot> create = Observable.create(new ObservableOnSubscribe<Robot>() { // from class: com.ubt.jimu.discover.CourseRepository.10
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public void subscribe(ObservableEmitter<Robot> observableEmitter) throws Exception {
|
||||
Robot robotByModelName = RobotDbHandler.getRobotByModelName(str);
|
||||
if (robotByModelName == null) {
|
||||
robotByModelName = new Robot();
|
||||
robotByModelName.setState(-100);
|
||||
}
|
||||
observableEmitter.onNext(robotByModelName);
|
||||
observableEmitter.onComplete();
|
||||
}
|
||||
});
|
||||
if (!NetWorkUtil.b(context)) {
|
||||
return create;
|
||||
}
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put(UnityActivity.pModelName, str);
|
||||
basicParams.put(UnityActivity.pModelType, String.valueOf(ModelType.DEFAULT.getType()));
|
||||
basicParams.put("pageNum", String.valueOf(1));
|
||||
basicParams.put("pageSize", String.valueOf(10));
|
||||
return Observable.zip(create, ((CourseService) ApiClient.getService(CourseService.class)).loadRobotInfoById(basicParams).map(new Function<ApiResponse<List<Robot>>, Robot>() { // from class: com.ubt.jimu.discover.CourseRepository.12
|
||||
@Override // io.reactivex.functions.Function
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public Robot apply(ApiResponse<List<Robot>> apiResponse) throws Exception {
|
||||
if (apiResponse == null || apiResponse.getModels() == null || apiResponse.getModels().size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return apiResponse.getModels().get(0);
|
||||
}
|
||||
}).doAfterNext(new Consumer<Robot>() { // from class: com.ubt.jimu.discover.CourseRepository.11
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void accept(Robot robot) throws Exception {
|
||||
if (robot != null) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.add(robot);
|
||||
RobotDbHandler.saveOrUpdate(arrayList);
|
||||
}
|
||||
}
|
||||
}), new BiFunction<Robot, Robot, Robot>() { // from class: com.ubt.jimu.discover.CourseRepository.13
|
||||
@Override // io.reactivex.functions.BiFunction
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public Robot apply(Robot robot, Robot robot2) throws Exception {
|
||||
return (robot == null || robot.getState() == -100) ? robot2 : robot;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
232
sources/com/ubt/jimu/discover/DiscoveryActivity.java
Normal file
232
sources/com/ubt/jimu/discover/DiscoveryActivity.java
Normal file
@@ -0,0 +1,232 @@
|
||||
package com.ubt.jimu.discover;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.discover.contract.StoryContract$Presenter;
|
||||
import com.ubt.jimu.discover.contract.StoryContract$View;
|
||||
import com.ubt.jimu.discover.presenter.StoryPresenter;
|
||||
import com.ubt.jimu.discover.view.CourseListActivity;
|
||||
import com.ubt.jimu.utils.BitmapUtils;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubt.jimu.widgets.NavigationBarView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiscoveryActivity extends BaseActivity implements StoryContract$View {
|
||||
StoryContract$Presenter a;
|
||||
View b;
|
||||
ImageView c;
|
||||
TextView d;
|
||||
ImageView e;
|
||||
private Bitmap f;
|
||||
private Handler g = new Handler();
|
||||
private List<Story> h = new ArrayList();
|
||||
private DownloadTask i;
|
||||
FrameLayout maskCardView;
|
||||
NavigationBarView navBarView;
|
||||
TextView progressView;
|
||||
|
||||
private void D0() {
|
||||
new StoryPresenter(this, this);
|
||||
this.a.subscribe();
|
||||
}
|
||||
|
||||
static /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
this.b = findViewById(R.id.downloadViewStub);
|
||||
this.c = (ImageView) findViewById(R.id.iv_loading);
|
||||
this.d = (TextView) findViewById(R.id.tv_progress);
|
||||
this.e = (ImageView) findViewById(R.id.iv_background);
|
||||
this.b.setOnClickListener(new View.OnClickListener(this) { // from class: com.ubt.jimu.discover.DiscoveryActivity.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
}
|
||||
});
|
||||
this.navBarView.setListener(new NavigationBarView.OnActionClickListener.Stub() { // from class: com.ubt.jimu.discover.DiscoveryActivity.2
|
||||
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
|
||||
public void onLeftClick(View view) {
|
||||
DiscoveryActivity.this.onBackAction(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.StoryContract$View
|
||||
public void a0() {
|
||||
View view = this.b;
|
||||
if (view != null) {
|
||||
view.setVisibility(8);
|
||||
}
|
||||
CourseListActivity.start(this, "AstroBot");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.StoryContract$View
|
||||
public void o(List<Story> list) {
|
||||
if (list != null && list.size() != 0) {
|
||||
this.h.addAll(list);
|
||||
} else {
|
||||
if (NetWorkUtil.b(this)) {
|
||||
return;
|
||||
}
|
||||
toastError(getString(R.string.network_error));
|
||||
}
|
||||
}
|
||||
|
||||
public void onAstrobotLayout(View view) {
|
||||
if (this.h.size() == 0) {
|
||||
return;
|
||||
}
|
||||
for (Story story : this.h) {
|
||||
if (story.getStoryName().equals("AstroBot")) {
|
||||
b(story);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBackAction(View view) {
|
||||
DownloadTask downloadTask = this.i;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
}
|
||||
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_discovery);
|
||||
ButterKnife.a(this);
|
||||
initView();
|
||||
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();
|
||||
Handler handler = this.g;
|
||||
if (handler != null) {
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
DownloadTask downloadTask = this.i;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
}
|
||||
Bitmap bitmap = this.f;
|
||||
if (bitmap != null) {
|
||||
bitmap.recycle();
|
||||
this.f = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.StoryContract$View
|
||||
public void onDownloadFail() {
|
||||
toastError(getString(R.string.tips_download_failed));
|
||||
this.b.setVisibility(8);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.StoryContract$View
|
||||
public void onDownloadStart() {
|
||||
this.b = findViewById(R.id.downloadViewStub);
|
||||
this.b.setVisibility(0);
|
||||
this.c = (ImageView) findViewById(R.id.iv_loading);
|
||||
this.d = (TextView) findViewById(R.id.tv_progress);
|
||||
this.e = (ImageView) findViewById(R.id.iv_background);
|
||||
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.c.startAnimation(rotateAnimation);
|
||||
Drawable background = this.e.getBackground();
|
||||
if (background == null) {
|
||||
return;
|
||||
}
|
||||
if (background instanceof BitmapDrawable) {
|
||||
this.f = ((BitmapDrawable) background).getBitmap();
|
||||
} else {
|
||||
Bitmap createBitmap = Bitmap.createBitmap(getScreenWidth(), getScreenHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(createBitmap);
|
||||
background.setBounds(0, 0, getScreenWidth(), getScreenHeight());
|
||||
background.draw(canvas);
|
||||
this.f = createBitmap;
|
||||
}
|
||||
Bitmap bitmap = this.f;
|
||||
if (bitmap == null || bitmap.isRecycled()) {
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() { // from class: com.ubt.jimu.discover.DiscoveryActivity.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
DiscoveryActivity discoveryActivity = DiscoveryActivity.this;
|
||||
final Bitmap a = BitmapUtils.a(discoveryActivity, discoveryActivity.f, "discovery_background.png");
|
||||
if (a == null || a.isRecycled()) {
|
||||
return;
|
||||
}
|
||||
DiscoveryActivity.this.g.post(new Runnable() { // from class: com.ubt.jimu.discover.DiscoveryActivity.3.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
DiscoveryActivity.this.e.setBackground(new BitmapDrawable(a));
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.StoryContract$View
|
||||
public void onProgressChange(int i) {
|
||||
this.d.setText(String.valueOf(i + "%"));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity
|
||||
public void relayout() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.StoryContract$View
|
||||
public void showCurrentTask(DownloadTask downloadTask) {
|
||||
this.i = downloadTask;
|
||||
}
|
||||
|
||||
private void b(final Story story) {
|
||||
JimuSimpleDialog.showWifiOnlyDialog(this, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.discover.a
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
DiscoveryActivity.a(dialogInterface, i);
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.discover.b
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
DiscoveryActivity.this.a(story, dialogInterface, i);
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void setPresenter(StoryContract$Presenter storyContract$Presenter) {
|
||||
this.a = storyContract$Presenter;
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(Story story, DialogInterface dialogInterface, int i) {
|
||||
this.a.a(story);
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package com.ubt.jimu.discover;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.DebouncingOnClickListener;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.NavigationBarView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiscoveryActivity_ViewBinding implements Unbinder {
|
||||
private DiscoveryActivity b;
|
||||
private View c;
|
||||
|
||||
public DiscoveryActivity_ViewBinding(final DiscoveryActivity discoveryActivity, View view) {
|
||||
this.b = discoveryActivity;
|
||||
discoveryActivity.maskCardView = (FrameLayout) Utils.b(view, R.id.mask_card_view, "field 'maskCardView'", FrameLayout.class);
|
||||
discoveryActivity.progressView = (TextView) Utils.b(view, R.id.downloadProgressTextView, "field 'progressView'", TextView.class);
|
||||
discoveryActivity.navBarView = (NavigationBarView) Utils.b(view, R.id.nbv_bar, "field 'navBarView'", NavigationBarView.class);
|
||||
View a = Utils.a(view, R.id.astrobotLayout, "method 'onAstrobotLayout'");
|
||||
this.c = a;
|
||||
a.setOnClickListener(new DebouncingOnClickListener(this) { // from class: com.ubt.jimu.discover.DiscoveryActivity_ViewBinding.1
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
discoveryActivity.onAstrobotLayout(view2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
DiscoveryActivity discoveryActivity = this.b;
|
||||
if (discoveryActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
discoveryActivity.maskCardView = null;
|
||||
discoveryActivity.progressView = null;
|
||||
discoveryActivity.navBarView = null;
|
||||
this.c.setOnClickListener(null);
|
||||
this.c = null;
|
||||
}
|
||||
}
|
10
sources/com/ubt/jimu/discover/IAccomplishEventListener.java
Normal file
10
sources/com/ubt/jimu/discover/IAccomplishEventListener.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.ubt.jimu.discover;
|
||||
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IAccomplishEventListener {
|
||||
void onPlayAgain(Course course);
|
||||
|
||||
void onPlayContinue(Course course);
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.ubt.jimu.discover.contract;
|
||||
|
||||
import com.ubtech.presenter.BasePresenter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface CourseContract$Presenter extends BasePresenter {
|
||||
void d(long j);
|
||||
|
||||
void o();
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.ubt.jimu.discover.contract;
|
||||
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubtech.view.BaseView;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface CourseContract$View extends BaseView<CourseContract$Presenter> {
|
||||
String I();
|
||||
|
||||
void a(DownloadTask downloadTask);
|
||||
|
||||
void a(Robot robot);
|
||||
|
||||
String d0();
|
||||
|
||||
void onDownloadFail();
|
||||
|
||||
void onProgress(int i, int i2, int i3);
|
||||
|
||||
void onStartDownload();
|
||||
|
||||
void showCourseList(List<Course> list);
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.ubt.jimu.discover.contract;
|
||||
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubtech.presenter.BasePresenter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface StoryContract$Presenter extends BasePresenter {
|
||||
void a(Story story);
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.ubt.jimu.discover.contract;
|
||||
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubtech.view.BaseView;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface StoryContract$View extends BaseView<StoryContract$Presenter> {
|
||||
void a0();
|
||||
|
||||
void o(List<Story> list);
|
||||
|
||||
void onDownloadFail();
|
||||
|
||||
void onDownloadStart();
|
||||
|
||||
void onProgressChange(int i);
|
||||
|
||||
void showCurrentTask(DownloadTask downloadTask);
|
||||
}
|
153
sources/com/ubt/jimu/discover/presenter/CoursePresenter.java
Normal file
153
sources/com/ubt/jimu/discover/presenter/CoursePresenter.java
Normal file
@@ -0,0 +1,153 @@
|
||||
package com.ubt.jimu.discover.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.FileDownloadRecordDbHandler;
|
||||
import com.ubt.jimu.base.db.starcourse.CourseDbHandler;
|
||||
import com.ubt.jimu.base.download.Downloader;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.base.entities.FileDownloadRecord;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.http.ApiResponse;
|
||||
import com.ubt.jimu.discover.CourseRepository;
|
||||
import com.ubt.jimu.discover.contract.CourseContract$Presenter;
|
||||
import com.ubt.jimu.discover.contract.CourseContract$View;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.RxSchedulers;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
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.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CoursePresenter implements CourseContract$Presenter {
|
||||
private Context a;
|
||||
private CourseContract$View b;
|
||||
private CompositeDisposable c = new CompositeDisposable();
|
||||
|
||||
public CoursePresenter(Context context, CourseContract$View courseContract$View) {
|
||||
this.a = context;
|
||||
this.b = courseContract$View;
|
||||
courseContract$View.setPresenter(this);
|
||||
}
|
||||
|
||||
static /* synthetic */ List a(CoursePresenter coursePresenter, List list) {
|
||||
coursePresenter.a((List<Course>) list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$Presenter
|
||||
public void d(long j) {
|
||||
LogUtils.c("下载机器人模型:" + j);
|
||||
CourseRepository.a(this.a, j).compose(RxSchedulers.a()).subscribe(new Observer<Robot>() { // from class: com.ubt.jimu.discover.presenter.CoursePresenter.3
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(final Robot robot) {
|
||||
if (robot == null || robot.getState() == -100) {
|
||||
CoursePresenter.this.b.onDownloadFail();
|
||||
} else {
|
||||
CoursePresenter.this.b.a(Downloader.downloadJimuRobot(robot, new Downloader.IDownloadJimuRobotListener() { // from class: com.ubt.jimu.discover.presenter.CoursePresenter.3.1
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onFailed() {
|
||||
CoursePresenter.this.b.onDownloadFail();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onPrepareStart() {
|
||||
CoursePresenter.this.b.onStartDownload();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
CoursePresenter.this.b.onProgress(i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onSuccess() {
|
||||
CoursePresenter.this.b.a(robot);
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
CoursePresenter.this.b.onDownloadFail();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
CoursePresenter.this.c.b(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.CourseContract$Presenter
|
||||
public void o() {
|
||||
String userId = Cache.getInstance().getUserId();
|
||||
if (!TextUtils.isEmpty(userId) && !userId.equals("local")) {
|
||||
a(userId);
|
||||
return;
|
||||
}
|
||||
String b = SPUtils.b(Constant.SelectRobot.INTERSTELLAR_ADVENTURE_SELECT_PACKAGE_KEY);
|
||||
List<Course> oldCourseList = (Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_CN.equals(b) || Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_NA.equals(b) || Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_GLOBAL.equals(b)) ? CourseDbHandler.getOldCourseList() : CourseDbHandler.getNewCourseList();
|
||||
if (oldCourseList == null || oldCourseList.size() <= 0) {
|
||||
a("0");
|
||||
} else {
|
||||
this.b.showCourseList(oldCourseList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.presenter.BasePresenter
|
||||
public void subscribe() {
|
||||
o();
|
||||
}
|
||||
|
||||
@Override // com.ubtech.presenter.BasePresenter
|
||||
public void unSubscribe() {
|
||||
this.c.dispose();
|
||||
this.c.a();
|
||||
}
|
||||
|
||||
private void a(final String str) {
|
||||
CourseRepository.a(str, this.b.I(), this.b.d0()).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Consumer<ApiResponse<List<Course>>>() { // from class: com.ubt.jimu.discover.presenter.CoursePresenter.1
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void accept(ApiResponse<List<Course>> apiResponse) throws Exception {
|
||||
boolean isStatus = apiResponse.isStatus();
|
||||
List<Course> models = apiResponse.getModels();
|
||||
LogUtils.c("从网络下载:" + isStatus + " courseList:" + models.size());
|
||||
if (!isStatus || models == null || models.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(str) || str.equals("0")) {
|
||||
Iterator<Course> it = models.iterator();
|
||||
while (it.hasNext()) {
|
||||
LogUtils.c("course:" + it.next().getStoryName());
|
||||
}
|
||||
CoursePresenter.a(CoursePresenter.this, models);
|
||||
CourseDbHandler.saveList(models);
|
||||
}
|
||||
CoursePresenter.this.b.showCourseList(models);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<Course> a(List<Course> list) {
|
||||
for (Course course : list) {
|
||||
course.setRobotDownloaded(FileDownloadRecordDbHandler.getFileDownloadRecord(course.getModelId(), FileDownloadRecord.Type.Robot.getValue()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
77
sources/com/ubt/jimu/discover/presenter/StoryPresenter.java
Normal file
77
sources/com/ubt/jimu/discover/presenter/StoryPresenter.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.ubt.jimu.discover.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.base.download.Downloader;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.discover.CourseRepository;
|
||||
import com.ubt.jimu.discover.contract.StoryContract$Presenter;
|
||||
import com.ubt.jimu.discover.contract.StoryContract$View;
|
||||
import com.ubt.jimu.utils.RxSchedulers;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StoryPresenter implements StoryContract$Presenter {
|
||||
private StoryContract$View a;
|
||||
private CompositeDisposable b = new CompositeDisposable();
|
||||
|
||||
public StoryPresenter(Context context, StoryContract$View storyContract$View) {
|
||||
this.a = storyContract$View;
|
||||
this.a.setPresenter(this);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.presenter.BasePresenter
|
||||
public void subscribe() {
|
||||
a();
|
||||
}
|
||||
|
||||
public void a() {
|
||||
CourseRepository.a().compose(RxSchedulers.a()).subscribe(new Observer<List<Story>>() { // from class: com.ubt.jimu.discover.presenter.StoryPresenter.1
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(List<Story> list) {
|
||||
StoryPresenter.this.a.o(list);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
StoryPresenter.this.b.b(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.discover.contract.StoryContract$Presenter
|
||||
public void a(Story story) {
|
||||
this.a.showCurrentTask(Downloader.downloadStarCourse(story, new Downloader.IDownloadJimuRobotListener() { // from class: com.ubt.jimu.discover.presenter.StoryPresenter.2
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onFailed() {
|
||||
StoryPresenter.this.a.onDownloadFail();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onPrepareStart() {
|
||||
StoryPresenter.this.a.onDownloadStart();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
StoryPresenter.this.a.onProgressChange(i3);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onSuccess() {
|
||||
StoryPresenter.this.a.a0();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
@@ -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