Commit 6f740b76 by 范玉宾

publish article done

parent 9f151440
......@@ -12,6 +12,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.DialogFragment
import com.blankj.utilcode.util.KeyboardUtils
import com.ydl.webview.R
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
class ArticleDialogFragment: DialogFragment() {
......@@ -20,6 +21,13 @@ class ArticleDialogFragment: DialogFragment() {
private lateinit var etComment: EditText
private lateinit var tvPublish: TextView
private lateinit var cslLayout:ConstraintLayout
private lateinit var mListener: OnPublishArticleCommentListener
private var mTitle:String = ""
fun setOnPublishListener(listener: OnPublishArticleCommentListener){
mListener = listener
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
......@@ -45,18 +53,23 @@ class ArticleDialogFragment: DialogFragment() {
}
private fun initView(view: View){
mTitle = arguments?.getString(KEY_ARTICLE_TITLE)?:""
ivClose = view.findViewById(R.id.iv_close_dialog)
etComment = view.findViewById(R.id.et_article_comment)
tvPublish = view.findViewById(R.id.tv_publish_comment)
cslLayout = view.findViewById(R.id.csl_root_layout)
cslLayout.setOnClickListener {
ActionCountUtils.record("article_detail_page","article_detail_cancelcomment_click",mTitle)
dismiss()
}
KeyboardUtils.showSoftInput(etComment)
ivClose.setOnClickListener {
ActionCountUtils.record("article_detail_page","article_detail_cancelcomment_click",mTitle)
dismiss()
}
tvPublish.setOnClickListener {
......@@ -64,6 +77,9 @@ class ArticleDialogFragment: DialogFragment() {
ToastHelper.show("评论内容不能为空~")
return@setOnClickListener
}
mListener.onPublishClick(etComment.text.toString())
ActionCountUtils.record("article_detail_page","article_detail_issuecomment_click",mTitle)
etComment.setText("")
dismiss()
}
......@@ -74,4 +90,23 @@ class ArticleDialogFragment: DialogFragment() {
super.dismiss()
}
companion object {
private const val KEY_ARTICLE_TITLE = "key_share_title"
@JvmStatic
fun newInstance(title: String): ArticleDialogFragment {
val args = Bundle()
args.putString(KEY_ARTICLE_TITLE, title)
val fragment = ArticleDialogFragment()
fragment.arguments = args
return fragment
}
}
interface OnPublishArticleCommentListener{
fun onPublishClick(comment:String)
}
}
\ No newline at end of file
......@@ -1547,7 +1547,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
public void showCommentArticleDialog(){
if (commentArticleDialog == null) {
commentArticleDialog = new ArticleDialogFragment();
commentArticleDialog = ArticleDialogFragment.newInstance(wv_content.getTitle());
commentArticleDialog.setOnPublishListener(comment -> {
callJSFunc("sendComment('"+comment+"')");
});
}
if (commentArticleDialog != null && !commentArticleDialog.isAdded()) {
commentArticleDialog.show(getSupportFragmentManager(), "article_comment");
......
......@@ -59,13 +59,12 @@
android:background="@null"
android:focusedByDefault="true"
android:gravity="start|top"
android:hint="请输入你的评论"
android:hint="说点什么吧..."
android:paddingHorizontal="20dp"
android:textColor="#1C1F28"
android:textColorHint="#C3C4CA"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@id/iv_close_dialog"
tools:text="默认好评!默认好评!默认好评!默认好评!默认好评" />
app:layout_constraintTop_toBottomOf="@id/iv_close_dialog"/>
</androidx.constraintlayout.widget.ConstraintLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment