修复 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/413 的 3、4、5、6、19(2)、20、22、25 点
This commit is contained in:
@ -122,7 +122,7 @@ class AskFragment : BaseFragment<Any>() {
|
||||
|
||||
mViewModel = ViewModelProviders.of(this).get(AskViewModel::class.java)
|
||||
|
||||
if (!UserManager.getInstance().isLoggedIn) {
|
||||
if (UserManager.getInstance().isLoggedIn) {
|
||||
mViewModel.checkUnreadFollowTimeline()
|
||||
}
|
||||
|
||||
|
||||
@ -304,7 +304,7 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
// 没点赞过,作者不是自己,正文长度不少于20个字。 开启停留一定时长(字数/10 + 8)秒)后的动画
|
||||
if (!mDetailEntity.getMe().isAnswerOwn() && !mDetailEntity.getMe().isAnswerVoted()) {
|
||||
if (mDetailEntity.getContent().length() > 20) {
|
||||
startTimeElapsedCount((int) ((mDetailEntity.getContent().length() * 10f) + 8));
|
||||
startTimeElapsedCount((int) ((mDetailEntity.getContent().length() / 10f) + 8));
|
||||
}
|
||||
}
|
||||
updateView();
|
||||
@ -517,7 +517,8 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
|
||||
ArrayList<String> displayablePermissionList = new ArrayList<>();
|
||||
|
||||
if (permissionList.contains(MeEntity.CHOICENESS_ANSWER)) {
|
||||
if (permissionList.contains(MeEntity.CHOICENESS_ANSWER)
|
||||
&& !mDetailEntity.getMe().isAnswerOwn()) {
|
||||
// 将答案加入精选的权限
|
||||
displayablePermissionList.add(highlight);
|
||||
}
|
||||
@ -874,6 +875,7 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
if (mDetailEntity.getMe().isAnswerOwn()) {
|
||||
mBinding.answerDetailFollow.setEnabled(false);
|
||||
mBinding.answerDetailFollow.setText(R.string.myself);
|
||||
mBinding.answerDetailFollow.setVisibility(View.VISIBLE);
|
||||
mBinding.answerDetailFollow.setTextColor(ContextCompat.getColor(getContext(), R.color.button_gray));
|
||||
mBinding.answerDetailFollow.setBackgroundResource(R.drawable.button_border_gray);
|
||||
} else {
|
||||
|
||||
@ -13,6 +13,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.gh.common.constant.ItemViewType
|
||||
import com.gh.common.util.NewsUtils
|
||||
import com.gh.gamecenter.PersonalHomeActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
@ -89,6 +90,7 @@ class AskFollowAdapter(val context: Context, val viewModel: AskFollowViewModel)
|
||||
userName.movementMethod = LinkMovementMethod.getInstance()
|
||||
} else {
|
||||
userName.text = historyEntity.user?.name + PersonalHomeAdapter.getUserCommand(historyEntity.type)
|
||||
userName.setOnClickListener { userIcon.performClick() }
|
||||
}
|
||||
endDesc.text = NewsUtils.getFormattedTime(historyEntity.time)
|
||||
questionTitle.setOnClickListener {
|
||||
@ -101,14 +103,18 @@ class AskFollowAdapter(val context: Context, val viewModel: AskFollowViewModel)
|
||||
}
|
||||
}
|
||||
|
||||
userIcon.setOnClickListener {
|
||||
PersonalHomeActivity.startTargetActivity(mContext, historyEntity.user?.id, mEntrance, "(问答:关注)")
|
||||
}
|
||||
// 禁止click事件穿透
|
||||
userIcon.setOnClickListener {}
|
||||
userCommand.setOnClickListener {}
|
||||
}
|
||||
holder.itemView.setOnClickListener {
|
||||
if ("community_article" == historyEntity.type || "community_article_vote" == historyEntity.type) {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, historyEntity.community, historyEntity.id, mEntrance, path))
|
||||
} else if (!historyEntity.type.contains("question")) {
|
||||
} else if (historyEntity.type.contains("question")) {
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, historyEntity.id, mEntrance, path))
|
||||
} else {
|
||||
mContext.startActivity(AnswerDetailActivity.getIntent(mContext, historyEntity.id, mEntrance, path))
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.gh.gamecenter.qa.follow
|
||||
|
||||
import android.arch.lifecycle.Observer
|
||||
import android.os.Bundle
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v4.widget.NestedScrollView
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
@ -10,14 +10,12 @@ import android.widget.TextView
|
||||
import butterknife.BindView
|
||||
import butterknife.OnClick
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.gh.common.util.CheckLoginUtils
|
||||
import com.gh.common.util.DisplayUtils
|
||||
import com.gh.common.util.ImageUtils
|
||||
import com.gh.common.util.NumberUtils
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.PersonalEntity
|
||||
import com.gh.gamecenter.entity.PersonalHistoryEntity
|
||||
import com.gh.gamecenter.eventbus.EBReuse
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.qa.AskFragment
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@ -30,6 +28,8 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
lateinit var noDataTv: TextView
|
||||
@BindView(R.id.recommend_container)
|
||||
lateinit var recommendContainer: View
|
||||
@BindView(R.id.recommend_scrollview)
|
||||
lateinit var recommendScrollView: NestedScrollView
|
||||
@BindView(R.id.recommend_user_container)
|
||||
lateinit var recommendUserContainer: LinearLayout
|
||||
@BindView(R.id.save_btn)
|
||||
@ -43,27 +43,18 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
super.onStart()
|
||||
if (TextUtils.isEmpty(UserManager.getInstance().userId)) {
|
||||
noDataTv.text = "请先登录"
|
||||
noDataTv.setTextColor(ContextCompat.getColor(context!!, R.color.theme))
|
||||
noDataTv.setTextColor(ContextCompat.getColor(requireContext(), R.color.theme))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
mListViewModel.recommendUsers.observe(this, Observer { recommendUsers ->
|
||||
recommendUsers?.let {
|
||||
showRecommendUser(it)
|
||||
}
|
||||
})
|
||||
mListViewModel.recommendUsers.observeNonNull(this) { showRecommendUser(it) }
|
||||
|
||||
mListViewModel.followStatus.observe(this, Observer { success ->
|
||||
success?.let {
|
||||
if (it) {
|
||||
onRefresh()
|
||||
hideRecommendUser()
|
||||
}
|
||||
}
|
||||
})
|
||||
mListViewModel.followStatus.observeNonNull(this) {
|
||||
onRefresh()
|
||||
}
|
||||
}
|
||||
|
||||
fun load() {
|
||||
@ -74,6 +65,8 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
}
|
||||
|
||||
private fun showRecommendUser(userList: List<PersonalEntity>) {
|
||||
updateSaveBtn()
|
||||
recommendScrollView.scrollTo(0, 0)
|
||||
recommendContainer.visibility = View.VISIBLE
|
||||
recommendUserContainer.removeAllViews()
|
||||
for (user in userList) {
|
||||
@ -89,27 +82,22 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
ImageUtils.display(userAuthIv, user.auth?.icon)
|
||||
userNameTv.text = user.name
|
||||
|
||||
followTv.setTextColor(ContextCompat.getColor(context!!, R.color.all_white))
|
||||
followTv.setTextColor(ContextCompat.getColor(requireContext(), R.color.all_white))
|
||||
followTv.text = "关注"
|
||||
followTv.setBackgroundResource(R.drawable.button_normal_style)
|
||||
followTv.setOnClickListener {
|
||||
if (followTv.text == "关注") {
|
||||
followTv.text = "取消关注"
|
||||
followTv.setTextColor(ContextCompat.getColor(context!!, R.color.theme))
|
||||
followTv.setTextColor(ContextCompat.getColor(requireContext(), R.color.theme))
|
||||
followTv.setBackgroundResource(R.drawable.button_normal_border)
|
||||
mListViewModel.followSet.add(user.id)
|
||||
} else {
|
||||
followTv.setTextColor(ContextCompat.getColor(context!!, R.color.all_white))
|
||||
followTv.setTextColor(ContextCompat.getColor(requireContext(), R.color.all_white))
|
||||
followTv.text = "关注"
|
||||
followTv.setBackgroundResource(R.drawable.button_normal_style)
|
||||
mListViewModel.followSet.remove(user.id)
|
||||
}
|
||||
|
||||
if (mListViewModel.followSet.isEmpty()) {
|
||||
saveBtn.visibility = View.GONE
|
||||
} else {
|
||||
saveBtn.visibility = View.VISIBLE
|
||||
}
|
||||
updateSaveBtn()
|
||||
}
|
||||
|
||||
saveBtn.setOnClickListener {
|
||||
@ -127,6 +115,17 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新保存按钮
|
||||
*/
|
||||
private fun updateSaveBtn() {
|
||||
if (mListViewModel.followSet.isEmpty()) {
|
||||
saveBtn.visibility = View.GONE
|
||||
} else {
|
||||
saveBtn.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideRecommendUser() {
|
||||
mListRefresh?.isEnabled = true
|
||||
recommendUserContainer.removeAllViews()
|
||||
@ -143,7 +142,7 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
}
|
||||
|
||||
private fun updateUnreadFollowHint() {
|
||||
EventBus.getDefault().post(AskFragment.EB_HIDE_FOLLOW_HINT)
|
||||
EventBus.getDefault().post(EBReuse(AskFragment.EB_HIDE_FOLLOW_HINT))
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@ -152,7 +151,7 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
|
||||
override fun provideListAdapter(): AskFollowAdapter {
|
||||
if (!::mAdapter.isInitialized) {
|
||||
mAdapter = AskFollowAdapter(context!!, mListViewModel)
|
||||
mAdapter = AskFollowAdapter(requireContext(), mListViewModel)
|
||||
}
|
||||
return mAdapter
|
||||
}
|
||||
@ -162,7 +161,7 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
|
||||
if (TextUtils.isEmpty(UserManager.getInstance().token)) {
|
||||
noDataTv.text = getString(R.string.login_hint)
|
||||
noDataTv.setTextColor(ContextCompat.getColor(context!!, R.color.theme))
|
||||
noDataTv.setTextColor(ContextCompat.getColor(requireContext(), R.color.theme))
|
||||
} else {
|
||||
mListRefresh?.isEnabled = false
|
||||
noDataContainer.visibility = View.GONE
|
||||
@ -181,7 +180,7 @@ class AskFollowFragment : ListFragment<PersonalHistoryEntity, AskFollowViewModel
|
||||
R.id.reuse_tv_none_data -> {
|
||||
val hint = getString(R.string.login_hint)
|
||||
if (hint == noDataTv.text.toString()) {
|
||||
CheckLoginUtils.checkLogin(context, "问答-关注-请先登录", null)
|
||||
ifLogin("问答-关注-请先登录")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ class AskFollowViewModel(application: Application)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe({
|
||||
followStatus.postValue(true)
|
||||
followSet.clear()
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
followStatus.postValue(false)
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
package com.gh.gamecenter.qa.questions.invite
|
||||
|
||||
import android.arch.lifecycle.Observer
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.common.util.ifLogin
|
||||
import com.gh.common.util.viewModelProvider
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.view.VerticalItemDecoration
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
@ -36,16 +32,14 @@ class QuestionsInviteFragment : ListFragment<InviteEntity, QuestionsInviteViewMo
|
||||
super.onCreate(savedInstanceState)
|
||||
mListRefresh!!.isEnabled = false
|
||||
|
||||
mViewModel.invite.observe(this, Observer {
|
||||
it?.let {
|
||||
mAdapter!!.inviteSuccess(it)
|
||||
toast(R.string.invite_success)
|
||||
}
|
||||
})
|
||||
mViewModel.invite.observeNonNull(this) {
|
||||
mAdapter?.inviteSuccess(it)
|
||||
toast(R.string.invite_success)
|
||||
}
|
||||
|
||||
mViewModel.inviteError.observe(this, Observer {
|
||||
it?.let { showAnsweredDialog(it) }
|
||||
})
|
||||
mViewModel.inviteError.observeNonNull(this) {
|
||||
showAnsweredDialog(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun provideListViewModel(): QuestionsInviteViewModel {
|
||||
@ -72,7 +66,9 @@ class QuestionsInviteFragment : ListFragment<InviteEntity, QuestionsInviteViewMo
|
||||
R.id.questionsinvite_item_invite -> {
|
||||
val inviteEntity = data as InviteEntity
|
||||
val me = inviteEntity.me
|
||||
if (me == null || !me.isUserInvite) ifLogin("问题详情-邀请回答-[邀请]") { postInvite(inviteEntity.id) }
|
||||
if (me == null || !me.isUserInvite) {
|
||||
ifLogin("问题详情-邀请回答-[邀请]") { postInvite(inviteEntity.id) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ public class QuestionsInviteViewHolder extends BaseRecyclerViewHolder<InviteEnti
|
||||
ImageUtils.displayIcon(mIcon, entity.getIcon());
|
||||
|
||||
if (!TextUtils.isEmpty(entity.getDescription())) {
|
||||
mName.setText(entity.getName() + "(" + entity.getDescription() + ")");
|
||||
mName.setText(entity.getName() + "(" + entity.getDescription() + ")");
|
||||
} else {
|
||||
mName.setText(entity.getName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user