|
@@ -16,6 +16,7 @@ import com.cooleshow.base.bean.CourseTipBean;
|
|
|
import com.cooleshow.base.common.WebConstants;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.utils.JumpUtils;
|
|
|
+import com.cooleshow.base.utils.ThreadUtils;
|
|
|
import com.youth.banner.Banner;
|
|
|
import com.youth.banner.adapter.BannerAdapter;
|
|
|
import com.youth.banner.adapter.BannerImageAdapter;
|
|
@@ -88,10 +89,19 @@ public class CourseTipDialog extends Dialog implements View.OnClickListener {
|
|
|
}
|
|
|
|
|
|
public void setSelect(int currentPos) {
|
|
|
- int itemCount = mBanner.getItemCount();
|
|
|
- if (currentPos < itemCount) {
|
|
|
- mBanner.setCurrentItem(currentPos, false);
|
|
|
- mBanner.getIndicator().onPageChanged(itemCount, currentPos);
|
|
|
+ if (mBanner != null) {
|
|
|
+ ThreadUtils.getMainHandler().post(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ if (mBanner != null) {
|
|
|
+ int itemCount = mBanner.getItemCount();
|
|
|
+ if (currentPos < itemCount) {
|
|
|
+ mBanner.setCurrentItem(currentPos, false);
|
|
|
+ mBanner.getIndicator().onPageChanged(itemCount, currentPos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -109,7 +119,7 @@ public class CourseTipDialog extends Dialog implements View.OnClickListener {
|
|
|
|
|
|
public void showCustomData(List<CourseTipBean> data) {
|
|
|
mBannerAdapter.setDatas(data);
|
|
|
- if(data.size()<=1){
|
|
|
+ if (data.size() <= 1) {
|
|
|
mBanner.removeIndicator();
|
|
|
}
|
|
|
}
|