记录专栏的阅读位置信息
This commit is contained in:
@ -8,6 +8,7 @@ import android.text.TextUtils;
|
||||
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.entity.SpecialColumn;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
import com.gh.gamecenter.qa.entity.Questions;
|
||||
import com.gh.loghub.LogHubUtils;
|
||||
@ -23,8 +24,12 @@ import org.json.JSONObject;
|
||||
*/
|
||||
public class LogUtils {
|
||||
|
||||
public static void uploadCommunityArticle(String tracers, String articleId, String articleTitle,
|
||||
int readTime, CommunityEntity community) {
|
||||
public static void uploadCommunityArticle(String tracers,
|
||||
String articleId,
|
||||
String articleTitle,
|
||||
int readTime,
|
||||
CommunityEntity community,
|
||||
SpecialColumn specialColumn) {
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("subject", "community_article");
|
||||
@ -34,6 +39,13 @@ public class LogUtils {
|
||||
object.put("article_name", articleTitle);
|
||||
object.put("tracers", tracers);
|
||||
object.put("read", readTime);
|
||||
if (specialColumn != null) {
|
||||
JSONObject columnObject = new JSONObject();
|
||||
columnObject.put("type", specialColumn.getType());
|
||||
columnObject.put("name", specialColumn.getName());
|
||||
columnObject.put("tab", specialColumn.getTab());
|
||||
object.put("special_column", columnObject);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -61,7 +73,8 @@ public class LogUtils {
|
||||
String answerId,
|
||||
Questions questions,
|
||||
String communityId,
|
||||
String CommunityName) {
|
||||
String CommunityName,
|
||||
SpecialColumn specialColumn) {
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("subject", "answer");
|
||||
@ -72,6 +85,13 @@ public class LogUtils {
|
||||
object.put("tracers", tracers);
|
||||
object.put("answer_id", answerId);
|
||||
object.put("read", readTime);
|
||||
if (specialColumn != null) {
|
||||
JSONObject columnObject = new JSONObject();
|
||||
columnObject.put("type", specialColumn.getType());
|
||||
columnObject.put("name", specialColumn.getName());
|
||||
columnObject.put("tab", specialColumn.getTab());
|
||||
object.put("special_column", columnObject);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -83,7 +103,8 @@ public class LogUtils {
|
||||
int readTime,
|
||||
Questions questions,
|
||||
String communityId,
|
||||
String communityName) {
|
||||
String communityName,
|
||||
SpecialColumn specialColumn) {
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("subject", "question");
|
||||
@ -93,6 +114,13 @@ public class LogUtils {
|
||||
object.put("question_name", questions.getTitle());
|
||||
object.put("tracers", tracers);
|
||||
object.put("read", readTime);
|
||||
if (specialColumn != null) {
|
||||
JSONObject columnObject = new JSONObject();
|
||||
columnObject.put("type", specialColumn.getType());
|
||||
columnObject.put("name", specialColumn.getName());
|
||||
columnObject.put("tab", specialColumn.getTab());
|
||||
object.put("special_column", columnObject);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class SpecialColumn(
|
||||
var type: String? = "",
|
||||
var name: String? = "",
|
||||
var tab: String? = ""
|
||||
) : Parcelable
|
||||
@ -426,7 +426,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
case "community_article_comment":
|
||||
community = new CommunityEntity(entity.getArticle().getCommunityId(), "");
|
||||
if (view.getId() == R.id.message_original) {
|
||||
context.startActivity(ArticleDetailActivity.getIntent(context, community, entity.getArticle().getId(), entrance, path));
|
||||
context.startActivity(ArticleDetailActivity.getIntent(context, community, entity.getArticle().getId(), entrance, path, null));
|
||||
} else if (view.getId() == R.id.message_item) { // 打开评论管理
|
||||
context.startActivity(ArticleDetailActivity.getOpenCommentIntent(context, community, entity.getArticle().getId(), entrance, path));
|
||||
}
|
||||
@ -434,13 +434,13 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
case "community_article_vote":
|
||||
if (view.getId() == R.id.message_original || view.getId() == R.id.message_item) {
|
||||
community = new CommunityEntity(entity.getArticle().getCommunityId(), "");
|
||||
context.startActivity(ArticleDetailActivity.getIntent(context, community, entity.getArticle().getId(), entrance, path));
|
||||
context.startActivity(ArticleDetailActivity.getIntent(context, community, entity.getArticle().getId(), entrance, path, null));
|
||||
}
|
||||
break;
|
||||
case "reply_community_article_comment":
|
||||
if (view.getId() == R.id.message_original) {
|
||||
community = new CommunityEntity(entity.getArticle().getCommunityId(), "");
|
||||
context.startActivity(ArticleDetailActivity.getIntent(context, community, entity.getArticle().getId(), entrance, path));
|
||||
context.startActivity(ArticleDetailActivity.getIntent(context, community, entity.getArticle().getId(), entrance, path, null));
|
||||
} else if (view.getId() == R.id.message_item) {
|
||||
linkEntity = new LinkEntity();
|
||||
linkEntity.setType("community_article");
|
||||
|
||||
@ -7,6 +7,7 @@ import android.support.annotation.NonNull;
|
||||
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.gamecenter.NormalActivity;
|
||||
import com.gh.gamecenter.entity.SpecialColumn;
|
||||
|
||||
/**
|
||||
* Created by khy on 10/04/18.
|
||||
@ -17,16 +18,27 @@ public class AnswerDetailActivity extends NormalActivity {
|
||||
|
||||
@NonNull
|
||||
public static Intent getIntent(Context context, String answerId, String entrance, String path) {
|
||||
return getIntent(context, answerId, entrance, path, false);
|
||||
return getIntent(context, answerId, entrance, path, false, null);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Intent getIntent(Context context, String answerId, String entrance, String path, boolean isOpenCommentManager) {
|
||||
return getIntent(context, answerId, entrance, path, isOpenCommentManager, null);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Intent getIntent(Context context, String answerId, String entrance, String path, SpecialColumn specialColumn) {
|
||||
return getIntent(context, answerId, entrance, path, false, specialColumn);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Intent getIntent(Context context, String answerId, String entrance, String path, boolean isOpenCommentManager, SpecialColumn specialColumn) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceUtils.KEY_ANSWER_ID, answerId);
|
||||
bundle.putString(EntranceUtils.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path));
|
||||
bundle.putBoolean(EntranceUtils.KEY_SHOW_ANSWER_COMMENT, isOpenCommentManager);
|
||||
bundle.putString(EntranceUtils.KEY_PATH, path);
|
||||
bundle.putParcelable(EntranceUtils.KEY_DATA, specialColumn);
|
||||
return getTargetIntent(context, AnswerDetailActivity.class, AnswerDetailFragment.class, bundle);
|
||||
}
|
||||
|
||||
|
||||
@ -61,6 +61,7 @@ import com.gh.gamecenter.SuggestionActivity;
|
||||
import com.gh.gamecenter.ViewImageActivity;
|
||||
import com.gh.gamecenter.databinding.FragmentAnswerDetailBinding;
|
||||
import com.gh.gamecenter.entity.MeEntity;
|
||||
import com.gh.gamecenter.entity.SpecialColumn;
|
||||
import com.gh.gamecenter.entity.UserEntity;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
@ -172,6 +173,8 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
private AnswerDetailViewModel mViewModel;
|
||||
private FragmentAnswerDetailBinding mBinding;
|
||||
|
||||
private SpecialColumn mSpecialColumn = null;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -189,6 +192,7 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
mIsShowCommentManager = arguments.getBoolean(EntranceUtils.KEY_SHOW_ANSWER_COMMENT, false);
|
||||
mIsRecommendsAnswer = arguments.getBoolean(EntranceUtils.KEY_RECOMMENDS_CONTENTS, false);
|
||||
mPath = arguments.getString(EntranceUtils.KEY_PATH);
|
||||
mSpecialColumn = arguments.getParcelable(EntranceUtils.KEY_DATA);
|
||||
mViewModel.getAnswerDetail(mAnswerId, mEntrance);
|
||||
}
|
||||
|
||||
@ -255,7 +259,8 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
mAnswerId,
|
||||
mDetailEntity.getQuestion(),
|
||||
mDetailEntity.getCommunity().getId(),
|
||||
mDetailEntity.getCommunity().getName());
|
||||
mDetailEntity.getCommunity().getName(),
|
||||
mSpecialColumn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ import com.gh.gamecenter.SuggestionActivity
|
||||
import com.gh.gamecenter.ViewImageActivity
|
||||
import com.gh.gamecenter.databinding.ActivityArticleDetailBinding
|
||||
import com.gh.gamecenter.entity.CommunityEntity
|
||||
import com.gh.gamecenter.entity.SpecialColumn
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.mvvm.Status
|
||||
import com.gh.gamecenter.qa.article.edit.ArticleEditActivity
|
||||
@ -64,6 +65,8 @@ class ArticleDetailActivity : BaseActivity() {
|
||||
private var mIsShowCommentManager: Boolean = false
|
||||
private var mIsRecommendsContent: Boolean = false
|
||||
|
||||
private var mSpecialColumn: SpecialColumn? = null
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == ARTICLE_PATCH_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
@ -576,8 +579,11 @@ class ArticleDetailActivity : BaseActivity() {
|
||||
UserManager.getInstance().community.name,
|
||||
intent.extras.getString(EntranceUtils.KEY_PATH))
|
||||
|
||||
LogUtils.uploadCommunityArticle(mEntrance, mViewModel.articleId, mViewModel.detailEntity?.title
|
||||
, mElapsedHelper?.elapsedTime!!, mViewModel.detailEntity?.community)
|
||||
LogUtils.uploadCommunityArticle(mEntrance,
|
||||
mViewModel.articleId,
|
||||
mViewModel.detailEntity?.title,
|
||||
mElapsedHelper?.elapsedTime!!,
|
||||
mViewModel.detailEntity?.community, mSpecialColumn)
|
||||
}
|
||||
}
|
||||
|
||||
@ -585,12 +591,13 @@ class ArticleDetailActivity : BaseActivity() {
|
||||
const val ARTICLE_PATCH_REQUEST = 123
|
||||
|
||||
@JvmStatic
|
||||
fun getIntent(context: Context, community: CommunityEntity, articleId: String, entrance: String, path: String): Intent {
|
||||
fun getIntent(context: Context, community: CommunityEntity, articleId: String, entrance: String, path: String, specialColumn: SpecialColumn? = null): Intent {
|
||||
val intent = Intent(context, ArticleDetailActivity::class.java)
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path))
|
||||
intent.putExtra(EntranceUtils.KEY_COMMUNITY_ARTICLE_ID, articleId)
|
||||
intent.putExtra(EntranceUtils.KEY_COMMUNITY_DATA, community)
|
||||
intent.putExtra(EntranceUtils.KEY_PATH, path)
|
||||
intent.putExtra(EntranceUtils.KEY_DATA, specialColumn)
|
||||
return intent
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import com.gh.common.util.ImageUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
import com.gh.gamecenter.entity.SpecialColumn
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity
|
||||
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity
|
||||
@ -18,7 +19,8 @@ import com.gh.gamecenter.qa.recommends.AskQuestionsRecommendsViewHolder
|
||||
|
||||
class HotAdapter(context: Context,
|
||||
private val mEntrance: String,
|
||||
private val mPath: String) : ListAdapter<AnswerEntity>(context) {
|
||||
private val mPath: String,
|
||||
private val mSpecialColumn: SpecialColumn) : ListAdapter<AnswerEntity>(context) {
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return if (position == itemCount - 1) ItemViewType.ITEM_FOOTER else ItemViewType.ITEM_BODY
|
||||
@ -50,17 +52,31 @@ class HotAdapter(context: Context,
|
||||
holder.initQuestionsHotViewHolder(mContext, answerEntity, mEntrance, mPath)
|
||||
holder.itemView.setOnClickListener {
|
||||
if ("community_article" == answerEntity.type) {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, UserManager.getInstance().community, answerEntity.id!!, mEntrance, mPath))
|
||||
mContext.startActivity(
|
||||
ArticleDetailActivity.getIntent(
|
||||
mContext,
|
||||
UserManager.getInstance().community,
|
||||
answerEntity.id!!,
|
||||
mEntrance,
|
||||
mPath,
|
||||
mSpecialColumn))
|
||||
} else {
|
||||
mContext.startActivity(AnswerDetailActivity.getIntent(mContext, answerEntity.id, mEntrance, mPath))
|
||||
mContext.startActivity(AnswerDetailActivity.getIntent(mContext, answerEntity.id, mEntrance, mPath, mSpecialColumn))
|
||||
}
|
||||
}
|
||||
holder.mAskTitle.setOnClickListener {
|
||||
if ("community_article" == answerEntity.type) {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, UserManager.getInstance().community, answerEntity.id!!, mEntrance, mPath))
|
||||
mContext.startActivity(
|
||||
ArticleDetailActivity.getIntent(
|
||||
mContext,
|
||||
UserManager.getInstance().community,
|
||||
answerEntity.id!!,
|
||||
mEntrance,
|
||||
mPath,
|
||||
mSpecialColumn))
|
||||
} else {
|
||||
val questions = answerEntity.questions
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.id, mEntrance, mPath))
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.id, mEntrance, mPath, mSpecialColumn))
|
||||
}
|
||||
}
|
||||
answerEntity.user.auth?.let { ImageUtils.display(holder.badgeIcon, it.icon) }
|
||||
|
||||
@ -4,6 +4,7 @@ import android.arch.lifecycle.ViewModelProviders
|
||||
import android.view.View
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.SpecialColumn
|
||||
import com.gh.gamecenter.qa.entity.AnswerEntity
|
||||
import com.gh.gamecenter.qa.entity.AskTagGroupsEntity
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -11,16 +12,20 @@ import com.halo.assistant.HaloApp
|
||||
class HotFragment : ListFragment<AnswerEntity, HotViewModel>() {
|
||||
|
||||
private var mAdapter: HotAdapter? = null
|
||||
|
||||
private var mSpecialColumn = SpecialColumn()
|
||||
|
||||
override fun provideListAdapter(): HotAdapter? {
|
||||
if (mAdapter == null) {
|
||||
mSpecialColumn.name = mListViewModel.tag ?: mListViewModel.columnTagEntity!!.name
|
||||
mSpecialColumn.tab = "热门"
|
||||
val path = if (mListViewModel.tag != null) {
|
||||
mSpecialColumn.type = "标签专栏"
|
||||
"标签专栏-热门"
|
||||
} else {
|
||||
mSpecialColumn.type = "社区专栏"
|
||||
"专栏-热门"
|
||||
}
|
||||
mAdapter = HotAdapter(context!!, mEntrance, path)
|
||||
mAdapter = HotAdapter(context!!, mEntrance, path, mSpecialColumn)
|
||||
}
|
||||
return mAdapter
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.gh.common.util.ImageUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
import com.gh.gamecenter.entity.SpecialColumn
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity
|
||||
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity
|
||||
@ -18,7 +19,8 @@ import com.gh.gamecenter.qa.recommends.AskQuestionsRecommendsViewHolder
|
||||
|
||||
class RecommendsAdapter(context: Context,
|
||||
private val mEntrance: String,
|
||||
private val mPath: String) : ListAdapter<AnswerEntity>(context) {
|
||||
private val mPath: String,
|
||||
private val mSpecialColumn: SpecialColumn) : ListAdapter<AnswerEntity>(context) {
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return if (position == itemCount - 1) ItemViewType.ITEM_FOOTER else ItemViewType.ITEM_BODY
|
||||
@ -50,17 +52,29 @@ class RecommendsAdapter(context: Context,
|
||||
holder.initQuestionsHotViewHolder(mContext, answerEntity, mEntrance, mPath)
|
||||
holder.itemView.setOnClickListener {
|
||||
if ("community_article" == answerEntity.type) {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, UserManager.getInstance().community, answerEntity.id!!, mEntrance, mPath))
|
||||
mContext.startActivity(
|
||||
ArticleDetailActivity.getIntent(mContext,
|
||||
UserManager.getInstance().community,
|
||||
answerEntity.id!!,
|
||||
mEntrance,
|
||||
mPath,
|
||||
mSpecialColumn))
|
||||
} else {
|
||||
mContext.startActivity(AnswerDetailActivity.getIntent(mContext, answerEntity.id, mEntrance, mPath))
|
||||
mContext.startActivity(AnswerDetailActivity.getIntent(mContext, answerEntity.id, mEntrance, mPath, mSpecialColumn))
|
||||
}
|
||||
}
|
||||
holder.mAskTitle.setOnClickListener {
|
||||
if ("community_article" == answerEntity.type) {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, UserManager.getInstance().community, answerEntity.id!!, mEntrance, mPath))
|
||||
mContext.startActivity(
|
||||
ArticleDetailActivity.getIntent(mContext,
|
||||
UserManager.getInstance().community,
|
||||
answerEntity.id!!,
|
||||
mEntrance,
|
||||
mPath,
|
||||
mSpecialColumn))
|
||||
} else {
|
||||
val questions = answerEntity.questions
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.id, mEntrance, mPath))
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.id, mEntrance, mPath, mSpecialColumn))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import android.arch.lifecycle.ViewModelProviders
|
||||
import android.view.View
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.SpecialColumn
|
||||
import com.gh.gamecenter.qa.entity.AnswerEntity
|
||||
import com.gh.gamecenter.qa.entity.AskTagGroupsEntity
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -11,16 +12,20 @@ import com.halo.assistant.HaloApp
|
||||
class RecommendsFragment : ListFragment<AnswerEntity, RecommendsViewModel>() {
|
||||
|
||||
private var mAdapter: RecommendsAdapter? = null
|
||||
|
||||
private var mSpecialColumn = SpecialColumn()
|
||||
|
||||
override fun provideListAdapter(): RecommendsAdapter? {
|
||||
if (mAdapter == null) {
|
||||
mSpecialColumn.tab = "精华"
|
||||
mSpecialColumn.name = mListViewModel.tag ?: mListViewModel.columnTagEntity!!.name
|
||||
val path = if (mListViewModel.tag != null) {
|
||||
mSpecialColumn.type = "标签专栏"
|
||||
"标签专栏-精华"
|
||||
} else {
|
||||
mSpecialColumn.type = "社区专栏"
|
||||
"专栏-精华"
|
||||
}
|
||||
mAdapter = RecommendsAdapter(context!!, mEntrance, path)
|
||||
mAdapter = RecommendsAdapter(context!!, mEntrance, path, mSpecialColumn)
|
||||
}
|
||||
return mAdapter
|
||||
}
|
||||
|
||||
@ -7,13 +7,15 @@ 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.entity.SpecialColumn
|
||||
import com.gh.gamecenter.qa.entity.Questions
|
||||
import com.gh.gamecenter.qa.newest.AskQuestionsNewViewHolder
|
||||
import com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity
|
||||
|
||||
class UnansweredAdapter(context: Context,
|
||||
private val mEntrance: String,
|
||||
private val mPath: String) : ListAdapter<Questions>(context) {
|
||||
private val mPath: String,
|
||||
private val mSpecialColumn: SpecialColumn) : ListAdapter<Questions>(context) {
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return if (position == itemCount - 1) ItemViewType.ITEM_FOOTER else ItemViewType.ITEM_BODY
|
||||
@ -39,7 +41,7 @@ class UnansweredAdapter(context: Context,
|
||||
val questions = mEntityList[position]
|
||||
holder.initAskQuestionsNewViewHolder(questions)
|
||||
holder.itemView.setOnClickListener {
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.id, mEntrance, mPath))
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.id, mEntrance, mPath, mSpecialColumn))
|
||||
}
|
||||
} else if (holder is FooterViewHolder) {
|
||||
holder.initItemPadding()
|
||||
|
||||
@ -4,6 +4,7 @@ import android.arch.lifecycle.ViewModelProviders
|
||||
import android.view.View
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.SpecialColumn
|
||||
import com.gh.gamecenter.qa.entity.AskTagGroupsEntity
|
||||
import com.gh.gamecenter.qa.entity.Questions
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -11,16 +12,20 @@ import com.halo.assistant.HaloApp
|
||||
class UnansweredFragment : ListFragment<Questions, UnansweredViewModel>() {
|
||||
|
||||
private var mAdapter: UnansweredAdapter? = null
|
||||
|
||||
private var mSpecialColumn = SpecialColumn()
|
||||
|
||||
override fun provideListAdapter(): UnansweredAdapter? {
|
||||
mSpecialColumn.tab = "待回答"
|
||||
mSpecialColumn.name = mListViewModel.tag ?: mListViewModel.columnTagEntity!!.name
|
||||
if (mAdapter == null) {
|
||||
val path = if (mListViewModel.tag != null) {
|
||||
mSpecialColumn.type = "标签专栏"
|
||||
"标签专栏-待回答"
|
||||
} else {
|
||||
mSpecialColumn.type = "社区专栏"
|
||||
"专栏-待回答"
|
||||
}
|
||||
mAdapter = UnansweredAdapter(context!!, mEntrance, path)
|
||||
mAdapter = UnansweredAdapter(context!!, mEntrance, path, mSpecialColumn)
|
||||
}
|
||||
return mAdapter
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import android.os.Bundle;
|
||||
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.gamecenter.NormalActivity;
|
||||
import com.gh.gamecenter.entity.SpecialColumn;
|
||||
|
||||
/**
|
||||
* Created by khy on 10/04/18.
|
||||
@ -23,6 +24,15 @@ public class QuestionsDetailActivity extends NormalActivity {
|
||||
return getTargetIntent(context, QuestionsDetailActivity.class, QuestionsDetailFragment.class, bundle);
|
||||
}
|
||||
|
||||
public static Intent getIntent(Context context, String questionId, String entrance, String path, SpecialColumn specialColumn) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceUtils.KEY_QUESTIONS_ID, questionId);
|
||||
bundle.putString(EntranceUtils.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path));
|
||||
bundle.putString(EntranceUtils.KEY_PATH, path);
|
||||
bundle.putParcelable(EntranceUtils.KEY_DATA, specialColumn);
|
||||
return getTargetIntent(context, QuestionsDetailActivity.class, QuestionsDetailFragment.class, bundle);
|
||||
}
|
||||
|
||||
public static Intent getIntent(Context context, String questionId, String entrance, String path, boolean isCheckConcern) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceUtils.KEY_QUESTIONS_ID, questionId);
|
||||
|
||||
@ -46,6 +46,7 @@ import com.gh.gamecenter.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.baselist.ListFragment;
|
||||
import com.gh.gamecenter.baselist.LoadType;
|
||||
import com.gh.gamecenter.entity.MeEntity;
|
||||
import com.gh.gamecenter.entity.SpecialColumn;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.mvvm.Status;
|
||||
import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity;
|
||||
@ -97,6 +98,8 @@ public class QuestionsDetailFragment
|
||||
public static final int QUESTIONS_EDIT_REQUEST = 111;
|
||||
public static final int QUESTIONS_MODERATOR_HISTORY_REQUEST = 112;
|
||||
|
||||
private SpecialColumn mSpecialColumn = null;
|
||||
|
||||
@BindView(R.id.reuse_tv_none_data)
|
||||
TextView mNoDataTv;
|
||||
|
||||
@ -172,6 +175,7 @@ public class QuestionsDetailFragment
|
||||
mIsCheckConcern = arguments.getBoolean(EntranceUtils.KEY_CHECK_QUESTION_CONCERN, false);
|
||||
mQuestionsId = arguments.getString(EntranceUtils.KEY_QUESTIONS_ID);
|
||||
mPath = arguments.getString(EntranceUtils.KEY_PATH);
|
||||
mSpecialColumn = arguments.getParcelable(EntranceUtils.KEY_DATA);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@ -262,7 +266,8 @@ public class QuestionsDetailFragment
|
||||
mElapsedHelper.getElapsedTime(),
|
||||
questions,
|
||||
mQuestionsDetailEntity.getCommunity().getId(),
|
||||
mQuestionsDetailEntity.getCommunity().getName());
|
||||
mQuestionsDetailEntity.getCommunity().getName(),
|
||||
mSpecialColumn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ public class AskSubjectAdapter extends ListAdapter<AnswerEntity> {
|
||||
Questions questions = entity.getQuestions();
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.getId(), mEntrance, path));
|
||||
} else {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, new CommunityEntity(entity.getCommunityId(), ""), entity.getId(), mEntrance, path));
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, new CommunityEntity(entity.getCommunityId(), ""), entity.getId(), mEntrance, path, null));
|
||||
}
|
||||
});
|
||||
|
||||
@ -131,7 +131,7 @@ public class AskSubjectAdapter extends ListAdapter<AnswerEntity> {
|
||||
if ("answer".equals(entity.getType())) {
|
||||
mContext.startActivity(AnswerDetailActivity.getIntent(mContext, entity.getId(), mEntrance, path));
|
||||
} else {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, new CommunityEntity(entity.getCommunityId(), ""), entity.getId(), mEntrance, path));
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, new CommunityEntity(entity.getCommunityId(), ""), entity.getId(), mEntrance, path, null));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user