回退问答-推荐访问路径 增加问题历史和历史详情
This commit is contained in:
@ -88,6 +88,7 @@ public class QuestionsDetailFragment extends ListFragment<AnswerEntity, NormalLi
|
||||
|
||||
public static final int QUESTIONS_DETAIL_ANSWER_REQUEST = 110;
|
||||
public static final int QUESTIONS_EDIT_REQUEST = 111;
|
||||
public static final int QUESTIONS_MANAGER_EDIT_REQUEST = 112;
|
||||
|
||||
@BindView(R.id.reuse_tv_none_data)
|
||||
TextView mNoDataTv;
|
||||
@ -418,6 +419,8 @@ public class QuestionsDetailFragment extends ListFragment<AnswerEntity, NormalLi
|
||||
tagDialog.show(getChildFragmentManager(), TagsSelectFragment.class.getSimpleName());
|
||||
break;
|
||||
case patchQuestion:
|
||||
Intent intent = QuestionEditActivity.getManagerIntent(getContext(), mQuestionsDetailEntity);
|
||||
startActivityForResult(intent, QUESTIONS_MANAGER_EDIT_REQUEST);
|
||||
break;
|
||||
case hideQuestion:
|
||||
break;
|
||||
|
||||
@ -58,6 +58,15 @@ class QuestionEditActivity : BaseActivity() {
|
||||
return intent
|
||||
}
|
||||
|
||||
// 编辑问题
|
||||
@JvmStatic
|
||||
fun getManagerIntent(context: Context, entity: QuestionsDetailEntity): Intent {
|
||||
val intent = Intent(context, QuestionEditActivity::class.java)
|
||||
intent.putExtra(QuestionsDetailEntity.TAG, entity)
|
||||
intent.putExtra(EntranceUtils.KEY_QUESTION_MANAGER_PATCH, true)
|
||||
return intent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@ -86,6 +95,7 @@ class QuestionEditActivity : BaseActivity() {
|
||||
mViewModel?.questionEntity = detailEntity
|
||||
mViewModel?.content = detailEntity.description
|
||||
mViewModel?.picList?.postValue(detailEntity.images as MutableList<String>?)
|
||||
mViewModel?.isManagerPatch = intent.getBooleanExtra(QuestionsDetailEntity.TAG, false)
|
||||
if (mViewModel?.title.isNullOrEmpty()) mViewModel?.title = detailEntity.title
|
||||
} else { // 新增问题
|
||||
var searchKey = intent.getStringExtra(EntranceUtils.KEY_QUESTIONS_SEARCH_KEY)
|
||||
@ -170,7 +180,12 @@ class QuestionEditActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
override fun onMenuItemClick(menuItem: MenuItem?): Boolean {
|
||||
mViewModel?.checkTitleAndLoadTitleTag()
|
||||
if (mViewModel!!.isManagerPatch) {
|
||||
mViewModel?.selectedTags?.addAll(mViewModel?.questionEntity?.tags!!)
|
||||
// todo 直接提交
|
||||
} else {
|
||||
mViewModel?.checkTitleAndLoadTitleTag()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.gh.gamecenter.qa.questions.edit.manager
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.gh.gamecenter.baselist.ListActivity
|
||||
import com.gh.gamecenter.baselist.NormalListViewModel
|
||||
import com.gh.gamecenter.qa.entity.QuestionsDetailEntity
|
||||
|
||||
class HistoryActivity : ListActivity<QuestionsDetailEntity, NormalListViewModel<QuestionsDetailEntity>>() {
|
||||
private var mAdapter: HistoryAdapter? = null
|
||||
|
||||
override fun provideListAdapter(): HistoryAdapter {
|
||||
if (mAdapter == null) {
|
||||
mAdapter = HistoryAdapter(this, mListViewModel)
|
||||
}
|
||||
return mAdapter!!
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getIntent(context: Context): Intent {
|
||||
val intent = Intent(context, HistoryActivity::class.java)
|
||||
return intent
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.gh.gamecenter.qa.questions.edit.manager
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.ViewGroup
|
||||
import com.gh.common.constant.ItemViewType
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
import com.gh.gamecenter.baselist.NormalListViewModel
|
||||
import com.gh.gamecenter.qa.entity.QuestionsDetailEntity
|
||||
|
||||
class HistoryAdapter(context: Context,
|
||||
private val mViewModel: NormalListViewModel<QuestionsDetailEntity>) : ListAdapter<QuestionsDetailEntity>(context) {
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return if (position == itemCount - 1) {
|
||||
ItemViewType.ITEM_FOOTER
|
||||
} else {
|
||||
ItemViewType.ITEM_BODY
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val view = mLayoutInflater . inflate (R.layout.refresh_footerview, parent, false)
|
||||
return FooterViewHolder(view)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = if (mEntityList.isEmpty()) 0 else mEntityList.size + TOP_ITEM_COUNT
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
if (holder is FooterViewHolder) {
|
||||
holder.initFooterViewHolder(mViewModel, mIsLoading, mIsNetworkError, mIsOver)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.gh.gamecenter.qa.questions.edit.manager
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.gh.base.BaseActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.databinding.QuestionsHistoryDetailBinding
|
||||
import com.gh.gamecenter.qa.entity.QuestionsDetailEntity
|
||||
|
||||
class HistoryDetailActivity : BaseActivity() {
|
||||
private lateinit var mBinding: QuestionsHistoryDetailBinding;
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.questions_history_detail
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mBinding = QuestionsHistoryDetailBinding.bind(mContentView)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, historyList: ArrayList<QuestionsDetailEntity>): Intent {
|
||||
val intent = Intent(context, HistoryDetailActivity::class.java)
|
||||
intent.putParcelableArrayListExtra(QuestionsDetailEntity::class.java.simpleName, historyList)
|
||||
return intent
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class AskQuestionsRecommendsFragment extends ListFragment<AnswerEntity, A
|
||||
@Override
|
||||
public void onListClick(View view, int position, Object data) {
|
||||
AnswerEntity answerEntity;
|
||||
String path = "首页-推荐";
|
||||
String path = "问答-精选";
|
||||
switch (view.getId()) {
|
||||
case R.id.footerview_item:
|
||||
if (mAdapter.isNetworkError()) {
|
||||
|
||||
@ -55,7 +55,7 @@ class RecommendNewestAdapter(context: Context) : ListAdapter<AnswerEntity>(conte
|
||||
questions.title = answerEntity.articleTitle
|
||||
answerEntity.questions = questions
|
||||
}
|
||||
val path = "首页-推荐"
|
||||
val path = "问答-精选(时间)"
|
||||
viewHolder.initQuestionsHotViewHolder(mContext, answerEntity, "", path)
|
||||
viewHolder.mAskTitle.setOnClickListener {
|
||||
if ("community_article" == answerEntity.type) {
|
||||
|
||||
Reference in New Issue
Block a user