Initial commit
This commit is contained in:
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