From 659e02af22082cdeb5e8cd26bf46574286c35981 Mon Sep 17 00:00:00 2001 From: 18561577093 <17882492@qq.com> Date: Mon, 11 Oct 2021 16:07:17 +0800 Subject: [PATCH] [AD] 00037 [describe] add click requestNetwork data function [Submitter] wanglixue --- .../himindspore/ui/courses/CoursesFragment.java | 3 +++ .../himindspore/ui/gateway/CaseFragment.java | 3 +++ .../ui/gateway/ContentDetailActivity.java | 12 ++++++++++-- .../himindspore/ui/gateway/IntroduceFragment.java | 3 +++ .../himindspore/ui/gateway/TrendFragment.java | 3 +++ .../himindspore/ui/lessons/LessonsActivity.java | 12 ++++++++++-- .../src/main/res/layout/activity_content_detail.xml | 2 +- .../src/main/res/layout/layout_network_view.xml | 1 + 8 files changed, 34 insertions(+), 5 deletions(-) diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/CoursesFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/CoursesFragment.java index ce3614bc75..d652ef9c04 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/CoursesFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/courses/CoursesFragment.java @@ -65,6 +65,9 @@ public class CoursesFragment extends BaseFragment super.onViewCreated(view, savedInstanceState); smartRefreshLayout = view.findViewById(R.id.refreshLayout); multipleStatusView = view.findViewById(R.id.multipleStatusView); + multipleStatusView.setOnRetryClickListener(v -> { + lazyInit(); + }); mRecyclerView = view.findViewById(R.id.recyclerView); mFrameLayout = view.findViewById(R.id.fragmentRefreshLayout); diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/CaseFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/CaseFragment.java index bf11eb89d5..e87b158de7 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/CaseFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/CaseFragment.java @@ -100,6 +100,9 @@ public class CaseFragment extends BaseFragment implements Gat super.onViewCreated(view, savedInstanceState); smartRefreshLayout = view.findViewById(R.id.refreshLayout); multipleStatusView = view.findViewById(R.id.multipleStatusView); + multipleStatusView.setOnRetryClickListener(v -> { + lazyInit(); + }); mRecyclerView = view.findViewById(R.id.recyclerView); mFrameLayout = view.findViewById(R.id.fragmentRefreshLayout); diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/ContentDetailActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/ContentDetailActivity.java index 8f85573b20..45b012496d 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/ContentDetailActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/ContentDetailActivity.java @@ -31,7 +31,8 @@ import com.mindspore.himindspore.ui.gateway.mvp.GateContract; import com.mindspore.himindspore.ui.gateway.mvp.GateDetailPresenter; import com.zzhoujay.richtext.RichText; -public class ContentDetailActivity extends BaseActivity implements GateContract.GateDetailView,View.OnClickListener { +public class ContentDetailActivity extends BaseActivity implements + GateContract.GateDetailView, View.OnClickListener { private RecyclerView recyclerView; @@ -69,7 +70,11 @@ public class ContentDetailActivity extends BaseActivity imp mComEdit.setShowSoftInputOnFocus(false); mComEdit.setOnClickListener(this); multipleStatusView = findViewById(R.id.multipleStatusView); - presenter.requestTrendDetailData(id); + multipleStatusView.setOnRetryClickListener(v -> { + requestNetworkData(); + }); + + requestNetworkData(); commentView = findViewById(R.id.com_comment_image); favoritesView = findViewById(R.id.com_favorites_image); @@ -82,6 +87,9 @@ public class ContentDetailActivity extends BaseActivity imp initData(); } + private void requestNetworkData() { + presenter.requestTrendDetailData(id); + } private void initData() { layoutManager = new VirtualLayoutManager(this); diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/IntroduceFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/IntroduceFragment.java index 1f6da26b95..74e39b2e99 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/IntroduceFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/IntroduceFragment.java @@ -93,6 +93,9 @@ public class IntroduceFragment extends BaseFragment implement super.onViewCreated(view, savedInstanceState); smartRefreshLayout = view.findViewById(R.id.refreshLayout); multipleStatusView = view.findViewById(R.id.multipleStatusView); + multipleStatusView.setOnRetryClickListener(v -> { + lazyInit(); + }); mRecyclerView = view.findViewById(R.id.recyclerView); initData(); } diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/TrendFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/TrendFragment.java index 9c8d675294..99526fea9a 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/TrendFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/gateway/TrendFragment.java @@ -105,6 +105,9 @@ public class TrendFragment extends BaseFragment implements Ga super.onViewCreated(view, savedInstanceState); smartRefreshLayout = view.findViewById(R.id.refreshLayout); multipleStatusView = view.findViewById(R.id.multipleStatusView); + multipleStatusView.setOnRetryClickListener(v -> { + lazyInit(); + }); mRecyclerView = view.findViewById(R.id.recyclerView); mFrameLayout = view.findViewById(R.id.fragmentRefreshLayout); initView(); diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/LessonsActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/LessonsActivity.java index a252bb902e..33352b3ae2 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/LessonsActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/lessons/LessonsActivity.java @@ -152,6 +152,10 @@ private final static int[] tabs = {R.string.lessons_introduction, beginTv = findViewById(R.id.begin_study); smartRefreshLayout = findViewById(R.id.refreshLayout); multipleStatusView = findViewById(R.id.multipleStatusView); + multipleStatusView.setOnRetryClickListener(v -> { + requestNetworkData(); + }); + LinearLayout mBulletChat = findViewById(R.id.bullet_chat_layout); LinearLayout mStoreLayout = findViewById(R.id.store_layout); LinearLayout mForwardLayout = findViewById(R.id.forward_layout); @@ -163,15 +167,19 @@ private final static int[] tabs = {R.string.lessons_introduction, mForwardLayout.setOnClickListener(LessonsActivity.this); mCacheLayout.setOnClickListener(LessonsActivity.this); - // 获取网络数据 presenter = new CourseDetailsPresenter(this); - presenter.requestDetailsDetailsData(id); + requestNetworkData(); initTabLayout(); initViewPager(); initFootView(); } + private void requestNetworkData(){ + // 获取网络数据 + presenter.requestDetailsDetailsData(id); + } + @Override public int getLayout() { return R.layout.activity_lessons; diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_content_detail.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_content_detail.xml index 140f3d1a19..47f699766a 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_content_detail.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_content_detail.xml @@ -101,7 +101,7 @@ app:emptyView="@layout/layout_empty_view" app:errorView="@layout/layout_error_view" app:loadingView="@layout/layout_loading_view" - app:noNetworkView="@layout/no_network_view"> + app:noNetworkView="@layout/layout_network_view">