diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/AiMapFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/AiMapFragment.java index 1045c591b2639e3e83feedbfb96c6c1a6a7d77ef..36b5eb735038941140c6ed0288ea1c692205bb3e 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/AiMapFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/AiMapFragment.java @@ -1,44 +1,39 @@ package com.mindspore.himindspore.ui.courses; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import androidx.viewpager.widget.ViewPager; -import com.mindspore.himindspore.R; -import com.mindspore.himindspore.bean.CoursesBean; -import com.mindspore.himindspore.ui.courses.adapter.AiMapListAdapter; -import com.mindspore.himindspore.ui.courses.adapter.CourseListAdapter; -import com.mindspore.himindspore.ui.courses.bean.CoursesMapBean; -import com.mindspore.himindspore.ui.courses.event.FragmentChangedEvent; -import com.mindspore.himindspore.ui.courses.util.Constant; -import com.mindspore.modelcamera.event.CameraSwitchEvent; +import com.alibaba.android.vlayout.DelegateAdapter; +import com.alibaba.android.vlayout.VirtualLayoutManager; +import com.alibaba.android.vlayout.layout.GridLayoutHelper; +import com.alibaba.android.vlayout.layout.SingleLayoutHelper; -import org.greenrobot.eventbus.EventBus; +import com.mindspore.common.utils.DisplayUtil; +import com.mindspore.himindspore.R; +import com.mindspore.himindspore.ui.courses.adapter.Column2GridAdapter; +import com.mindspore.himindspore.ui.courses.adapter.TitleAdapter; +import com.mindspore.himindspore.ui.courses.adapter.HotGridAdapter; +import com.mindspore.himindspore.ui.courses.bean.CourseBean; +import com.mindspore.himindspore.ui.utils.RecyclerViewHorAdapter; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; public class AiMapFragment extends Fragment { - private int target1State = Constant.STUDY_STATE_NO; - private int target2State = Constant.STUDY_STATE_LEARNING; - private int target3State = Constant.STUDY_STATE_LEARNING; - private ConstraintLayout target1Layout; - private ConstraintLayout target2Layout; - private ConstraintLayout target3Layout; private RecyclerView aiMapListView; + //设置Adapter列表 + List adapters = new LinkedList<>(); @Override public void onCreate(Bundle savedInstanceState) { @@ -55,47 +50,111 @@ public class AiMapFragment extends Fragment { @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - aiMapListView = (RecyclerView) view.findViewById(R.id.ai_map_list); - LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity()); - aiMapListView.setLayoutManager(mLayoutManager); - AiMapListAdapter adapter = new AiMapListAdapter(getContext(), initDate()); - aiMapListView.setAdapter(adapter); + aiMapListView = view.findViewById(R.id.root_recycler); + + //绑定VirtualLayoutManager + VirtualLayoutManager layoutManager = new VirtualLayoutManager(getContext()); + aiMapListView.setLayoutManager(layoutManager); + + initHotArea(); + initPreparationArea(); + initQuickStartArea(); + + //绑定delegateAdapter + DelegateAdapter delegateAdapter = new DelegateAdapter(layoutManager); + delegateAdapter.setAdapters(adapters); + aiMapListView.setAdapter(delegateAdapter); } - private List initDate() { + private void initQuickStartArea() { + //设置通栏布局 + SingleLayoutHelper quickCourseTitleLH = new SingleLayoutHelper(); + TitleAdapter titleAdapter = new TitleAdapter(getContext(), quickCourseTitleLH, + getString(R.string.course_quick_start_title)); + titleAdapter.setMoreViewClickListener( new View.OnClickListener() { + @Override + public void onClick(View v) { + // 跳转到快速入门的页面 + } + }); + adapters.add(titleAdapter); + + // 设置gird布局, 两列,两行 + GridLayoutHelper quickStarGridLH = new GridLayoutHelper(2, 4); + quickStarGridLH.setMargin(DisplayUtil.dp2px(getContext(), 15), 0, + DisplayUtil.dp2px(getContext(), 9), + DisplayUtil.dp2px(getContext(), 4)); + quickCourseTitleLH.setBgColor(getContext().getResources().getColor(R.color.white)); + DelegateAdapter.Adapter preparationGridAdapter = new Column2GridAdapter(getContext(), + quickStarGridLH, initHotData()); + adapters.add(preparationGridAdapter); + } + + private void initPreparationArea() { + SingleLayoutHelper preparatoryCourseTitleLH = new SingleLayoutHelper(); + + TitleAdapter titleAdapter = new TitleAdapter(getContext(), preparatoryCourseTitleLH, + getString(R.string.course_preparatory_knowledge_title)); + titleAdapter.setMoreViewClickListener( new View.OnClickListener() { + @Override + public void onClick(View v) { + // 跳转到快速入门的页面 + } + }); + adapters.add(titleAdapter); + + // 设置gird布局, 两列,两行 + GridLayoutHelper preparationGridLH = new GridLayoutHelper(2, 4); + preparationGridLH.setMargin(DisplayUtil.dp2px(getContext(), 15), 0, + DisplayUtil.dp2px(getContext(), 9), + DisplayUtil.dp2px(getContext(), 4)); + DelegateAdapter.Adapter preparationGridAdapter = new Column2GridAdapter(getContext(), + preparationGridLH, initHotData()); + adapters.add(preparationGridAdapter); + } + + private void initHotArea() { + // 设置通栏布局 + SingleLayoutHelper hotCourseTitleLH = new SingleLayoutHelper(); + TitleAdapter titleAdapter = new TitleAdapter(getContext(), hotCourseTitleLH, + getString(R.string.course_hot_title)); + titleAdapter.setMoreViewClickListener( new View.OnClickListener() { + @Override + public void onClick(View v) { + // 跳转到快速入门的页面 + } + }); + adapters.add(titleAdapter); + + // 设置gird布局, 横向滑动 + SingleLayoutHelper hotCourseHorLH = new SingleLayoutHelper(); + hotCourseHorLH.setMarginBottom(DisplayUtil.dp2px(getContext(), 4)); + DelegateAdapter.Adapter horInnerAdapter = new HotGridAdapter(getContext(), + hotCourseHorLH, initHotData()); + RecyclerView.LayoutManager horInnerLayoutManager = new GridLayoutManager(getContext(), 2, + RecyclerView.HORIZONTAL, false); + RecyclerViewHorAdapter recyclerViewHorAdapter = new RecyclerViewHorAdapter(getContext(), + hotCourseHorLH, horInnerAdapter, horInnerLayoutManager); + recyclerViewHorAdapter.setStartMargin(15); + adapters.add(recyclerViewHorAdapter); + } + + private List initHotData() { // TODO 从网络中获取每种课程的数据,并存储在data中。 - ArrayList data = new ArrayList(); - CoursesMapBean coursesMapBean1 = new CoursesMapBean.Builder() - .targetNum(getResources().getString(R.string.course_ai_introductory_target)) - .targetDescribe(getResources().getString(R.string.course_ai_introductory_explain)) - .coursesTypeName(getResources().getString(R.string.course_introductory_title)) - .studyState(Constant.STUDY_STATE_LEARNING) - .icons(new Drawable[]{ - getResources().getDrawable(R.drawable.target1_selected_image), - getResources().getDrawable(R.drawable.target1_unselected_image),}) - .build(); - CoursesMapBean coursesMapBean2 = new CoursesMapBean.Builder() - .targetNum(getResources().getString(R.string.course_ai_advanced_target)) - .targetDescribe(getResources().getString(R.string.course_ai_advanced_explain)) - .coursesTypeName(getResources().getString(R.string.course_advanced_title)) - .studyState(Constant.STUDY_STATE_NO) - .icons(new Drawable[]{ - getResources().getDrawable(R.drawable.target2_selected_image), - getResources().getDrawable(R.drawable.target2_unselected_image),}) - .build(); - CoursesMapBean coursesMapBean3 = new CoursesMapBean.Builder() - .targetNum(getResources().getString(R.string.course_ai_expert_target)) - .targetDescribe(getResources().getString(R.string.course_ai_expert_explain)) - .coursesTypeName(getResources().getString(R.string.course_expert_title)) - .studyState(Constant.STUDY_STATE_LEARNING) - .icons(new Drawable[]{ - getResources().getDrawable(R.drawable.target3_selected_image), - getResources().getDrawable(R.drawable.target3_unselected_image),}) + List result = new ArrayList(); + CourseBean courseBean = new CourseBean.Builder() + .title("机器学习") + .coverUrl("http://www.juimg.com/tuku/yulantu/140703/330746-140F301555752.jpg") .build(); - data.add(coursesMapBean1); - data.add(coursesMapBean2); - data.add(coursesMapBean3); - return data; + result.add(courseBean); + result.add(courseBean); + result.add(courseBean); + result.add(courseBean); + result.add(courseBean); + result.add(courseBean); + result.add(courseBean); + result.add(courseBean); + return result; } } diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/Column2GridAdapter.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/Column2GridAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..382a7eb6bcbeba9f414d8d2138dd57ef5a3c8b21 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/Column2GridAdapter.java @@ -0,0 +1,83 @@ +package com.mindspore.himindspore.ui.courses.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.android.vlayout.DelegateAdapter; +import com.alibaba.android.vlayout.LayoutHelper; +import com.bumptech.glide.Glide; +import com.mindspore.himindspore.R; +import com.mindspore.himindspore.ui.courses.bean.CourseBean; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; + +public class Column2GridAdapter extends DelegateAdapter.Adapter { + private final String TAG = Column2GridAdapter.class.getSimpleName(); + private Context context; + private LayoutHelper layoutHelper; + private List data; + + public Column2GridAdapter(Context context, LayoutHelper layoutHelper, List data) { + this.context = context; + this.layoutHelper = layoutHelper; + this.data = data; + } + + @Override + public LayoutHelper onCreateLayoutHelper() { + return layoutHelper; + } + + @NonNull + @Override + public Column2GridAdapter.MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, + int viewType) { + return new MainViewHolder(LayoutInflater.from(context).inflate(R.layout.column2_grid_item, + parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull MainViewHolder holder, int position) { + try { + Glide.with(context) + .load(new URL(data.get(position).getCoverUrl())) + .into(holder.backgroundIv); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + holder.backgroundIv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // 跳转到lessonActivity。 + } + }); + + holder.titleTv.setText(data.get(position).getTitle()); + } + + @Override + public int getItemCount() { + return 4; + } + + public class MainViewHolder extends RecyclerView.ViewHolder { + ImageView backgroundIv; + TextView titleTv; + + public MainViewHolder(@NonNull View itemView) { + super(itemView); + backgroundIv = itemView.findViewById(R.id.background_iv); + titleTv = itemView.findViewById(R.id.course_title); + } + } +} diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/HotGridAdapter.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/HotGridAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..152978321cafa9294db3cafeb965d420a65b021c --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/HotGridAdapter.java @@ -0,0 +1,85 @@ +package com.mindspore.himindspore.ui.courses.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.android.vlayout.DelegateAdapter; +import com.alibaba.android.vlayout.LayoutHelper; +import com.bumptech.glide.Glide; +import com.mindspore.himindspore.R; +import com.mindspore.himindspore.ui.courses.bean.CourseBean; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; + +public class HotGridAdapter extends DelegateAdapter.Adapter { + private final String TAG = HotGridAdapter.class.getSimpleName(); + private Context context; + private LayoutHelper layoutHelper; + private List data; + + public HotGridAdapter(Context context, LayoutHelper layoutHelper, List data) { + this.context = context; + this.layoutHelper = layoutHelper; + this.data = data; + } + + @Override + public LayoutHelper onCreateLayoutHelper() { + return layoutHelper; + } + + @NonNull + @Override + public HotGridAdapter.MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, + int viewType) { + return new MainViewHolder(LayoutInflater.from(context).inflate(R.layout.ai_map_grid_item, + parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull MainViewHolder holder, int position) { + try { + Glide.with(context) + .load(new URL(data.get(position).getCoverUrl())) + .error(R.drawable.icon_default) + .placeholder(R.drawable.icon_default) + .into(holder.backgroundIv); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + holder.backgroundIv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // 跳转到lessonActivity。 + } + }); + + holder.titleTv.setText(data.get(position).getTitle()); + } + + @Override + public int getItemCount() { + return data.size(); + } + + public class MainViewHolder extends RecyclerView.ViewHolder { + ImageView backgroundIv; + TextView titleTv; + + public MainViewHolder(@NonNull View itemView) { + super(itemView); + backgroundIv = itemView.findViewById(R.id.background_iv); + titleTv = itemView.findViewById(R.id.course_title); + } + } +} diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/TitleAdapter.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/TitleAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..21edc933eec1749d7c4d8e8ab8199d034083b6cd --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/adapter/TitleAdapter.java @@ -0,0 +1,65 @@ +package com.mindspore.himindspore.ui.courses.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.android.vlayout.DelegateAdapter; +import com.alibaba.android.vlayout.LayoutHelper; +import com.mindspore.himindspore.R; + +public class TitleAdapter extends DelegateAdapter.Adapter { + private Context context; + private LayoutHelper layoutHelper; + private String titleStr; + private View.OnClickListener moreListener = null; + + public TitleAdapter(Context context, LayoutHelper layoutHelper, String titleStr) { + this.context = context; + this.layoutHelper = layoutHelper; + this.titleStr = titleStr; + } + + @Override + public LayoutHelper onCreateLayoutHelper() { + return layoutHelper; + } + + @NonNull + @Override + public MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new TitleAdapter.MainViewHolder(LayoutInflater.from(context).inflate( + R.layout.title_item, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull MainViewHolder holder, int position) { + holder.titleTv.setText(titleStr); + holder.moreTv.setOnClickListener(moreListener); + } + + @Override + public int getItemCount() { + return 1; + } + + public class MainViewHolder extends RecyclerView.ViewHolder { + TextView titleTv; + TextView moreTv; + + public MainViewHolder(@NonNull View itemView) { + super(itemView); + titleTv = itemView.findViewById(R.id.title_tv); + moreTv = itemView.findViewById(R.id.more); + } + } + + public void setMoreViewClickListener(View.OnClickListener moreListener){ + this.moreListener = moreListener; + } +} diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/bean/CourseBean.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/bean/CourseBean.java new file mode 100644 index 0000000000000000000000000000000000000000..7f9a9ae4a39d97d601f5063ec3156908fdec722a --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/bean/CourseBean.java @@ -0,0 +1,46 @@ +package com.mindspore.himindspore.ui.courses.bean; + +public class CourseBean { + String title; + String coverUrl; + + public CourseBean(Builder builder) { + title = builder.title; + coverUrl = builder.coverUrl; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getCoverUrl() { + return coverUrl; + } + + public void setCoverUrl(String coverUrl) { + this.coverUrl = coverUrl; + } + + public static class Builder { + String title; + String coverUrl; + + public CourseBean.Builder title(String title) { + this.title = title; + return this; + } + + public CourseBean.Builder coverUrl(String coverUrl) { + this.coverUrl = coverUrl; + return this; + } + + public CourseBean build() { + return new CourseBean(this); + } + } +} diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/LessonIntroductionFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/LessonIntroductionFragment.java index 747b98cac7f6d9d403a4287db12845fbbf77ee73..fc5826d42d81f358c3cf9a1666dbf7704dd3c13c 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/LessonIntroductionFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/LessonIntroductionFragment.java @@ -5,7 +5,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; @@ -13,14 +12,13 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.alibaba.android.vlayout.DelegateAdapter; -import com.alibaba.android.vlayout.LayoutHelper; import com.alibaba.android.vlayout.VirtualLayoutManager; -import com.alibaba.android.vlayout.layout.LinearLayoutHelper; import com.alibaba.android.vlayout.layout.SingleLayoutHelper; + import com.mindspore.common.utils.DisplayUtil; import com.mindspore.himindspore.R; import com.mindspore.himindspore.ui.lessons.adapter.LessonsIntroduceAdapter; -import com.mindspore.himindspore.ui.lessons.adapter.RecyclerViewHorAdapter; +import com.mindspore.himindspore.ui.utils.RecyclerViewHorAdapter; import com.mindspore.himindspore.ui.lessons.adapter.RelatedCourseListAdapter; import com.mindspore.himindspore.ui.lessons.adapter.RelatedCourseTitleAdapter; import com.mindspore.himindspore.ui.lessons.bean.IntroductionBean; @@ -36,7 +34,6 @@ public class LessonIntroductionFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - } @Override @@ -60,28 +57,32 @@ public class LessonIntroductionFragment extends Fragment { //设置课程介绍通栏布局 SingleLayoutHelper introductionLayoutHelper = new SingleLayoutHelper(); - introductionLayoutHelper.setMarginTop(DisplayUtil.dp2px(getContext(),1)); + introductionLayoutHelper.setMarginTop(DisplayUtil.dp2px(getContext(), 1)); adapters.add(new LessonsIntroduceAdapter(getContext(), introductionLayoutHelper, initIntroductionData())); //设置相关课程头通栏布局 SingleLayoutHelper relatedCourseTitleLH = new SingleLayoutHelper(); - relatedCourseTitleLH.setMarginTop(DisplayUtil.dp2px(getContext(),4)); + relatedCourseTitleLH.setMarginTop(DisplayUtil.dp2px(getContext(), 4)); adapters.add((new RelatedCourseTitleAdapter(getContext(), relatedCourseTitleLH))); - //设置相关课程横滑布局, + // 设置相关课程横滑布局, SingleLayoutHelper relatedCourseListLayoutHelper = new SingleLayoutHelper(); - adapters.add(new RecyclerViewHorAdapter(getContext(), relatedCourseListLayoutHelper, initRelatedCourseData())); + DelegateAdapter.Adapter horInnerAdapter = new RelatedCourseListAdapter(getContext(), + relatedCourseListLayoutHelper, initRelatedCourseData()); + RecyclerView.LayoutManager horInnerLayoutManager = new LinearLayoutManager(getContext(), + RecyclerView.HORIZONTAL, false); + RecyclerViewHorAdapter recyclerViewHorAdapter = new RecyclerViewHorAdapter( + getContext(), relatedCourseListLayoutHelper, horInnerAdapter, + horInnerLayoutManager); + recyclerViewHorAdapter.setStartMargin(10); + adapters.add(recyclerViewHorAdapter); //绑定delegateAdapter DelegateAdapter delegateAdapter = new DelegateAdapter(layoutManager); delegateAdapter.setAdapters(adapters); recyclerView.setAdapter(delegateAdapter); - - } - - private void initData() { } private IntroductionBean initIntroductionData() { diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/adapter/RecyclerViewHorAdapter.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/utils/RecyclerViewHorAdapter.java similarity index 61% rename from model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/adapter/RecyclerViewHorAdapter.java rename to model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/utils/RecyclerViewHorAdapter.java index 768a127460a0218bd8e45fd605d130989eeb4db9..54f6c8b543e1edacfd7a32332ed58410fb71a4c8 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/adapter/RecyclerViewHorAdapter.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/utils/RecyclerViewHorAdapter.java @@ -1,34 +1,35 @@ -package com.mindspore.himindspore.ui.lessons.adapter; +package com.mindspore.himindspore.ui.utils; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.LinearLayout; import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; +import android.widget.FrameLayout; import androidx.recyclerview.widget.RecyclerView; import com.alibaba.android.vlayout.DelegateAdapter; import com.alibaba.android.vlayout.LayoutHelper; +import com.mindspore.common.utils.DisplayUtil; import com.mindspore.himindspore.R; -import com.mindspore.himindspore.ui.lessons.bean.RelatedCoursesBean; - -import java.util.List; +import com.mindspore.himindspore.ui.lessons.adapter.RelatedCourseListAdapter; public class RecyclerViewHorAdapter extends DelegateAdapter.Adapter { private Context context; LayoutHelper layoutHelper; - List data; - int count; + RecyclerView.LayoutManager layoutManager; + DelegateAdapter.Adapter adapter; + int startMarginDp = 0; public RecyclerViewHorAdapter(Context context, LayoutHelper layoutHelper, - List data) { + DelegateAdapter.Adapter adapter, RecyclerView.LayoutManager layoutManager) { this.context = context; this.layoutHelper = layoutHelper; - this.data = data; - this.count = data.size(); + this.adapter = adapter; + this.layoutManager = layoutManager; } @Override @@ -43,11 +44,13 @@ public class RecyclerViewHorAdapter extends DelegateAdapter.Adapter - - - - + @@ -72,10 +69,10 @@ android:background="@color/white" app:emptyView="@layout/layout_empty_view" app:errorView="@layout/layout_error_view" - app:loadingView="@layout/layout_loading_view" - app:noNetworkView="@layout/layout_network_view" + app:layout_constraintBottom_toTopOf="@+id/foot" app:layout_constraintTop_toBottomOf="@+id/tab_bullet_layout" - app:layout_constraintBottom_toTopOf="@+id/foot"> + app:loadingView="@layout/layout_loading_view" + app:noNetworkView="@layout/layout_network_view"> + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/column2_grid_item.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/column2_grid_item.xml new file mode 100644 index 0000000000000000000000000000000000000000..f1bf793585223aa8c48c35169e4ba6a6f59227c9 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/column2_grid_item.xml @@ -0,0 +1,32 @@ + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/fragment_ai_map.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/fragment_ai_map.xml index 2949240b9e42313a0987b9f6fbf642b65c50eed1..deb36881990ce298cd67d1ff0c8a16b6f7df9304 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/fragment_ai_map.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/fragment_ai_map.xml @@ -4,39 +4,13 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - - - - - - - + android:background="@color/white" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintEnd_toEndOf="parent" + /> \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/lessons_related_list_item.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/lessons_related_list_item.xml index 92448670bc18472aca7921fc36b31a784a72f75e..b1db11f383576e70c3b2d17b59cc24319eed86ec 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/lessons_related_list_item.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/lessons_related_list_item.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="112dp" - android:layout_marginEnd="5dp" + android:layout_marginEnd="6dp" android:layout_height="wrap_content"> + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/vlayout_recyclerview_hor.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/vlayout_recyclerview_hor.xml index 3c5926992271ff6a5d39755feecbe01b326608ac..4cf9a1f3b85e54e03004bfb9930b66525fe45e87 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/vlayout_recyclerview_hor.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/vlayout_recyclerview_hor.xml @@ -11,8 +11,8 @@ android:id="@+id/recyclerview_hor" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginStart="0dp" android:overScrollMode="never" android:scrollbars="none" - android:layout_marginStart="10dp" app:fastScrollEnabled="false" /> diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values/strings.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values/strings.xml index e41e1b36a4fa154e34b5c5133209c43e505e0fed..daf93e0240d4b3a46ff240e96741c34a3afeb06b 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values/strings.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values/strings.xml @@ -112,6 +112,10 @@ 待学习 完成学习 + 热门课程 + 预备知识 + 快速入门 + "简介" 目录 评论