|
@@ -10,8 +10,10 @@ import android.widget.ImageView;
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
import com.bumptech.glide.Glide;
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
+import com.chad.library.adapter.base.listener.OnItemChildClickListener;
|
|
|
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
|
|
import com.cooleshow.base.common.WebConstants;
|
|
|
+import com.cooleshow.base.constanst.Constants;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
|
import com.cooleshow.base.utils.SizeUtils;
|
|
@@ -161,7 +163,7 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
mViewBinding.recyclerviewRecommendTalent.addItemDecoration(commonItemDecoration);
|
|
|
mViewBinding.recyclerviewRecommendTalent.setAdapter(mRecommendTalentAdapter);
|
|
|
|
|
|
- LinearLayoutManager videoCourseManager = new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false);
|
|
|
+ LinearLayoutManager videoCourseManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false);
|
|
|
mViewBinding.rvVideoCourse.setLayoutManager(videoCourseManager);
|
|
|
mHomeVideoCourseAdapter = new NewHomeVideoCourseAdapter();
|
|
|
CommonItemDecoration videoListItemDecoration = new CommonItemDecoration(SizeUtils.dp2px(12), 0, 0, SizeUtils.dp2px(10), 0);
|
|
@@ -221,6 +223,22 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
}
|
|
|
|
|
|
private void initListener() {
|
|
|
+ mRecommendTalentAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemChildClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
|
|
|
+ if (view.getId() == R.id.tv_focus) {
|
|
|
+ //关注
|
|
|
+ if (position < mRecommendTalentAdapter.getData().size()) {
|
|
|
+ RecommendTalentListBean data = mRecommendTalentAdapter.getData().get(position);
|
|
|
+ if (presenter != null) {
|
|
|
+ presenter.followTeacher(data.isFocus ? Constants.STUDENT_FOCUS_TEACHER_STATUS_NORMAL : Constants.STUDENT_FOCUS_TEACHER_STATUS_FOLLOW, String.valueOf(data.userId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
mViewBinding.viewPagerBottom.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
|
@Override
|
|
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
@@ -631,6 +649,18 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void followTeacherSuccess() {
|
|
|
+ //关注老师成功
|
|
|
+ if (isDetached()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //获取推荐达人列表
|
|
|
+ if (presenter != null) {
|
|
|
+ presenter.getRecommendTalentList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void onClick(View v) {
|
|
|
int id = v.getId();
|
|
|
|