| | |
| | | |
| | | import android.content.Context |
| | | import com.google.gson.annotations.SerializedName |
| | | import com.sinata.xqmuse.ui.course.CourseDetailActivity |
| | | import com.sinata.xqmuse.ui.discovery.DynamicActivity |
| | | import com.sinata.xqmuse.utils.Const |
| | | import com.sinata.xqmuse.utils.event.EmptyEvent |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.jetbrains.anko.startActivity |
| | | |
| | | |
| | | data class Banner( |
| | |
| | | val typeId: String = "", |
| | | val content: String = "", |
| | | val title: String = "", |
| | | val courseId: String = "", |
| | | val buttonImage: String = "", |
| | | val pageName: String = "", |
| | | var height: Int = 0, |
| | | var width: Int = 0, |
| | | @SerializedName("img") |
| | | @SerializedName("imageUrl") |
| | | val url: String = "", |
| | | val backgroundImage: String = "" |
| | | ){ |
| | | fun jumpPage(context: Context){ |
| | | when(modelName){ |
| | | "首页"->EventBus.getDefault().post(EmptyEvent(Const.EventCode.SWITCH_HOME)) |
| | | "运动"->{ |
| | | if(pageName == "详情页") |
| | | context.startActivity<CourseDetailActivity>("id" to turnId) |
| | | } |
| | | "发现"->{ |
| | | when(pageName){ |
| | | "详情页"->context.startActivity<DynamicActivity>("id" to turnId) |
| | | "主页"->EventBus.getDefault().post(EmptyEvent(Const.EventCode.SWITCH_DISCOVERY)) |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |