| | |
| | | private val dyns = arrayListOf<Dynamic>() |
| | | private val adapter = DynamicAdapter(dyns,true) |
| | | private val comment = arrayListOf<Comment>() |
| | | private val commentAdapter = CommentAdapter(comment) |
| | | val id by lazy { intent.getStringExtra("id")?:"" } |
| | | private var page = 1 |
| | | |
| | | override fun initClick() { |
| | | tv_like.clickDelay { |
| | | if(dyns[0].isLike == "0") |
| | | HttpManager.doLike(id,1,null).request(this){_,_-> |
| | | dyns[0].isLike = if(dyns[0].isLike == "1") "0" else "1" |
| | | tv_like.setCompoundDrawablesRelativeWithIntrinsicBounds(0,if (dyns[0].isLike == "1") R.mipmap.dianzaned else R.mipmap.dianzan,0,0) |
| | | } |
| | | } |
| | | |
| | | |
| | | et_content.setOnEditorActionListener { v, actionId, event -> |
| | | val content = et_content.text.toString() |
| | |
| | | rv_moment.layoutManager = LinearLayoutManager(this) |
| | | rv_moment.adapter = adapter |
| | | rv_comment.layoutManager = LinearLayoutManager(this) |
| | | rv_comment.adapter = commentAdapter |
| | | |
| | | refreshLayout.setOnRefreshListener { |
| | | getMomentDetail() |
| | |
| | | if (page == 1) |
| | | comment.clear() |
| | | comment.addAll(data?: arrayListOf()) |
| | | commentAdapter.notifyDataSetChanged() |
| | | if (comment.isEmpty()) |
| | | refreshLayout.finishRefreshWithNoMoreData() |
| | | else if (data.isNullOrEmpty()) |