Commit 0b806b34 by 范玉宾

article comment dialog done

parent 05a81045
package widget
import androidx.fragment.app.DialogFragment
class ArticleDialogFragment: DialogFragment() {
}
\ No newline at end of file
...@@ -38,8 +38,8 @@ class HomeArticleItemView(private val mContext: Context, private var homeEvent: ...@@ -38,8 +38,8 @@ class HomeArticleItemView(private val mContext: Context, private var homeEvent:
homeModuleArticleItemViewTitle.text = bean?.title homeModuleArticleItemViewTitle.text = bean?.title
homeModuleArticleItemViewContent.text = bean?.desc homeModuleArticleItemViewContent.text = bean?.desc
homeModuleArticleItemViewAuthor.text = bean?.name homeModuleArticleItemViewAuthor.text = bean?.name
homeModuleArticleItemViewGreatNum.text = "点赞${bean?.countOfFavorite}" homeModuleArticleItemViewGreatNum.text = "${bean?.countOfFavorite}点赞"
homeModuleArticleItemViewLookNum.text = "浏览${bean?.readNum}" homeModuleArticleItemViewLookNum.text = "${bean?.readNum}浏览"
YDLImageCacheManager.showImage(mContext, bean?.imgUrl, homeModuleArticleItemViewImg) YDLImageCacheManager.showImage(mContext, bean?.imgUrl, homeModuleArticleItemViewImg)
setOnClickListener { setOnClickListener {
homeEvent?.articleItemClick(bean) homeEvent?.articleItemClick(bean)
......
...@@ -32,33 +32,32 @@ ...@@ -32,33 +32,32 @@
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="#1C1F28" android:textColor="#1C1F28"
android:layout_alignParentTop="true"
android:lineSpacingExtra="@dimen/platform_dp_1" android:lineSpacingExtra="@dimen/platform_dp_1"
tools:text="喧嚣的世界中,你的重要何以而来?喧嚣的世界中,你的重要何以而来?" tools:text="喧嚣的世界中,你的重要何以而来?喧嚣的世界中,你的重要何以而来?"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignTop="@id/homeModuleArticleItemViewCardImg"
android:layout_toLeftOf="@+id/homeModuleArticleItemViewCardImg" android:layout_toLeftOf="@+id/homeModuleArticleItemViewCardImg"
android:layout_marginRight="14dp"/> android:layout_marginRight="14dp"/>
<TextView <TextView
android:id="@+id/homeModuleArticleItemViewContent" android:id="@+id/homeModuleArticleItemViewContent"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:singleLine="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1"
android:gravity="center_vertical"
android:ellipsize="end" android:ellipsize="end"
android:textSize="@dimen/platform_dp_13" android:textSize="@dimen/platform_dp_13"
android:layout_marginTop="5dp"
android:textColor="#9D9EA7" android:textColor="#9D9EA7"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_below="@+id/homeModuleArticleItemViewTitle"
tools:text="喧嚣的世界中,你的重要何以而来?当我伫立在我所伫立之处..." tools:text="喧嚣的世界中,你的重要何以而来?当我伫立在我所伫立之处..."
android:layout_toLeftOf="@+id/homeModuleArticleItemViewCardImg" android:layout_toLeftOf="@+id/homeModuleArticleItemViewCardImg"
android:layout_alignBottom="@id/homeModuleArticleItemViewCardImg"
android:layout_marginRight="9dp"/> android:layout_marginRight="9dp"/>
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/homeModuleArticleItemViewBottomLayout" android:id="@+id/homeModuleArticleItemViewBottomLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_below="@+id/homeModuleArticleItemViewCardImg" android:layout_below="@+id/homeModuleArticleItemViewCardImg"
android:layout_marginTop="20dp"> android:layout_marginTop="20dp">
...@@ -67,37 +66,48 @@ ...@@ -67,37 +66,48 @@
android:layout_width="16dp" android:layout_width="16dp"
android:layout_height="16dp" android:layout_height="16dp"
android:src="@drawable/home_article_item_icon" android:src="@drawable/home_article_item_icon"
android:layout_alignParentLeft="true"/> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView <TextView
android:id="@+id/homeModuleArticleItemViewAuthor" android:id="@+id/homeModuleArticleItemViewAuthor"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="13sp" android:textSize="13sp"
android:textColor="#666666" android:textColor="#666666"
android:layout_marginLeft="@dimen/platform_dp_3" android:layout_marginLeft="@dimen/platform_dp_3"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/homeModuleArticleItemViewIcon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:text="赵秀英"/> tools:text="赵秀英"/>
<TextView <TextView
android:id="@+id/homeModuleArticleItemViewLookNum" android:id="@+id/homeModuleArticleItemViewLookNum"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="浏览2656" android:layout_marginEnd="85dp"
tools:text="2656浏览"
android:textSize="13sp" android:textSize="13sp"
android:textColor="#62636F"/> android:textColor="#62636F"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView <TextView
android:id="@+id/homeModuleArticleItemViewGreatNum" android:id="@+id/homeModuleArticleItemViewGreatNum"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
tools:text="点赞3327" tools:text="3327点赞"
android:textSize="13sp" android:textSize="13sp"
android:textColor="#62636F"/> android:textColor="#62636F"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<View <View
android:id="@+id/homeModuleArticleItemViewBottomLine" android:id="@+id/homeModuleArticleItemViewBottomLine"
......
package com.ydl.view
import android.os.Bundle
import android.util.DisplayMetrics
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
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.remind.ToastHelper
class ArticleDialogFragment: DialogFragment() {
private lateinit var ivClose: ImageView
private lateinit var etComment: EditText
private lateinit var tvPublish: TextView
private lateinit var cslLayout:ConstraintLayout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NO_TITLE, R.style.BottomDialogAnimation)
}
override fun onStart() {
super.onStart()
val displayMetrics = DisplayMetrics()
activity?.windowManager?.defaultDisplay?.getMetrics(displayMetrics)
val window = dialog?.window
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.layout_comment_article,container)
initView(view)
return view
}
private fun initView(view: View){
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 {
dismiss()
}
KeyboardUtils.showSoftInput(etComment)
ivClose.setOnClickListener {
dismiss()
}
tvPublish.setOnClickListener {
if (etComment.text.toString().isNullOrBlank()){
ToastHelper.show("评论内容不能为空~")
return@setOnClickListener
}
dismiss()
}
}
override fun dismiss() {
KeyboardUtils.hideSoftInput(etComment)
super.dismiss()
}
}
\ No newline at end of file
...@@ -37,6 +37,7 @@ import com.umeng.socialize.bean.SHARE_MEDIA; ...@@ -37,6 +37,7 @@ import com.umeng.socialize.bean.SHARE_MEDIA;
import com.ydl.utils.PopUtils; import com.ydl.utils.PopUtils;
import com.ydl.utils.ProxyCheckUtils; import com.ydl.utils.ProxyCheckUtils;
import com.ydl.utils.WebUrlParamsUtils; import com.ydl.utils.WebUrlParamsUtils;
import com.ydl.view.ArticleDialogFragment;
import com.ydl.view.ShareMeditationDialog; import com.ydl.view.ShareMeditationDialog;
import com.ydl.ydl_router.manager.YDLRouterManager; import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
...@@ -1216,10 +1217,13 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -1216,10 +1217,13 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish(); finish();
} else { } else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) { // if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); // WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
} // }
finish(); // finish();
new ArticleDialogFragment().show(getSupportFragmentManager(),"Article");
} }
}); });
} else { } else {
......
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="MissingDefaultResource">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toYDelta="100%p" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="100%p"
android:interpolator="@android:anim/accelerate_interpolator"
android:toYDelta="0" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFFFF"/>
<corners
android:topLeftRadius="4dp"
android:topRightRadius="4dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"> android:id="@+id/csl_root_layout">
<ImageView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/iv_close_dialog" android:id="@+id/csl_comment_layout"
android:layout_width="50dp" android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="2dp"
android:padding="13dp"
android:src="@drawable/article_close_dialog"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="发布评论" android:background="@drawable/bg_comment_article"
android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent"
android:textSize="16sp"
android:textColor="#1C1F28"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/iv_close_dialog" app:layout_constraintStart_toStartOf="parent">
app:layout_constraintBottom_toBottomOf="@id/iv_close_dialog"/>
<TextView <ImageView
android:id="@+id/tv_publish_comment" android:id="@+id/iv_close_dialog"
android:layout_width="55dp" android:layout_width="50dp"
android:layout_height="28dp" android:layout_height="50dp"
android:gravity="center" android:layout_marginTop="2dp"
android:layout_marginEnd="15dp" android:padding="13dp"
android:text="发布" android:src="@drawable/article_close_dialog"
android:textColor="@color/white" app:layout_constraintStart_toStartOf="parent"
android:textStyle="bold" app:layout_constraintTop_toTopOf="parent" />
android:textSize="14sp"
android:background="@drawable/article_bg_publish"
app:layout_constraintTop_toTopOf="@id/iv_close_dialog"
app:layout_constraintBottom_toBottomOf="@id/iv_close_dialog"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.appcompat.widget.AppCompatEditText <TextView
android:id="@+id/et_article_comment" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:text="发布评论"
android:padding="20dp" android:textColor="#1C1F28"
android:minHeight="260dp" android:textSize="16sp"
android:hint="请输入你的评论" android:textStyle="bold"
android:textColorHint="#C3C4CA" app:layout_constraintBottom_toBottomOf="@id/iv_close_dialog"
android:textSize="16sp" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_close_dialog"/> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/iv_close_dialog" />
<TextView
android:id="@+id/tv_publish_comment"
android:layout_width="55dp"
android:layout_height="28dp"
android:layout_marginEnd="15dp"
android:background="@drawable/article_bg_publish"
android:gravity="center"
android:text="发布"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/iv_close_dialog"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/iv_close_dialog" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/et_article_comment"
android:layout_width="match_parent"
android:layout_height="240dp"
android:background="@null"
android:focusedByDefault="true"
android:gravity="start|top"
android:hint="请输入你的评论"
android:paddingHorizontal="20dp"
android:textColor="#1C1F28"
android:textColorHint="#C3C4CA"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@id/iv_close_dialog"
tools:text="默认好评!默认好评!默认好评!默认好评!默认好评" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -9,4 +9,18 @@ ...@@ -9,4 +9,18 @@
</style> </style>
<style name="BottomDialogAnimation" parent="Theme.Design.BottomSheetDialog">
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:background">@color/transparent</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowFrame">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowSoftInputMode">stateAlwaysVisible</item>
<item name="android:windowEnterAnimation">@anim/dialog_bottom_up</item>
<item name="android:windowExitAnimation">@anim/dialog_bottom_down</item>
</style>
</resources> </resources>
\ No newline at end of file
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