|
@@ -12,6 +12,7 @@ import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
|
import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
+import com.cooleshow.musicmerge.adapter.MyWorkPagerAdapter;
|
|
|
import com.cooleshow.student.R;
|
|
|
import com.cooleshow.student.adapter.MineCoursePagerAdapter;
|
|
|
import com.cooleshow.student.bean.QuerySubjectBean;
|
|
@@ -27,6 +28,7 @@ import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
+import androidx.fragment.app.Fragment;
|
|
|
import androidx.viewpager2.widget.ViewPager2;
|
|
|
|
|
|
|
|
@@ -50,6 +52,12 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
|
|
|
private VideoCourseAppointListFragment mVideoCourseAppointListFragment;
|
|
|
|
|
|
@Override
|
|
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ QMUIStatusBarHelper.setStatusBarLightMode(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
protected void initView() {
|
|
|
initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "约课");
|
|
|
viewBinding.toolbarInclude.toolbar.setBackgroundColor(Color.TRANSPARENT);
|
|
@@ -57,11 +65,7 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
|
|
|
viewPager = viewBinding.viewPager;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
- super.onCreate(savedInstanceState);
|
|
|
- QMUIStatusBarHelper.setStatusBarLightMode(this);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
protected ActivityAppointmentCourseBinding getLayoutView() {
|
|
@@ -76,21 +80,32 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
|
|
|
@Override
|
|
|
public void initData() {
|
|
|
super.initData();
|
|
|
- int selectPosition = getIntent().getIntExtra(SELECT_POSITION, -1);
|
|
|
titles = new ArrayList<String>(Arrays.asList("VIP定制课", "趣纠课", "直播课", "视频课"));
|
|
|
+ initListener();
|
|
|
+
|
|
|
initTabLayoutAndViewPager();
|
|
|
+ preSelect();
|
|
|
presenter.querySubjectItem();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void preSelect() {
|
|
|
+ int selectPosition = getIntent().getIntExtra(SELECT_POSITION, -1);
|
|
|
if (selectPosition != -1 && selectPosition < fragments.size()) {
|
|
|
- viewPager.post(new Runnable() {
|
|
|
+ viewBinding.viewPager.post(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- viewPager.setCurrentItem(selectPosition);
|
|
|
+ viewBinding.viewPager.setCurrentItem(selectPosition);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void initTabLayoutAndViewPager() {
|
|
|
+ TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(tabLayout, viewBinding.viewPager, (tab, position) -> {
|
|
|
+ //这里需要根据position修改tab的样式和文字等
|
|
|
+ createTab(tab, titles.get(position));
|
|
|
+ });
|
|
|
+
|
|
|
mVipCustomCourseListFragment = VIPCustomCourseListFragment.newInstance();
|
|
|
mInterestCorrectionCourseListFragment = InterestCorrectionCourseListFragment.newInstance();
|
|
|
mLiveCourseAppointListFragment = LiveCourseAppointListFragment.newInstance();
|
|
@@ -102,10 +117,6 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
|
|
|
MineCoursePagerAdapter mineCoursePageAdapter = new MineCoursePagerAdapter(this);
|
|
|
mineCoursePageAdapter.setFragments(fragments);
|
|
|
viewPager.setAdapter(mineCoursePageAdapter);
|
|
|
- TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> {
|
|
|
- //这里需要根据position修改tab的样式和文字等
|
|
|
- createTab(tab, titles.get(position));
|
|
|
- });
|
|
|
viewPager.setOffscreenPageLimit(fragments.size());
|
|
|
initListener();
|
|
|
tabLayoutMediator.attach();
|
|
@@ -141,7 +152,7 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
|
|
+ viewBinding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
|
|
@Override
|
|
|
public void onPageSelected(int position) {
|
|
|
super.onPageSelected(position);
|