Initial commit
This commit is contained in:
66
sources/com/ubt/jimu/course/contract/CourseListContract.java
Normal file
66
sources/com/ubt/jimu/course/contract/CourseListContract.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.ubt.jimu.course.contract;
|
||||
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.unity.bluetooth.ConnectionStatus;
|
||||
import com.ubtech.presenter.BasePresenter;
|
||||
import com.ubtech.view.BaseView;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface CourseListContract {
|
||||
|
||||
public interface Presenter extends BasePresenter {
|
||||
void cancelDownloadResource();
|
||||
|
||||
void downloadJimuCourse(JimuCourse jimuCourse);
|
||||
|
||||
void downloadStory();
|
||||
|
||||
void getARPack();
|
||||
|
||||
void getCourse(String str, String str2, String str3, long j, long j2);
|
||||
|
||||
void getExpeditionPack();
|
||||
}
|
||||
|
||||
public interface View extends BaseView<Presenter> {
|
||||
void downloadCourseFailed(JimuCourse jimuCourse);
|
||||
|
||||
void downloadCourseProgress(int i, int i2, int i3);
|
||||
|
||||
void downloadCourseStart();
|
||||
|
||||
void downloadCourseSuccess(JimuCourse jimuCourse);
|
||||
|
||||
void expeditionListFail();
|
||||
|
||||
void expeditionListStart();
|
||||
|
||||
void expeditionListSuccess(List<Package> list);
|
||||
|
||||
void loadArListFail();
|
||||
|
||||
void loadArListStart();
|
||||
|
||||
void loadArListSuccess(List<Package> list);
|
||||
|
||||
void onConnectionStatusChange(ConnectionStatus connectionStatus);
|
||||
|
||||
void onDownloadFail();
|
||||
|
||||
void onDownloadStart();
|
||||
|
||||
void onDownloadSuccess(Story story);
|
||||
|
||||
void onProgressChange(int i);
|
||||
|
||||
void showCourseList(List<JimuCourse> list);
|
||||
|
||||
void showCurrentTask(DownloadTask downloadTask);
|
||||
|
||||
void showException(Throwable th);
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package com.ubt.jimu.course.contract;
|
||||
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubt.jimu.unity.bluetooth.ConnectionStatus;
|
||||
import com.ubtech.presenter.BasePresenter;
|
||||
import com.ubtech.view.BaseView;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface MissionListContract {
|
||||
|
||||
public interface Presenter extends BasePresenter {
|
||||
void getMissions(String str, String str2, long j, long j2, long j3, boolean z);
|
||||
|
||||
void updateMission(String str, long j, int i, String str2, long j2, long j3);
|
||||
}
|
||||
|
||||
public interface View extends BaseView<Presenter> {
|
||||
void onConnectionStatusChange(ConnectionStatus connectionStatus);
|
||||
|
||||
void showException(Throwable th);
|
||||
|
||||
void showMissions(List<JimuCourseTask> list, boolean z);
|
||||
|
||||
void showTitle(JimuCourseTask jimuCourseTask);
|
||||
}
|
||||
}
|
240
sources/com/ubt/jimu/course/presenter/CourseListPresenter.java
Normal file
240
sources/com/ubt/jimu/course/presenter/CourseListPresenter.java
Normal file
@@ -0,0 +1,240 @@
|
||||
package com.ubt.jimu.course.presenter;
|
||||
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.download.Downloader;
|
||||
import com.ubt.jimu.base.entities.ApiResult;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.service.PackageRobotService;
|
||||
import com.ubt.jimu.course.contract.CourseListContract;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.course.repository.JimuCourseRepository;
|
||||
import com.ubt.jimu.discover.CourseRepository;
|
||||
import com.ubt.jimu.pack.repository.PackageRepository;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.RxSchedulers;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseListPresenter implements CourseListContract.Presenter {
|
||||
private CompositeDisposable disposables = new CompositeDisposable();
|
||||
private DownloadTask downloadTask;
|
||||
private LoadingView loadingView;
|
||||
private Story story;
|
||||
private CourseListContract.View view;
|
||||
|
||||
public CourseListPresenter(CourseListContract.View view, LoadingView loadingView) {
|
||||
this.view = view;
|
||||
this.loadingView = loadingView;
|
||||
this.view.setPresenter(this);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void doDownloadStory(final Story story) {
|
||||
this.view.showCurrentTask(Downloader.downloadStarCourse(story, new Downloader.IDownloadJimuRobotListener() { // from class: com.ubt.jimu.course.presenter.CourseListPresenter.7
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onFailed() {
|
||||
CourseListPresenter.this.view.onDownloadFail();
|
||||
LogUtils.c("下载课程失败");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onPrepareStart() {
|
||||
CourseListPresenter.this.view.onDownloadStart();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
CourseListPresenter.this.view.onProgressChange(i3);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onSuccess() {
|
||||
CourseListPresenter.this.view.onDownloadSuccess(story);
|
||||
LogUtils.c("下载课程成功" + story.getDisplayDesc());
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void getStoryList() {
|
||||
CourseRepository.a().compose(RxSchedulers.a()).subscribe(new Observer<List<Story>>() { // from class: com.ubt.jimu.course.presenter.CourseListPresenter.4
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
CourseListPresenter.this.view.onDownloadFail();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
CourseListPresenter.this.disposables.b(disposable);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(List<Story> list) {
|
||||
if (list == null || list.size() <= 0) {
|
||||
CourseListPresenter.this.view.onDownloadFail();
|
||||
return;
|
||||
}
|
||||
for (Story story : list) {
|
||||
if ("AstroBot".equals(story.getStoryName())) {
|
||||
CourseListPresenter.this.story = story;
|
||||
CourseListPresenter.this.doDownloadStory(story);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.Presenter
|
||||
public void cancelDownloadResource() {
|
||||
DownloadTask downloadTask = this.downloadTask;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
this.downloadTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.Presenter
|
||||
public void downloadJimuCourse(final JimuCourse jimuCourse) {
|
||||
this.downloadTask = Downloader.downloadJimuCourse(jimuCourse, new Downloader.IDownloadJimuRobotListener() { // from class: com.ubt.jimu.course.presenter.CourseListPresenter.3
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onFailed() {
|
||||
if (CourseListPresenter.this.view != null) {
|
||||
CourseListPresenter.this.view.downloadCourseFailed(jimuCourse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onPrepareStart() {
|
||||
if (CourseListPresenter.this.view != null) {
|
||||
CourseListPresenter.this.view.downloadCourseStart();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
if (CourseListPresenter.this.view != null) {
|
||||
CourseListPresenter.this.view.downloadCourseProgress(i, i2, i3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onSuccess() {
|
||||
if (CourseListPresenter.this.view != null) {
|
||||
CourseListPresenter.this.view.downloadCourseSuccess(jimuCourse);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.Presenter
|
||||
public void downloadStory() {
|
||||
Story story = this.story;
|
||||
if (story == null) {
|
||||
getStoryList();
|
||||
} else {
|
||||
doDownloadStory(story);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.Presenter
|
||||
public void getARPack() {
|
||||
PackageRepository.a().compose(RxSchedulers.a()).subscribe(new Observer<ApiResult<Package>>() { // from class: com.ubt.jimu.course.presenter.CourseListPresenter.6
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
CourseListPresenter.this.view.loadArListFail();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
CourseListPresenter.this.view.loadArListStart();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(ApiResult<Package> apiResult) {
|
||||
List<Package> models = apiResult.getModels();
|
||||
LogUtils.c("加载AR模型成功");
|
||||
CourseListPresenter.this.view.loadArListSuccess(models);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.Presenter
|
||||
public void getCourse(String str, String str2, String str3, long j, long j2) {
|
||||
ApiObserver<List<JimuCourse>> apiObserver = new ApiObserver<List<JimuCourse>>(this.loadingView) { // from class: com.ubt.jimu.course.presenter.CourseListPresenter.1
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
super.onSubscribe(disposable);
|
||||
CourseListPresenter.this.disposables.b(disposable);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onNext(List<JimuCourse> list) {
|
||||
CourseListPresenter.this.view.showCourseList(list);
|
||||
}
|
||||
};
|
||||
apiObserver.setNetErrorListener(new ApiObserver.NetErrorListener() { // from class: com.ubt.jimu.course.presenter.CourseListPresenter.2
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver.NetErrorListener
|
||||
public void onError(Throwable th) {
|
||||
CourseListPresenter.this.view.showException(th);
|
||||
}
|
||||
});
|
||||
JimuCourseRepository.getInstance().getJimuCourses(str, str2, str3, j, j2, apiObserver);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.Presenter
|
||||
public void getExpeditionPack() {
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put(Constant.SelectRobot.PACKAGE_NAME_KEY, "Astrobot");
|
||||
((PackageRobotService) ApiClient.getService(PackageRobotService.class)).getPackage(basicParams).compose(RxSchedulers.a()).subscribe(new Observer<ApiResult<Package>>() { // from class: com.ubt.jimu.course.presenter.CourseListPresenter.5
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
CourseListPresenter.this.view.expeditionListFail();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
CourseListPresenter.this.view.expeditionListStart();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(ApiResult<Package> apiResult) {
|
||||
List<Package> models = apiResult.getModels();
|
||||
LogUtils.c("加载星际探险成功");
|
||||
CourseListPresenter.this.view.expeditionListSuccess(models);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubtech.presenter.BasePresenter
|
||||
public void subscribe() {
|
||||
}
|
||||
|
||||
@Override // com.ubtech.presenter.BasePresenter
|
||||
public void unSubscribe() {
|
||||
this.disposables.dispose();
|
||||
this.disposables.a();
|
||||
this.loadingView.b();
|
||||
}
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
package com.ubt.jimu.course.presenter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.utils.BitmapUtils;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseNoviceGuideOperation implements View.OnClickListener {
|
||||
private ImageView im_guide_card;
|
||||
private Activity mActivity;
|
||||
private ImageView mGaussianBlur;
|
||||
private RelativeLayout rl_guide_layout;
|
||||
private View rootView;
|
||||
|
||||
public CourseNoviceGuideOperation(Activity activity, View view) {
|
||||
this.rootView = view;
|
||||
this.mActivity = activity;
|
||||
LogUtils.c("rootView:" + view);
|
||||
this.mGaussianBlur = (ImageView) view.findViewById(R.id.im_train_guide);
|
||||
this.im_guide_card = (ImageView) view.findViewById(R.id.im_guide_card);
|
||||
this.rl_guide_layout = (RelativeLayout) view.findViewById(R.id.rl_guide_layout);
|
||||
this.rl_guide_layout.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (view.getId() != R.id.rl_guide_layout) {
|
||||
return;
|
||||
}
|
||||
this.rl_guide_layout.setVisibility(8);
|
||||
}
|
||||
|
||||
public void setImageViewSize(int i, int i2) {
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.im_guide_card.getLayoutParams();
|
||||
layoutParams.width = i;
|
||||
layoutParams.height = i2;
|
||||
LogUtils.c("h=" + i2);
|
||||
this.im_guide_card.requestLayout();
|
||||
}
|
||||
|
||||
public void showGuideImageView(String str) {
|
||||
LogUtils.c("URL:" + str);
|
||||
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(str);
|
||||
a.a(new RequestOptions().b());
|
||||
a.a(this.im_guide_card);
|
||||
}
|
||||
|
||||
public void showNoviceGuideView() {
|
||||
View rootView = this.mActivity.getWindow().getDecorView().getRootView();
|
||||
rootView.setDrawingCacheEnabled(true);
|
||||
rootView.buildDrawingCache();
|
||||
Bitmap drawingCache = rootView.getDrawingCache();
|
||||
LogUtils.c("temBitmap:" + drawingCache);
|
||||
if (drawingCache == null) {
|
||||
return;
|
||||
}
|
||||
Bitmap a = BitmapUtils.a(this.mActivity, drawingCache, 25.0f);
|
||||
LogUtils.c("blur:" + a);
|
||||
this.mGaussianBlur.setImageBitmap(a);
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.ubt.jimu.course.presenter;
|
||||
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.course.contract.MissionListContract;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMissionRepository;
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MissionListPresenter implements MissionListContract.Presenter {
|
||||
private CompositeDisposable disposables = new CompositeDisposable();
|
||||
private LoadingView loadingView;
|
||||
private MissionListContract.View view;
|
||||
|
||||
public MissionListPresenter(MissionListContract.View view, LoadingView loadingView) {
|
||||
this.view = view;
|
||||
this.loadingView = loadingView;
|
||||
view.setPresenter(this);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.MissionListContract.Presenter
|
||||
public void getMissions(String str, String str2, long j, long j2, long j3, final boolean z) {
|
||||
ApiObserver<List<JimuCourseTask>> apiObserver = new ApiObserver<List<JimuCourseTask>>(this.loadingView) { // from class: com.ubt.jimu.course.presenter.MissionListPresenter.1
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
MissionListPresenter.this.disposables.b(disposable);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onNext(List<JimuCourseTask> list) {
|
||||
MissionListPresenter.this.view.showMissions(list, z);
|
||||
}
|
||||
};
|
||||
apiObserver.setNetErrorListener(new ApiObserver.NetErrorListener() { // from class: com.ubt.jimu.course.presenter.MissionListPresenter.2
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver.NetErrorListener
|
||||
public void onError(Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
});
|
||||
JimuCourseMissionRepository.getInstance().getMissions(str, str2, j, j2, j3, apiObserver);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.presenter.BasePresenter
|
||||
public void subscribe() {
|
||||
}
|
||||
|
||||
@Override // com.ubtech.presenter.BasePresenter
|
||||
public void unSubscribe() {
|
||||
this.view = null;
|
||||
this.loadingView = null;
|
||||
CompositeDisposable compositeDisposable = this.disposables;
|
||||
if (compositeDisposable != null) {
|
||||
compositeDisposable.dispose();
|
||||
this.disposables.a();
|
||||
this.disposables = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.MissionListContract.Presenter
|
||||
public void updateMission(String str, long j, int i, String str2, long j2, long j3) {
|
||||
}
|
||||
}
|
37
sources/com/ubt/jimu/course/repository/CourseResult.java
Normal file
37
sources/com/ubt/jimu/course/repository/CourseResult.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ubt.jimu.course.repository;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseResult {
|
||||
public static final String SUCCESS = "success";
|
||||
private String message;
|
||||
private ResultData params;
|
||||
private String state;
|
||||
|
||||
public static class ResultData {
|
||||
public String level;
|
||||
public String mission;
|
||||
public long missionId;
|
||||
public String modelID;
|
||||
public long modelId;
|
||||
public String moveType;
|
||||
public String stage;
|
||||
}
|
||||
|
||||
public CourseResult(String str, String str2, ResultData resultData) {
|
||||
this.state = str;
|
||||
this.message = str2;
|
||||
this.params = resultData;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
public ResultData getParams() {
|
||||
return this.params;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return this.state;
|
||||
}
|
||||
}
|
192
sources/com/ubt/jimu/course/repository/JimuCourse.java
Normal file
192
sources/com/ubt/jimu/course/repository/JimuCourse.java
Normal file
@@ -0,0 +1,192 @@
|
||||
package com.ubt.jimu.course.repository;
|
||||
|
||||
import com.ubt.jimu.base.download.DownloadInfo;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourse {
|
||||
public static final String AVAILABLE = "1";
|
||||
public static final String NOT_AVAILABLE = "0";
|
||||
public static final String WAITING = "2";
|
||||
private String description;
|
||||
private boolean download;
|
||||
private String folderName;
|
||||
private int id;
|
||||
private String imagePath;
|
||||
private String imagePathLock;
|
||||
private String isAvailable;
|
||||
private Long localId;
|
||||
private int missionCount;
|
||||
private String missionType;
|
||||
private String name;
|
||||
private long packageId;
|
||||
private int passCount;
|
||||
private String resourceZip;
|
||||
private int starMax;
|
||||
private long updatedTime;
|
||||
private String userId;
|
||||
|
||||
public JimuCourse(Long l, int i, String str, long j, String str2, String str3, String str4, String str5, int i2, String str6, String str7, int i3, int i4, String str8, String str9, long j2, boolean z) {
|
||||
this.localId = l;
|
||||
this.id = i;
|
||||
this.userId = str;
|
||||
this.packageId = j;
|
||||
this.missionType = str2;
|
||||
this.folderName = str3;
|
||||
this.name = str4;
|
||||
this.description = str5;
|
||||
this.starMax = i2;
|
||||
this.imagePath = str6;
|
||||
this.imagePathLock = str7;
|
||||
this.missionCount = i3;
|
||||
this.passCount = i4;
|
||||
this.isAvailable = str8;
|
||||
this.resourceZip = str9;
|
||||
this.updatedTime = j2;
|
||||
this.download = z;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public boolean getDownload() {
|
||||
return this.download;
|
||||
}
|
||||
|
||||
public String getFolderName() {
|
||||
return this.folderName;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getImagePath() {
|
||||
return this.imagePath;
|
||||
}
|
||||
|
||||
public String getImagePathLock() {
|
||||
return this.imagePathLock;
|
||||
}
|
||||
|
||||
public String getIsAvailable() {
|
||||
return this.isAvailable;
|
||||
}
|
||||
|
||||
public Long getLocalId() {
|
||||
return this.localId;
|
||||
}
|
||||
|
||||
public int getMissionCount() {
|
||||
return this.missionCount;
|
||||
}
|
||||
|
||||
public String getMissionType() {
|
||||
return this.missionType;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public long getPackageId() {
|
||||
return this.packageId;
|
||||
}
|
||||
|
||||
public int getPassCount() {
|
||||
return this.passCount;
|
||||
}
|
||||
|
||||
public String getResourceZip() {
|
||||
return this.resourceZip;
|
||||
}
|
||||
|
||||
public int getStarMax() {
|
||||
return this.starMax;
|
||||
}
|
||||
|
||||
public long getUpdatedTime() {
|
||||
return this.updatedTime;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public boolean isDownloaded() {
|
||||
List<DownloadInfo> needDownloadCourse = DownloadInfo.getNeedDownloadCourse(this);
|
||||
return needDownloadCourse == null || needDownloadCourse.size() == 0;
|
||||
}
|
||||
|
||||
public void setDescription(String str) {
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
public void setDownload(boolean z) {
|
||||
this.download = z;
|
||||
}
|
||||
|
||||
public void setFolderName(String str) {
|
||||
this.folderName = str;
|
||||
}
|
||||
|
||||
public void setId(int i) {
|
||||
this.id = i;
|
||||
}
|
||||
|
||||
public void setImagePath(String str) {
|
||||
this.imagePath = str;
|
||||
}
|
||||
|
||||
public void setImagePathLock(String str) {
|
||||
this.imagePathLock = str;
|
||||
}
|
||||
|
||||
public void setIsAvailable(String str) {
|
||||
this.isAvailable = str;
|
||||
}
|
||||
|
||||
public void setLocalId(Long l) {
|
||||
this.localId = l;
|
||||
}
|
||||
|
||||
public void setMissionCount(int i) {
|
||||
this.missionCount = i;
|
||||
}
|
||||
|
||||
public void setMissionType(String str) {
|
||||
this.missionType = str;
|
||||
}
|
||||
|
||||
public void setName(String str) {
|
||||
this.name = str;
|
||||
}
|
||||
|
||||
public void setPackageId(long j) {
|
||||
this.packageId = j;
|
||||
}
|
||||
|
||||
public void setPassCount(int i) {
|
||||
this.passCount = i;
|
||||
}
|
||||
|
||||
public void setResourceZip(String str) {
|
||||
this.resourceZip = str;
|
||||
}
|
||||
|
||||
public void setStarMax(int i) {
|
||||
this.starMax = i;
|
||||
}
|
||||
|
||||
public void setUpdatedTime(long j) {
|
||||
this.updatedTime = j;
|
||||
}
|
||||
|
||||
public void setUserId(String str) {
|
||||
this.userId = str;
|
||||
}
|
||||
|
||||
public JimuCourse() {
|
||||
}
|
||||
}
|
339
sources/com/ubt/jimu/course/repository/JimuCourseMission.java
Normal file
339
sources/com/ubt/jimu/course/repository/JimuCourseMission.java
Normal file
@@ -0,0 +1,339 @@
|
||||
package com.ubt.jimu.course.repository;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.ubt.jimu.utils.GsonUtil;
|
||||
import com.ubtrobot.jimu.robotapi.BoardInfo;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseMission implements Serializable {
|
||||
public static final int SKIP_MISSION = 1;
|
||||
public static final String STATE_LOCK = "1";
|
||||
public static final String STATE_UNLOCK = "0";
|
||||
public static final long serialVersionUID = 3;
|
||||
private String androidVersion;
|
||||
private String beginPath;
|
||||
private String beginType;
|
||||
private long courseId;
|
||||
private String description;
|
||||
private String folderName;
|
||||
private long id;
|
||||
private String imagePath;
|
||||
private String imagePathLock;
|
||||
private String iosVersion;
|
||||
private String isAvailable;
|
||||
private String isLock;
|
||||
private int isSkip;
|
||||
private String knowledge;
|
||||
private Long localId;
|
||||
private String missionType;
|
||||
private List<List<JimuModule>> modules;
|
||||
|
||||
@Expose(deserialize = false, serialize = false)
|
||||
private String modulesStr;
|
||||
private String name;
|
||||
private long packageId;
|
||||
private String resourceZip;
|
||||
private String skipDescription;
|
||||
private int star;
|
||||
private String starMax;
|
||||
private long taskId;
|
||||
private long updatedTime;
|
||||
private String userId;
|
||||
|
||||
public JimuCourseMission(Long l, long j, long j2, long j3, long j4, String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, String str12, String str13, String str14, String str15, String str16, long j5, int i, int i2, String str17, String str18) {
|
||||
this.localId = l;
|
||||
this.id = j;
|
||||
this.taskId = j2;
|
||||
this.courseId = j3;
|
||||
this.packageId = j4;
|
||||
this.userId = str;
|
||||
this.missionType = str2;
|
||||
this.folderName = str3;
|
||||
this.name = str4;
|
||||
this.description = str5;
|
||||
this.starMax = str6;
|
||||
this.imagePath = str7;
|
||||
this.imagePathLock = str8;
|
||||
this.resourceZip = str9;
|
||||
this.beginType = str10;
|
||||
this.beginPath = str11;
|
||||
this.isLock = str12;
|
||||
this.knowledge = str13;
|
||||
this.isAvailable = str14;
|
||||
this.iosVersion = str15;
|
||||
this.androidVersion = str16;
|
||||
this.updatedTime = j5;
|
||||
this.star = i;
|
||||
this.isSkip = i2;
|
||||
this.skipDescription = str17;
|
||||
this.modulesStr = str18;
|
||||
}
|
||||
|
||||
public String getAndroidVersion() {
|
||||
return this.androidVersion;
|
||||
}
|
||||
|
||||
public String getBeginPath() {
|
||||
return this.beginPath;
|
||||
}
|
||||
|
||||
public String getBeginType() {
|
||||
return this.beginType;
|
||||
}
|
||||
|
||||
public long getCourseId() {
|
||||
return this.courseId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public String getFolderName() {
|
||||
return this.folderName;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getImagePath() {
|
||||
return this.imagePath;
|
||||
}
|
||||
|
||||
public String getImagePathLock() {
|
||||
return this.imagePathLock;
|
||||
}
|
||||
|
||||
public String getIosVersion() {
|
||||
return this.iosVersion;
|
||||
}
|
||||
|
||||
public String getIsAvailable() {
|
||||
return this.isAvailable;
|
||||
}
|
||||
|
||||
public String getIsLock() {
|
||||
return this.isLock;
|
||||
}
|
||||
|
||||
public int getIsSkip() {
|
||||
return this.isSkip;
|
||||
}
|
||||
|
||||
public String getKnowledge() {
|
||||
return this.knowledge;
|
||||
}
|
||||
|
||||
public Long getLocalId() {
|
||||
return this.localId;
|
||||
}
|
||||
|
||||
public List<JimuModule> getMissingComponents(BoardInfo boardInfo) {
|
||||
List<List<JimuModule>> modules = getModules();
|
||||
ArrayList arrayList = null;
|
||||
if (modules != null && modules.size() > 0) {
|
||||
if (boardInfo == null) {
|
||||
return null;
|
||||
}
|
||||
Map<Integer, Integer> g = boardInfo.g();
|
||||
arrayList = new ArrayList();
|
||||
for (List<JimuModule> list : modules) {
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int size = list.size() - 1; size >= 0; size--) {
|
||||
JimuModule jimuModule = (JimuModule) list.get(size).clone();
|
||||
Integer num = g.get(Integer.valueOf(JimuModule.getType(jimuModule.getModuleId())));
|
||||
if (num == null || num.intValue() < jimuModule.getCount()) {
|
||||
if (size <= 0) {
|
||||
if (num != null) {
|
||||
jimuModule.setCount(jimuModule.getCount() - num.intValue());
|
||||
}
|
||||
arrayList.add(jimuModule);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public String getMissionType() {
|
||||
return this.missionType;
|
||||
}
|
||||
|
||||
public List<List<JimuModule>> getModules() {
|
||||
List<List<JimuModule>> list = this.modules;
|
||||
if ((list == null || list.size() <= 0) && !TextUtils.isEmpty(this.modulesStr)) {
|
||||
this.modules = (List) GsonUtil.a(this.modulesStr, new TypeToken<List<List<JimuModule>>>() { // from class: com.ubt.jimu.course.repository.JimuCourseMission.1
|
||||
});
|
||||
}
|
||||
return this.modules;
|
||||
}
|
||||
|
||||
public String getModulesStr() {
|
||||
List<List<JimuModule>> list;
|
||||
if (TextUtils.isEmpty(this.modulesStr) && (list = this.modules) != null && list.size() > 0) {
|
||||
setModulesStr(new Gson().toJson(this.modules));
|
||||
}
|
||||
return this.modulesStr;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public long getPackageId() {
|
||||
return this.packageId;
|
||||
}
|
||||
|
||||
public String getResourceZip() {
|
||||
return this.resourceZip;
|
||||
}
|
||||
|
||||
public String getSkipDescription() {
|
||||
return this.skipDescription;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return this.star;
|
||||
}
|
||||
|
||||
public String getStarMax() {
|
||||
return this.starMax;
|
||||
}
|
||||
|
||||
public long getTaskId() {
|
||||
return this.taskId;
|
||||
}
|
||||
|
||||
public long getUpdatedTime() {
|
||||
return this.updatedTime;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public boolean isLock() {
|
||||
return "1".equals(this.isLock);
|
||||
}
|
||||
|
||||
public void setAndroidVersion(String str) {
|
||||
this.androidVersion = str;
|
||||
}
|
||||
|
||||
public void setBeginPath(String str) {
|
||||
this.beginPath = str;
|
||||
}
|
||||
|
||||
public void setBeginType(String str) {
|
||||
this.beginType = str;
|
||||
}
|
||||
|
||||
public void setCourseId(long j) {
|
||||
this.courseId = j;
|
||||
}
|
||||
|
||||
public void setDescription(String str) {
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
public void setFolderName(String str) {
|
||||
this.folderName = str;
|
||||
}
|
||||
|
||||
public void setId(long j) {
|
||||
this.id = j;
|
||||
}
|
||||
|
||||
public void setImagePath(String str) {
|
||||
this.imagePath = str;
|
||||
}
|
||||
|
||||
public void setImagePathLock(String str) {
|
||||
this.imagePathLock = str;
|
||||
}
|
||||
|
||||
public void setIosVersion(String str) {
|
||||
this.iosVersion = str;
|
||||
}
|
||||
|
||||
public void setIsAvailable(String str) {
|
||||
this.isAvailable = str;
|
||||
}
|
||||
|
||||
public void setIsLock(String str) {
|
||||
this.isLock = str;
|
||||
}
|
||||
|
||||
public void setIsSkip(int i) {
|
||||
this.isSkip = i;
|
||||
}
|
||||
|
||||
public void setKnowledge(String str) {
|
||||
this.knowledge = str;
|
||||
}
|
||||
|
||||
public void setLocalId(Long l) {
|
||||
this.localId = l;
|
||||
}
|
||||
|
||||
public void setMissionType(String str) {
|
||||
this.missionType = str;
|
||||
}
|
||||
|
||||
public void setModules(List<List<JimuModule>> list) {
|
||||
this.modules = list;
|
||||
}
|
||||
|
||||
public void setModulesStr(String str) {
|
||||
this.modulesStr = str;
|
||||
}
|
||||
|
||||
public void setName(String str) {
|
||||
this.name = str;
|
||||
}
|
||||
|
||||
public void setPackageId(long j) {
|
||||
this.packageId = j;
|
||||
}
|
||||
|
||||
public void setResourceZip(String str) {
|
||||
this.resourceZip = str;
|
||||
}
|
||||
|
||||
public void setSkipDescription(String str) {
|
||||
this.skipDescription = str;
|
||||
}
|
||||
|
||||
public void setStar(int i) {
|
||||
this.star = i;
|
||||
}
|
||||
|
||||
public void setStarMax(String str) {
|
||||
this.starMax = str;
|
||||
}
|
||||
|
||||
public void setTaskId(long j) {
|
||||
this.taskId = j;
|
||||
}
|
||||
|
||||
public void setUpdatedTime(long j) {
|
||||
this.updatedTime = j;
|
||||
}
|
||||
|
||||
public void setUserId(String str) {
|
||||
this.userId = str;
|
||||
}
|
||||
|
||||
public JimuCourseMission() {
|
||||
}
|
||||
}
|
@@ -0,0 +1,154 @@
|
||||
package com.ubt.jimu.course.repository;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.course.JimuCourseMissionDbHandler;
|
||||
import com.ubt.jimu.base.db.course.JimuCourseTaskDbHaldler;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.ApiResponse;
|
||||
import com.ubt.jimu.base.http.manager.Manager;
|
||||
import com.ubt.jimu.base.http.service.CourseService;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubtech.utils.XLog;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.functions.BiFunction;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseMissionRepository extends Manager {
|
||||
private static JimuCourseMissionRepository courseMissionRepository;
|
||||
|
||||
private JimuCourseMissionRepository() {
|
||||
}
|
||||
|
||||
public static JimuCourseMissionRepository getInstance() {
|
||||
if (courseMissionRepository == null) {
|
||||
courseMissionRepository = new JimuCourseMissionRepository();
|
||||
}
|
||||
return courseMissionRepository;
|
||||
}
|
||||
|
||||
public Observable<List<JimuCourseTask>> getMissions(String str, String str2, final long j, long j2, final long j3, ApiObserver<List<JimuCourseTask>> apiObserver) {
|
||||
Observable<List<JimuCourseTask>> create = Observable.create(new ObservableOnSubscribe<List<JimuCourseTask>>() { // from class: com.ubt.jimu.course.repository.JimuCourseMissionRepository.1
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public void subscribe(ObservableEmitter<List<JimuCourseTask>> observableEmitter) throws Exception {
|
||||
observableEmitter.onNext(JimuCourseTaskDbHaldler.getJimuCourseTasks(Cache.getInstance().getUserId(), j, j3));
|
||||
observableEmitter.onComplete();
|
||||
}
|
||||
});
|
||||
if (!NetWorkUtil.b(JimuApplication.l())) {
|
||||
XLog.b("Course", "Please check network, now use local cache.");
|
||||
return create;
|
||||
}
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put("findChild", "1");
|
||||
if (Cache.getInstance().getUser() != null) {
|
||||
basicParams.put("userId", str);
|
||||
basicParams.put("token", Cache.getInstance().getUserToken());
|
||||
} else {
|
||||
basicParams.put("deviceId", str2);
|
||||
}
|
||||
basicParams.put(Constant.SelectRobot.PACKAGEID_KEY, String.valueOf(j));
|
||||
basicParams.put("modelId", String.valueOf(j2));
|
||||
basicParams.put(JockstickDataConverter.ID, String.valueOf(j3));
|
||||
Observable<List<JimuCourseTask>> doAfterNext = Observable.zip(((CourseService) ApiClient.getService(CourseService.class)).getMissions(basicParams), create, new BiFunction<ApiResponse<List<JimuCourseTask>>, List<JimuCourseTask>, List<JimuCourseTask>>() { // from class: com.ubt.jimu.course.repository.JimuCourseMissionRepository.3
|
||||
@Override // io.reactivex.functions.BiFunction
|
||||
public List<JimuCourseTask> apply(ApiResponse<List<JimuCourseTask>> apiResponse, List<JimuCourseTask> list) throws Exception {
|
||||
List<JimuCourseTask> models = apiResponse.getModels();
|
||||
if (models == null || models.size() == 0) {
|
||||
return list;
|
||||
}
|
||||
for (JimuCourseTask jimuCourseTask : models) {
|
||||
jimuCourseTask.setUserId(Cache.getInstance().getUserId());
|
||||
jimuCourseTask.setPackageId(j);
|
||||
jimuCourseTask.setCourseId(j3);
|
||||
List<JimuCourseMission> missions = jimuCourseTask.getMissions();
|
||||
for (JimuCourseMission jimuCourseMission : missions) {
|
||||
jimuCourseMission.setUserId(Cache.getInstance().getUserId());
|
||||
jimuCourseMission.setPackageId(j);
|
||||
jimuCourseMission.setCourseId(j3);
|
||||
jimuCourseMission.setTaskId(jimuCourseTask.getId());
|
||||
}
|
||||
Iterator<JimuCourseTask> it = list.iterator();
|
||||
while (true) {
|
||||
if (it.hasNext()) {
|
||||
JimuCourseTask next = it.next();
|
||||
if (next.getId() == jimuCourseTask.getId()) {
|
||||
jimuCourseTask.setLocalId(next.getLocalId());
|
||||
List<JimuCourseMission> missions2 = next.getMissions();
|
||||
for (JimuCourseMission jimuCourseMission2 : missions) {
|
||||
Iterator<JimuCourseMission> it2 = missions2.iterator();
|
||||
while (true) {
|
||||
if (!it2.hasNext()) {
|
||||
break;
|
||||
}
|
||||
if (it2.next().getId() == jimuCourseMission2.getId()) {
|
||||
jimuCourseMission2.setLocalId(next.getLocalId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return models;
|
||||
}
|
||||
}).doAfterNext(new Consumer<List<JimuCourseTask>>() { // from class: com.ubt.jimu.course.repository.JimuCourseMissionRepository.2
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
public void accept(List<JimuCourseTask> list) throws Exception {
|
||||
JimuCourseTaskDbHaldler.saveOrUpdate(list);
|
||||
Iterator<JimuCourseTask> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
JimuCourseMissionDbHandler.update(it.next().getMissions());
|
||||
}
|
||||
}
|
||||
});
|
||||
noAddSubscribe(doAfterNext, apiObserver);
|
||||
return doAfterNext;
|
||||
}
|
||||
|
||||
public Observable<ApiResponse<List<JimuCourseMission>>> skipMission(String str, long j, String str2, long j2, long j3, ApiObserver<ApiResponse<List<JimuCourseMission>>> apiObserver) {
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put("missionId", String.valueOf(j));
|
||||
basicParams.put("deviceId", str2);
|
||||
if (Cache.getInstance().getUser() != null) {
|
||||
basicParams.put("userId", str);
|
||||
basicParams.put("token", Cache.getInstance().getUserToken());
|
||||
} else {
|
||||
basicParams.put("deviceId", str2);
|
||||
}
|
||||
basicParams.put(Constant.SelectRobot.PACKAGEID_KEY, String.valueOf(j2));
|
||||
basicParams.put("modelId", String.valueOf(j3));
|
||||
Observable<ApiResponse<List<JimuCourseMission>>> skipMission = ((CourseService) ApiClient.getService(CourseService.class)).skipMission(basicParams);
|
||||
noAddSubscribe(skipMission, apiObserver);
|
||||
return skipMission;
|
||||
}
|
||||
|
||||
public Observable<ApiResponse<UpdateMission>> updateMission(String str, long j, int i, String str2, long j2, long j3, ApiObserver<ApiResponse<UpdateMission>> apiObserver) {
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put("missionId", String.valueOf(j));
|
||||
basicParams.put("finishStar", String.valueOf(i));
|
||||
basicParams.put("deviceId", str2);
|
||||
if (Cache.getInstance().getUser() != null) {
|
||||
basicParams.put("userId", str);
|
||||
basicParams.put("token", Cache.getInstance().getUserToken());
|
||||
} else {
|
||||
basicParams.put("deviceId", str2);
|
||||
}
|
||||
basicParams.put(Constant.SelectRobot.PACKAGEID_KEY, String.valueOf(j2));
|
||||
basicParams.put("modelId", String.valueOf(j3));
|
||||
Observable<ApiResponse<UpdateMission>> updateMission = ((CourseService) ApiClient.getService(CourseService.class)).updateMission(basicParams);
|
||||
noAddSubscribe(updateMission, apiObserver);
|
||||
return updateMission;
|
||||
}
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
package com.ubt.jimu.course.repository;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.course.JimuCourseDbHandler;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.ApiResponse;
|
||||
import com.ubt.jimu.base.http.manager.Manager;
|
||||
import com.ubt.jimu.base.http.service.CourseService;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.functions.BiFunction;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseRepository extends Manager {
|
||||
|
||||
private static class JimuCourseRepositoryManager {
|
||||
private static JimuCourseRepository repository = new JimuCourseRepository();
|
||||
|
||||
private JimuCourseRepositoryManager() {
|
||||
}
|
||||
}
|
||||
|
||||
public static JimuCourseRepository getInstance() {
|
||||
return JimuCourseRepositoryManager.repository;
|
||||
}
|
||||
|
||||
public Observable<List<JimuCourse>> getJimuCourses(String str, final String str2, String str3, final long j, long j2, ApiObserver<List<JimuCourse>> apiObserver) {
|
||||
final List<JimuCourse> jimuCourseList = JimuCourseDbHandler.getJimuCourseList(Cache.getInstance().getUserId(), j);
|
||||
Observable<List<JimuCourse>> create = Observable.create(new ObservableOnSubscribe<List<JimuCourse>>() { // from class: com.ubt.jimu.course.repository.JimuCourseRepository.1
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public void subscribe(ObservableEmitter<List<JimuCourse>> observableEmitter) throws Exception {
|
||||
observableEmitter.onNext(jimuCourseList);
|
||||
observableEmitter.onComplete();
|
||||
}
|
||||
});
|
||||
if (!NetWorkUtil.b(JimuApplication.l()) && jimuCourseList != null && jimuCourseList.size() > 0) {
|
||||
toSubscribe(create, apiObserver);
|
||||
return create;
|
||||
}
|
||||
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
||||
basicParams.put("missionType", str);
|
||||
if (Cache.getInstance().getUser() != null) {
|
||||
basicParams.put("userId", str2);
|
||||
basicParams.put("token", Cache.getInstance().getUserToken());
|
||||
} else {
|
||||
basicParams.put("deviceId", str3);
|
||||
}
|
||||
basicParams.put(Constant.SelectRobot.PACKAGEID_KEY, String.valueOf(j));
|
||||
basicParams.put("modelId", String.valueOf(j2));
|
||||
Observable<List<JimuCourse>> zip = Observable.zip(((CourseService) ApiClient.getService(CourseService.class)).getCourses(basicParams), create, new BiFunction<ApiResponse<List<JimuCourse>>, List<JimuCourse>, List<JimuCourse>>() { // from class: com.ubt.jimu.course.repository.JimuCourseRepository.2
|
||||
@Override // io.reactivex.functions.BiFunction
|
||||
public List<JimuCourse> apply(ApiResponse<List<JimuCourse>> apiResponse, List<JimuCourse> list) throws Exception {
|
||||
List<JimuCourse> models = apiResponse.getModels();
|
||||
if (models == null || models.size() == 0) {
|
||||
return list;
|
||||
}
|
||||
for (JimuCourse jimuCourse : models) {
|
||||
if (TextUtils.isEmpty(str2)) {
|
||||
jimuCourse.setUserId(Cache.getInstance().getUserId());
|
||||
} else {
|
||||
jimuCourse.setUserId(String.valueOf(str2));
|
||||
}
|
||||
jimuCourse.setPackageId(j);
|
||||
}
|
||||
JimuCourseDbHandler.saveOrUpdate(models);
|
||||
return models;
|
||||
}
|
||||
});
|
||||
toSubscribe(zip, apiObserver);
|
||||
return zip;
|
||||
}
|
||||
}
|
322
sources/com/ubt/jimu/course/repository/JimuCourseTask.java
Normal file
322
sources/com/ubt/jimu/course/repository/JimuCourseTask.java
Normal file
@@ -0,0 +1,322 @@
|
||||
package com.ubt.jimu.course.repository;
|
||||
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import com.ubt.jimu.gen.JimuCourseTaskDao;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.DaoException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseTask implements Cloneable, Serializable {
|
||||
public static final int SKIP_TASK = 1;
|
||||
public static final long serialVersionUID = 2;
|
||||
private String androidVersion;
|
||||
private String beginPath;
|
||||
private String beginType;
|
||||
private long courseId;
|
||||
private transient DaoSession daoSession;
|
||||
private String description;
|
||||
private String folderName;
|
||||
private long id;
|
||||
private String imagePath;
|
||||
private String imagePathLock;
|
||||
private String iosVersion;
|
||||
private String isAvailable;
|
||||
private String isLock;
|
||||
private int isSkip;
|
||||
private String knowledge;
|
||||
private Long localId;
|
||||
private String missionType;
|
||||
private List<JimuCourseMission> missions;
|
||||
private transient JimuCourseTaskDao myDao;
|
||||
private String name;
|
||||
private long packageId;
|
||||
private String resourceZip;
|
||||
private String skipDescription;
|
||||
private int star;
|
||||
private String starMax;
|
||||
private long updatedTime;
|
||||
private String userId;
|
||||
|
||||
public JimuCourseTask(Long l, long j, long j2, long j3, String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, String str12, String str13, String str14, String str15, String str16, long j4, int i, int i2, String str17) {
|
||||
this.localId = l;
|
||||
this.id = j;
|
||||
this.courseId = j2;
|
||||
this.packageId = j3;
|
||||
this.userId = str;
|
||||
this.missionType = str2;
|
||||
this.folderName = str3;
|
||||
this.name = str4;
|
||||
this.description = str5;
|
||||
this.starMax = str6;
|
||||
this.imagePath = str7;
|
||||
this.imagePathLock = str8;
|
||||
this.resourceZip = str9;
|
||||
this.beginType = str10;
|
||||
this.beginPath = str11;
|
||||
this.isLock = str12;
|
||||
this.knowledge = str13;
|
||||
this.isAvailable = str14;
|
||||
this.iosVersion = str15;
|
||||
this.androidVersion = str16;
|
||||
this.updatedTime = j4;
|
||||
this.star = i;
|
||||
this.isSkip = i2;
|
||||
this.skipDescription = str17;
|
||||
}
|
||||
|
||||
public void __setDaoSession(DaoSession daoSession) {
|
||||
this.daoSession = daoSession;
|
||||
this.myDao = daoSession != null ? daoSession.n() : null;
|
||||
}
|
||||
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
JimuCourseTask jimuCourseTask = (JimuCourseTask) super.clone();
|
||||
jimuCourseTask.missions = new ArrayList();
|
||||
return jimuCourseTask;
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
JimuCourseTaskDao jimuCourseTaskDao = this.myDao;
|
||||
if (jimuCourseTaskDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
jimuCourseTaskDao.b((JimuCourseTaskDao) this);
|
||||
}
|
||||
|
||||
public String getAndroidVersion() {
|
||||
return this.androidVersion;
|
||||
}
|
||||
|
||||
public String getBeginPath() {
|
||||
return this.beginPath;
|
||||
}
|
||||
|
||||
public String getBeginType() {
|
||||
return this.beginType;
|
||||
}
|
||||
|
||||
public long getCourseId() {
|
||||
return this.courseId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public String getFolderName() {
|
||||
return this.folderName;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getImagePath() {
|
||||
return this.imagePath;
|
||||
}
|
||||
|
||||
public String getImagePathLock() {
|
||||
return this.imagePathLock;
|
||||
}
|
||||
|
||||
public String getIosVersion() {
|
||||
return this.iosVersion;
|
||||
}
|
||||
|
||||
public String getIsAvailable() {
|
||||
return this.isAvailable;
|
||||
}
|
||||
|
||||
public String getIsLock() {
|
||||
return this.isLock;
|
||||
}
|
||||
|
||||
public int getIsSkip() {
|
||||
return this.isSkip;
|
||||
}
|
||||
|
||||
public String getKnowledge() {
|
||||
return this.knowledge;
|
||||
}
|
||||
|
||||
public Long getLocalId() {
|
||||
return this.localId;
|
||||
}
|
||||
|
||||
public String getMissionType() {
|
||||
return this.missionType;
|
||||
}
|
||||
|
||||
public List<JimuCourseMission> getMissions() {
|
||||
if (this.missions == null) {
|
||||
DaoSession daoSession = this.daoSession;
|
||||
if (daoSession == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
List<JimuCourseMission> a = daoSession.m().a(this.id, this.courseId, this.packageId);
|
||||
synchronized (this) {
|
||||
if (this.missions == null) {
|
||||
this.missions = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.missions;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public long getPackageId() {
|
||||
return this.packageId;
|
||||
}
|
||||
|
||||
public String getResourceZip() {
|
||||
return this.resourceZip;
|
||||
}
|
||||
|
||||
public String getSkipDescription() {
|
||||
return this.skipDescription;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return this.star;
|
||||
}
|
||||
|
||||
public String getStarMax() {
|
||||
return this.starMax;
|
||||
}
|
||||
|
||||
public long getUpdatedTime() {
|
||||
return this.updatedTime;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
JimuCourseTaskDao jimuCourseTaskDao = this.myDao;
|
||||
if (jimuCourseTaskDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
jimuCourseTaskDao.i(this);
|
||||
}
|
||||
|
||||
public synchronized void resetMissions() {
|
||||
this.missions = null;
|
||||
}
|
||||
|
||||
public void setAndroidVersion(String str) {
|
||||
this.androidVersion = str;
|
||||
}
|
||||
|
||||
public void setBeginPath(String str) {
|
||||
this.beginPath = str;
|
||||
}
|
||||
|
||||
public void setBeginType(String str) {
|
||||
this.beginType = str;
|
||||
}
|
||||
|
||||
public void setCourseId(long j) {
|
||||
this.courseId = j;
|
||||
}
|
||||
|
||||
public void setDescription(String str) {
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
public void setFolderName(String str) {
|
||||
this.folderName = str;
|
||||
}
|
||||
|
||||
public void setId(long j) {
|
||||
this.id = j;
|
||||
}
|
||||
|
||||
public void setImagePath(String str) {
|
||||
this.imagePath = str;
|
||||
}
|
||||
|
||||
public void setImagePathLock(String str) {
|
||||
this.imagePathLock = str;
|
||||
}
|
||||
|
||||
public void setIosVersion(String str) {
|
||||
this.iosVersion = str;
|
||||
}
|
||||
|
||||
public void setIsAvailable(String str) {
|
||||
this.isAvailable = str;
|
||||
}
|
||||
|
||||
public void setIsLock(String str) {
|
||||
this.isLock = str;
|
||||
}
|
||||
|
||||
public void setIsSkip(int i) {
|
||||
this.isSkip = i;
|
||||
}
|
||||
|
||||
public void setKnowledge(String str) {
|
||||
this.knowledge = str;
|
||||
}
|
||||
|
||||
public void setLocalId(Long l) {
|
||||
this.localId = l;
|
||||
}
|
||||
|
||||
public void setMissionType(String str) {
|
||||
this.missionType = str;
|
||||
}
|
||||
|
||||
public void setMissions(List<JimuCourseMission> list) {
|
||||
this.missions = list;
|
||||
}
|
||||
|
||||
public void setName(String str) {
|
||||
this.name = str;
|
||||
}
|
||||
|
||||
public void setPackageId(long j) {
|
||||
this.packageId = j;
|
||||
}
|
||||
|
||||
public void setResourceZip(String str) {
|
||||
this.resourceZip = str;
|
||||
}
|
||||
|
||||
public void setSkipDescription(String str) {
|
||||
this.skipDescription = str;
|
||||
}
|
||||
|
||||
public void setStar(int i) {
|
||||
this.star = i;
|
||||
}
|
||||
|
||||
public void setStarMax(String str) {
|
||||
this.starMax = str;
|
||||
}
|
||||
|
||||
public void setUpdatedTime(long j) {
|
||||
this.updatedTime = j;
|
||||
}
|
||||
|
||||
public void setUserId(String str) {
|
||||
this.userId = str;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
JimuCourseTaskDao jimuCourseTaskDao = this.myDao;
|
||||
if (jimuCourseTaskDao == null) {
|
||||
throw new DaoException("Entity is detached from DAO context");
|
||||
}
|
||||
jimuCourseTaskDao.j(this);
|
||||
}
|
||||
|
||||
public JimuCourseTask() {
|
||||
}
|
||||
}
|
91
sources/com/ubt/jimu/course/repository/JimuModule.java
Normal file
91
sources/com/ubt/jimu/course/repository/JimuModule.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package com.ubt.jimu.course.repository;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuModule implements Cloneable {
|
||||
public static final Map<Integer, Integer> modulesMap = new HashMap();
|
||||
private int count;
|
||||
private long id;
|
||||
private long missionId;
|
||||
private int moduleId;
|
||||
private int type;
|
||||
|
||||
static {
|
||||
modulesMap.put(1, 4);
|
||||
modulesMap.put(2, 6);
|
||||
modulesMap.put(3, 1);
|
||||
modulesMap.put(4, 7);
|
||||
modulesMap.put(5, 14);
|
||||
modulesMap.put(6, 9);
|
||||
}
|
||||
|
||||
public JimuModule() {
|
||||
}
|
||||
|
||||
public static int getType(int i) {
|
||||
return modulesMap.get(Integer.valueOf(i)).intValue();
|
||||
}
|
||||
|
||||
protected Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
return new JimuModule(this.count, this.id, this.missionId, this.moduleId, this.type);
|
||||
}
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public long getMissionId() {
|
||||
return this.missionId;
|
||||
}
|
||||
|
||||
public int getModuleId() {
|
||||
return this.moduleId;
|
||||
}
|
||||
|
||||
public void setCount(int i) {
|
||||
this.count = i;
|
||||
}
|
||||
|
||||
public void setId(long j) {
|
||||
this.id = j;
|
||||
}
|
||||
|
||||
public void setMissionId(long j) {
|
||||
this.missionId = j;
|
||||
}
|
||||
|
||||
public void setModuleId(int i) {
|
||||
this.moduleId = i;
|
||||
}
|
||||
|
||||
public void setType(int i) {
|
||||
this.type = i;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "count: " + this.count + " id: " + this.id + " missionId: " + this.missionId + " moduleId: " + this.moduleId + " type: " + this.type;
|
||||
}
|
||||
|
||||
public JimuModule(int i, long j, long j2, int i2, int i3) {
|
||||
this.count = i;
|
||||
this.id = j;
|
||||
this.missionId = j2;
|
||||
this.moduleId = i2;
|
||||
this.type = i3;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
}
|
97
sources/com/ubt/jimu/course/repository/UpdateMission.java
Normal file
97
sources/com/ubt/jimu/course/repository/UpdateMission.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package com.ubt.jimu.course.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UpdateMission {
|
||||
private int capArt;
|
||||
private int capEngineering;
|
||||
private int capMath;
|
||||
private int capScience;
|
||||
private int capSpace;
|
||||
private int exp;
|
||||
private int missionId;
|
||||
private List<JimuCourseMission> missions;
|
||||
private int score;
|
||||
private int star;
|
||||
|
||||
public int getCapArt() {
|
||||
return this.capArt;
|
||||
}
|
||||
|
||||
public int getCapEngineering() {
|
||||
return this.capEngineering;
|
||||
}
|
||||
|
||||
public int getCapMath() {
|
||||
return this.capMath;
|
||||
}
|
||||
|
||||
public int getCapScience() {
|
||||
return this.capScience;
|
||||
}
|
||||
|
||||
public int getCapSpace() {
|
||||
return this.capSpace;
|
||||
}
|
||||
|
||||
public int getExp() {
|
||||
return this.exp;
|
||||
}
|
||||
|
||||
public int getMissionId() {
|
||||
return this.missionId;
|
||||
}
|
||||
|
||||
public List<JimuCourseMission> getMissions() {
|
||||
return this.missions;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return this.score;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return this.star;
|
||||
}
|
||||
|
||||
public void setCapArt(int i) {
|
||||
this.capArt = i;
|
||||
}
|
||||
|
||||
public void setCapEngineering(int i) {
|
||||
this.capEngineering = i;
|
||||
}
|
||||
|
||||
public void setCapMath(int i) {
|
||||
this.capMath = i;
|
||||
}
|
||||
|
||||
public void setCapScience(int i) {
|
||||
this.capScience = i;
|
||||
}
|
||||
|
||||
public void setCapSpace(int i) {
|
||||
this.capSpace = i;
|
||||
}
|
||||
|
||||
public void setExp(int i) {
|
||||
this.exp = i;
|
||||
}
|
||||
|
||||
public void setMissionId(int i) {
|
||||
this.missionId = i;
|
||||
}
|
||||
|
||||
public void setMissions(List<JimuCourseMission> list) {
|
||||
this.missions = list;
|
||||
}
|
||||
|
||||
public void setScore(int i) {
|
||||
this.score = i;
|
||||
}
|
||||
|
||||
public void setStar(int i) {
|
||||
this.star = i;
|
||||
}
|
||||
}
|
44
sources/com/ubt/jimu/course/view/FixedSpeedScroller.java
Normal file
44
sources/com/ubt/jimu/course/view/FixedSpeedScroller.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.ubt.jimu.course.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.Scroller;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FixedSpeedScroller extends Scroller {
|
||||
public int mDuration;
|
||||
|
||||
public FixedSpeedScroller(Context context) {
|
||||
super(context);
|
||||
this.mDuration = ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED;
|
||||
}
|
||||
|
||||
public int getmDuration() {
|
||||
return this.mDuration;
|
||||
}
|
||||
|
||||
public void setmDuration(int i) {
|
||||
this.mDuration = i;
|
||||
}
|
||||
|
||||
@Override // android.widget.Scroller
|
||||
public void startScroll(int i, int i2, int i3, int i4) {
|
||||
startScroll(i, i2, i3, i4, this.mDuration);
|
||||
}
|
||||
|
||||
@Override // android.widget.Scroller
|
||||
public void startScroll(int i, int i2, int i3, int i4, int i5) {
|
||||
super.startScroll(i, i2, i3, i4, this.mDuration);
|
||||
}
|
||||
|
||||
public FixedSpeedScroller(Context context, Interpolator interpolator) {
|
||||
super(context, interpolator);
|
||||
this.mDuration = ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED;
|
||||
}
|
||||
|
||||
public FixedSpeedScroller(Context context, Interpolator interpolator, boolean z) {
|
||||
super(context, interpolator, z);
|
||||
this.mDuration = ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED;
|
||||
}
|
||||
}
|
159
sources/com/ubt/jimu/course/view/GridItemDecoration.java
Normal file
159
sources/com/ubt/jimu/course/view/GridItemDecoration.java
Normal file
@@ -0,0 +1,159 @@
|
||||
package com.ubt.jimu.course.view;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GridItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private int headerNumber;
|
||||
private int leftRight;
|
||||
protected Drawable mDivider = new ColorDrawable();
|
||||
private int topBottom;
|
||||
|
||||
public GridItemDecoration(int i, int i2) {
|
||||
this.topBottom = 16;
|
||||
this.leftRight = 16;
|
||||
this.headerNumber = 0;
|
||||
this.topBottom = i;
|
||||
this.leftRight = i2;
|
||||
this.headerNumber = 0;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
GridLayoutManager gridLayoutManager = (GridLayoutManager) recyclerView.getLayoutManager();
|
||||
GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
int e = recyclerView.e(view);
|
||||
int N = gridLayoutManager.N();
|
||||
if (gridLayoutManager.K() != 1) {
|
||||
if ((e + layoutParams.f()) - 1 < N) {
|
||||
rect.left = this.leftRight;
|
||||
}
|
||||
if (layoutParams.e() + layoutParams.f() == N) {
|
||||
rect.bottom = this.topBottom;
|
||||
}
|
||||
rect.right = this.leftRight;
|
||||
rect.top = this.topBottom;
|
||||
return;
|
||||
}
|
||||
int f = (layoutParams.f() + e) - 1;
|
||||
int i = this.headerNumber;
|
||||
if (f - i < N && e >= i) {
|
||||
rect.top = this.topBottom;
|
||||
}
|
||||
if (layoutParams.e() + layoutParams.f() == N) {
|
||||
rect.right = this.leftRight;
|
||||
}
|
||||
rect.bottom = this.topBottom;
|
||||
rect.left = this.leftRight;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
public void onDraw(Canvas canvas, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
int i;
|
||||
GridLayoutManager gridLayoutManager;
|
||||
GridLayoutManager.SpanSizeLookup spanSizeLookup;
|
||||
RecyclerView recyclerView2 = recyclerView;
|
||||
GridLayoutManager gridLayoutManager2 = (GridLayoutManager) recyclerView.getLayoutManager();
|
||||
GridLayoutManager.SpanSizeLookup O = gridLayoutManager2.O();
|
||||
if (this.mDivider == null || gridLayoutManager2.e() == 0) {
|
||||
return;
|
||||
}
|
||||
int N = gridLayoutManager2.N();
|
||||
int childCount = recyclerView.getChildCount();
|
||||
int i2 = 1;
|
||||
if (gridLayoutManager2.K() == 1) {
|
||||
int i3 = 0;
|
||||
while (i3 < childCount) {
|
||||
View childAt = recyclerView2.getChildAt(i3);
|
||||
int e = recyclerView2.e(childAt);
|
||||
int spanSize = O.getSpanSize(e);
|
||||
int spanIndex = O.getSpanIndex(e, gridLayoutManager2.N());
|
||||
float k = ((gridLayoutManager2.k(childAt) + i2) - this.leftRight) / 2;
|
||||
float d = ((gridLayoutManager2.d(childAt) + i2) - this.topBottom) / 2;
|
||||
int i4 = e + spanSize;
|
||||
if ((i4 <= gridLayoutManager2.N()) || spanIndex != 0) {
|
||||
gridLayoutManager = gridLayoutManager2;
|
||||
spanSizeLookup = O;
|
||||
} else {
|
||||
int k2 = gridLayoutManager2.k(childAt);
|
||||
int width = recyclerView.getWidth() - gridLayoutManager2.k(childAt);
|
||||
gridLayoutManager = gridLayoutManager2;
|
||||
spanSizeLookup = O;
|
||||
int i5 = this.topBottom;
|
||||
int top = ((int) (childAt.getTop() - d)) - i5;
|
||||
this.mDivider.setBounds(k2, top, width, i5 + top);
|
||||
this.mDivider.draw(canvas);
|
||||
}
|
||||
if (!(spanIndex + spanSize == N)) {
|
||||
int right = (int) (childAt.getRight() + k);
|
||||
int i6 = this.leftRight + right;
|
||||
int top2 = childAt.getTop();
|
||||
if (i4 - 1 >= N) {
|
||||
top2 = (int) (top2 - d);
|
||||
}
|
||||
this.mDivider.setBounds(right, top2, i6, (int) (childAt.getBottom() + d));
|
||||
this.mDivider.draw(canvas);
|
||||
}
|
||||
i3++;
|
||||
recyclerView2 = recyclerView;
|
||||
gridLayoutManager2 = gridLayoutManager;
|
||||
O = spanSizeLookup;
|
||||
i2 = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
GridLayoutManager gridLayoutManager3 = gridLayoutManager2;
|
||||
GridLayoutManager.SpanSizeLookup spanSizeLookup2 = O;
|
||||
int i7 = 0;
|
||||
while (i7 < childCount) {
|
||||
View childAt2 = recyclerView.getChildAt(i7);
|
||||
int e2 = recyclerView.e(childAt2);
|
||||
GridLayoutManager.SpanSizeLookup spanSizeLookup3 = spanSizeLookup2;
|
||||
int spanSize2 = spanSizeLookup3.getSpanSize(e2);
|
||||
int spanIndex2 = spanSizeLookup3.getSpanIndex(e2, gridLayoutManager3.N());
|
||||
GridLayoutManager gridLayoutManager4 = gridLayoutManager3;
|
||||
float m = ((gridLayoutManager4.m(childAt2) + 1) - this.leftRight) / 2;
|
||||
float n = ((gridLayoutManager4.n(childAt2) + 1) - this.topBottom) / 2;
|
||||
int i8 = e2 + spanSize2;
|
||||
if ((i8 <= gridLayoutManager4.N()) || spanIndex2 != 0) {
|
||||
i = childCount;
|
||||
spanSizeLookup2 = spanSizeLookup3;
|
||||
} else {
|
||||
int i9 = this.leftRight;
|
||||
int left = ((int) (childAt2.getLeft() - m)) - i9;
|
||||
i = childCount;
|
||||
spanSizeLookup2 = spanSizeLookup3;
|
||||
this.mDivider.setBounds(left, gridLayoutManager4.m(childAt2), i9 + left, recyclerView.getHeight() - gridLayoutManager4.n(childAt2));
|
||||
this.mDivider.draw(canvas);
|
||||
}
|
||||
if (!(spanIndex2 + spanSize2 == N)) {
|
||||
int left2 = childAt2.getLeft();
|
||||
if (i8 - 1 >= N) {
|
||||
left2 = (int) (left2 - m);
|
||||
}
|
||||
int right2 = (int) (childAt2.getRight() + n);
|
||||
int bottom = (int) (childAt2.getBottom() + m);
|
||||
this.mDivider.setBounds(left2, bottom, right2, this.leftRight + bottom);
|
||||
this.mDivider.draw(canvas);
|
||||
}
|
||||
i7++;
|
||||
gridLayoutManager3 = gridLayoutManager4;
|
||||
childCount = i;
|
||||
}
|
||||
}
|
||||
|
||||
public GridItemDecoration(int i, int i2, int i3) {
|
||||
this.topBottom = 16;
|
||||
this.leftRight = 16;
|
||||
this.headerNumber = 0;
|
||||
this.topBottom = i;
|
||||
this.leftRight = i2;
|
||||
this.headerNumber = i3;
|
||||
}
|
||||
}
|
541
sources/com/ubt/jimu/course/view/JimuTaskListActivity.java
Normal file
541
sources/com/ubt/jimu/course/view/JimuTaskListActivity.java
Normal file
@@ -0,0 +1,541 @@
|
||||
package com.ubt.jimu.course.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import butterknife.ButterKnife;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.ViewImpl;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.entities.RobotLite;
|
||||
import com.ubt.jimu.connect.ConnectActivity;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import com.ubt.jimu.course.contract.MissionListContract;
|
||||
import com.ubt.jimu.course.presenter.MissionListPresenter;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMission;
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubt.jimu.course.view.adapter.JimuCourseTaskPagerAdapter;
|
||||
import com.ubt.jimu.course.view.fragment.JimuMissionListFragment;
|
||||
import com.ubt.jimu.unity.bluetooth.ConnectionStatus;
|
||||
import com.ubt.jimu.utils.DeviceUtils;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
import com.ubtrobot.jimu.bluetooth.ConnectionState;
|
||||
import com.ubtrobot.jimu.robotapi.BatteryInfo;
|
||||
import com.ubtrobot.jimu.robotapi.IPowerStateListener;
|
||||
import com.ubtrobot.jimu.robotapi.JimuManager;
|
||||
import com.youth.banner.transformer.DefaultTransformer;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuTaskListActivity extends BaseActivity implements MissionListContract.View, LoadingView.RetryRequest, ViewPager.OnPageChangeListener, ViewImpl, JimuMissionListFragment.MissionListCallback, IPowerStateListener {
|
||||
public static final String BLUR_IMAGE_NAME = "jimu_task_home.png";
|
||||
public static final int REQUEST_CHANGE_ROBOT = 100;
|
||||
public static final int UNITY_MODULE_TASK_LIST = 1282;
|
||||
public static volatile boolean isConnecting = false;
|
||||
private AnimationDrawable animation;
|
||||
private long id;
|
||||
protected ImageView imgBack;
|
||||
protected ImageView imgConnectRobot;
|
||||
protected ImageView imgDecorate;
|
||||
protected ImageView imgNextPage;
|
||||
protected ImageView imgPowerState;
|
||||
protected ImageView imgPreviousPage;
|
||||
private List<JimuCourseTask> jimuCourseTasks = new ArrayList();
|
||||
private int jimuRobotBleState = 3;
|
||||
protected LoadingView loadingView;
|
||||
private long modelId;
|
||||
private long packageId;
|
||||
private JimuCourseTaskPagerAdapter pagerAdapter;
|
||||
private MissionListContract.Presenter presenter;
|
||||
protected RelativeLayout rlContainer;
|
||||
protected RelativeLayout rlTask;
|
||||
private FixedSpeedScroller scroller;
|
||||
protected TextView tvTitle;
|
||||
protected ViewPager viewPager;
|
||||
|
||||
private void cancelAnimation() {
|
||||
AnimationDrawable animationDrawable = this.animation;
|
||||
if (animationDrawable != null) {
|
||||
animationDrawable.stop();
|
||||
this.animation = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void deviceDiff() {
|
||||
if (JimuApplication.l().i()) {
|
||||
this.imgPreviousPage.setImageResource(R.mipmap.course_previous_pad);
|
||||
this.imgNextPage.setImageResource(R.mipmap.course_next_pad);
|
||||
} else {
|
||||
this.imgPreviousPage.setImageResource(R.mipmap.course_previous);
|
||||
this.imgNextPage.setImageResource(R.mipmap.course_next);
|
||||
}
|
||||
}
|
||||
|
||||
private void diffDevice() {
|
||||
if (JimuApplication.l().i()) {
|
||||
this.imgBack.setImageResource(R.mipmap.combined_shape_pad);
|
||||
this.imgDecorate.setImageResource(R.mipmap.course_task_decorate_pad);
|
||||
} else {
|
||||
this.imgBack.setImageResource(R.drawable.icon_back);
|
||||
this.imgDecorate.setImageResource(R.mipmap.course_task_decorate);
|
||||
}
|
||||
resize();
|
||||
}
|
||||
|
||||
private void getTaskList(boolean z) {
|
||||
String a = DeviceUtils.a((Context) this);
|
||||
long loginUserIntId = Cache.getInstance().getLoginUserIntId();
|
||||
this.presenter.getMissions(1 > loginUserIntId ? "" : String.valueOf(loginUserIntId), a, this.packageId, this.modelId, this.id, z);
|
||||
}
|
||||
|
||||
private void initConnectionStatus(int i) {
|
||||
this.jimuRobotBleState = i;
|
||||
for (ConnectionStatus connectionStatus : ConnectionStatus.values()) {
|
||||
if (connectionStatus.getStatus() == i) {
|
||||
onConnectionStatusChange(connectionStatus);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void initView() {
|
||||
diffDevice();
|
||||
this.loadingView.setOnRetryListener(this);
|
||||
try {
|
||||
Field declaredField = Class.forName("android.support.v4.view.ViewPager").getDeclaredField("mScroller");
|
||||
FixedSpeedScroller fixedSpeedScroller = new FixedSpeedScroller(this, new LinearOutSlowInInterpolator());
|
||||
fixedSpeedScroller.setmDuration(1000);
|
||||
declaredField.setAccessible(true);
|
||||
declaredField.set(this.viewPager, fixedSpeedScroller);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.pagerAdapter = new JimuCourseTaskPagerAdapter(getSupportFragmentManager(), this.jimuCourseTasks);
|
||||
this.viewPager.setAdapter(this.pagerAdapter);
|
||||
this.viewPager.setOffscreenPageLimit(1);
|
||||
this.viewPager.a(this);
|
||||
this.presenter = new MissionListPresenter(this, this.loadingView);
|
||||
OnRetryListener();
|
||||
}
|
||||
|
||||
private void reloadRobot() {
|
||||
Robot robot = Cache.getInstance().getRobot();
|
||||
if (robot == null) {
|
||||
return;
|
||||
}
|
||||
this.packageId = Cache.getInstance().getPackageId();
|
||||
this.modelId = robot.getModelId();
|
||||
getTaskList(false);
|
||||
}
|
||||
|
||||
private void resize() {
|
||||
int i;
|
||||
int height = this.rlTask.getHeight();
|
||||
int a = DisplayUtil.a((Context) this, 270.0f);
|
||||
int a2 = DisplayUtil.a((Context) this, 445.0f);
|
||||
int i2 = 0;
|
||||
if (JimuApplication.l().i()) {
|
||||
if (height >= a2) {
|
||||
i2 = (height - a2) / 2;
|
||||
i = i2;
|
||||
}
|
||||
i = 0;
|
||||
} else {
|
||||
if (height >= a) {
|
||||
i2 = (height - a) / 2;
|
||||
i = i2;
|
||||
}
|
||||
i = 0;
|
||||
}
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.rlTask.getLayoutParams();
|
||||
layoutParams.topMargin = i2;
|
||||
layoutParams.bottomMargin = i;
|
||||
this.rlTask.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
private void setCurrentPage(int i) {
|
||||
this.viewPager.a(i, true);
|
||||
Cache.getInstance().setJimuCourseTask(this.jimuCourseTasks.get(i));
|
||||
if (i == 0) {
|
||||
this.imgPreviousPage.setVisibility(4);
|
||||
}
|
||||
if (i == this.jimuCourseTasks.size() - 1) {
|
||||
this.imgNextPage.setVisibility(4);
|
||||
}
|
||||
showTitle(i, this.jimuCourseTasks.get(i));
|
||||
}
|
||||
|
||||
private void showTitle(int i, JimuCourseTask jimuCourseTask) {
|
||||
String format = String.format(getString(R.string.title_level_number), Integer.valueOf(i + 1));
|
||||
this.tvTitle.setText(format + " " + jimuCourseTask.getName());
|
||||
}
|
||||
|
||||
private void slide2CurrentPage() {
|
||||
int i;
|
||||
JimuCourse jimuCourse = Cache.getInstance().getJimuCourse();
|
||||
if (jimuCourse != null) {
|
||||
Iterator<JimuCourseTask> it = this.jimuCourseTasks.iterator();
|
||||
int i2 = 0;
|
||||
i = 0;
|
||||
while (it.hasNext() && (i2 = i2 + it.next().getMissions().size()) < jimuCourse.getPassCount() + 1) {
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
if (i == 0) {
|
||||
this.imgPreviousPage.setVisibility(4);
|
||||
this.imgNextPage.setVisibility(0);
|
||||
} else if (i == this.jimuCourseTasks.size() - 1) {
|
||||
this.imgPreviousPage.setVisibility(0);
|
||||
this.imgNextPage.setVisibility(4);
|
||||
} else {
|
||||
this.imgPreviousPage.setVisibility(0);
|
||||
this.imgNextPage.setVisibility(0);
|
||||
}
|
||||
setCurrentPage(i);
|
||||
}
|
||||
|
||||
public static void start(Context context, long j, long j2, long j3) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(context, (Class<?>) JimuTaskListActivity.class);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGEID_KEY, j);
|
||||
intent.putExtra("modelId", j2);
|
||||
intent.putExtra(JockstickDataConverter.ID, j3);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
/* renamed from: updateConnectionState, reason: merged with bridge method [inline-methods] */
|
||||
public void a(ConnectionStatus connectionStatus) {
|
||||
this.imgConnectRobot.setImageResource(connectionStatus.getStatusBackground());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.LoadingView.RetryRequest
|
||||
public void OnRetryListener() {
|
||||
getTaskList(true);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.view.fragment.JimuMissionListFragment.MissionListCallback
|
||||
public void connectRobot() {
|
||||
onConnectRobot();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.view.fragment.JimuMissionListFragment.MissionListCallback
|
||||
public View getBlurView() {
|
||||
return getRootView();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.view.fragment.JimuMissionListFragment.MissionListCallback
|
||||
public int getConnectState() {
|
||||
return this.jimuRobotBleState;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ViewImpl
|
||||
public View getRootView() {
|
||||
return this.rlContainer;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
super.onActivityResult(i, i2, intent);
|
||||
if (100 == i && -1 == i2) {
|
||||
reloadRobot();
|
||||
}
|
||||
}
|
||||
|
||||
public void onBack(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onBackPressed() {
|
||||
JimuMissionListFragment fragment = this.pagerAdapter.getFragment(Integer.valueOf(this.viewPager.getCurrentItem()));
|
||||
if (fragment == null || !fragment.onBackPressed()) {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public void onConnectRobot(View view) {
|
||||
onConnectRobot();
|
||||
}
|
||||
|
||||
@Override // com.ubtrobot.jimu.robotapi.IPowerStateListener
|
||||
public void onConnectionStateChange(String str, ConnectionState connectionState) {
|
||||
if (connectionState == null) {
|
||||
return;
|
||||
}
|
||||
if (ConnectionState.STATE_CONNECTED == connectionState) {
|
||||
initConnectionStatus(ConnectionStatus.CONNECTED.getStatus());
|
||||
} else if (ConnectionState.STATE_DISCONNECTED == connectionState) {
|
||||
initConnectionStatus(ConnectionStatus.DIS_CONNECT.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.MissionListContract.View
|
||||
public void onConnectionStatusChange(final ConnectionStatus connectionStatus) {
|
||||
this.imgConnectRobot.post(new Runnable() { // from class: com.ubt.jimu.course.view.a
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
JimuTaskListActivity.this.a(connectionStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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_jimu_task_list);
|
||||
ButterKnife.a(this);
|
||||
deviceDiff();
|
||||
this.packageId = getIntent().getLongExtra(Constant.SelectRobot.PACKAGEID_KEY, 0L);
|
||||
this.modelId = getIntent().getLongExtra("modelId", 0L);
|
||||
this.id = getIntent().getLongExtra(JockstickDataConverter.ID, 0L);
|
||||
this.rlTask.post(new Runnable() { // from class: com.ubt.jimu.course.view.JimuTaskListActivity.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
JimuTaskListActivity.this.initView();
|
||||
JimuManager f = JimuApplication.l().f();
|
||||
f.a(JimuTaskListActivity.this);
|
||||
JimuTaskListActivity.this.onConnectionStateChange(f.d(), f.a(f.d()));
|
||||
}
|
||||
});
|
||||
this.viewPager.a(true, (ViewPager.PageTransformer) new DefaultTransformer());
|
||||
try {
|
||||
Field declaredField = ViewPager.class.getDeclaredField("j");
|
||||
declaredField.setAccessible(true);
|
||||
this.scroller = new FixedSpeedScroller(this, new AccelerateInterpolator());
|
||||
declaredField.set(this.viewPager, this.scroller);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
MissionListContract.Presenter presenter = this.presenter;
|
||||
if (presenter != null) {
|
||||
presenter.unSubscribe();
|
||||
}
|
||||
isConnecting = false;
|
||||
Cache.getInstance().setCourseTaskList(null);
|
||||
Cache.getInstance().setCourseMission(null);
|
||||
JimuMissionListFragment.itemHeight = 0;
|
||||
JimuMissionListFragment.itemWidth = 0;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
JimuCourseTaskPagerAdapter jimuCourseTaskPagerAdapter = this.pagerAdapter;
|
||||
if (jimuCourseTaskPagerAdapter == null) {
|
||||
return;
|
||||
}
|
||||
jimuCourseTaskPagerAdapter.notifyDataSetChanged();
|
||||
JimuMissionListFragment fragment = this.pagerAdapter.getFragment(Integer.valueOf(this.viewPager.getCurrentItem()));
|
||||
if (fragment != null) {
|
||||
fragment.notifyDataChanged();
|
||||
if (intent != null && intent.getBooleanExtra("showSkip", false)) {
|
||||
fragment.showMissionComponents(Cache.getInstance().getCourseMission());
|
||||
}
|
||||
}
|
||||
JimuCourseMission courseMission = Cache.getInstance().getCourseMission();
|
||||
if (courseMission != null) {
|
||||
slide2CurrentPage(courseMission.getId());
|
||||
}
|
||||
JimuManager f = JimuApplication.l().f();
|
||||
onConnectionStateChange(f.d(), f.a(f.d()));
|
||||
}
|
||||
|
||||
public void onNextPage(View view) {
|
||||
int currentItem = this.viewPager.getCurrentItem();
|
||||
if (currentItem < this.jimuCourseTasks.size() - 1) {
|
||||
this.scroller.setmDuration(1000);
|
||||
this.viewPager.a(currentItem + 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageScrollStateChanged(int i) {
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageScrolled(int i, float f, int i2) {
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageSelected(int i) {
|
||||
if (i == this.jimuCourseTasks.size() - 1) {
|
||||
this.imgNextPage.setVisibility(4);
|
||||
this.imgNextPage.setEnabled(false);
|
||||
} else {
|
||||
this.imgNextPage.setVisibility(0);
|
||||
this.imgNextPage.setEnabled(true);
|
||||
}
|
||||
if (i == 0) {
|
||||
this.imgPreviousPage.setVisibility(4);
|
||||
this.imgPreviousPage.setEnabled(false);
|
||||
} else {
|
||||
this.imgPreviousPage.setVisibility(0);
|
||||
this.imgPreviousPage.setEnabled(true);
|
||||
}
|
||||
JimuCourseTask jimuCourseTask = this.jimuCourseTasks.get(i);
|
||||
Cache.getInstance().setJimuCourseTask(jimuCourseTask);
|
||||
showTitle(i, jimuCourseTask);
|
||||
JimuMissionListFragment fragment = this.pagerAdapter.getFragment(Integer.valueOf(i));
|
||||
if (fragment != null) {
|
||||
fragment.notifyDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onPause() {
|
||||
cancelAnimation();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // com.ubtrobot.jimu.robotapi.IPowerStateListener
|
||||
public void onPowerStateChanged(BatteryInfo batteryInfo) {
|
||||
if (batteryInfo == null) {
|
||||
return;
|
||||
}
|
||||
if (batteryInfo.d()) {
|
||||
initConnectionStatus(ConnectionStatus.CHARGING.getStatus());
|
||||
} else if (batteryInfo.a() < 20.0f) {
|
||||
initConnectionStatus(ConnectionStatus.LOW_BATTERY.getStatus());
|
||||
} else {
|
||||
initConnectionStatus(ConnectionStatus.CONNECTED.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
public void onPreviousPage(View view) {
|
||||
int currentItem = this.viewPager.getCurrentItem();
|
||||
if (currentItem > 0) {
|
||||
this.scroller.setmDuration(1000);
|
||||
this.viewPager.a(currentItem - 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.view.fragment.JimuMissionListFragment.MissionListCallback
|
||||
public void onRobotChanged(Robot robot) {
|
||||
reloadRobot();
|
||||
onConnectRobot();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity
|
||||
public void relayout() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.MissionListContract.View
|
||||
public void showException(Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.MissionListContract.View
|
||||
public void showMissions(List<JimuCourseTask> list, boolean z) {
|
||||
try {
|
||||
Cache.getInstance().setCourseTaskList(list);
|
||||
this.jimuCourseTasks.clear();
|
||||
this.jimuCourseTasks.addAll(list);
|
||||
if (z) {
|
||||
this.pagerAdapter = new JimuCourseTaskPagerAdapter(getSupportFragmentManager(), this.jimuCourseTasks);
|
||||
this.viewPager.setAdapter(this.pagerAdapter);
|
||||
} else {
|
||||
this.pagerAdapter.notifyDataSetChanged();
|
||||
JimuMissionListFragment fragment = this.pagerAdapter.getFragment(Integer.valueOf(this.viewPager.getCurrentItem()));
|
||||
if (fragment != null) {
|
||||
fragment.notifyDataChanged();
|
||||
}
|
||||
}
|
||||
slide2CurrentPage();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("Chrome", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void onConnectRobot() {
|
||||
isConnecting = true;
|
||||
Robot robot = Cache.getInstance().getRobot();
|
||||
if (robot == null) {
|
||||
Log.e(this.TAG, "User not select a robot, cann't to robot connect page.");
|
||||
} else if (this.jimuRobotBleState < 3) {
|
||||
ConnectActivity.b(this, new RobotLite(robot.getModelId(), robot.getModelName(), robot.getModelNameLanguage(), robot.getFilePath(), false, false));
|
||||
} else {
|
||||
ConnectActivity.a(this, new RobotLite(robot.getModelId(), robot.getModelName(), robot.getModelNameLanguage(), robot.getFilePath(), false, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
public void setPresenter(MissionListContract.Presenter presenter) {
|
||||
this.presenter = presenter;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.MissionListContract.View
|
||||
public void showTitle(JimuCourseTask jimuCourseTask) {
|
||||
this.tvTitle.setText(jimuCourseTask.getName());
|
||||
}
|
||||
|
||||
public static void start(Activity activity, long j, long j2, long j3, int i) {
|
||||
Intent intent = new Intent(activity, (Class<?>) JimuTaskListActivity.class);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGEID_KEY, j);
|
||||
intent.putExtra("modelId", j2);
|
||||
intent.putExtra(JockstickDataConverter.ID, j3);
|
||||
activity.startActivityForResult(intent, i);
|
||||
}
|
||||
|
||||
public static void start(Activity activity, long j, long j2, long j3, boolean z) {
|
||||
Intent intent = new Intent(activity, (Class<?>) JimuTaskListActivity.class);
|
||||
intent.putExtra(Constant.SelectRobot.PACKAGEID_KEY, j);
|
||||
intent.putExtra("modelId", j2);
|
||||
intent.putExtra(JockstickDataConverter.ID, j3);
|
||||
intent.putExtra("showSkip", z);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
private void slide2CurrentPage(long j) {
|
||||
Iterator<JimuCourseTask> it = this.jimuCourseTasks.iterator();
|
||||
int i = 0;
|
||||
boolean z = false;
|
||||
while (it.hasNext()) {
|
||||
Iterator<JimuCourseMission> it2 = it.next().getMissions().iterator();
|
||||
while (true) {
|
||||
if (!it2.hasNext()) {
|
||||
break;
|
||||
} else if (it2.next().getId() == j) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
break;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
setCurrentPage(i);
|
||||
}
|
||||
}
|
@@ -0,0 +1,100 @@
|
||||
package com.ubt.jimu.course.view;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.DebouncingOnClickListener;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuTaskListActivity_ViewBinding implements Unbinder {
|
||||
private JimuTaskListActivity target;
|
||||
private View view7f090237;
|
||||
private View view7f09023e;
|
||||
private View view7f09025d;
|
||||
private View view7f090267;
|
||||
|
||||
public JimuTaskListActivity_ViewBinding(JimuTaskListActivity jimuTaskListActivity) {
|
||||
this(jimuTaskListActivity, jimuTaskListActivity.getWindow().getDecorView());
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
JimuTaskListActivity jimuTaskListActivity = this.target;
|
||||
if (jimuTaskListActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.target = null;
|
||||
jimuTaskListActivity.rlContainer = null;
|
||||
jimuTaskListActivity.imgBack = null;
|
||||
jimuTaskListActivity.imgConnectRobot = null;
|
||||
jimuTaskListActivity.imgPowerState = null;
|
||||
jimuTaskListActivity.tvTitle = null;
|
||||
jimuTaskListActivity.viewPager = null;
|
||||
jimuTaskListActivity.loadingView = null;
|
||||
jimuTaskListActivity.imgPreviousPage = null;
|
||||
jimuTaskListActivity.imgNextPage = null;
|
||||
jimuTaskListActivity.imgDecorate = null;
|
||||
jimuTaskListActivity.rlTask = null;
|
||||
this.view7f090237.setOnClickListener(null);
|
||||
this.view7f090237 = null;
|
||||
this.view7f09023e.setOnClickListener(null);
|
||||
this.view7f09023e = null;
|
||||
this.view7f090267.setOnClickListener(null);
|
||||
this.view7f090267 = null;
|
||||
this.view7f09025d.setOnClickListener(null);
|
||||
this.view7f09025d = null;
|
||||
}
|
||||
|
||||
public JimuTaskListActivity_ViewBinding(final JimuTaskListActivity jimuTaskListActivity, View view) {
|
||||
this.target = jimuTaskListActivity;
|
||||
jimuTaskListActivity.rlContainer = (RelativeLayout) Utils.b(view, R.id.rlContainer, "field 'rlContainer'", RelativeLayout.class);
|
||||
View a = Utils.a(view, R.id.imgBack, "field 'imgBack' and method 'onBack'");
|
||||
jimuTaskListActivity.imgBack = (ImageView) Utils.a(a, R.id.imgBack, "field 'imgBack'", ImageView.class);
|
||||
this.view7f090237 = a;
|
||||
a.setOnClickListener(new DebouncingOnClickListener() { // from class: com.ubt.jimu.course.view.JimuTaskListActivity_ViewBinding.1
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
jimuTaskListActivity.onBack(view2);
|
||||
}
|
||||
});
|
||||
View a2 = Utils.a(view, R.id.imgConnectRobot, "field 'imgConnectRobot' and method 'onConnectRobot'");
|
||||
jimuTaskListActivity.imgConnectRobot = (ImageView) Utils.a(a2, R.id.imgConnectRobot, "field 'imgConnectRobot'", ImageView.class);
|
||||
this.view7f09023e = a2;
|
||||
a2.setOnClickListener(new DebouncingOnClickListener() { // from class: com.ubt.jimu.course.view.JimuTaskListActivity_ViewBinding.2
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
jimuTaskListActivity.onConnectRobot(view2);
|
||||
}
|
||||
});
|
||||
jimuTaskListActivity.imgPowerState = (ImageView) Utils.b(view, R.id.imgPowerState, "field 'imgPowerState'", ImageView.class);
|
||||
jimuTaskListActivity.tvTitle = (TextView) Utils.b(view, R.id.tvTitle, "field 'tvTitle'", TextView.class);
|
||||
jimuTaskListActivity.viewPager = (ViewPager) Utils.b(view, R.id.viewPager, "field 'viewPager'", ViewPager.class);
|
||||
jimuTaskListActivity.loadingView = (LoadingView) Utils.b(view, R.id.loadingView, "field 'loadingView'", LoadingView.class);
|
||||
View a3 = Utils.a(view, R.id.imgPreviousPage, "field 'imgPreviousPage' and method 'onPreviousPage'");
|
||||
jimuTaskListActivity.imgPreviousPage = (ImageView) Utils.a(a3, R.id.imgPreviousPage, "field 'imgPreviousPage'", ImageView.class);
|
||||
this.view7f090267 = a3;
|
||||
a3.setOnClickListener(new DebouncingOnClickListener() { // from class: com.ubt.jimu.course.view.JimuTaskListActivity_ViewBinding.3
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
jimuTaskListActivity.onPreviousPage(view2);
|
||||
}
|
||||
});
|
||||
View a4 = Utils.a(view, R.id.imgNextPage, "field 'imgNextPage' and method 'onNextPage'");
|
||||
jimuTaskListActivity.imgNextPage = (ImageView) Utils.a(a4, R.id.imgNextPage, "field 'imgNextPage'", ImageView.class);
|
||||
this.view7f09025d = a4;
|
||||
a4.setOnClickListener(new DebouncingOnClickListener() { // from class: com.ubt.jimu.course.view.JimuTaskListActivity_ViewBinding.4
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
jimuTaskListActivity.onNextPage(view2);
|
||||
}
|
||||
});
|
||||
jimuTaskListActivity.imgDecorate = (ImageView) Utils.b(view, R.id.imgDecorate, "field 'imgDecorate'", ImageView.class);
|
||||
jimuTaskListActivity.rlTask = (RelativeLayout) Utils.b(view, R.id.rlTask, "field 'rlTask'", RelativeLayout.class);
|
||||
}
|
||||
}
|
78
sources/com/ubt/jimu/course/view/LinearItemDecoration.java
Normal file
78
sources/com/ubt/jimu/course/view/LinearItemDecoration.java
Normal file
@@ -0,0 +1,78 @@
|
||||
package com.ubt.jimu.course.view;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LinearItemDecoration extends RecyclerView.ItemDecoration {
|
||||
public static final int[] ATRRS = {R.attr.listDivider};
|
||||
public static final int HORIZONTAL_LIST = 0;
|
||||
public static final int VERTICAL_LIST = 1;
|
||||
private Context mContext;
|
||||
private Drawable mDivider;
|
||||
private int mOrientation;
|
||||
|
||||
public LinearItemDecoration(Context context, int i) {
|
||||
this.mContext = context;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(ATRRS);
|
||||
this.mDivider = obtainStyledAttributes.getDrawable(0);
|
||||
obtainStyledAttributes.recycle();
|
||||
setOrientation(i);
|
||||
}
|
||||
|
||||
public void drawHorizontalLine(Canvas canvas, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
int paddingLeft = recyclerView.getPaddingLeft();
|
||||
int width = recyclerView.getWidth() - recyclerView.getPaddingRight();
|
||||
int childCount = recyclerView.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = recyclerView.getChildAt(i);
|
||||
int bottom = childAt.getBottom() + ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) childAt.getLayoutParams())).bottomMargin;
|
||||
this.mDivider.setBounds(paddingLeft, bottom, width, this.mDivider.getIntrinsicHeight() + bottom);
|
||||
this.mDivider.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawVerticalLine(Canvas canvas, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
int paddingTop = recyclerView.getPaddingTop();
|
||||
int height = recyclerView.getHeight() - recyclerView.getPaddingBottom();
|
||||
int childCount = recyclerView.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = recyclerView.getChildAt(i);
|
||||
int right = childAt.getRight() + ((ViewGroup.MarginLayoutParams) ((RecyclerView.LayoutParams) childAt.getLayoutParams())).rightMargin;
|
||||
this.mDivider.setBounds(right, paddingTop, this.mDivider.getIntrinsicWidth() + right, height);
|
||||
this.mDivider.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
if (this.mOrientation == 0) {
|
||||
rect.set(0, 0, 0, this.mDivider.getIntrinsicHeight());
|
||||
} else {
|
||||
rect.set(0, 0, this.mDivider.getIntrinsicWidth(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
public void onDraw(Canvas canvas, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
if (this.mOrientation == 0) {
|
||||
drawVerticalLine(canvas, recyclerView, state);
|
||||
} else {
|
||||
drawHorizontalLine(canvas, recyclerView, state);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOrientation(int i) {
|
||||
if (i != 0 && i != 1) {
|
||||
throw new IllegalArgumentException("invalid orientation");
|
||||
}
|
||||
this.mOrientation = i;
|
||||
}
|
||||
}
|
177
sources/com/ubt/jimu/course/view/adapter/CourseFlowAdapter.java
Normal file
177
sources/com/ubt/jimu/course/view/adapter/CourseFlowAdapter.java
Normal file
@@ -0,0 +1,177 @@
|
||||
package com.ubt.jimu.course.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import at.technikum.mti.fancycoverflow.FancyCoverFlow;
|
||||
import at.technikum.mti.fancycoverflow.FancyCoverFlowAdapter;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseFlowAdapter extends FancyCoverFlowAdapter {
|
||||
private Context context;
|
||||
private View convertView;
|
||||
private List<JimuCourse> courseList;
|
||||
private int fanFlowHeight;
|
||||
private LayoutInflater inflater;
|
||||
private boolean isShowFlag = false;
|
||||
private boolean isTablet;
|
||||
private final int logoHeight;
|
||||
private FrameLayout.LayoutParams logoParams;
|
||||
private FancyCoverFlow.LayoutParams params;
|
||||
private FrameLayout.LayoutParams pgParams;
|
||||
private ShowNoviceGuideListener showNoviceGuideListener;
|
||||
private final int width;
|
||||
|
||||
public interface ShowNoviceGuideListener {
|
||||
void onShowNoviceGuideListener(int i, int i2);
|
||||
}
|
||||
|
||||
public class ViewHolder {
|
||||
public FrameLayout fl_guide_logo_layout;
|
||||
public ImageView imgCourseLogo;
|
||||
public ImageView imglockLogo;
|
||||
public ProgressBar pgCourse;
|
||||
public TextView tvCourseLevel;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
ButterKnife.a(this, view);
|
||||
view.setLayoutParams(CourseFlowAdapter.this.params);
|
||||
this.imgCourseLogo.setLayoutParams(CourseFlowAdapter.this.logoParams);
|
||||
this.pgCourse.setLayoutParams(CourseFlowAdapter.this.pgParams);
|
||||
}
|
||||
|
||||
public void initViewHolder(int i, JimuCourse jimuCourse) {
|
||||
if ("1".equals(jimuCourse.getIsAvailable())) {
|
||||
RequestBuilder<Drawable> a = Glide.e(CourseFlowAdapter.this.context).a(jimuCourse.getImagePath());
|
||||
a.a(RequestOptions.b((Transformation<Bitmap>) new RoundedCorners(DisplayUtil.a(CourseFlowAdapter.this.context, 10.0f))).a(R.drawable.community_img).a(CourseFlowAdapter.this.width, CourseFlowAdapter.this.logoHeight));
|
||||
a.a(this.imgCourseLogo);
|
||||
} else {
|
||||
RequestBuilder<Drawable> a2 = Glide.e(CourseFlowAdapter.this.context).a(jimuCourse.getImagePathLock());
|
||||
a2.a(RequestOptions.b((Transformation<Bitmap>) new RoundedCorners(DisplayUtil.a(CourseFlowAdapter.this.context, 10.0f))).a(CourseFlowAdapter.this.width, CourseFlowAdapter.this.logoHeight));
|
||||
a2.a(this.imgCourseLogo);
|
||||
}
|
||||
this.tvCourseLevel.setText(jimuCourse.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public class ViewHolder_ViewBinding implements Unbinder {
|
||||
private ViewHolder target;
|
||||
|
||||
public ViewHolder_ViewBinding(ViewHolder viewHolder, View view) {
|
||||
this.target = viewHolder;
|
||||
viewHolder.imgCourseLogo = (ImageView) Utils.b(view, R.id.imgCourseLogo, "field 'imgCourseLogo'", ImageView.class);
|
||||
viewHolder.imglockLogo = (ImageView) Utils.b(view, R.id.imgCourseLock, "field 'imglockLogo'", ImageView.class);
|
||||
viewHolder.tvCourseLevel = (TextView) Utils.b(view, R.id.tvCourseLevel, "field 'tvCourseLevel'", TextView.class);
|
||||
viewHolder.pgCourse = (ProgressBar) Utils.b(view, R.id.pgCourse, "field 'pgCourse'", ProgressBar.class);
|
||||
viewHolder.fl_guide_logo_layout = (FrameLayout) Utils.b(view, R.id.fl_guide_logo_layout, "field 'fl_guide_logo_layout'", FrameLayout.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
ViewHolder viewHolder = this.target;
|
||||
if (viewHolder == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.target = null;
|
||||
viewHolder.imgCourseLogo = null;
|
||||
viewHolder.imglockLogo = null;
|
||||
viewHolder.tvCourseLevel = null;
|
||||
viewHolder.pgCourse = null;
|
||||
viewHolder.fl_guide_logo_layout = null;
|
||||
}
|
||||
}
|
||||
|
||||
public CourseFlowAdapter(Context context, List<JimuCourse> list, int i) {
|
||||
this.isTablet = false;
|
||||
this.context = context;
|
||||
this.courseList = list;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.fanFlowHeight = i;
|
||||
this.logoHeight = i - DisplayUtil.a(context, JimuApplication.l().i() ? 52.5f : 48.0f);
|
||||
this.width = (int) (this.logoHeight * 0.735d);
|
||||
this.isTablet = JimuApplication.l().i();
|
||||
this.params = new FancyCoverFlow.LayoutParams(this.width, i);
|
||||
this.logoParams = new FrameLayout.LayoutParams(this.width, this.logoHeight);
|
||||
int a = this.width - DisplayUtil.a(context, 30.0f);
|
||||
DisplayUtil.a(context, 12.0f);
|
||||
int a2 = DisplayUtil.a(context, 8.0f);
|
||||
this.pgParams = new FrameLayout.LayoutParams(a, -2);
|
||||
FrameLayout.LayoutParams layoutParams = this.pgParams;
|
||||
layoutParams.gravity = 81;
|
||||
layoutParams.setMargins(a2, 0, a2, a2 * 2);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
return this.courseList.size();
|
||||
}
|
||||
|
||||
@Override // at.technikum.mti.fancycoverflow.FancyCoverFlowAdapter
|
||||
public View getCoverFlowItem(int i, View view, ViewGroup viewGroup) {
|
||||
ViewHolder viewHolder;
|
||||
if (view == null) {
|
||||
view = this.inflater.inflate(this.isTablet ? R.layout.flow_item_course : R.layout.flow_item_course_phone, viewGroup, false);
|
||||
viewHolder = new ViewHolder(view);
|
||||
view.setTag(viewHolder);
|
||||
} else {
|
||||
viewHolder = (ViewHolder) view.getTag();
|
||||
}
|
||||
viewHolder.initViewHolder(i, this.courseList.get(i));
|
||||
ShowNoviceGuideListener showNoviceGuideListener = this.showNoviceGuideListener;
|
||||
if (showNoviceGuideListener != null && i == 2 && !this.isShowFlag) {
|
||||
showNoviceGuideListener.onShowNoviceGuideListener(this.width - DisplayUtil.a(this.context, 8.0f), this.logoHeight);
|
||||
this.isShowFlag = true;
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
public View getFirstItem() {
|
||||
return this.convertView;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
List<JimuCourse> list = this.courseList;
|
||||
if (list == null) {
|
||||
return null;
|
||||
}
|
||||
return list.get(i);
|
||||
}
|
||||
|
||||
public int getItemHeight() {
|
||||
return this.fanFlowHeight;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getItemWidth() {
|
||||
return this.width - DisplayUtil.a(this.context, 30.0f);
|
||||
}
|
||||
|
||||
public void setShowNoviceGuideListener(ShowNoviceGuideListener showNoviceGuideListener) {
|
||||
this.showNoviceGuideListener = showNoviceGuideListener;
|
||||
}
|
||||
}
|
@@ -0,0 +1,168 @@
|
||||
package com.ubt.jimu.course.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.DebouncingOnClickListener;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMission;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseMissionAdapter extends RecyclerView.Adapter<MissionViewHolder> {
|
||||
private Context context;
|
||||
private LayoutInflater inflater;
|
||||
private int itemHeight;
|
||||
private FrameLayout.LayoutParams itemLayoutParams;
|
||||
private int itemWidth;
|
||||
private OnCourseMissionClickListener listener;
|
||||
private List<JimuCourseMission> missions;
|
||||
|
||||
public class MissionViewHolder extends RecyclerView.ViewHolder {
|
||||
protected View cvMission;
|
||||
protected ImageView imgLockLogo;
|
||||
protected ImageView imgMissingParts;
|
||||
protected ImageView imgMissionLogo;
|
||||
protected ImageView imgMissionStar;
|
||||
private JimuCourseMission mission;
|
||||
private int position;
|
||||
protected TextView tvMissionName;
|
||||
|
||||
public MissionViewHolder(View view) {
|
||||
super(view);
|
||||
ButterKnife.a(this, view);
|
||||
}
|
||||
|
||||
private void initItemBackground(JimuCourseMission jimuCourseMission) {
|
||||
if (jimuCourseMission == null) {
|
||||
return;
|
||||
}
|
||||
if ("1".equals(jimuCourseMission.getIsLock())) {
|
||||
this.imgMissionLogo.setVisibility(8);
|
||||
this.tvMissionName.setVisibility(8);
|
||||
this.imgMissionStar.setVisibility(8);
|
||||
this.imgLockLogo.setVisibility(0);
|
||||
this.imgMissingParts.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
this.imgMissionLogo.setVisibility(0);
|
||||
this.imgMissionStar.setVisibility(0);
|
||||
this.imgLockLogo.setVisibility(8);
|
||||
this.tvMissionName.setVisibility(0);
|
||||
this.tvMissionName.setText(String.valueOf(this.position + 1));
|
||||
int star = jimuCourseMission.getStar();
|
||||
this.imgMissionStar.setImageResource(star != 1 ? star != 2 ? star != 3 ? R.mipmap.mission_star0 : R.mipmap.mission_star3 : R.mipmap.mission_star2 : R.mipmap.mission_star1);
|
||||
}
|
||||
|
||||
public void initViewHolder(JimuCourseMission jimuCourseMission, int i) {
|
||||
this.mission = jimuCourseMission;
|
||||
this.position = i;
|
||||
initItemBackground(jimuCourseMission);
|
||||
}
|
||||
|
||||
public void onMissingPartsClick(View view) {
|
||||
}
|
||||
|
||||
public void onMissionClick(View view) {
|
||||
if (CourseMissionAdapter.this.listener != null) {
|
||||
CourseMissionAdapter.this.listener.onCourseMissionClick(this.mission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MissionViewHolder_ViewBinding implements Unbinder {
|
||||
private MissionViewHolder target;
|
||||
private View view7f090100;
|
||||
private View view7f090255;
|
||||
|
||||
public MissionViewHolder_ViewBinding(final MissionViewHolder missionViewHolder, View view) {
|
||||
this.target = missionViewHolder;
|
||||
View a = Utils.a(view, R.id.cvMission, "field 'cvMission' and method 'onMissionClick'");
|
||||
missionViewHolder.cvMission = a;
|
||||
this.view7f090100 = a;
|
||||
a.setOnClickListener(new DebouncingOnClickListener() { // from class: com.ubt.jimu.course.view.adapter.CourseMissionAdapter.MissionViewHolder_ViewBinding.1
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
missionViewHolder.onMissionClick(view2);
|
||||
}
|
||||
});
|
||||
missionViewHolder.imgMissionLogo = (ImageView) Utils.b(view, R.id.imgMissionLogo, "field 'imgMissionLogo'", ImageView.class);
|
||||
missionViewHolder.imgLockLogo = (ImageView) Utils.b(view, R.id.imgLockLogo, "field 'imgLockLogo'", ImageView.class);
|
||||
missionViewHolder.tvMissionName = (TextView) Utils.b(view, R.id.tvMissionName, "field 'tvMissionName'", TextView.class);
|
||||
View a2 = Utils.a(view, R.id.imgMissingParts, "field 'imgMissingParts' and method 'onMissingPartsClick'");
|
||||
missionViewHolder.imgMissingParts = (ImageView) Utils.a(a2, R.id.imgMissingParts, "field 'imgMissingParts'", ImageView.class);
|
||||
this.view7f090255 = a2;
|
||||
a2.setOnClickListener(new DebouncingOnClickListener() { // from class: com.ubt.jimu.course.view.adapter.CourseMissionAdapter.MissionViewHolder_ViewBinding.2
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
missionViewHolder.onMissingPartsClick(view2);
|
||||
}
|
||||
});
|
||||
missionViewHolder.imgMissionStar = (ImageView) Utils.b(view, R.id.imgMissionStar, "field 'imgMissionStar'", ImageView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
MissionViewHolder missionViewHolder = this.target;
|
||||
if (missionViewHolder == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.target = null;
|
||||
missionViewHolder.cvMission = null;
|
||||
missionViewHolder.imgMissionLogo = null;
|
||||
missionViewHolder.imgLockLogo = null;
|
||||
missionViewHolder.tvMissionName = null;
|
||||
missionViewHolder.imgMissingParts = null;
|
||||
missionViewHolder.imgMissionStar = null;
|
||||
this.view7f090100.setOnClickListener(null);
|
||||
this.view7f090100 = null;
|
||||
this.view7f090255.setOnClickListener(null);
|
||||
this.view7f090255 = null;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnCourseMissionClickListener {
|
||||
void onCourseMissionClick(JimuCourseMission jimuCourseMission);
|
||||
}
|
||||
|
||||
public CourseMissionAdapter(Context context, List<JimuCourseMission> list, int i, int i2) {
|
||||
this.context = context;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.missions = list;
|
||||
this.itemLayoutParams = new FrameLayout.LayoutParams(i, i);
|
||||
this.itemWidth = i + context.getResources().getDimensionPixelSize(R.dimen.course_mission_star_right);
|
||||
this.itemHeight = i2;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
return this.missions.size();
|
||||
}
|
||||
|
||||
public void setOnCourseMissionClickListener(OnCourseMissionClickListener onCourseMissionClickListener) {
|
||||
this.listener = onCourseMissionClickListener;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(MissionViewHolder missionViewHolder, int i) {
|
||||
missionViewHolder.initViewHolder(this.missions.get(i), i);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public MissionViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
View inflate = this.inflater.inflate(R.layout.recycler_item_mission, viewGroup, false);
|
||||
ViewGroup.LayoutParams layoutParams = inflate.getLayoutParams();
|
||||
layoutParams.width = this.itemWidth;
|
||||
layoutParams.height = this.itemHeight;
|
||||
inflate.setLayoutParams(layoutParams);
|
||||
return new MissionViewHolder(inflate);
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package com.ubt.jimu.course.view.adapter;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubt.jimu.course.view.fragment.JimuMissionListFragment;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseTaskPagerAdapter extends FragmentStatePagerAdapter {
|
||||
private Map<Integer, JimuMissionListFragment> state;
|
||||
private List<JimuCourseTask> tasks;
|
||||
|
||||
public JimuCourseTaskPagerAdapter(FragmentManager fragmentManager, List<JimuCourseTask> list) {
|
||||
super(fragmentManager);
|
||||
this.state = new HashMap();
|
||||
this.tasks = list;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentStatePagerAdapter, androidx.viewpager.widget.PagerAdapter
|
||||
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
|
||||
this.state.remove(Integer.valueOf(i));
|
||||
super.destroyItem(viewGroup, i, obj);
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public int getCount() {
|
||||
return this.tasks.size();
|
||||
}
|
||||
|
||||
public JimuMissionListFragment getFragment(Integer num) {
|
||||
return this.state.get(num);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentStatePagerAdapter
|
||||
public Fragment getItem(int i) {
|
||||
JimuMissionListFragment newInstance = JimuMissionListFragment.newInstance(i);
|
||||
newInstance.setJimuCourseTask(this.tasks.get(i));
|
||||
this.state.put(Integer.valueOf(i), newInstance);
|
||||
return newInstance;
|
||||
}
|
||||
}
|
@@ -0,0 +1,471 @@
|
||||
package com.ubt.jimu.course.view.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.HelpActivity;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.ApiResponse;
|
||||
import com.ubt.jimu.blockly.command.JimuCourseCommand;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMission;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMissionRepository;
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubt.jimu.course.repository.JimuModule;
|
||||
import com.ubt.jimu.course.view.adapter.CourseMissionAdapter;
|
||||
import com.ubt.jimu.pack.view.RobotSelectActivity;
|
||||
import com.ubt.jimu.unity.bluetooth.ConnectionStatus;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.utils.DeviceUtils;
|
||||
import com.ubt.jimu.widgets.JAlertDialog;
|
||||
import com.ubtech.view.dialog.BigDialog$Builder;
|
||||
import com.ubtech.view.dialog.SimpleDialog;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuMissionListFragment extends BaseFragment implements CourseMissionAdapter.OnCourseMissionClickListener {
|
||||
public static final String KEY_COURSE_TASK = "courseTask";
|
||||
public static final String POSITION = "position";
|
||||
public static int itemHeight;
|
||||
public static int itemWidth;
|
||||
protected ImageView imgMissingParts;
|
||||
protected ImageView imgMissionDesc;
|
||||
protected ImageView imgTaskLeftDesc;
|
||||
private JimuCourseTask jimuCourseTask;
|
||||
private JimuMissionInteractionListener listener;
|
||||
protected LinearLayout llTaskLeft;
|
||||
private Unbinder mBind;
|
||||
private GridLayoutManager mGridLayoutManager;
|
||||
protected JAlertDialog mJAlertDialog;
|
||||
private SimpleDialog missingPartsDialog;
|
||||
private CourseMissionAdapter missionAdapterAdapter;
|
||||
private int position;
|
||||
protected RecyclerView recyclerView;
|
||||
protected TextView tvStars;
|
||||
private CompositeDisposable disposables = new CompositeDisposable();
|
||||
private boolean skiping = false;
|
||||
|
||||
public class GridItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private int leftRight;
|
||||
protected Drawable mDivider = new ColorDrawable();
|
||||
private int topBottom;
|
||||
|
||||
public GridItemDecoration(int i, int i2) {
|
||||
this.topBottom = i;
|
||||
this.leftRight = i2;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) {
|
||||
GridLayoutManager gridLayoutManager = (GridLayoutManager) recyclerView.getLayoutManager();
|
||||
GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
int e = recyclerView.e(view);
|
||||
int f = layoutParams.f();
|
||||
recyclerView.getChildCount();
|
||||
int N = gridLayoutManager.N();
|
||||
layoutParams.e();
|
||||
if (gridLayoutManager.K() == 1) {
|
||||
if (e + f <= N) {
|
||||
rect.top = 0;
|
||||
} else {
|
||||
rect.top = this.topBottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface JimuMissionInteractionListener {
|
||||
void shipJimuCourseTask(JimuCourseTask jimuCourseTask);
|
||||
}
|
||||
|
||||
public interface MissionListCallback {
|
||||
void connectRobot();
|
||||
|
||||
View getBlurView();
|
||||
|
||||
int getConnectState();
|
||||
|
||||
void onRobotChanged(Robot robot);
|
||||
}
|
||||
|
||||
private void diffDevice() {
|
||||
if (JimuApplication.l().i()) {
|
||||
this.tvStars.setBackgroundResource(R.mipmap.task_star_count_pad);
|
||||
this.imgMissionDesc.setImageResource(R.mipmap.course_task_logo_pad);
|
||||
} else {
|
||||
this.tvStars.setBackgroundResource(R.drawable.task_star_count);
|
||||
this.imgMissionDesc.setImageResource(R.mipmap.course_task_logo);
|
||||
}
|
||||
}
|
||||
|
||||
private int getMaxStar() {
|
||||
JimuCourseTask jimuCourseTask = this.jimuCourseTask;
|
||||
if (jimuCourseTask == null || jimuCourseTask.getMissions() == null) {
|
||||
return 0;
|
||||
}
|
||||
return this.jimuCourseTask.getMissions().size() * 3;
|
||||
}
|
||||
|
||||
private String getSkipDescription(List<JimuModule> list) {
|
||||
if (list == null || list.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String[] stringArray = getResources().getStringArray(R.array.module_list);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i).getType() <= stringArray.length) {
|
||||
sb.append(stringArray[r3.getType() - 1]);
|
||||
if (i < list.size() - 1) {
|
||||
sb.append(" & ");
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private int getUserStar() {
|
||||
JimuCourseTask jimuCourseTask = this.jimuCourseTask;
|
||||
int i = 0;
|
||||
if (jimuCourseTask != null && jimuCourseTask.getMissions() != null) {
|
||||
Iterator<JimuCourseMission> it = this.jimuCourseTask.getMissions().iterator();
|
||||
while (it.hasNext()) {
|
||||
i += it.next().getStar();
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
private boolean isMissionInValid() {
|
||||
JimuCourseTask jimuCourseTask = this.jimuCourseTask;
|
||||
return jimuCourseTask == null || jimuCourseTask.getMissions() == null || this.jimuCourseTask.getMissions().size() == 0;
|
||||
}
|
||||
|
||||
public static JimuMissionListFragment newInstance(int i) {
|
||||
JimuMissionListFragment jimuMissionListFragment = new JimuMissionListFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(POSITION, i);
|
||||
jimuMissionListFragment.setArguments(bundle);
|
||||
return jimuMissionListFragment;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void resizeLeft() {
|
||||
int height = this.llTaskLeft.getHeight();
|
||||
ViewGroup.LayoutParams layoutParams = this.llTaskLeft.getLayoutParams();
|
||||
layoutParams.height = height;
|
||||
layoutParams.width = (height * 160) / 270;
|
||||
this.llTaskLeft.setLayoutParams(layoutParams);
|
||||
this.llTaskLeft.requestLayout();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void selectRobot() {
|
||||
if (getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
RobotSelectActivity.a(getActivity(), "", 0L, null, 7, 0);
|
||||
}
|
||||
|
||||
private void showMissComponents(JimuCourseMission jimuCourseMission, List<JimuModule> list) {
|
||||
if (isMissionInValid() || this.jimuCourseTask.getMissions().get(0).isLock()) {
|
||||
return;
|
||||
}
|
||||
showSkipDialog(jimuCourseMission, getSkipDescription(list), false, R.string.btn_skip_mission);
|
||||
}
|
||||
|
||||
private void showSkipDialog(final JimuCourseMission jimuCourseMission, String str, boolean z, int i) {
|
||||
SpannableString spannableString = new SpannableString(str);
|
||||
spannableString.setSpan(new UnderlineSpan(), 0, str.length(), 0);
|
||||
BigDialog$Builder bigDialog$Builder = new BigDialog$Builder(getActivity());
|
||||
bigDialog$Builder.a(true);
|
||||
bigDialog$Builder.c(getString(R.string.missing_module_title));
|
||||
bigDialog$Builder.a(getString(i));
|
||||
bigDialog$Builder.b(getString(R.string.switch_robot));
|
||||
bigDialog$Builder.a(spannableString, getResources().getColor(R.color.link_color));
|
||||
bigDialog$Builder.c(R.mipmap.course_miss_parts_dialog_img);
|
||||
bigDialog$Builder.a(new View.OnClickListener() { // from class: com.ubt.jimu.course.view.fragment.JimuMissionListFragment.4
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
HelpActivity.start(JimuMissionListFragment.this.getActivity(), "https://video.ubtrobot.com/jimu/product/h5/JimuTips/index.html?language=" + JimuApplication.l().g(), null, R.color.theme_background);
|
||||
}
|
||||
});
|
||||
bigDialog$Builder.a(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.course.view.fragment.JimuMissionListFragment.3
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i2) {
|
||||
JimuCourseMission jimuCourseMission2 = jimuCourseMission;
|
||||
JimuMissionListFragment.this.skipMission(Cache.getInstance().getUserId(), jimuCourseMission2 == null ? JimuMissionListFragment.this.jimuCourseTask.getId() : jimuCourseMission2.getId(), DeviceUtils.a(JimuApplication.l()), Cache.getInstance().getPackageId(), Cache.getInstance().getRobot().getModelId(), jimuCourseMission == null);
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
});
|
||||
bigDialog$Builder.b(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.course.view.fragment.JimuMissionListFragment.2
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i2) {
|
||||
dialogInterface.dismiss();
|
||||
JimuMissionListFragment.this.selectRobot();
|
||||
}
|
||||
});
|
||||
this.missingPartsDialog = bigDialog$Builder.a();
|
||||
this.missingPartsDialog.show();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void skipTask(JimuCourseTask jimuCourseTask) {
|
||||
if (jimuCourseTask == null) {
|
||||
return;
|
||||
}
|
||||
if (1 == jimuCourseTask.getIsSkip()) {
|
||||
this.imgMissingParts.setVisibility(0);
|
||||
} else {
|
||||
this.imgMissingParts.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
protected void hideLoading() {
|
||||
JAlertDialog jAlertDialog = this.mJAlertDialog;
|
||||
if (jAlertDialog != null) {
|
||||
jAlertDialog.dismiss();
|
||||
this.mJAlertDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyDataChanged() {
|
||||
CourseMissionAdapter courseMissionAdapter = this.missionAdapterAdapter;
|
||||
if (courseMissionAdapter != null) {
|
||||
courseMissionAdapter.notifyDataSetChanged();
|
||||
}
|
||||
TextView textView = this.tvStars;
|
||||
if (textView != null) {
|
||||
textView.setText(getUserStar() + "/" + getMaxStar());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
public boolean onBackPressed() {
|
||||
return super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.view.adapter.CourseMissionAdapter.OnCourseMissionClickListener
|
||||
public void onCourseMissionClick(JimuCourseMission jimuCourseMission) {
|
||||
if (jimuCourseMission == null) {
|
||||
return;
|
||||
}
|
||||
MissionListCallback missionListCallback = (MissionListCallback) getActivity();
|
||||
if (missionListCallback.getConnectState() == ConnectionStatus.DIS_CONNECT.getStatus()) {
|
||||
missionListCallback.connectRobot();
|
||||
} else {
|
||||
if ("1".equals(jimuCourseMission.getIsLock()) || showMissionComponents(jimuCourseMission)) {
|
||||
return;
|
||||
}
|
||||
Cache.getInstance().setCourseMission(jimuCourseMission);
|
||||
UnityActivity.startUnityActivity(getActivity(), Cache.getInstance().getRobot(), 1001, 1, UnityActivity.BLOCKLY_TYPE_COURSE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
if (getArguments() != null) {
|
||||
this.position = getArguments().getInt(POSITION);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
View inflate = layoutInflater.inflate(R.layout.fragment_mission_list_phone, viewGroup, false);
|
||||
this.mBind = ButterKnife.a(this, inflate);
|
||||
diffDevice();
|
||||
this.tvStars.setText(getUserStar() + "/" + getMaxStar());
|
||||
JimuCourseTask jimuCourseTask = this.jimuCourseTask;
|
||||
if (jimuCourseTask == null) {
|
||||
return inflate;
|
||||
}
|
||||
if (1 == jimuCourseTask.getIsSkip()) {
|
||||
this.imgMissingParts.setVisibility(0);
|
||||
} else {
|
||||
this.imgMissingParts.setVisibility(8);
|
||||
}
|
||||
this.recyclerView.post(new Runnable() { // from class: com.ubt.jimu.course.view.fragment.JimuMissionListFragment.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
FragmentActivity activity = JimuMissionListFragment.this.getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
JimuMissionListFragment.this.resizeLeft();
|
||||
int dimensionPixelOffset = JimuMissionListFragment.this.getResources().getDimensionPixelOffset(R.dimen.course_task_mission_decoration);
|
||||
JimuMissionListFragment.this.mGridLayoutManager = new GridLayoutManager(activity, 3);
|
||||
JimuMissionListFragment jimuMissionListFragment = JimuMissionListFragment.this;
|
||||
jimuMissionListFragment.recyclerView.setLayoutManager(jimuMissionListFragment.mGridLayoutManager);
|
||||
JimuMissionListFragment jimuMissionListFragment2 = JimuMissionListFragment.this;
|
||||
jimuMissionListFragment2.recyclerView.a(jimuMissionListFragment2.new GridItemDecoration(dimensionPixelOffset, dimensionPixelOffset));
|
||||
int height = JimuMissionListFragment.this.recyclerView.getHeight();
|
||||
int width = JimuMissionListFragment.this.recyclerView.getWidth();
|
||||
if (JimuMissionListFragment.itemHeight < 50 || JimuMissionListFragment.itemWidth < 50) {
|
||||
int i = dimensionPixelOffset * 2;
|
||||
JimuMissionListFragment.itemHeight = (height - i) / 3;
|
||||
JimuMissionListFragment.itemWidth = (width - i) / 3;
|
||||
}
|
||||
if (JimuMissionListFragment.itemHeight < JimuMissionListFragment.itemWidth) {
|
||||
JimuMissionListFragment.itemWidth = JimuMissionListFragment.itemHeight;
|
||||
}
|
||||
int dimensionPixelSize = JimuMissionListFragment.this.getResources().getDimensionPixelSize(R.dimen.course_mission_star_right);
|
||||
if ((JimuMissionListFragment.itemWidth + dimensionPixelSize) * 3 > width) {
|
||||
JimuMissionListFragment.itemWidth = (width / 3) - dimensionPixelSize;
|
||||
}
|
||||
JimuMissionListFragment jimuMissionListFragment3 = JimuMissionListFragment.this;
|
||||
jimuMissionListFragment3.missionAdapterAdapter = new CourseMissionAdapter(activity, jimuMissionListFragment3.jimuCourseTask.getMissions(), JimuMissionListFragment.itemWidth, JimuMissionListFragment.itemHeight);
|
||||
JimuMissionListFragment.this.missionAdapterAdapter.setOnCourseMissionClickListener(JimuMissionListFragment.this);
|
||||
JimuMissionListFragment jimuMissionListFragment4 = JimuMissionListFragment.this;
|
||||
jimuMissionListFragment4.recyclerView.setAdapter(jimuMissionListFragment4.missionAdapterAdapter);
|
||||
}
|
||||
});
|
||||
return inflate;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroy() {
|
||||
this.disposables.dispose();
|
||||
this.disposables.a();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroyView() {
|
||||
this.mBind.unbind();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
public void onMissingPartsClick(View view) {
|
||||
if (isMissionInValid() || this.jimuCourseTask.getMissions().get(0).isLock()) {
|
||||
return;
|
||||
}
|
||||
showSkipDialog(null, getSkipDescription((JimuCourseMission) null), true, R.string.btn_skip_task);
|
||||
}
|
||||
|
||||
public void setJimuCourseTask(JimuCourseTask jimuCourseTask) {
|
||||
this.jimuCourseTask = jimuCourseTask;
|
||||
}
|
||||
|
||||
public void setListener(JimuMissionInteractionListener jimuMissionInteractionListener) {
|
||||
this.listener = jimuMissionInteractionListener;
|
||||
}
|
||||
|
||||
protected void showLoading(String str) {
|
||||
Activity activity = this.mActivity;
|
||||
if (activity == null || activity.isFinishing() || this.mActivity.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
if (this.mJAlertDialog == null) {
|
||||
JAlertDialog.Builder builder = new JAlertDialog.Builder(this.mActivity);
|
||||
builder.a(R.drawable.ic_loading);
|
||||
builder.a(str);
|
||||
builder.a(true);
|
||||
this.mJAlertDialog = builder.a();
|
||||
}
|
||||
this.mJAlertDialog.show();
|
||||
}
|
||||
|
||||
public boolean showMissionComponents(JimuCourseMission jimuCourseMission) {
|
||||
List<JimuModule> missingComponents = jimuCourseMission.getMissingComponents(Cache.getInstance().getBoardInfo());
|
||||
if (missingComponents == null || missingComponents.size() <= 0) {
|
||||
return false;
|
||||
}
|
||||
showMissComponents(jimuCourseMission, missingComponents);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void skipMission(String str, long j, String str2, long j2, long j3, final boolean z) {
|
||||
if (this.skiping) {
|
||||
return;
|
||||
}
|
||||
synchronized (this) {
|
||||
if (this.skiping) {
|
||||
return;
|
||||
}
|
||||
this.skiping = true;
|
||||
JimuCourseMissionRepository.getInstance().skipMission(str, j, str2, j2, j3, new ApiObserver<ApiResponse<List<JimuCourseMission>>>(null) { // from class: com.ubt.jimu.course.view.fragment.JimuMissionListFragment.5
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
JimuMissionListFragment.this.skiping = false;
|
||||
JimuMissionListFragment.this.hideLoading();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
JimuMissionListFragment.this.skiping = false;
|
||||
JimuMissionListFragment.this.hideLoading();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
JimuMissionListFragment.this.disposables.b(disposable);
|
||||
JimuMissionListFragment.this.showLoading("");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
||||
public void onNext(ApiResponse<List<JimuCourseMission>> apiResponse) {
|
||||
JimuMissionListFragment.this.skiping = false;
|
||||
JimuCourseCommand.unLockMission(apiResponse.getModels());
|
||||
JimuMissionListFragment.this.missionAdapterAdapter.notifyDataSetChanged();
|
||||
if (z) {
|
||||
if (JimuMissionListFragment.this.jimuCourseTask != null) {
|
||||
JimuMissionListFragment.this.jimuCourseTask.setIsSkip(0);
|
||||
}
|
||||
JimuMissionListFragment jimuMissionListFragment = JimuMissionListFragment.this;
|
||||
jimuMissionListFragment.skipTask(jimuMissionListFragment.jimuCourseTask);
|
||||
}
|
||||
if (JimuMissionListFragment.this.isAdded()) {
|
||||
ToastView.a(JimuMissionListFragment.this.getContext(), JimuMissionListFragment.this.getString(R.string.skip_success), ToastView.Type.SUCCESS).a();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private String getSkipDescription(JimuCourseMission jimuCourseMission) {
|
||||
String skipDescription = this.jimuCourseTask.getSkipDescription();
|
||||
if (!TextUtils.isEmpty(skipDescription)) {
|
||||
return skipDescription;
|
||||
}
|
||||
if (jimuCourseMission != null) {
|
||||
return jimuCourseMission.getSkipDescription();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
package com.ubt.jimu.course.view.fragment;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
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 JimuMissionListFragment_ViewBinding implements Unbinder {
|
||||
private JimuMissionListFragment target;
|
||||
private View view7f090255;
|
||||
|
||||
public JimuMissionListFragment_ViewBinding(final JimuMissionListFragment jimuMissionListFragment, View view) {
|
||||
this.target = jimuMissionListFragment;
|
||||
jimuMissionListFragment.llTaskLeft = (LinearLayout) Utils.b(view, R.id.llTaskLeft, "field 'llTaskLeft'", LinearLayout.class);
|
||||
jimuMissionListFragment.imgTaskLeftDesc = (ImageView) Utils.b(view, R.id.imgTaskLeftDesc, "field 'imgTaskLeftDesc'", ImageView.class);
|
||||
jimuMissionListFragment.recyclerView = (RecyclerView) Utils.b(view, R.id.recycleView, "field 'recyclerView'", RecyclerView.class);
|
||||
jimuMissionListFragment.imgMissionDesc = (ImageView) Utils.b(view, R.id.imgMissionDesc, "field 'imgMissionDesc'", ImageView.class);
|
||||
jimuMissionListFragment.tvStars = (TextView) Utils.b(view, R.id.tvStars, "field 'tvStars'", TextView.class);
|
||||
View a = Utils.a(view, R.id.imgMissingParts, "field 'imgMissingParts' and method 'onMissingPartsClick'");
|
||||
jimuMissionListFragment.imgMissingParts = (ImageView) Utils.a(a, R.id.imgMissingParts, "field 'imgMissingParts'", ImageView.class);
|
||||
this.view7f090255 = a;
|
||||
a.setOnClickListener(new DebouncingOnClickListener() { // from class: com.ubt.jimu.course.view.fragment.JimuMissionListFragment_ViewBinding.1
|
||||
@Override // butterknife.internal.DebouncingOnClickListener
|
||||
public void doClick(View view2) {
|
||||
jimuMissionListFragment.onMissingPartsClick(view2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
JimuMissionListFragment jimuMissionListFragment = this.target;
|
||||
if (jimuMissionListFragment == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.target = null;
|
||||
jimuMissionListFragment.llTaskLeft = null;
|
||||
jimuMissionListFragment.imgTaskLeftDesc = null;
|
||||
jimuMissionListFragment.recyclerView = null;
|
||||
jimuMissionListFragment.imgMissionDesc = null;
|
||||
jimuMissionListFragment.tvStars = null;
|
||||
jimuMissionListFragment.imgMissingParts = null;
|
||||
this.view7f090255.setOnClickListener(null);
|
||||
this.view7f090255 = null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user