撰写回答页面添加我来回答遮罩
This commit is contained in:
@ -140,7 +140,7 @@ class PersonalHomeActivity : ListActivity<PersonalHistoryEntity, PersonalHomeVie
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun startTargetActivity(context: Context, userId: String?, entrance: String, path: String?) {
|
||||
fun startTargetActivity(context: Context, userId: String?, entrance: String?, path: String?) {
|
||||
if (!userId.isNullOrEmpty()) {
|
||||
val intent = Intent(context, PersonalHomeActivity::class.java)
|
||||
intent.putExtra(EntranceUtils.KEY_USER_ID, userId)
|
||||
|
||||
@ -504,7 +504,13 @@ class AnswerDetailFragment : NormalFragment() {
|
||||
mBinding.refreshLayout.setOnLoadMoreListener {
|
||||
mBinding.refreshLayout.finishLoadMore(0)
|
||||
val question = mViewModel.answerDetail!!.question
|
||||
startActivity(AnswerEditActivity.getIntent(context!!, question.id, question.title, true, question.communityName))
|
||||
startActivity(AnswerEditActivity.getIntent(
|
||||
requireContext(),
|
||||
question.id,
|
||||
question.title,
|
||||
true,
|
||||
question.communityName,
|
||||
showHintBackground = true))
|
||||
}
|
||||
} else {
|
||||
mRefreshFooter?.REFRESH_FOOTER_PULLING = "不能向下翻页了"
|
||||
|
||||
@ -9,6 +9,8 @@ import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
@ -49,12 +51,18 @@ class AnswerEditActivity : BaseRichEditorActivity() {
|
||||
/**
|
||||
* 撰写回答
|
||||
*/
|
||||
fun getIntent(context: Context, questionId: String?, questionTitle: String?, showInNewPage: Boolean?, communityName: String?): Intent {
|
||||
fun getIntent(context: Context,
|
||||
questionId: String?,
|
||||
questionTitle: String?,
|
||||
showInNewPage: Boolean?,
|
||||
communityName: String?,
|
||||
showHintBackground: Boolean = false): Intent {
|
||||
val intent = Intent(context, AnswerEditActivity::class.java)
|
||||
intent.putExtra(EntranceUtils.KEY_QUESTIONS_ID, questionId)
|
||||
intent.putExtra(EntranceUtils.KEY_QUESTIONS_TITLE, questionTitle)
|
||||
intent.putExtra(EntranceUtils.KEY_ANSWER_OPEN_IN_NEW_PAGE, showInNewPage)
|
||||
intent.putExtra(EntranceUtils.KEY_COMMUNITY_NAME, communityName)
|
||||
intent.putExtra(EntranceUtils.KEY_HINT, showHintBackground)
|
||||
return intent
|
||||
}
|
||||
|
||||
@ -108,6 +116,7 @@ class AnswerEditActivity : BaseRichEditorActivity() {
|
||||
|
||||
private var mOpenAnswerInNewPage: Boolean = false
|
||||
private var mAgreePostPic: Boolean = false
|
||||
private var mShowCreateNewAnswerHint: Boolean = false
|
||||
|
||||
private var mViewModel: AnswerEditViewModel? = null
|
||||
|
||||
@ -132,6 +141,8 @@ class AnswerEditActivity : BaseRichEditorActivity() {
|
||||
mQuestionsTitle = intent?.getStringExtra(EntranceUtils.KEY_QUESTIONS_TITLE)
|
||||
mCommunityName = intent?.getStringExtra(EntranceUtils.KEY_COMMUNITY_NAME)
|
||||
mOpenAnswerInNewPage = intent?.getBooleanExtra(EntranceUtils.KEY_ANSWER_OPEN_IN_NEW_PAGE, false)!!
|
||||
mShowCreateNewAnswerHint = intent?.getBooleanExtra(EntranceUtils.KEY_HINT, false) ?: false
|
||||
|
||||
val factory = AnswerEditViewModel.Factory(
|
||||
HaloApp.getInstance().application,
|
||||
intent?.getStringExtra(EntranceUtils.KEY_ANSWER_ID),
|
||||
@ -139,6 +150,11 @@ class AnswerEditActivity : BaseRichEditorActivity() {
|
||||
intent?.getStringExtra(EntranceUtils.KEY_DRAFT_ID),
|
||||
intent?.getStringExtra(EntranceUtils.KEY_QUESTIONS_ID))
|
||||
mViewModel = ViewModelProviders.of(this, factory).get(AnswerEditViewModel::class.java)
|
||||
|
||||
if (mShowCreateNewAnswerHint) {
|
||||
showCreateAnswerHintDialog()
|
||||
}
|
||||
|
||||
addObserver()
|
||||
|
||||
if (TextUtils.isEmpty(mViewModel?.answerId)) {
|
||||
@ -177,6 +193,19 @@ class AnswerEditActivity : BaseRichEditorActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showCreateAnswerHintDialog() {
|
||||
val dialog = Dialog(this, R.style.DialogWindowTransparent)
|
||||
dialog.setCancelable(true)
|
||||
dialog.setCanceledOnTouchOutside(false)
|
||||
val window = dialog.window
|
||||
window?.setGravity(Gravity.CENTER)
|
||||
dialog.show()
|
||||
val viewDialog = LayoutInflater.from(this).inflate(R.layout.dialog_new_answer_hint, null)
|
||||
viewDialog.findViewById<View>(R.id.tv_ok).setOnClickListener { dialog.dismiss() }
|
||||
viewDialog.findViewById<View>(R.id.tv_back).setOnClickListener { finish() }
|
||||
dialog.setContentView(viewDialog)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_answer_edit
|
||||
}
|
||||
@ -330,7 +359,6 @@ class AnswerEditActivity : BaseRichEditorActivity() {
|
||||
mViewModel?.postAnswer(answerContent)
|
||||
}, 100)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun getReplaceRealContent(): String {
|
||||
|
||||
28
app/src/main/res/layout/dialog_new_answer_hint.xml
Normal file
28
app/src/main/res/layout/dialog_new_answer_hint.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_back"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="55dp"
|
||||
android:background="@drawable/detail_download_normal_image_style"
|
||||
android:gravity="center"
|
||||
android:text="返回"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="23sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ok"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="55dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:background="@drawable/game_item_btn_download_style"
|
||||
android:gravity="center"
|
||||
android:text="我来回答"
|
||||
android:textColor="@color/all_white"
|
||||
android:textSize="23sp" />
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user