|
@@ -12,6 +12,7 @@ import com.cooleshow.base.bean.SubjectListBean;
|
|
|
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.ThreadUtils;
|
|
|
import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
import com.cooleshow.base.widgets.dialog.CourseTipDialog;
|
|
|
import com.cooleshow.musicmerge.adapter.MyWorkPagerAdapter;
|
|
@@ -24,6 +25,7 @@ import com.cooleshow.student.databinding.ActivityAppointmentCourseBinding;
|
|
|
import com.cooleshow.student.databinding.ActivityMineCourseBinding;
|
|
|
import com.cooleshow.student.presenter.course.AppointCoursePresenter;
|
|
|
import com.cooleshow.student.presenter.course.MineCoursePresenter;
|
|
|
+import com.cooleshow.usercenter.helper.UserHelper;
|
|
|
import com.google.android.material.tabs.TabLayout;
|
|
|
import com.google.android.material.tabs.TabLayoutMediator;
|
|
|
|
|
@@ -46,6 +48,7 @@ import androidx.viewpager2.widget.ViewPager2;
|
|
|
@Route(path = RouterPath.CourseCenter.APPOINTMENT_COURSE)
|
|
|
public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointmentCourseBinding, AppointCoursePresenter> implements AppointCourseContract.View, View.OnClickListener {
|
|
|
public static final String SELECT_POSITION = "selectPosition";
|
|
|
+ public static final String HAS_SHOW_TIP_DIALOG = "showAppointCourseTipDialog";
|
|
|
private TabLayout tabLayout;
|
|
|
private ViewPager2 viewPager;
|
|
|
private ArrayList<String> titles = null;
|
|
@@ -74,7 +77,6 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
protected ActivityAppointmentCourseBinding getLayoutView() {
|
|
|
return ActivityAppointmentCourseBinding.inflate(getLayoutInflater());
|
|
@@ -102,14 +104,15 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
|
|
|
viewBinding.viewPager.post(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- viewBinding.viewPager.setCurrentItem(selectPosition,false);
|
|
|
+ viewBinding.viewPager.setCurrentItem(selectPosition, false);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ checkIsAutoShowTipDialog(selectPosition);
|
|
|
}
|
|
|
|
|
|
private void initTabLayoutAndViewPager() {
|
|
|
- TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(tabLayout, viewBinding.viewPager, (tab, position) -> {
|
|
|
+ TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(tabLayout, viewBinding.viewPager, (tab, position) -> {
|
|
|
//这里需要根据position修改tab的样式和文字等
|
|
|
createTab(tab, titles.get(position));
|
|
|
});
|
|
@@ -198,21 +201,45 @@ public class AppointmentCourseActivity extends BaseMVPActivity<ActivityAppointme
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
int id = v.getId();
|
|
|
- if(id == com.cooleshow.base.R.id.tv_right){
|
|
|
- showTipDialog();
|
|
|
+ if (id == com.cooleshow.base.R.id.tv_right) {
|
|
|
+ int currentPos = viewBinding.viewPager.getCurrentItem();
|
|
|
+ showTipDialog(currentPos);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void showTipDialog() {
|
|
|
- int currentPos = viewBinding.viewPager.getCurrentItem();
|
|
|
- if (mCourseTipDialog == null){
|
|
|
+
|
|
|
+ private void checkIsAutoShowTipDialog(int selectPosition) {
|
|
|
+ ThreadUtils.getMainHandler().post(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ int customCacheForInt = UserHelper.getCustomCacheForInt(HAS_SHOW_TIP_DIALOG );
|
|
|
+ if (customCacheForInt == 0) {
|
|
|
+ //未显示,显示弹窗
|
|
|
+ showTipDialog(selectPosition);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setAutoShowTipDialogCompleted() {
|
|
|
+ UserHelper.setCustomCache(HAS_SHOW_TIP_DIALOG, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showTipDialog(int selectPos) {
|
|
|
+ if (mCourseTipDialog == null) {
|
|
|
mCourseTipDialog = new CourseTipDialog(this);
|
|
|
+ mCourseTipDialog.setEventListener(new CourseTipDialog.OnEventListener() {
|
|
|
+ @Override
|
|
|
+ public void onCancelClick() {
|
|
|
+ setAutoShowTipDialogCompleted();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- if(!mCourseTipDialog.isShowing()){
|
|
|
+ if (!mCourseTipDialog.isShowing()) {
|
|
|
mCourseTipDialog.show();
|
|
|
}
|
|
|
- mCourseTipDialog.setSelect(currentPos);
|
|
|
+ mCourseTipDialog.setSelect(selectPos);
|
|
|
}
|
|
|
|
|
|
|