feat: 组件化消息中心相关功能 https://jira.shanqu.cc/browse/GHZS-2972
This commit is contained in:
@ -24,6 +24,10 @@ class BindingAdaptersProviderImpl : IBindingAdaptersProvider {
|
||||
BindingAdapters.setGameTags(layout, gameEntity)
|
||||
}
|
||||
|
||||
override fun setMessageUnread(view: TextView, unreadCount: Int) {
|
||||
BindingAdapters.setMessageUnread(view, unreadCount)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Parcelable
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.CommentDetailActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ICommentDetailProvider
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity
|
||||
|
||||
@Route(path = RouteConsts.provider.commentDetail, name = "CommentDetailActivity暴露服务")
|
||||
class CommentDetailProviderImpl : ICommentDetailProvider {
|
||||
|
||||
override fun getIntent(context: Context, commentId: String?, message: Parcelable): Intent {
|
||||
return CommentDetailActivity.getIntent(context, commentId, message as MessageEntity.Article)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.CommentUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ICommentUtilsProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.commentUtils, name = "CommentUtils暴露服务")
|
||||
class CommentUtilsProviderImpl : ICommentUtilsProvider {
|
||||
override fun setCommentTime(textView: TextView, time: Long) {
|
||||
CommentUtils.setCommentTime(textView, time)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -69,6 +69,52 @@ class DirectProviderImpl : IDirectProvider {
|
||||
return DirectUtils.directToQqGroup(context, groupNumber)
|
||||
}
|
||||
|
||||
override fun directToHomeActivity(context: Context, userId: String?, entrance: String?, path: String?) {
|
||||
DirectUtils.directToHomeActivity(context, userId, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToAnswerDetail(context: Context, id: String, entrance: String?, path: String?) {
|
||||
DirectUtils.directToAnswerDetail(context, id, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToCommunityArticle(
|
||||
context: Context,
|
||||
articleId: String?,
|
||||
communityId: String?,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
) {
|
||||
DirectUtils.directToCommunityArticle(context, articleId, communityId, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToVideoDetail(context: Context, videoId: String, entrance: String?, path: String?) {
|
||||
DirectUtils.directToVideoDetail(context, videoId, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToAmway(context: Context, fixedTopAmwayCommentId: String?, entrance: String?, path: String?) {
|
||||
DirectUtils.directToAmway(context, fixedTopAmwayCommentId, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToOrderCenter(context: Context) {
|
||||
DirectUtils.directToOrderCenter(context)
|
||||
}
|
||||
|
||||
override fun directToOrderDetail(context: Context, orderId: String) {
|
||||
DirectUtils.directToOrderDetail(context, orderId)
|
||||
}
|
||||
|
||||
override fun directToEnergyRecord(context: Context, position: Int) {
|
||||
DirectUtils.directToEnergyRecord(context, position)
|
||||
}
|
||||
|
||||
override fun directToMyPrizePage(context: Context) {
|
||||
DirectUtils.directToMyPrizePage(context)
|
||||
}
|
||||
|
||||
override fun directToWinOrderDetail(context: Context, orderId: String, activityId: String) {
|
||||
DirectUtils.directToWinOrderDetail(context, orderId, activityId)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.IGameCollectionDetailProvider
|
||||
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
||||
|
||||
@Route(path = RouteConsts.provider.gameCollectionDetail, name = "GameCollectionDetailActivity暴露服务")
|
||||
class GameCollectionDetailProviderImpl : IGameCollectionDetailProvider {
|
||||
override fun getIntent(context: Context, gameCollectionId: String, isFromSquare: Boolean): Intent {
|
||||
return GameCollectionDetailActivity.getIntent(context, gameCollectionId, isFromSquare)
|
||||
}
|
||||
|
||||
override fun getSpecifiedCommentIntent(context: Context, gameCollectionId: String, topCommentId: String): Intent {
|
||||
return GameCollectionDetailActivity.getSpecifiedCommentIntent(context, gameCollectionId, topCommentId)
|
||||
}
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -40,6 +40,30 @@ class GameDetailProviderImpl : IGameDetailProvider {
|
||||
)
|
||||
}
|
||||
|
||||
override fun startGameDetailActivity(
|
||||
context: Context,
|
||||
gameId: String,
|
||||
entrance: String?,
|
||||
defaultTab: Int,
|
||||
isSkipGameComment: Boolean,
|
||||
scrollToLibao: Boolean,
|
||||
openVideoStreaming: Boolean,
|
||||
openPlatformWindow: Boolean,
|
||||
traceEvent: ExposureEvent?
|
||||
) {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
context,
|
||||
gameId,
|
||||
entrance,
|
||||
defaultTab,
|
||||
isSkipGameComment,
|
||||
scrollToLibao,
|
||||
openVideoStreaming,
|
||||
openPlatformWindow,
|
||||
traceEvent
|
||||
)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.entity.SimpleGameEntity
|
||||
import com.gh.gamecenter.common.entity.SuggestType
|
||||
@ -62,6 +63,16 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
|
||||
DirectUtils.directToSuggestion(context, type, hiddenHint)
|
||||
}
|
||||
|
||||
override fun directToCommunityColumn(
|
||||
context: Context,
|
||||
community: CommunityEntity?,
|
||||
subjectId: String,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
) {
|
||||
DirectUtils.directToCommunityColumn(context, community, subjectId, entrance, path)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.MessageDetailActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.IMessageDetailProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.messageDetail, name = "MessageDetailActivity暴露服务")
|
||||
class MessageDetailProviderImpl : IMessageDetailProvider {
|
||||
|
||||
override fun getIntentById(
|
||||
context: Context,
|
||||
newsId: String,
|
||||
commentNum: Int,
|
||||
openSoftInput: Boolean,
|
||||
entrance: String
|
||||
): Intent {
|
||||
return MessageDetailActivity.getIntentById(context, newsId, commentNum, openSoftInput, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,11 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IMessageUnreadRepositoryProvider
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.feature.provider.IMessageUnreadRepositoryProvider
|
||||
import com.gh.gamecenter.message.MessageUnreadRepository
|
||||
|
||||
@Route(path = RouteConsts.provider.messageUnreadRepository, name = "MessageUnreadRepository暴露服务")
|
||||
@ -13,6 +15,10 @@ class MessageUnreadRepositoryProviderImpl : IMessageUnreadRepositoryProvider {
|
||||
MessageUnreadRepository.loadMessageUnreadData()
|
||||
}
|
||||
|
||||
override fun getUnreadLiveData(): MediatorLiveData<MessageUnreadEntity> {
|
||||
return MessageUnreadRepository.unreadLiveData
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.INewCommentDetailProvider
|
||||
import com.gh.gamecenter.qa.comment.NewCommentDetailActivity
|
||||
|
||||
@Route(path = RouteConsts.provider.newCommentDetail, name = "NewCommentDetailActivity暴露服务")
|
||||
class NewCommentDetailProviderImpl : INewCommentDetailProvider {
|
||||
|
||||
override fun getAnswerCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
questionId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent {
|
||||
return NewCommentDetailActivity.getAnswerCommentIntent(
|
||||
context,
|
||||
commentId,
|
||||
questionId,
|
||||
topCommentId,
|
||||
entrance,
|
||||
path
|
||||
)
|
||||
}
|
||||
|
||||
override fun getArticleCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
communityId: String,
|
||||
articleId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent {
|
||||
return NewCommentDetailActivity.getArticleCommentIntent(
|
||||
context,
|
||||
commentId,
|
||||
communityId,
|
||||
articleId,
|
||||
topCommentId,
|
||||
entrance,
|
||||
path
|
||||
)
|
||||
}
|
||||
|
||||
override fun getVideoCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
videoId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent {
|
||||
return NewCommentDetailActivity.getVideoCommentIntent(context, commentId, videoId, topCommentId, entrance, path)
|
||||
}
|
||||
|
||||
override fun getGameCollectionCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
gameCollectionId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent {
|
||||
return NewCommentDetailActivity.getGameCollectionCommentIntent(
|
||||
context,
|
||||
commentId,
|
||||
gameCollectionId,
|
||||
topCommentId,
|
||||
entrance,
|
||||
path
|
||||
)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ISimpleAnswerDetailProvider
|
||||
import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity
|
||||
|
||||
@Route(path = RouteConsts.provider.simpleAnswerDetail, name = "SimpleAnswerDetailActivity暴露服务")
|
||||
class SimpleAnswerDetailProviderImpl : ISimpleAnswerDetailProvider {
|
||||
|
||||
override fun getIntent(context: Context, answerId: String, entrance: String, path: String): Intent {
|
||||
return SimpleAnswerDetailActivity.getIntent(context, answerId, entrance, path)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ISubjectProvider
|
||||
import com.gh.gamecenter.subject.SubjectActivity
|
||||
|
||||
@Route(path = RouteConsts.provider.subject, name = "SubjectActivity暴露服务")
|
||||
class SubjectProviderImpl : ISubjectProvider {
|
||||
override fun startSubjectActivity(
|
||||
context: Context,
|
||||
id: String?,
|
||||
name: String?,
|
||||
isOrder: Boolean,
|
||||
entrance: String?
|
||||
) {
|
||||
SubjectActivity.startSubjectActivity(context, id, name, isOrder, null, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity;
|
||||
import com.gh.gamecenter.qa.comment.CommentActivity;
|
||||
import com.gh.gamecenter.qa.comment.NewCommentConversationFragment;
|
||||
import com.halo.assistant.fragment.comment.CommentDetailFragment;
|
||||
|
||||
@ -34,6 +34,7 @@ import androidx.transition.*
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
import com.facebook.drawee.backends.pipeline.Fresco
|
||||
import com.facebook.imagepipeline.core.ImagePipeline
|
||||
@ -41,6 +42,7 @@ import com.facebook.imagepipeline.request.ImageRequest
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
@ -71,6 +73,7 @@ import kotlin.math.roundToInt
|
||||
* @author 黄壮华
|
||||
*
|
||||
*/
|
||||
@Route(path = RouteConsts.activity.imageViewerActivity)
|
||||
class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
|
||||
|
||||
private var mScale = 0F
|
||||
@ -150,8 +153,8 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
|
||||
mUrlList = ArrayList()
|
||||
mUrlList?.add(base64Image)
|
||||
} else {
|
||||
mUrlList = it.getStringArrayList(KEY_URL_LIST) ?: arrayListOf()
|
||||
mInitialPosition = it.getInt(KEY_CURRENT, 0)
|
||||
mUrlList = it.getStringArrayList(EntranceConsts.KEY_URL_LIST) ?: arrayListOf()
|
||||
mInitialPosition = it.getInt(EntranceConsts.KEY_CURRENT, 0)
|
||||
}
|
||||
mShowSaveBtn = it.getBoolean(KEY_SHOW_SAVE)
|
||||
mUseEnterAndExitAnimation = it.getBoolean(KEY_USE_ENTER_AND_EXIT_ANIMATION)
|
||||
@ -930,8 +933,6 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
|
||||
var base64Image: String = ""
|
||||
|
||||
private const val KEY_BASE64 = "base64"
|
||||
private const val KEY_URL_LIST = "urls"
|
||||
private const val KEY_CURRENT = "current"
|
||||
private const val KEY_SHOW_SAVE = "showSave"
|
||||
private const val KEY_USE_ENTER_AND_EXIT_ANIMATION = "use_enter_and_exit_animation"
|
||||
private const val KEY_IS_FROM_IMAGE_CONTAINER_VIEW = "is_from_image_container_view"
|
||||
@ -995,8 +996,8 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
|
||||
isFromICV: Boolean = false
|
||||
): Intent {
|
||||
val intent = Intent(context, ImageViewerActivity::class.java)
|
||||
intent.putExtra(KEY_URL_LIST, list)
|
||||
intent.putExtra(KEY_CURRENT, position)
|
||||
intent.putExtra(EntranceConsts.KEY_URL_LIST, list)
|
||||
intent.putExtra(EntranceConsts.KEY_CURRENT, position)
|
||||
intent.putExtra(KEY_SHOW_SAVE, isShowSaveBtn)
|
||||
intent.putExtra(AnswerEntity::class.java.name, answerEntity)
|
||||
intent.putExtra(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.message.MessageFragment;
|
||||
|
||||
/**
|
||||
* Created by khy on 21/07/17.
|
||||
*/
|
||||
@Deprecated
|
||||
public class MessageActivity extends ToolBarActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
|
||||
}
|
||||
|
||||
public static Intent getIntent(Context context, String entrance) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
||||
return getTargetIntent(context, MessageActivity.class, MessageFragment.class, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDarkModeChanged() {
|
||||
super.onDarkModeChanged();
|
||||
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.message.MessageNormalFragment;
|
||||
|
||||
/**
|
||||
* Created by khy on 10/04/18.
|
||||
*/
|
||||
|
||||
public class MessageInviteActivity extends ToolBarActivity {
|
||||
|
||||
public static Intent getIntent(Context context, String messageType, String outerInfo, String entrance) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceConsts.KEY_MESSAGE_TYPE, messageType);
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
||||
bundle.putString(EntranceConsts.KEY_OUTER_INFO, outerInfo);
|
||||
return getTargetIntent(context, MessageInviteActivity.class, MessageNormalFragment.class, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDarkModeChanged() {
|
||||
super.onDarkModeChanged();
|
||||
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
|
||||
}
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.message.KeFuFragment;
|
||||
|
||||
/**
|
||||
* Created by khy on 10/04/18.
|
||||
*/
|
||||
|
||||
public class MessageKeFuActivity extends ToolBarActivity {
|
||||
|
||||
@Override
|
||||
protected Intent provideNormalIntent() {
|
||||
return getTargetIntent(this, MessageKeFuActivity.class, KeFuFragment.class);
|
||||
}
|
||||
|
||||
public static Intent getIntent(Context context, String entrance) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
||||
return getTargetIntent(context, MessageKeFuActivity.class, KeFuFragment.class, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDarkModeChanged() {
|
||||
super.onDarkModeChanged();
|
||||
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.message.MessageNormalFragment;
|
||||
|
||||
/**
|
||||
* Created by khy on 10/04/18.
|
||||
*/
|
||||
|
||||
public class MessageVoteActivity extends ToolBarActivity {
|
||||
|
||||
public static Intent getIntent(Context context, String messageType, String outerInfo, String entrance) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
||||
bundle.putString(EntranceConsts.KEY_MESSAGE_TYPE, messageType);
|
||||
bundle.putString(EntranceConsts.KEY_OUTER_INFO, outerInfo);
|
||||
return getTargetIntent(context, MessageVoteActivity.class, MessageNormalFragment.class, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDarkModeChanged() {
|
||||
super.onDarkModeChanged();
|
||||
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
|
||||
}
|
||||
}
|
||||
@ -25,6 +25,7 @@ import androidx.core.content.ContextCompat;
|
||||
import androidx.core.view.MotionEventCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.ethanhua.skeleton.Skeleton;
|
||||
import com.ethanhua.skeleton.ViewSkeletonScreen;
|
||||
import com.gh.base.DownloadToolbarActivity;
|
||||
@ -40,6 +41,7 @@ import com.gh.gamecenter.adapter.viewholder.DetailViewHolder;
|
||||
import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.constant.RouteConsts;
|
||||
import com.gh.gamecenter.common.eventbus.EBNetworkState;
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
@ -83,6 +85,7 @@ import retrofit2.HttpException;
|
||||
*
|
||||
* @author 黄壮华
|
||||
*/
|
||||
@Route(path = RouteConsts.activity.newsDetailActivity)
|
||||
public class NewsDetailActivity extends DownloadToolbarActivity implements OnClickListener, OnRequestCallBackListener {
|
||||
|
||||
RecyclerView mDetailRv;
|
||||
|
||||
@ -1,290 +0,0 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import com.gh.gamecenter.feature.entity.SimpleGame
|
||||
import com.gh.gamecenter.feature.entity.SourceEntity
|
||||
import com.gh.gamecenter.feature.entity.UserEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/18.
|
||||
*/
|
||||
class MessageEntity {
|
||||
|
||||
@SerializedName(value = "_id", alternate = ["message_id"])
|
||||
var id: String = ""
|
||||
|
||||
var time: Long = 0
|
||||
|
||||
var article: Article = Article()
|
||||
|
||||
var comment: Comment = Comment()
|
||||
|
||||
var dialogue: Dialogue = Dialogue()
|
||||
|
||||
var question: Question = Question()
|
||||
|
||||
var answer: Answer = Answer()
|
||||
|
||||
@SerializedName("game_list")
|
||||
var gameList: GameList = GameList()
|
||||
|
||||
var type: String = ""
|
||||
|
||||
var read: Boolean = true // true:已读,false:未读
|
||||
|
||||
@SerializedName("user")
|
||||
var userEntity: UserEntity = UserEntity()
|
||||
|
||||
var game: SimpleGame = SimpleGame()
|
||||
|
||||
var video: Video = Video()
|
||||
|
||||
var reply: Reply = Reply()
|
||||
|
||||
var fold: Fold? = null
|
||||
|
||||
var activity: Activity = Activity()
|
||||
|
||||
val source: SourceEntity? = null
|
||||
|
||||
class Article() : Parcelable {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
var title: String? = null
|
||||
|
||||
var thumb: String? = null
|
||||
|
||||
@SerializedName("community_id")
|
||||
var communityId: String? = null
|
||||
|
||||
var images: List<String> = ArrayList()
|
||||
|
||||
var videos: List<Video> = ArrayList()
|
||||
|
||||
constructor(parcel: Parcel) : this() {
|
||||
id = parcel.readString()
|
||||
title = parcel.readString()
|
||||
thumb = parcel.readString()
|
||||
communityId = parcel.readString()
|
||||
images = parcel.createStringArrayList() ?: arrayListOf()
|
||||
parcel.readTypedList(videos, Video.CREATOR)
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(id)
|
||||
parcel.writeString(title)
|
||||
parcel.writeString(thumb)
|
||||
parcel.writeString(communityId)
|
||||
parcel.writeStringList(images)
|
||||
parcel.writeTypedList(videos)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "Article"
|
||||
|
||||
@JvmField
|
||||
val CREATOR: Parcelable.Creator<Article> = object : Parcelable.Creator<Article> {
|
||||
override fun createFromParcel(parcel: Parcel): Article {
|
||||
return Article(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Article?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Answer() : Parcelable {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
var content: String? = null
|
||||
|
||||
var images: List<String> = ArrayList()
|
||||
|
||||
constructor(parcel: Parcel) : this() {
|
||||
id = parcel.readString()
|
||||
content = parcel.readString()
|
||||
images = parcel.createStringArrayList() ?: arrayListOf()
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(id)
|
||||
parcel.writeString(content)
|
||||
parcel.writeStringList(images)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = "MessageAnswer"
|
||||
|
||||
@JvmField
|
||||
val CREATOR: Parcelable.Creator<Answer> = object : Parcelable.Creator<Answer> {
|
||||
override fun createFromParcel(parcel: Parcel): Answer {
|
||||
return Answer(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Answer?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Question {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
var title: String? = null
|
||||
|
||||
var images: List<String> = ArrayList()
|
||||
|
||||
var videos: List<Video> = ArrayList()
|
||||
}
|
||||
|
||||
|
||||
class Dialogue {
|
||||
|
||||
var from: From = From()
|
||||
|
||||
var to: To = To()
|
||||
}
|
||||
|
||||
class From {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
var content: String? = null
|
||||
}
|
||||
|
||||
class To {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
@SerializedName("top_id")
|
||||
var topId: String? = null
|
||||
|
||||
var content: String? = null
|
||||
|
||||
var images: List<String> = ArrayList()
|
||||
|
||||
var type: String? = null // 取值 reply/comment,代表父内容是回复/评论
|
||||
}
|
||||
|
||||
class Comment {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
@SerializedName("top_id", alternate = ["parent_id"])
|
||||
var topId: String? = null
|
||||
|
||||
var content: String? = null
|
||||
|
||||
var parent: Parent = Parent()
|
||||
|
||||
var images: List<String> = ArrayList()
|
||||
}
|
||||
|
||||
class Parent {
|
||||
@SerializedName("_id")
|
||||
var id: String = ""
|
||||
|
||||
var content: String = ""
|
||||
|
||||
var type: String = ""
|
||||
|
||||
var images: List<String> = ArrayList()
|
||||
}
|
||||
|
||||
class Video() : Parcelable {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
var title: String? = null
|
||||
|
||||
var poster: String? = null
|
||||
|
||||
constructor(parcel: Parcel) : this() {
|
||||
id = parcel.readString()
|
||||
title = parcel.readString()
|
||||
poster = parcel.readString()
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(id)
|
||||
parcel.writeString(title)
|
||||
parcel.writeString(poster)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<Video> {
|
||||
override fun createFromParcel(parcel: Parcel): Video {
|
||||
return Video(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Video?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Fold {
|
||||
@SerializedName("resource_id")
|
||||
var resourceId: String = ""
|
||||
|
||||
var number: Int = 0
|
||||
}
|
||||
|
||||
class Reply {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
var content: String? = null
|
||||
|
||||
@SerializedName("comment_id")
|
||||
var commentId: String? = null
|
||||
|
||||
var comment: String? = null
|
||||
|
||||
var parent: Parent = Parent()
|
||||
|
||||
var images: List<String> = ArrayList()
|
||||
}
|
||||
|
||||
class Activity {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
var title: String? = null
|
||||
|
||||
@SerializedName("image_url")
|
||||
var imageUrl: String? = null
|
||||
|
||||
var url: String? = null
|
||||
|
||||
@SerializedName("url_comment")
|
||||
var urlComment: String? = null
|
||||
}
|
||||
|
||||
class GameList {
|
||||
@SerializedName("_id")
|
||||
var id: String = ""
|
||||
var cover: String = ""
|
||||
var title: String = ""
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.feature.entity.UserEntity
|
||||
|
||||
data class MessageFold(
|
||||
val time: Long = 0,
|
||||
var user: UserEntity = UserEntity()
|
||||
)
|
||||
@ -1,50 +0,0 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.feature.entity.Auth
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/10.
|
||||
*/
|
||||
class MessageKeFuEntity {
|
||||
|
||||
@SerializedName("_id")
|
||||
var id: String = ""
|
||||
|
||||
@SerializedName("read")
|
||||
var isRead: Boolean = true
|
||||
|
||||
@SerializedName("receive")
|
||||
var isReceive: Boolean = false
|
||||
|
||||
var message: String? = null
|
||||
|
||||
var time: Long = 0
|
||||
|
||||
var suggestion: String? = null
|
||||
|
||||
var links: List<MessageLinkEntity>? = null
|
||||
|
||||
@SerializedName("new_links")
|
||||
var newLinks: List<LinkEntity>? = null
|
||||
|
||||
var images: List<String>? = null
|
||||
|
||||
@SerializedName("service")
|
||||
var serviceEntity: ServiceEntity? = null
|
||||
|
||||
@SerializedName("show_user_id")
|
||||
var showUserId: Boolean? = false
|
||||
|
||||
var type: String = ""
|
||||
|
||||
class ServiceEntity {
|
||||
var name: String? = null
|
||||
var icon: String? = null
|
||||
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
var auth: Auth? = null
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/18.
|
||||
*/
|
||||
class MessageLinkEntity {
|
||||
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
var document: String? = null
|
||||
|
||||
var type: String? = null
|
||||
|
||||
var url: String? = null
|
||||
|
||||
var qq: String? = null
|
||||
|
||||
var key: String? = null
|
||||
|
||||
@SerializedName("activity_id")
|
||||
var activityId: String? = null
|
||||
|
||||
var community: CommunityEntity? = null
|
||||
}
|
||||
@ -1,149 +0,0 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.common.utils.tryWithDefaultCatch
|
||||
import com.gh.gamecenter.feature.entity.UserEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/12.
|
||||
* 消息未读数据实体
|
||||
*/
|
||||
class MessageUnreadEntity {
|
||||
|
||||
var invited: Int = 0
|
||||
|
||||
@SerializedName("answer_vote")
|
||||
var answerVote: Int = 0
|
||||
|
||||
@SerializedName("comment_vote")
|
||||
var commentVote: Int = 0
|
||||
|
||||
@SerializedName("answer_comment_vote")
|
||||
var answerCommentVote: Int = 0
|
||||
|
||||
var service: Int = 0
|
||||
|
||||
var total: Int = 0
|
||||
|
||||
var answer: Int = 0
|
||||
|
||||
var reply: Int = 0
|
||||
|
||||
@SerializedName("follow_question")
|
||||
var followQuestion: Int = 0
|
||||
|
||||
@SerializedName("reply_answer_comment")
|
||||
var replyAnswerComment: Int = 0
|
||||
|
||||
@SerializedName("answer_comment")
|
||||
var answerComment: Int = 0
|
||||
|
||||
@SerializedName("system_invited")
|
||||
var systemInvited: Int = 0
|
||||
|
||||
@SerializedName("community_article_vote")
|
||||
var communityArticleVote: Int = 0
|
||||
|
||||
@SerializedName("community_article_comment_vote")
|
||||
var communityArticleCommentVote: Int = 0
|
||||
|
||||
@SerializedName("community_article_comment")
|
||||
var communityArticleComment: Int = 0
|
||||
|
||||
@SerializedName("reply_community_article_comment")
|
||||
var replyCommunityArticleComment = 0
|
||||
|
||||
@SerializedName("video_vote")
|
||||
var videoVote = 0
|
||||
|
||||
@SerializedName("video_comment_vote")
|
||||
var videoCommentVote = 0
|
||||
|
||||
@SerializedName("game_comment_vote")
|
||||
var gameCommentVote = 0
|
||||
|
||||
@SerializedName("game_comment_reply_vote")
|
||||
var gameCommentReplyVote = 0
|
||||
|
||||
@SerializedName("activity_comment")
|
||||
var activityComment = 0
|
||||
|
||||
@SerializedName("reply_activity_comment")
|
||||
var replyActivityComment = 0
|
||||
|
||||
@SerializedName("activity_comment_vote")
|
||||
var activityCommentVote = 0
|
||||
|
||||
@SerializedName("activity_comment_reply_vote")
|
||||
var activityCommentReplyVote = 0
|
||||
|
||||
@SerializedName("game_list_comment")
|
||||
var gameListComment = 0
|
||||
|
||||
@SerializedName("game_list_comment_reply")
|
||||
var gameListCommentReply = 0
|
||||
|
||||
@SerializedName("game_list_comment_vote")
|
||||
var gameListCommentVote = 0
|
||||
|
||||
@SerializedName("game_list_vote")
|
||||
var gameListVote = 0
|
||||
|
||||
@SerializedName("community_article_comment_reply_vote")
|
||||
var communityArticleCommentReplyVote = 0
|
||||
|
||||
@SerializedName("game_comment_reply")
|
||||
var gameCommentReply = 0
|
||||
|
||||
@SerializedName("video_comment")
|
||||
var videoComment = 0
|
||||
|
||||
@SerializedName("video_comment_reply")
|
||||
var videoCommentReply = 0
|
||||
|
||||
@SerializedName("video_comment_reply_vote")
|
||||
var videoCommentReplyVote = 0
|
||||
|
||||
var fans: Int = 0 // 与其他未读区分 用于我的主页
|
||||
|
||||
var meta: Meta? = null
|
||||
|
||||
class Meta(
|
||||
@SerializedName("message_id")
|
||||
var messageId: String? = "",
|
||||
@SerializedName("answer_id")
|
||||
var answerId: String? = "",
|
||||
var type: String? = "",
|
||||
var user: UserEntity? = null
|
||||
)
|
||||
|
||||
// 遍历含 vote 的成员变量,累加点赞数
|
||||
fun getVoteCount(): Int {
|
||||
var voteCount = 0
|
||||
|
||||
tryWithDefaultCatch {
|
||||
val fields = this.javaClass.declaredFields
|
||||
for (field in fields) {
|
||||
if (field.name.toLowerCase(Locale.getDefault()).contains("vote") && field.type == Integer.TYPE) {
|
||||
voteCount += field.getInt(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
return voteCount
|
||||
}
|
||||
|
||||
// 归零所有名字含 vote 的成员变量
|
||||
fun resetVote() {
|
||||
val fields = this.javaClass.declaredFields
|
||||
|
||||
tryWithDefaultCatch {
|
||||
for (field in fields) {
|
||||
if (field.name.toLowerCase(Locale.getDefault()).contains("vote") && field.type == Integer.TYPE) {
|
||||
field.setInt(this, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -20,29 +20,29 @@ import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
import com.gh.common.util.NewLogUtils;
|
||||
import com.gh.gamecenter.core.iinterface.SearchBarHint;
|
||||
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.common.databind.BindingAdapters;
|
||||
import com.gh.common.util.CheckLoginUtils;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.utils.PackageFlavorHelper;
|
||||
import com.gh.common.util.IntegralLogHelper;
|
||||
import com.gh.common.util.LogUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
import com.gh.common.util.NewLogUtils;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.DownloadManagerActivity;
|
||||
import com.gh.gamecenter.MessageActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.SearchActivity;
|
||||
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.constant.RouteConsts;
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.core.iinterface.SearchBarHint;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.feature.provider.IMessageProvider;
|
||||
import com.gh.gamecenter.message.MessageUnreadViewModel;
|
||||
import com.gh.gamecenter.packagehelper.PackageViewModel;
|
||||
import com.gh.gamecenter.teenagermode.TeenagerModeActivity;
|
||||
@ -291,8 +291,10 @@ public class SearchToolbarFragment extends BaseLazyFragment implements View.OnCl
|
||||
|
||||
CheckLoginUtils.checkLogin(requireContext(), "(工具栏)", () -> {
|
||||
NewLogUtils.logMessageInformBellClick(mMessageUnread.getVisibility() == View.VISIBLE, mLocation);
|
||||
Intent i = MessageActivity.getIntent(requireContext(), "(工具栏)");
|
||||
startActivityForResult(i, REQUEST_MESSAGE);
|
||||
IMessageProvider messageProvider = (IMessageProvider) ARouter.getInstance().build(RouteConsts.provider.message).navigation();
|
||||
if (messageProvider != null) {
|
||||
startActivityForResult(messageProvider.getIntent(requireContext(), "(工具栏)"), REQUEST_MESSAGE);
|
||||
}
|
||||
});
|
||||
} else if (id == R.id.actionbar_teenager_model) {
|
||||
startActivity(TeenagerModeActivity.getIntent(requireContext()));
|
||||
|
||||
@ -11,6 +11,7 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.util.NewLogUtils
|
||||
@ -20,6 +21,7 @@ import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
|
||||
import com.gh.gamecenter.common.baselist.ListActivity
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.CustomDividerItemDecoration
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
@ -29,21 +31,21 @@ import com.gh.gamecenter.core.utils.PageSwitchDataHelper
|
||||
import com.gh.gamecenter.databinding.ActivityRatingReplyBinding
|
||||
import com.gh.gamecenter.databinding.PieceArticleInputContainerBinding
|
||||
import com.gh.gamecenter.databinding.PieceCommentTypingContainerBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.RatingComment
|
||||
import com.gh.gamecenter.entity.RatingReplyEntity
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureSource
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.DownloadStatus
|
||||
import com.lightgame.utils.Util_System_Keyboard
|
||||
import com.lightgame.utils.Utils
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import kotlin.math.abs
|
||||
|
||||
@Route(path = RouteConsts.activity.ratingReplyActivity)
|
||||
class RatingReplyActivity : ListActivity<RatingReplyEntity, RatingReplyViewModel>(),
|
||||
KeyboardHeightObserver {
|
||||
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.common.baselist.ListFragment;
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity;
|
||||
import com.halo.assistant.HaloApp;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/5.
|
||||
* 消息-客服
|
||||
*/
|
||||
public class KeFuFragment extends ListFragment<MessageKeFuEntity, KeFuViewModel> {
|
||||
|
||||
private KeFuFragmentAdapter mAdapter;
|
||||
private MessageUnreadViewModel mUnreadViewModel;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
setNavigationTitle("系统");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mUnreadViewModel = ViewModelProviders.of(this, new MessageUnreadViewModel.Factory(HaloApp.getInstance().getApplication()))
|
||||
.get(MessageUnreadViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadDone() {
|
||||
super.onLoadDone();
|
||||
mUnreadViewModel.markRead(MessageUnreadViewModel.ReadType.SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListAdapter provideListAdapter() {
|
||||
return mAdapter == null ? mAdapter = new KeFuFragmentAdapter(getContext(),
|
||||
this,
|
||||
mListViewModel,
|
||||
mEntrance) : mAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListClick(View view, int position, Object data) {
|
||||
if (view.getId() == R.id.message_kaifu_item) {
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击卡片");
|
||||
MessageKeFuEntity keFuEntity = (MessageKeFuEntity) data;
|
||||
if (!keFuEntity.isRead()) {
|
||||
mListViewModel.postMessageRead(keFuEntity.getId());
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,499 +0,0 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.facebook.drawee.generic.GenericDraweeHierarchy;
|
||||
import com.facebook.drawee.generic.RoundingParams;
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.common.util.NewLogUtils;
|
||||
import com.gh.gamecenter.common.callback.OnListClickListener;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.ItemViewType;
|
||||
import com.gh.common.util.CommentUtils;
|
||||
import com.gh.gamecenter.common.utils.DialogHelper;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.ImageViewerActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.databinding.MessageKefuItemBinding;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity;
|
||||
import com.gh.gamecenter.entity.MessageLinkEntity;
|
||||
import com.gh.gamecenter.feature.exposure.ExposureSource;
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity;
|
||||
import com.gh.gamecenter.login.user.UserManager;
|
||||
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity;
|
||||
import com.gh.gamecenter.subject.SubjectActivity;
|
||||
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel;
|
||||
import com.google.android.flexbox.FlexboxLayout;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/10.
|
||||
* 消息-客服适配器
|
||||
*/
|
||||
public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
|
||||
private OnListClickListener mClickListener;
|
||||
|
||||
private KeFuViewModel mListViewModel;
|
||||
|
||||
private String mEntrance;
|
||||
|
||||
private int mImageSize;
|
||||
|
||||
public KeFuFragmentAdapter(Context context, OnListClickListener listener, KeFuViewModel listViewModel, String entrance) {
|
||||
super(context);
|
||||
mListViewModel = listViewModel;
|
||||
mClickListener = listener;
|
||||
mEntrance = entrance;
|
||||
|
||||
mImageSize = (mContext.getResources().getDisplayMetrics().widthPixels - DisplayUtils.dip2px(36)) / 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
if (viewType == ItemViewType.ITEM_FOOTER) {
|
||||
View view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
|
||||
return new FooterViewHolder(view);
|
||||
} else {
|
||||
return new KeFuViewHolder(MessageKefuItemBinding.inflate(mLayoutInflater, parent, false), mClickListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof KeFuViewHolder) {
|
||||
MessageKeFuEntity keFuEntity = mEntityList.get(position);
|
||||
KeFuViewHolder viewHolder = (KeFuViewHolder) holder;
|
||||
initKeFuViewHolder(viewHolder, keFuEntity);
|
||||
} else if (holder instanceof FooterViewHolder) {
|
||||
((FooterViewHolder) holder).initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver);
|
||||
((FooterViewHolder) holder).initItemPadding();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == getItemCount() - 1) {
|
||||
return ItemViewType.ITEM_FOOTER;
|
||||
} else {
|
||||
return ItemViewType.ITEM_BODY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mEntityList == null || mEntityList.isEmpty() ? 0 : mEntityList.size() + FOOTER_ITEM_COUNT;
|
||||
}
|
||||
|
||||
private void initKeFuViewHolder(KeFuViewHolder viewHolder, final MessageKeFuEntity keFuEntity) {
|
||||
viewHolder.binding.messageKaifuItem.setBackground(ContextCompat.getDrawable(mContext, R.drawable.reuse_listview_item_style));
|
||||
viewHolder.binding.messageKefuSuggestion.setBackgroundColor(ContextCompat.getColor(mContext, R.color.background));
|
||||
viewHolder.binding.messageKefuSuggestion.setTextColor(ContextCompat.getColor(mContext, R.color.title));
|
||||
viewHolder.binding.messageKefuName.setTextColor(ContextCompat.getColor(mContext, R.color.text_black));
|
||||
viewHolder.binding.messageKefuContent.setTextColor(ContextCompat.getColor(mContext, R.color.title));
|
||||
viewHolder.binding.messageKefuTime.setTextColor(ContextCompat.getColor(mContext, R.color.hint));
|
||||
viewHolder.binding.copyTv.setTextColor(ContextCompat.getColor(mContext, R.color.text_subtitle));
|
||||
|
||||
boolean shouldShouldUserId = keFuEntity.getShowUserId() != null && keFuEntity.getShowUserId();
|
||||
|
||||
List<String> images = keFuEntity.getImages();
|
||||
if (images != null && !images.isEmpty()) {
|
||||
viewHolder.binding.messageKefuImagesContainer.removeAllViews();
|
||||
viewHolder.binding.messageKefuImagesContainer.setVisibility(View.VISIBLE);
|
||||
for (int i = 0; i < images.size(); i++) {
|
||||
String image = images.get(i);
|
||||
SimpleDraweeView draweeView = new SimpleDraweeView(mContext);
|
||||
int padding = DisplayUtils.dip2px(2);
|
||||
draweeView.setPadding(padding, padding, padding, padding);
|
||||
FlexboxLayout.LayoutParams params = new FlexboxLayout.LayoutParams(mImageSize, mImageSize);
|
||||
draweeView.setLayoutParams(params);
|
||||
draweeView.setImageURI(image);
|
||||
int finalI = i;
|
||||
draweeView.setOnClickListener(v -> {
|
||||
Intent intent = ImageViewerActivity.getIntent(mContext,
|
||||
(ArrayList<String>) images,
|
||||
finalI,
|
||||
"(消息中心-系统)");
|
||||
mContext.startActivity(intent);
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击图片");
|
||||
});
|
||||
|
||||
GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
|
||||
RoundingParams roundingParams = RoundingParams.fromCornersRadius(18f);
|
||||
hierarchy.setRoundingParams(roundingParams);
|
||||
hierarchy.setPlaceholderImage(R.drawable.occupy);
|
||||
viewHolder.binding.messageKefuImagesContainer.addView(draweeView);
|
||||
}
|
||||
viewHolder.binding.messageKefuImagesContainer.requestLayout();
|
||||
} else {
|
||||
viewHolder.binding.messageKefuImagesContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ExtensionsKt.goneIf(viewHolder.binding.copyIdContainer, !shouldShouldUserId);
|
||||
if (shouldShouldUserId) {
|
||||
viewHolder.binding.copyIdContainer.setOnClickListener(view -> ExtensionsKt.copyTextAndToast(UserManager.getInstance().getUserId(), "已复制"));
|
||||
}
|
||||
|
||||
viewHolder.binding.messageKefuContent.setText(Html.fromHtml(keFuEntity.getMessage()));
|
||||
|
||||
viewHolder.binding.messageKefuContent.setOnSpannableClickListener(spannableText -> ExtensionsKt.copyTextAndToast(spannableText, "已复制:" + spannableText));
|
||||
|
||||
viewHolder.setClickData(keFuEntity);
|
||||
if (!TextUtils.isEmpty(keFuEntity.getSuggestion())) {
|
||||
viewHolder.binding.messageKefuSuggestion.setVisibility(View.VISIBLE);
|
||||
viewHolder.binding.messageKefuSuggestion.setText(keFuEntity.getSuggestion());
|
||||
} else {
|
||||
viewHolder.binding.messageKefuSuggestion.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
List<LinkEntity> newLinks = keFuEntity.getNewLinks();
|
||||
if (newLinks != null && !newLinks.isEmpty()) {
|
||||
viewHolder.binding.messageSkipList.setVisibility(View.VISIBLE);
|
||||
viewHolder.binding.messageSkipList.removeAllViews();
|
||||
for (LinkEntity linkEntity : newLinks) {
|
||||
if (TextUtils.isEmpty(linkEntity.getText()) && TextUtils.isEmpty(linkEntity.getTitle()))
|
||||
continue;
|
||||
TextView textView = getLinkChildView(viewHolder, !TextUtils.isEmpty(linkEntity.getTitle()) ? linkEntity.getTitle() : linkEntity.getText());
|
||||
textView.setOnClickListener(v -> {
|
||||
if (!keFuEntity.isRead()) {
|
||||
mListViewModel.postMessageRead(keFuEntity.getId());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
linkNewSkip(linkEntity);
|
||||
|
||||
if ("求加速回复".equals(keFuEntity.getType())) {
|
||||
NewLogUtils.logMessageInformClick("", "", "", "", "求加速版本");
|
||||
} else if ("求版本回复".equals(keFuEntity.getType())) {
|
||||
NewLogUtils.logMessageInformClick("", "", "", "", "投票");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
List<MessageLinkEntity> links = keFuEntity.getLinks();
|
||||
if (links != null && !links.isEmpty()) {
|
||||
viewHolder.binding.messageSkipList.setVisibility(View.VISIBLE);
|
||||
viewHolder.binding.messageSkipList.removeAllViews();
|
||||
for (MessageLinkEntity link : links) {
|
||||
if (TextUtils.isEmpty(link.getQq()) &&
|
||||
TextUtils.isEmpty(link.getId()) &&
|
||||
TextUtils.isEmpty(link.getUrl()) &&
|
||||
!"7moor".equals(link.getType()) &&
|
||||
!"个人主页".equals(link.getType())) continue;
|
||||
TextView textView = getLinkChildView(viewHolder, link.getDocument());
|
||||
textView.setOnClickListener(v -> {
|
||||
if (!keFuEntity.isRead()) {
|
||||
mListViewModel.postMessageRead(keFuEntity.getId());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
linkSkip(link);
|
||||
|
||||
if ("求加速回复".equals(keFuEntity.getType())) {
|
||||
NewLogUtils.logMessageInformClick("", "", link.getId() == null ? "" : link.getId(), "", "求加速版本");
|
||||
} else if ("求版本回复".equals(keFuEntity.getType())) {
|
||||
NewLogUtils.logMessageInformClick("", "", link.getId() == null ? "" : link.getId(), "", "投票");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
viewHolder.binding.messageSkipList.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
MessageKeFuEntity.ServiceEntity serviceEntity = keFuEntity.getServiceEntity();
|
||||
viewHolder.binding.messageKefuName.setText(R.string.kefu_default_name);
|
||||
if (serviceEntity != null) {
|
||||
String name = serviceEntity.getName();
|
||||
if (!TextUtils.isEmpty(name)) {
|
||||
viewHolder.binding.messageKefuName.setText(name);
|
||||
}
|
||||
ImageUtils.displayIcon(viewHolder.binding.messageKefuIcon, serviceEntity.getIcon());
|
||||
} else {
|
||||
ImageUtils.display(viewHolder.binding.messageKefuIcon, R.drawable.message_kefu_icon);
|
||||
}
|
||||
|
||||
if (keFuEntity.getServiceEntity() != null && keFuEntity.getServiceEntity().getAuth() != null) {
|
||||
ImageUtils.display(viewHolder.binding.messageUserBadge, keFuEntity.getServiceEntity().getAuth().getIcon());
|
||||
viewHolder.binding.messageUserBadge.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.binding.messageUserBadge.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
CommentUtils.setCommentTime(viewHolder.binding.messageKefuTime, keFuEntity.getTime());
|
||||
|
||||
if (!TextUtils.isEmpty(keFuEntity.getSuggestion())) {
|
||||
StringBuffer suggest = new StringBuffer();
|
||||
suggest.append("反馈原文:");
|
||||
suggest.append(keFuEntity.getSuggestion());
|
||||
viewHolder.binding.messageKefuSuggestion.setVisibility(View.VISIBLE);
|
||||
viewHolder.binding.messageKefuSuggestion.setText(suggest);
|
||||
} else {
|
||||
viewHolder.binding.messageKefuSuggestion.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (keFuEntity.isRead()) {
|
||||
viewHolder.binding.messageKefuUnread.setVisibility(View.GONE);
|
||||
} else {
|
||||
viewHolder.binding.messageKefuUnread.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
viewHolder.binding.messageKefuIcon.setOnClickListener(v -> {
|
||||
if (serviceEntity != null) {
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击头像");
|
||||
DirectUtils.directToHomeActivity(mContext, serviceEntity.getId(), mEntrance, "消息中心-系统");
|
||||
}
|
||||
});
|
||||
viewHolder.binding.messageKefuName.setOnClickListener(v -> {
|
||||
if (serviceEntity != null) {
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击名字");
|
||||
DirectUtils.directToHomeActivity(mContext, serviceEntity.getId(), mEntrance, "消息中心-系统");
|
||||
}
|
||||
});
|
||||
|
||||
viewHolder.binding.getRoot().setOnLongClickListener(v -> {
|
||||
DialogHelper.showDialog(mContext,
|
||||
"删除消息",
|
||||
"消息删除将不可恢复,确定删除吗?",
|
||||
"确定", "取消", () -> {
|
||||
mListViewModel.deleteMessage(keFuEntity.getId());
|
||||
}, () -> {
|
||||
},
|
||||
true, "消息中心", "系统列表-删除");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private TextView getLinkChildView(KeFuViewHolder viewHolder, String text) {
|
||||
TextView textView = new TextView(mContext);
|
||||
textView.setTextColor(mContext.getResources().getColor(R.color.theme_font));
|
||||
textView.setTextSize(12F);
|
||||
textView.setText(text);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, DisplayUtils.dip2px(8F), 0, 0);
|
||||
viewHolder.binding.messageSkipList.addView(textView, params);
|
||||
return textView;
|
||||
}
|
||||
|
||||
private void linkSkip(MessageLinkEntity data) {
|
||||
String type = data.getType();
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
Utils.toast(mContext, "数据请求失败");
|
||||
return;
|
||||
}
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击链接");
|
||||
|
||||
|
||||
switch (type) {
|
||||
case "游戏":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
GameDetailActivity.startGameDetailActivity(mContext, data.getId(), "", null);
|
||||
}
|
||||
break;
|
||||
case "QQ号":
|
||||
if (!TextUtils.isEmpty(data.getQq())) {
|
||||
DirectUtils.directToQqConversation(mContext, data.getQq());
|
||||
}
|
||||
break;
|
||||
case "web":
|
||||
if (!TextUtils.isEmpty(data.getUrl())) {
|
||||
DirectUtils.directToWebView(mContext, data.getUrl(), "(消息-公告)");
|
||||
}
|
||||
break;
|
||||
case "QQ群":
|
||||
if (!TextUtils.isEmpty(data.getKey())) {
|
||||
DirectUtils.directToQqGroup(mContext, data.getKey());
|
||||
}
|
||||
break;
|
||||
case "新闻":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
Intent intent2 = new Intent(mContext, NewsDetailActivity.class);
|
||||
intent2.putExtra(EntranceConsts.KEY_ENTRANCE, "(消息-公告)");
|
||||
intent2.putExtra(EntranceConsts.KEY_NEWSID, data.getId());
|
||||
mContext.startActivity(intent2);
|
||||
}
|
||||
break;
|
||||
case "专题":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
SubjectActivity.startSubjectActivity(mContext, data.getId()
|
||||
, null, false, null, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "7moor":
|
||||
if (mContext instanceof Activity) {
|
||||
// 去掉七陌支持,跳转到企点
|
||||
// ImManager.startChatActivity((Activity) mContext, null, null);
|
||||
DirectUtils.directToWebView(mContext, Constants.TENCENT_QIDIAN_ADDRESS, mEntrance);
|
||||
}
|
||||
break;
|
||||
case "问题":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
mContext.startActivity(NewQuestionDetailActivity.getIntent(mContext, data.getId(), mEntrance, "(消息-客服)"));
|
||||
}
|
||||
break;
|
||||
case "回答":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
DirectUtils.directToAnswerDetail(mContext, data.getId(), mEntrance, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "社区文章":
|
||||
if (!TextUtils.isEmpty(data.getId()) && data.getCommunity() != null) {
|
||||
DirectUtils.directToCommunityArticle(mContext, data.getId(), data.getCommunity().getId(), mEntrance, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "社区专题":
|
||||
if (!TextUtils.isEmpty(data.getId()) && data.getCommunity() != null) {
|
||||
DirectUtils.directToCommunityColumn(mContext, data.getCommunity(), data.getId(), mEntrance, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "视频":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
DirectUtils.directToVideoDetail(mContext, data.getId(), VideoDetailContainerViewModel.Location.SINGLE_VIDEO.getValue(), false, "", mEntrance, "系统_二级列表", "");
|
||||
}
|
||||
break;
|
||||
case "安利墙评论":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
MtaHelper.onEvent("安利墙", "进入", "消息中心");
|
||||
DirectUtils.directToAmway(mContext, data.getId(), mEntrance, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "个人主页":
|
||||
DirectUtils.directToHomeActivity(mContext, UserManager.getInstance().getUserId(), mEntrance, "(消息-客服)");
|
||||
break;
|
||||
case "游戏详情评论":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
GameDetailActivity.startGameDetailActivity(mContext, data.getId(), "", -1, true, false, false, false, null);
|
||||
}
|
||||
break;
|
||||
case "订单中心":
|
||||
DirectUtils.directToOrderCenter(mContext);
|
||||
break;
|
||||
case "订单详情":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
DirectUtils.directToOrderDetail(mContext, data.getId());
|
||||
}
|
||||
break;
|
||||
case "光能记录":
|
||||
case "光能记录获取":
|
||||
DirectUtils.directToEnergyRecord(mContext);
|
||||
break;
|
||||
case "光能记录使用":
|
||||
DirectUtils.directToEnergyRecord(mContext, 1);
|
||||
break;
|
||||
case "抽奖中心":
|
||||
DirectUtils.directToLotteryParadisePage(mContext);
|
||||
break;
|
||||
case "我的奖品":
|
||||
DirectUtils.directToMyPrizePage(mContext);
|
||||
break;
|
||||
case "兑换商品":
|
||||
DirectUtils.directToExchangeCommodityPage(mContext);
|
||||
break;
|
||||
case "中奖订单详情":
|
||||
if (!TextUtils.isEmpty(data.getId()) && !TextUtils.isEmpty(data.getActivityId())) {
|
||||
DirectUtils.directToWinOrderDetail(mContext, data.getId(), data.getActivityId());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LinkEntity entity = new LinkEntity();
|
||||
entity.setType(data.getType());
|
||||
if (TextUtils.isEmpty(data.getId())) {
|
||||
entity.setLink(data.getId());
|
||||
}
|
||||
if (TextUtils.isEmpty(data.getUrl())) {
|
||||
entity.setLink(data.getUrl());
|
||||
}
|
||||
if (TextUtils.isEmpty(data.getDocument())) {
|
||||
entity.setText(data.getDocument());
|
||||
}
|
||||
entity.setCommunity(data.getCommunity());
|
||||
DirectUtils.directToLinkPage(mContext, entity, mEntrance, "(消息-客服)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void linkNewSkip(LinkEntity data) {
|
||||
String type = data.getType();
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
Utils.toast(mContext, "数据请求失败");
|
||||
return;
|
||||
}
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击链接");
|
||||
|
||||
switch (type) {
|
||||
case "home":
|
||||
DirectUtils.directToHomeActivity(mContext, UserManager.getInstance().getUserId(), mEntrance, "(消息-客服)");
|
||||
break;
|
||||
case "7moor":
|
||||
case "qidian":
|
||||
DirectUtils.directToWebView(mContext, Constants.TENCENT_QIDIAN_ADDRESS, mEntrance);
|
||||
break;
|
||||
case "order_center":
|
||||
DirectUtils.directToOrderCenter(mContext);
|
||||
break;
|
||||
case "order_detail":
|
||||
if (!TextUtils.isEmpty(data.getLink())) {
|
||||
DirectUtils.directToOrderDetail(mContext, data.getLink());
|
||||
}
|
||||
break;
|
||||
case "energy_record":
|
||||
case "energy_record_get":
|
||||
DirectUtils.directToEnergyRecord(mContext);
|
||||
break;
|
||||
case "energy_record_cost":
|
||||
DirectUtils.directToEnergyRecord(mContext, 1);
|
||||
break;
|
||||
case "raffle_center":
|
||||
DirectUtils.directToLotteryParadisePage(mContext);
|
||||
break;
|
||||
case "raffle_prize":
|
||||
DirectUtils.directToMyPrizePage(mContext);
|
||||
break;
|
||||
case "exchange_commodity":
|
||||
DirectUtils.directToExchangeCommodityPage(mContext);
|
||||
break;
|
||||
case "win_order_detail":
|
||||
if (!TextUtils.isEmpty(data.getLink()) && !TextUtils.isEmpty(data.getActivityId())) {
|
||||
DirectUtils.directToWinOrderDetail(mContext, data.getLink(), data.getActivityId());
|
||||
}
|
||||
break;
|
||||
case "game_comment_detail":
|
||||
mContext.startActivity(RatingReplyActivity.getSimpleIntent(
|
||||
mContext,
|
||||
data.getGameId(),
|
||||
data.getLink(),
|
||||
new ExposureSource("消息中心", ""),
|
||||
"消息中心-系统消息",
|
||||
""));
|
||||
break;
|
||||
default:
|
||||
DirectUtils.directToLinkPage(mContext, data, mEntrance, "(消息-客服)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder;
|
||||
import com.gh.gamecenter.common.callback.OnListClickListener;
|
||||
import com.gh.gamecenter.databinding.MessageKefuItemBinding;
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/10.
|
||||
*/
|
||||
public class KeFuViewHolder extends BaseRecyclerViewHolder<MessageKeFuEntity> {
|
||||
public MessageKefuItemBinding binding;
|
||||
|
||||
public KeFuViewHolder(MessageKefuItemBinding binding, OnListClickListener listClickListener) {
|
||||
super(binding.getRoot(), listClickListener);
|
||||
this.binding = binding;
|
||||
this.binding.getRoot().setOnClickListener(this);
|
||||
}
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
package com.gh.gamecenter.message
|
||||
|
||||
import android.app.Application
|
||||
import com.gh.gamecenter.common.baselist.ListViewModel
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.ResponseBody
|
||||
import org.json.JSONObject
|
||||
|
||||
class KeFuViewModel(application: Application) : ListViewModel<MessageKeFuEntity, MessageKeFuEntity>(application) {
|
||||
|
||||
override fun provideDataObservable(page: Int): Observable<MutableList<MessageKeFuEntity>>? {
|
||||
return RetrofitManager.getInstance().api.getMessageKeFuData(UserManager.getInstance().userId, page)
|
||||
}
|
||||
|
||||
override fun mergeResultLiveData() {
|
||||
mResultLiveData.addSource<List<MessageKeFuEntity>>(mListLiveData) { mResultLiveData.postValue(it) }
|
||||
}
|
||||
|
||||
fun postMessageRead(messageId: String) {
|
||||
|
||||
// 更新本地数据以及页面
|
||||
val listData = mListLiveData.value
|
||||
if (listData != null) {
|
||||
for (entity in listData) {
|
||||
if (messageId == entity.id) {
|
||||
entity.isRead = true
|
||||
mListLiveData.postValue(listData)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 后端同步
|
||||
val jsonObject = JSONObject()
|
||||
jsonObject.put("type", "system_message")
|
||||
val body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString())
|
||||
RetrofitManager.getInstance().api.postMessageRead(UserManager.getInstance().userId, messageId, body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
})
|
||||
}
|
||||
|
||||
fun deleteMessage(messageId: String) {
|
||||
RetrofitManager.getInstance().api
|
||||
.deleteKaiFuMessage(UserManager.getInstance().userId, messageId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
override fun onResponse(response: ResponseBody?) {
|
||||
val listData = mListLiveData.value
|
||||
listData?.let {
|
||||
val iterator = it.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val data = iterator.next()
|
||||
if (data.id == messageId) {
|
||||
it.remove(data)
|
||||
mListLiveData.postValue(listData)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1,151 +0,0 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.gh.gamecenter.common.callback.OnListClickListener;
|
||||
import com.gh.gamecenter.common.constant.ItemViewType;
|
||||
import com.gh.common.databind.BindingAdapters;
|
||||
import com.gh.gamecenter.common.utils.DialogHelper;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.databinding.MessageItemBinding;
|
||||
import com.gh.gamecenter.databinding.MessageItemTopBinding;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.gh.gamecenter.entity.MessageUnreadEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by khy on 23/03/18.
|
||||
*/
|
||||
|
||||
public class MessageAdapter extends ListAdapter<MessageEntity> {
|
||||
|
||||
private OnListClickListener mClickListener;
|
||||
|
||||
private MessageUnreadEntity mUnreadEntity;
|
||||
|
||||
private MessageNormalViewModel mViewModel;
|
||||
|
||||
private String mEntrance;
|
||||
|
||||
public MessageAdapter(Context context,
|
||||
OnListClickListener clickListener,
|
||||
String entrance,
|
||||
MessageNormalViewModel viewModel) {
|
||||
super(context);
|
||||
mClickListener = clickListener;
|
||||
mEntrance = entrance;
|
||||
mViewModel = viewModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setListData(List<MessageEntity> updateData) {
|
||||
int oldSize = TOP_ITEM_COUNT;
|
||||
if (mEntityList != null && mEntityList.size() > 0) {
|
||||
oldSize += mEntityList.size();
|
||||
}
|
||||
mEntityList = new ArrayList<>(updateData);
|
||||
if (oldSize == TOP_ITEM_COUNT || oldSize > updateData.size()) {
|
||||
notifyDataSetChanged();
|
||||
} else {
|
||||
notifyItemRangeInserted(oldSize, updateData.size() + TOP_ITEM_COUNT - oldSize);
|
||||
}
|
||||
}
|
||||
|
||||
void setMessageUnreadData(MessageUnreadEntity unreadEntity) {
|
||||
mUnreadEntity = unreadEntity;
|
||||
notifyItemChanged(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
case ItemViewType.ITEM_HEADER:
|
||||
MessageItemTopBinding topBinding = MessageItemTopBinding.inflate(mLayoutInflater, parent, false);
|
||||
return new MessageTopViewHolder(topBinding, mClickListener);
|
||||
case ItemViewType.ITEM_FOOTER:
|
||||
View view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
|
||||
return new FooterViewHolder(view, mClickListener);
|
||||
case ItemViewType.ITEM_BODY:
|
||||
MessageItemBinding binding = MessageItemBinding.inflate(mLayoutInflater, parent, false);
|
||||
return new MessageItemViewHolder(binding, mClickListener, "消息_一级列表");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
switch (getItemViewType(position)) {
|
||||
case ItemViewType.ITEM_HEADER:
|
||||
MessageTopViewHolder topViewHolder = (MessageTopViewHolder) holder;
|
||||
topViewHolder.mBinding.messageInviteName.setTextColor(ContextCompat.getColor(mContext, R.color.text_title));
|
||||
topViewHolder.mBinding.messageVoteName.setTextColor(ContextCompat.getColor(mContext, R.color.text_title));
|
||||
topViewHolder.mBinding.messageServiceName.setTextColor(ContextCompat.getColor(mContext, R.color.text_title));
|
||||
topViewHolder.mBinding.messageVote.setBackground(ContextCompat.getDrawable(mContext, R.drawable.reuse_listview_item_style));
|
||||
topViewHolder.mBinding.messageService.setBackground(ContextCompat.getDrawable(mContext, R.drawable.reuse_listview_item_style));
|
||||
topViewHolder.mBinding.messageInvite.setBackground(ContextCompat.getDrawable(mContext, R.drawable.reuse_listview_item_style));
|
||||
|
||||
if (mUnreadEntity != null) {
|
||||
BindingAdapters.setMessageUnread(topViewHolder.mBinding.unreadVote, mUnreadEntity.getVoteCount());
|
||||
BindingAdapters.showHide(topViewHolder.mBinding.unreadVote, mUnreadEntity.getVoteCount() != 0);
|
||||
|
||||
BindingAdapters.setMessageUnread(topViewHolder.mBinding.unreadInvite, mUnreadEntity.getInvited() + mUnreadEntity.getSystemInvited());
|
||||
BindingAdapters.showHide(topViewHolder.mBinding.unreadInvite, mUnreadEntity.getInvited() + mUnreadEntity.getSystemInvited() != 0);
|
||||
|
||||
BindingAdapters.setMessageUnread(topViewHolder.mBinding.unreadService, mUnreadEntity.getService());
|
||||
BindingAdapters.showHide(topViewHolder.mBinding.unreadService, mUnreadEntity.getService() != 0);
|
||||
}
|
||||
break;
|
||||
case ItemViewType.ITEM_BODY:
|
||||
MessageItemViewHolder viewHolder = (MessageItemViewHolder) holder;
|
||||
MessageEntity entity = mEntityList.get(position - TOP_ITEM_COUNT);
|
||||
viewHolder.setMessageItem(entity, mContext, mEntrance);
|
||||
viewHolder.itemView.setOnLongClickListener(v -> {
|
||||
DialogHelper.showDialog(
|
||||
mContext,
|
||||
"删除消息",
|
||||
"消息删除将不可恢复,确定删除吗?",
|
||||
"确定",
|
||||
"取消",
|
||||
() -> mViewModel.deleteMessage(entity.getId()),
|
||||
() -> {
|
||||
},
|
||||
true,
|
||||
"消息中心",
|
||||
"消息列表-删除");
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
case ItemViewType.ITEM_FOOTER:
|
||||
FooterViewHolder footerViewHolder = (FooterViewHolder) holder;
|
||||
footerViewHolder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver);
|
||||
footerViewHolder.initItemPadding();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == 0) {
|
||||
return ItemViewType.ITEM_HEADER;
|
||||
} else if (position == getItemCount() - 1) {
|
||||
return ItemViewType.ITEM_FOOTER;
|
||||
} else {
|
||||
return ItemViewType.ITEM_BODY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mEntityList == null || mEntityList.isEmpty() ? TOP_ITEM_COUNT : mEntityList.size() + FOOTER_ITEM_COUNT + TOP_ITEM_COUNT;
|
||||
}
|
||||
}
|
||||
@ -1,127 +0,0 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.gh.common.util.NewLogUtils;
|
||||
import com.gh.gamecenter.common.view.CustomDividerItemDecoration;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.MessageInviteActivity;
|
||||
import com.gh.gamecenter.MessageKeFuActivity;
|
||||
import com.gh.gamecenter.MessageVoteActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.common.baselist.ListFragment;
|
||||
import com.gh.gamecenter.common.baselist.LoadStatus;
|
||||
import com.gh.gamecenter.common.baselist.LoadType;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.gh.gamecenter.entity.MessageUnreadEntity;
|
||||
import com.halo.assistant.HaloApp;
|
||||
|
||||
/**
|
||||
* Created by khy on 23/03/18.
|
||||
*/
|
||||
|
||||
public class MessageFragment extends ListFragment<MessageEntity, MessageNormalViewModel> {
|
||||
|
||||
private MessageAdapter mAdapter;
|
||||
|
||||
private MessageUnreadViewModel mUnreadViewModel;
|
||||
|
||||
private MessageUnreadEntity mUnreadEntity;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
setNavigationTitle(getString(R.string.title_message_center));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mUnreadViewModel = ViewModelProviders.of(this, new MessageUnreadViewModel.Factory(HaloApp.getInstance().getApplication()))
|
||||
.get(MessageUnreadViewModel.class);
|
||||
if (savedInstanceState != null) {
|
||||
mUnreadViewModel.retry();
|
||||
}
|
||||
mUnreadViewModel.getLiveData().observe(this,
|
||||
messageUnread -> {
|
||||
mUnreadEntity = messageUnread;
|
||||
provideListAdapter().setMessageUnreadData(messageUnread);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MessageNormalViewModel provideListViewModel() {
|
||||
MessageNormalViewModel.Factory factory = new MessageNormalViewModel.Factory(HaloApp.getInstance().getApplication(), "default");
|
||||
return ViewModelProviders.of(this, factory).get(MessageNormalViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MessageAdapter provideListAdapter() {
|
||||
return mAdapter == null ? mAdapter = new MessageAdapter(
|
||||
getContext(),
|
||||
this,
|
||||
mEntrance,
|
||||
mListViewModel) : mAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.ItemDecoration getItemDecoration() {
|
||||
CustomDividerItemDecoration decoration = new CustomDividerItemDecoration(requireContext(), false, true, false, false);
|
||||
decoration.setDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.divider_item_line_space_16_h_1px));
|
||||
mItemDecoration = decoration;
|
||||
return mItemDecoration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadEmpty() {
|
||||
super.onLoadDone();
|
||||
mAdapter.loadChange(LoadStatus.LIST_OVER);
|
||||
mReuseNoData.setVisibility(View.VISIBLE);
|
||||
mReuseNoData.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.transparent));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadError() {
|
||||
super.onLoadDone();
|
||||
mAdapter.loadChange(LoadStatus.LIST_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListClick(View view, int position, Object data) {
|
||||
switch (view.getId()) {
|
||||
case R.id.footerview_item:
|
||||
if (mAdapter.isNetworkError()) {
|
||||
mListViewModel.load(LoadType.RETRY);
|
||||
}
|
||||
return;
|
||||
case R.id.message_vote:
|
||||
MtaHelper.onEvent("消息中心", "二级入口", "赞同");
|
||||
NewLogUtils.logMessageInformTopIconClick(mUnreadEntity.getVoteCount() != 0, "赞同");
|
||||
startActivity(MessageVoteActivity.getIntent(getContext(), MessageNormalFragment.MESSAGE_TYPE_VOTE, "赞同_二级列表", mEntrance));
|
||||
return;
|
||||
case R.id.message_invite:
|
||||
MtaHelper.onEvent("消息中心", "二级入口", "邀请");
|
||||
NewLogUtils.logMessageInformTopIconClick(mUnreadEntity.getInvited() + mUnreadEntity.getSystemInvited() != 0, "邀请");
|
||||
startActivity(MessageInviteActivity.getIntent(getContext(), MessageNormalFragment.MESSAGE_TYPE_INVITE, "邀请_二级列表", mEntrance));
|
||||
return;
|
||||
case R.id.message_service:
|
||||
MtaHelper.onEvent("消息中心", "二级入口", "系统");
|
||||
NewLogUtils.logMessageInformTopIconClick(mUnreadEntity.getService() != 0, "系统");
|
||||
startActivity(MessageKeFuActivity.getIntent(getContext(), mEntrance));
|
||||
return;
|
||||
}
|
||||
|
||||
MessageEntity entity = (MessageEntity) data;
|
||||
String path = "我的光环-消息中心-列表";
|
||||
MessageItemViewHolder.messageItemClickSkip(view, entity, mEntrance, "消息_一级列表", path);
|
||||
if (!entity.getRead()) {
|
||||
mListViewModel.postMessageRead(entity.getId(), entity.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,107 +0,0 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.gh.gamecenter.common.callback.OnListClickListener;
|
||||
import com.gh.gamecenter.common.constant.ItemViewType;
|
||||
import com.gh.gamecenter.common.utils.DialogHelper;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.databinding.MessageItemBinding;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
|
||||
/**
|
||||
* Created by khy on 23/03/18.
|
||||
*/
|
||||
|
||||
public class MessageNormalAdapter extends ListAdapter<MessageEntity> {
|
||||
|
||||
private OnListClickListener mClickListener;
|
||||
|
||||
private MessageNormalViewModel mViewModel;
|
||||
private String mEntrance;
|
||||
private String mOuterInfo;
|
||||
|
||||
public MessageNormalAdapter(Context context,
|
||||
OnListClickListener clickListener,
|
||||
String entrance,
|
||||
String outerInfo,
|
||||
MessageNormalViewModel viewModel) {
|
||||
super(context);
|
||||
mClickListener = clickListener;
|
||||
mEntrance = entrance;
|
||||
mOuterInfo = outerInfo;
|
||||
mViewModel = viewModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view;
|
||||
switch (viewType) {
|
||||
case ItemViewType.ITEM_FOOTER:
|
||||
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
|
||||
return new FooterViewHolder(view, mClickListener);
|
||||
case ItemViewType.ITEM_BODY:
|
||||
MessageItemBinding binding = MessageItemBinding.inflate(mLayoutInflater, parent, false);
|
||||
return new MessageItemViewHolder(binding, mClickListener, mOuterInfo);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
switch (getItemViewType(position)) {
|
||||
case ItemViewType.ITEM_BODY:
|
||||
MessageItemViewHolder viewHolder = (MessageItemViewHolder) holder;
|
||||
MessageEntity entity = mEntityList.get(position);
|
||||
entity.setRead(true);
|
||||
viewHolder.setMessageItem(entity, mContext, mEntrance);
|
||||
viewHolder.itemView.setOnLongClickListener(v -> {
|
||||
String mtaKey;
|
||||
if (MessageNormalFragment.MESSAGE_TYPE_INVITE.equals(mViewModel.getMessageType())) {
|
||||
mtaKey = "邀请列表-删除";
|
||||
} else {
|
||||
mtaKey = "赞同列表-删除";
|
||||
}
|
||||
DialogHelper.showDialog(
|
||||
mContext,
|
||||
"删除消息",
|
||||
"消息删除将不可恢复,确定删除吗?",
|
||||
"确定",
|
||||
"取消",
|
||||
() -> mViewModel.deleteMessage(entity.getId()),
|
||||
() -> {
|
||||
},
|
||||
true,
|
||||
"消息中心",
|
||||
mtaKey);
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
case ItemViewType.ITEM_FOOTER:
|
||||
((FooterViewHolder) holder).initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver);
|
||||
((FooterViewHolder) holder).initItemPadding();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == getItemCount() - 1) {
|
||||
return ItemViewType.ITEM_FOOTER;
|
||||
} else {
|
||||
return ItemViewType.ITEM_BODY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mEntityList == null || mEntityList.isEmpty() ? 0 : mEntityList.size() + FOOTER_ITEM_COUNT;
|
||||
}
|
||||
}
|
||||
@ -1,113 +0,0 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.common.baselist.ListFragment;
|
||||
import com.gh.gamecenter.common.baselist.LoadType;
|
||||
import com.gh.gamecenter.common.view.CustomDividerItemDecoration;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.halo.assistant.HaloApp;
|
||||
|
||||
/**
|
||||
* Created by khy on 24/03/18.
|
||||
* 不需要未读机制
|
||||
*/
|
||||
|
||||
public class MessageNormalFragment extends ListFragment<MessageEntity, MessageNormalViewModel> {
|
||||
public final static String MESSAGE_TYPE_VOTE = "vote";
|
||||
public final static String MESSAGE_TYPE_INVITE = "invite";
|
||||
|
||||
private MessageNormalAdapter mAdapter;
|
||||
|
||||
private MessageUnreadViewModel mUnreadViewModel;
|
||||
|
||||
private String mMessageType;
|
||||
private String mTitle;
|
||||
private String mOuterInfo;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
if (getArguments() == null)
|
||||
throw new NullPointerException(MessageFragment.class.getSimpleName() + " Arguments is not null");
|
||||
mMessageType = getArguments().getString(EntranceConsts.KEY_MESSAGE_TYPE);
|
||||
mOuterInfo = getArguments().getString(EntranceConsts.KEY_OUTER_INFO);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mUnreadViewModel = ViewModelProviders.of(this, new MessageUnreadViewModel.Factory(HaloApp.getInstance().getApplication()))
|
||||
.get(MessageUnreadViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MessageNormalViewModel provideListViewModel() {
|
||||
MessageNormalViewModel.Factory factory = new MessageNormalViewModel.Factory(HaloApp.getInstance().getApplication(), mMessageType);
|
||||
return ViewModelProviders.of(this, factory).get(MessageNormalViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
if (MESSAGE_TYPE_INVITE.equals(mMessageType)) {
|
||||
mTitle = "邀请";
|
||||
} else if (MESSAGE_TYPE_VOTE.equals(mMessageType)) {
|
||||
mTitle = "赞同";
|
||||
}
|
||||
setNavigationTitle(mTitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.ItemDecoration getItemDecoration() {
|
||||
CustomDividerItemDecoration decoration = new CustomDividerItemDecoration(requireContext(), false, false, true, false);
|
||||
decoration.setDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.divider_item_line_space_16_h_1px));
|
||||
mItemDecoration = decoration;
|
||||
return mItemDecoration;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoadDone() {
|
||||
super.onLoadDone();
|
||||
if (MESSAGE_TYPE_INVITE.equals(mMessageType)) {
|
||||
mUnreadViewModel.markRead(MessageUnreadViewModel.ReadType.INVITE);
|
||||
} else {
|
||||
mUnreadViewModel.markRead(MessageUnreadViewModel.ReadType.VOTE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListAdapter provideListAdapter() {
|
||||
return mAdapter == null ? mAdapter = new MessageNormalAdapter(
|
||||
getContext(),
|
||||
this,
|
||||
mEntrance,
|
||||
mOuterInfo,
|
||||
mListViewModel) : mAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListClick(View view, int position, Object data) {
|
||||
if (view.getId() == R.id.footerview_item) {
|
||||
if (mAdapter.isNetworkError()) {
|
||||
mListViewModel.load(LoadType.RETRY);
|
||||
}
|
||||
return;
|
||||
}
|
||||
MessageEntity entity = (MessageEntity) data;
|
||||
String path = "我的光环-消息中心-" + mTitle;
|
||||
MessageItemViewHolder.messageItemClickSkip(view, entity, mEntrance, mOuterInfo, path);
|
||||
// if (!entity.getRead()) {
|
||||
// mListViewModel.postMessageRead(entity.getId(), entity.getType());
|
||||
// mAdapter.notifyItemChanged(position);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -1,96 +0,0 @@
|
||||
package com.gh.gamecenter.message
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.gh.gamecenter.common.baselist.ListViewModel
|
||||
import com.gh.gamecenter.entity.MessageEntity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.lightgame.utils.Utils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.ResponseBody
|
||||
import org.json.JSONObject
|
||||
|
||||
class MessageNormalViewModel(
|
||||
application: Application,
|
||||
val messageType: String
|
||||
) : ListViewModel<MessageEntity, MessageEntity>(application) {
|
||||
|
||||
override fun provideDataObservable(page: Int): Observable<MutableList<MessageEntity>>? {
|
||||
return RetrofitManager.getInstance().api.getMessage(
|
||||
UserManager.getInstance().userId,
|
||||
messageType,
|
||||
Utils.getTime(getApplication()),
|
||||
page
|
||||
)
|
||||
}
|
||||
|
||||
override fun mergeResultLiveData() {
|
||||
mResultLiveData.addSource<List<MessageEntity>>(mListLiveData) { mResultLiveData.postValue(it) }
|
||||
}
|
||||
|
||||
|
||||
fun deleteMessage(messageId: String) {
|
||||
RetrofitManager.getInstance().api
|
||||
.deleteMessage(UserManager.getInstance().userId, messageId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
override fun onResponse(response: ResponseBody?) {
|
||||
val listData = mListLiveData.value
|
||||
|
||||
listData?.let {
|
||||
val iterator = it.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val data = iterator.next()
|
||||
if (data.id == messageId) {
|
||||
it.remove(data)
|
||||
mListLiveData.postValue(listData)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun postMessageRead(messageId: String, type: String) {
|
||||
|
||||
// 更新本地数据以及页面
|
||||
val listData = mListLiveData.value
|
||||
if (listData != null) {
|
||||
for (entity in listData) {
|
||||
if (messageId == entity.id) {
|
||||
entity.read = true
|
||||
mListLiveData.postValue(listData)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 后端同步
|
||||
val jsonObject = JSONObject()
|
||||
jsonObject.put("type", type)
|
||||
val body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString())
|
||||
RetrofitManager.getInstance().api.postMessageRead(UserManager.getInstance().userId, messageId, body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
})
|
||||
}
|
||||
|
||||
class Factory(
|
||||
private val mApplication: Application,
|
||||
private val mMessageType: String
|
||||
) : ViewModelProvider.NewInstanceFactory() {
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
return MessageNormalViewModel(mApplication, mMessageType) as T
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder;
|
||||
import com.gh.gamecenter.common.callback.OnListClickListener;
|
||||
import com.gh.gamecenter.databinding.MessageItemTopBinding;
|
||||
|
||||
/**
|
||||
* Created by khy on 24/03/18.
|
||||
*/
|
||||
|
||||
public class MessageTopViewHolder extends BaseRecyclerViewHolder {
|
||||
MessageItemTopBinding mBinding;
|
||||
|
||||
public MessageTopViewHolder(MessageItemTopBinding binding, OnListClickListener listClickListener) {
|
||||
super(binding.getRoot(), listClickListener);
|
||||
mBinding = binding;
|
||||
mBinding.messageInvite.setOnClickListener(this);
|
||||
mBinding.messageService.setOnClickListener(this);
|
||||
mBinding.messageVote.setOnClickListener(this);
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,7 @@ import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.retrofit.service.ApiService
|
||||
import com.google.gson.reflect.TypeToken
|
||||
|
||||
@ -10,7 +10,7 @@ import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.gh.gamecenter.entity.AddonsUnreadEntity;
|
||||
import com.gh.gamecenter.entity.MessageUnreadEntity;
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -16,6 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.PagerSnapHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.databind.BindingAdapters
|
||||
import com.gh.common.util.*
|
||||
@ -24,6 +25,7 @@ import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.util.NewLogUtils
|
||||
import com.gh.gamecenter.*
|
||||
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.eventbus.EBNetworkState
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse
|
||||
import com.gh.gamecenter.common.retrofit.ApiResponse
|
||||
@ -34,9 +36,10 @@ import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.databinding.FragmentHaloPersonalBinding
|
||||
import com.gh.gamecenter.databinding.FragmentPersonalStubBinding
|
||||
import com.gh.gamecenter.entity.BadgeEntity
|
||||
import com.gh.gamecenter.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.eventbus.EBConcernChanged
|
||||
import com.gh.gamecenter.feature.entity.Badge
|
||||
import com.gh.gamecenter.feature.provider.IMessageProvider
|
||||
import com.gh.gamecenter.fragment.MainWrapperFragment
|
||||
import com.gh.gamecenter.gamecollection.mine.MyGameCollectionActivity
|
||||
import com.gh.gamecenter.history.HistoryActivity
|
||||
@ -164,10 +167,9 @@ class HaloPersonalFragment : BaseLazyFragment() {
|
||||
mStubBinding.loginMessageHint.visibility == View.VISIBLE,
|
||||
"我的"
|
||||
)
|
||||
startActivityForResult(
|
||||
MessageActivity.getIntent(context, "(我的光环)+(消息中心)"),
|
||||
REQUEST_MESSAGE
|
||||
)
|
||||
(ARouter.getInstance().build(RouteConsts.provider.message).navigation() as? IMessageProvider)?.let {
|
||||
startActivityForResult(it.getIntent(requireContext(), "(我的光环)+(消息中心)"), REQUEST_MESSAGE)
|
||||
}
|
||||
} else {
|
||||
NewFlatLogUtils.logHaloSelfLogin()
|
||||
CheckLoginUtils.checkLogin(context, "我的光环-消息") {}
|
||||
|
||||
@ -32,7 +32,7 @@ import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.databinding.FragmentHomeBinding
|
||||
import com.gh.gamecenter.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.feature.entity.Badge
|
||||
import com.gh.gamecenter.feature.entity.PersonalEntity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
|
||||
@ -3,13 +3,16 @@ package com.gh.gamecenter.qa.article.detail
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.gh.gamecenter.entity.SpecialColumn
|
||||
|
||||
@Route(path = RouteConsts.activity.articleDetailActivity)
|
||||
class ArticleDetailActivity : ToolBarActivity() {
|
||||
|
||||
override fun getLayoutId() = R.layout.activity_amway
|
||||
|
||||
@ -1,102 +0,0 @@
|
||||
package com.gh.gamecenter.qa.dialog
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Point
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.NewsUtils
|
||||
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||
import com.gh.gamecenter.common.utils.ImageUtils
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.databinding.DialogAskFollowMoreBinding
|
||||
import com.gh.gamecenter.databinding.ItemAskFollowMoreBinding
|
||||
import com.gh.gamecenter.feature.entity.UserEntity
|
||||
|
||||
class AskFollowMoreDialog : BaseDialogFragment() {
|
||||
|
||||
private var mType = ""
|
||||
private var mPath = ""
|
||||
private var mUserList = ArrayList<UserEntity>()
|
||||
private lateinit var mBinding: DialogAskFollowMoreBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
requireArguments().run {
|
||||
mType = getString(KEY_TYPE) ?: ""
|
||||
mPath = getString(KEY_PATH) ?: ""
|
||||
mUserList = getParcelableArrayList(KEY_USER_LIST) ?: arrayListOf()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
return DialogAskFollowMoreBinding.inflate(LayoutInflater.from(requireContext()), null, false).apply {
|
||||
mBinding = this
|
||||
}.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
dialog?.setCanceledOnTouchOutside(true)
|
||||
|
||||
val lp = mBinding.container.layoutParams
|
||||
lp.width = ((getScreenWidth(requireActivity())) * 0.8).toInt()
|
||||
mBinding.container.layoutParams = lp
|
||||
|
||||
mBinding.tvTitle.text = mType
|
||||
mBinding.recyclerview.adapter = AskFollowMoreAdapter(requireContext(), mUserList, mPath)
|
||||
mBinding.recyclerview.layoutManager = LinearLayoutManager(mBinding.recyclerview.context)
|
||||
}
|
||||
|
||||
private fun getScreenWidth(activity: Activity): Int {
|
||||
val size = Point()
|
||||
activity.windowManager.defaultDisplay.getSize(size)
|
||||
return size.x
|
||||
}
|
||||
|
||||
class AskFollowMoreAdapter(var context: Context, var list: ArrayList<UserEntity>, var path: String) :
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
return ItemViewHolder(parent.toBinding())
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return list.size
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
(holder as ItemViewHolder).run {
|
||||
val user = list[position]
|
||||
ImageUtils.display(binding.ivIcon, user.icon)
|
||||
binding.tvUsername.text = user.name
|
||||
binding.tvTime.text = NewsUtils.getFormattedTime(user.time ?: 0)
|
||||
binding.root.setOnClickListener {
|
||||
DirectUtils.directToHomeActivity(context, list[position].id, "问答-关注", path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ItemViewHolder(var binding: ItemAskFollowMoreBinding) : RecyclerView.ViewHolder(binding.root)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val KEY_TYPE = "type"
|
||||
const val KEY_PATH = "path"
|
||||
const val KEY_USER_LIST = "user_list"
|
||||
|
||||
@JvmStatic
|
||||
fun getInstance(type: String, path: String, userList: ArrayList<UserEntity>) = AskFollowMoreDialog().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(KEY_TYPE, type)
|
||||
putString(KEY_PATH, path)
|
||||
putParcelableArrayList(KEY_USER_LIST, userList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,12 +3,15 @@ package com.gh.gamecenter.qa.questions.newdetail
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
|
||||
@Route(path = RouteConsts.activity.questionDetailActivity)
|
||||
class NewQuestionDetailActivity : ToolBarActivity() {
|
||||
|
||||
override fun getLayoutId() = R.layout.activity_amway
|
||||
|
||||
@ -5,13 +5,16 @@ import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout.PAGE_INDEX
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
|
||||
@Route(path = RouteConsts.activity.forumVideoDetailActivity)
|
||||
class ForumVideoDetailActivity : BaseActivity() {
|
||||
var containerFragment: Fragment? = null
|
||||
|
||||
|
||||
@ -3,10 +3,12 @@ package com.gh.gamecenter.retrofit;
|
||||
import android.content.Context;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.common.retrofit.BaseRetrofitManager;
|
||||
import com.gh.gamecenter.retrofit.service.ApiService;
|
||||
import com.gh.gamecenter.retrofit.service.VApiService;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
|
||||
@ -56,10 +56,7 @@ import com.gh.gamecenter.entity.InterestedGameEntity;
|
||||
import com.gh.gamecenter.entity.LibaoDetailEntity;
|
||||
import com.gh.gamecenter.entity.LibaoEntity;
|
||||
import com.gh.gamecenter.entity.LibaoStatusEntity;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.gh.gamecenter.entity.MessageFold;
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity;
|
||||
import com.gh.gamecenter.entity.MessageUnreadEntity;
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity;
|
||||
import com.gh.gamecenter.entity.MyVideoEntity;
|
||||
import com.gh.gamecenter.entity.NewApiSettingsEntity;
|
||||
import com.gh.gamecenter.entity.NewSettingsEntity;
|
||||
@ -619,13 +616,6 @@ public interface ApiService {
|
||||
|
||||
/***************8 MessageService *******/
|
||||
|
||||
|
||||
/**
|
||||
* 获取消息-客服数据
|
||||
*/
|
||||
@GET("users/{user_id}/private_messages")
|
||||
Observable<List<MessageKeFuEntity>> getMessageKeFuData(@Path("user_id") String user_id, @Query("page") int page);
|
||||
|
||||
/**
|
||||
* 获取消息未读数据
|
||||
*/
|
||||
@ -633,10 +623,6 @@ public interface ApiService {
|
||||
Observable<MessageUnreadEntity> getMessageUnread(@Path("user_id") String user_id);
|
||||
|
||||
|
||||
@GET("users/{user_id}/messages")
|
||||
Observable<List<MessageEntity>> getMessage(@Path("user_id") String user_id, @Query("view") String type, @Query("timestamp") long timestamp, @Query("page") int page);
|
||||
|
||||
|
||||
/****** 问答(社区相关) *******/
|
||||
|
||||
|
||||
@ -1018,18 +1004,6 @@ public interface ApiService {
|
||||
@POST("users/{user_id}/messages/{message_id}:read")
|
||||
Observable<ResponseBody> postMessageRead(@Path("user_id") String userId, @Path("message_id") String messageId, @Body RequestBody body);
|
||||
|
||||
/**
|
||||
* 将消息删除
|
||||
*/
|
||||
@POST("users/{user_id}/messages/{message_id}:inactivate")
|
||||
Observable<ResponseBody> deleteMessage(@Path("user_id") String userId, @Path("message_id") String messageId);
|
||||
|
||||
/**
|
||||
* 将消息删除
|
||||
*/
|
||||
@POST("users/{user_id}/private_messages/{message_id}:inactivate")
|
||||
Observable<ResponseBody> deleteKaiFuMessage(@Path("user_id") String userId, @Path("message_id") String messageId);
|
||||
|
||||
/**
|
||||
* 在社区发布文章
|
||||
*/
|
||||
@ -1323,10 +1297,6 @@ public interface ApiService {
|
||||
@POST("./app:activate")
|
||||
Observable<ResponseBody> postActivationInfo();
|
||||
|
||||
@GET("users/{user_id}/messages/{resource_id}/fold-list")
|
||||
Observable<List<MessageFold>> getMessageFoldList(@Path("user_id") String userId,
|
||||
@Path("resource_id") String resourceId);
|
||||
|
||||
/**
|
||||
* 获取首页游戏补充库
|
||||
*/
|
||||
|
||||
@ -33,7 +33,7 @@ import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.CommentDetailAdapter;
|
||||
import com.gh.gamecenter.adapter.OnCommentCallBackListener;
|
||||
import com.gh.gamecenter.entity.CommentEntity;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity;
|
||||
import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
|
||||
import com.gh.gamecenter.eventbus.EBAddComment;
|
||||
import com.gh.gamecenter.eventbus.EBDeleteComment;
|
||||
|
||||
Reference in New Issue
Block a user