From 5dc5fc5c1121d7e12496be50dacf996f8d67daa1 Mon Sep 17 00:00:00 2001 From: 18561577093 <17882492@qq.com> Date: Sat, 18 Sep 2021 16:16:57 +0800 Subject: [PATCH] [AD] 00034 [describe] add duration [Submitter] wanglixue --- .../ui/courses/adapter/CourseListAdapter.java | 18 ++++++--- .../ui/courses/mvp/CourseListPresenter.java | 1 - .../lessons/adapter/CatalogueListAdapter.java | 3 ++ .../adapter/LessonsIntroduceAdapter.java | 9 +++-- .../com/mindspore/common/net/HttpUtils.java | 4 +- .../netbean/response/CourseDetailsBean.java | 38 +++++-------------- 6 files changed, 32 insertions(+), 41 deletions(-) diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/CourseListAdapter.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/CourseListAdapter.java index 76bb77bae3..d54dd1ecf1 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/CourseListAdapter.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/CourseListAdapter.java @@ -2,6 +2,7 @@ package com.mindspore.himindspore.ui.courses.adapter; import android.content.Context; import android.content.Intent; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -65,13 +66,18 @@ public class CourseListAdapter extends RecyclerView.Adapter lessons = bean.getPostEntityList(); if (lessons != null) { -/* if (lessons.isEmpty() && lessons.size() > 1) { + if (lessons.size() > 1) { holder.updateInfoView.setText(context.getString(R.string.course_update_info, - bean.getUpdateNum(), bean.getTotalNum())); - } else { - holder.updateInfoView.setText( - lessons.get(0).get); - }*/ + bean.getChapter(), lessons.size())); + } else { // 只有一集的情况下,显示第一集的时长 + if (!lessons.isEmpty() && lessons.get(0) != null) { + holder.updateInfoView.setText(lessons.get(0).getDuration()); + } else { + holder.updateInfoView.setVisibility(View.GONE); + } + } + } else { + Log.w(TAG, "this course no lesson"); } holder.introductionView.setText(bean.getSummary()); diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/mvp/CourseListPresenter.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/mvp/CourseListPresenter.java index 4bf51c30f3..bf27425473 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/mvp/CourseListPresenter.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/mvp/CourseListPresenter.java @@ -1,6 +1,5 @@ package com.mindspore.himindspore.ui.courses.mvp; -import com.mindspore.common.base.bean.BaseResponseBean; import com.mindspore.common.base.mvp.BaseFragmentPresenter; import com.mindspore.common.exception.ExceptionHandle; import com.mindspore.common.http.HttpClient; diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/adapter/CatalogueListAdapter.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/adapter/CatalogueListAdapter.java index 450dde1fbb..1f0e1d16bd 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/adapter/CatalogueListAdapter.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/adapter/CatalogueListAdapter.java @@ -84,6 +84,7 @@ public class CatalogueListAdapter extends DelegateAdapter.Adapter courseDetailsBean.getPostEntityList().size()) { updateStateString = context.getString(R.string.lessons_update_doing); holder.updateSituationTv.setText(context.getResources() - .getString(R.string.course_update_info, courseDetailsBean.getUpdateStatus(), - courseDetailsBean.getCommonSections())); - } else if (courseDetailsBean.getUpdateStatus() == UPDATE_STATE_COMPLETE) { + .getString(R.string.course_update_info, + courseDetailsBean.getPostEntityList().size(), + courseDetailsBean.getChapter())); + } else if (courseDetailsBean.getChapter() <= courseDetailsBean.getPostEntityList().size()) { updateStateString = context.getString(R.string.lessons_update_completed); holder.updateSituationTv.setText(""); } else { diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/net/HttpUtils.java b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/net/HttpUtils.java index 66886f9795..b8f56b6ef2 100644 --- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/net/HttpUtils.java +++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/net/HttpUtils.java @@ -41,10 +41,10 @@ public class HttpUtils { public final static String API_APP = "https://download.mindspore.cn/model_zoo/official/lite/apk/"; -// public final static String API_DATA = "http://124.70.210.216:8888/"; //cong + public final static String API_DATA = "http://124.70.210.216:8888/"; //cong // public final static String API_DATA = "http://192.168.0.155:8888/"; //kang // public final static String API_DATA = "http://172.100.24.218:8888/"; //kang - public final static String API_DATA = "http://172.100.21.248:8888/"; // weiqi +// public final static String API_DATA = "http://172.100.21.248:8888/"; // weiqi public static HttpUtils getInstance() { if (instance == null) { diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/netbean/response/CourseDetailsBean.java b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/netbean/response/CourseDetailsBean.java index 796c6bfc4d..14192a4c98 100644 --- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/netbean/response/CourseDetailsBean.java +++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/netbean/response/CourseDetailsBean.java @@ -10,6 +10,7 @@ public class CourseDetailsBean { * content : 快速入门Git操作,小白最佳指南!快速入门Git操作,小白最佳指南! * createTime : 2021-07-27T12:42:11.000+00:00 * id : 8 + * chapter:1 * likeCount : 150 * parentId : 1 * postEntityList : [{"id":74,"type":"VIDEO","dataType":"article", @@ -38,6 +39,7 @@ public class CourseDetailsBean { private String content; private String createTime; private int id; + private int chapter; private int likeCount; private int parentId; private ProviderBean provider; @@ -47,9 +49,7 @@ public class CourseDetailsBean { private List postEntityList; private int likeState; // 1已经点赞, 0未点赞 private int favoriteState; // 1已经收藏, 0未收藏 - private int commonSections; - private int updateSections; - private int updateStatus; + private int playSum; public int getPlaySum() { return playSum; @@ -59,7 +59,13 @@ public class CourseDetailsBean { this.playSum = playSum; } - private int playSum; + public int getChapter() { + return chapter; + } + + public void setChapter(int chapter) { + this.chapter = chapter; + } public int getFavoriteState() { return favoriteState; @@ -77,30 +83,6 @@ public class CourseDetailsBean { this.likeState = likeState; } - public int getCommonSections() { - return commonSections; - } - - public void setCommonSections(int commonSections) { - this.commonSections = commonSections; - } - - public int getUpdateSections() { - return updateSections; - } - - public void setUpdateSections(int updateSections) { - this.updateSections = updateSections; - } - - public int getUpdateStatus() { - return updateStatus; - } - - public void setUpdateStatus(int updateStatus) { - this.updateStatus = updateStatus; - } - public String getAvatar() { return avatar; } -- Gitee