feat: 组件化消息中心相关功能 https://jira.shanqu.cc/browse/GHZS-2972
This commit is contained in:
@ -336,6 +336,9 @@ dependencies {
|
||||
implementation(project(':module_sensors_data')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
implementation(project(':module_message')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
// implementation(project(':feature:vpn'))
|
||||
implementation(project(':feature:pkg'))
|
||||
implementation(project(':feature:oaid'))
|
||||
|
||||
@ -297,10 +297,6 @@
|
||||
android:name="com.gh.gamecenter.CollectionActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.UserInfoEditActivity"
|
||||
android:screenOrientation="portrait"
|
||||
@ -322,18 +318,6 @@
|
||||
android:name="com.gh.gamecenter.InfoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageKeFuActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageInviteActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageVoteActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".qa.questions.invite.QuestionsInviteActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 638 B |
Binary file not shown.
|
Before Width: | Height: | Size: 804 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@ -20,7 +20,6 @@
|
||||
<string name="search_hot">热门搜索</string>
|
||||
<string name="search_hot_tag">热门标签</string>
|
||||
<string name="search_history">历史搜索</string>
|
||||
<string name="title_message_center">消息中心</string>
|
||||
<string name="news_concenrn_game_mine">我关注的游戏</string>
|
||||
<string name="news_search_input">请输入搜索关键字</string>
|
||||
<string name="news_search">搜索</string>
|
||||
@ -84,7 +83,6 @@
|
||||
<string name="dialog_hint_content">提示内容</string>
|
||||
<string name="dialog_hint_confirm">知道了</string>
|
||||
|
||||
<string name="copy_id"><u>复制ID</u></string>
|
||||
<string name="loading_error_network">网络错误,点击重试!</string>
|
||||
<string name="comment_empty">目前还没有评论</string>
|
||||
<string name="comment_nomore">没有更多评论啦</string>
|
||||
@ -204,7 +202,6 @@
|
||||
<string name="article_hot">热门</string>
|
||||
|
||||
<string name="vote_count">%1$d票</string>
|
||||
<string name="kefu_default_name">光环客服</string>
|
||||
<string name="menu_search">搜索</string>
|
||||
|
||||
<string name="concern_cancel_failure">取消失败,请稍后再试</string>
|
||||
@ -275,7 +272,6 @@
|
||||
<string name="answer_edit_title">撰写回答</string>
|
||||
<string name="answer_patch_title">修改回答</string>
|
||||
|
||||
<string name="request_failure_normal_hint">网络错误</string>
|
||||
<string name="ask_vote_hint">已经点赞了哟~</string>
|
||||
<string name="ask_vote_limit_hint">不能重复点赞哦</string>
|
||||
<string name="ask_share_invite_title">%1$s邀请你回答:%2$s</string>
|
||||
|
||||
@ -81,6 +81,10 @@ class AppProviderImpl : IAppProvider {
|
||||
override fun logEvent(content: String) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun logCoreEvent() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,10 @@ class DirectProviderImpl : IDirectProvider {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToEnergyRecord")
|
||||
}
|
||||
|
||||
override fun directToEnergyRecord(context: Context, position: Int) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToEnergyRecord")
|
||||
}
|
||||
|
||||
override fun directToEnergyRulePage(context: Context) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToEnergyRulePage")
|
||||
}
|
||||
@ -70,6 +74,48 @@ class DirectProviderImpl : IDirectProvider {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun directToHomeActivity(context: Context, userId: String?, entrance: String?, path: String?) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToHomeActivity")
|
||||
}
|
||||
|
||||
override fun directToAnswerDetail(context: Context, id: String, entrance: String?, path: String?) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToAnswerDetail")
|
||||
}
|
||||
|
||||
override fun directToCommunityArticle(
|
||||
context: Context,
|
||||
articleId: String?,
|
||||
communityId: String?,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToCommunityArticle")
|
||||
}
|
||||
|
||||
override fun directToVideoDetail(context: Context, videoId: String, entrance: String?, path: String?) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToVideoDetail")
|
||||
}
|
||||
|
||||
override fun directToAmway(context: Context, fixedTopAmwayCommentId: String?, entrance: String?, path: String?) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToAmway")
|
||||
}
|
||||
|
||||
override fun directToOrderCenter(context: Context) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToOrderCenter")
|
||||
}
|
||||
|
||||
override fun directToOrderDetail(context: Context, orderId: String) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToOrderDetail")
|
||||
}
|
||||
|
||||
override fun directToMyPrizePage(context: Context) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToMyPrizePage")
|
||||
}
|
||||
|
||||
override fun directToWinOrderDetail(context: Context, orderId: String, activityId: String) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToWinOrderDetail")
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import android.content.Context
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
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
|
||||
@ -118,6 +119,16 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
override fun directToCommunityColumn(
|
||||
context: Context,
|
||||
community: CommunityEntity?,
|
||||
subjectId: String,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
) {
|
||||
ToastUtils.toast("调用->LinkDirectUtilsProviderImpl.directToCommunityColumn")
|
||||
}
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
|
||||
@ -77,9 +77,17 @@ class AppProviderImpl : IAppProvider {
|
||||
override fun logEvent(content: String) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun logCoreEvent() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getIsBrandNewInstall(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getFlavor(): String {
|
||||
return "internal"
|
||||
}
|
||||
|
||||
@ -77,6 +77,10 @@ class AppProviderImpl : IAppProvider {
|
||||
override fun logEvent(content: String) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun logCoreEvent() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -282,4 +282,6 @@ public class EntranceConsts {
|
||||
public static final String KEY_EDIT_HISTORY = "edit_history";
|
||||
public static final String KEY_TAB = "tab";
|
||||
public static final String KEY_SHOW_SEARCH_TOOLBAR = "show_search_toolbar";
|
||||
public static final String KEY_URL_LIST = "urls";
|
||||
public static final String KEY_CURRENT = "current";
|
||||
}
|
||||
|
||||
@ -6,6 +6,12 @@ object RouteConsts {
|
||||
const val splashActivity = "/app/SplashScreenActivity"
|
||||
const val cleanApkActivity = "/app/cleanApkActivity"
|
||||
const val gameSubmissionActivity = "/app/gameSubmissionActivity"
|
||||
const val imageViewerActivity = "/app/imageViewerActivity"
|
||||
const val newsDetailActivity = "/app/newsDetailActivity"
|
||||
const val ratingReplyActivity = "/app/ratingReplyActivity"
|
||||
const val questionDetailActivity = "/app/questionDetailActivity"
|
||||
const val articleDetailActivity = "/app/articleDetailActivity"
|
||||
const val forumVideoDetailActivity = "/app/forumVideoDetailActivity"
|
||||
|
||||
const val aboutActivity = "/settings/AboutActivity"
|
||||
const val webActivity = "/setting/WebActivity"
|
||||
@ -62,6 +68,14 @@ object RouteConsts {
|
||||
const val gameDetail = "/services/gameDetail"
|
||||
const val packagesManager = "/services/packagesManager"
|
||||
const val adHelper = "/services/adHelper"
|
||||
const val commentUtils = "/services/commentUtils"
|
||||
const val subject = "/services/subject"
|
||||
const val messageDetail = "/services/messageDetail"
|
||||
const val commentDetail = "/services/commentDetail"
|
||||
const val newCommentDetail = "/services/newCommentDetail"
|
||||
const val simpleAnswerDetail = "/services/simpleAnswerDetail"
|
||||
const val gameCollectionDetail = "/services/gameCollectionDetail"
|
||||
|
||||
const val downloadButtonClickedHandler = "/downloadbutton/clickedHandler"
|
||||
|
||||
const val userManager = "/login/userManager"
|
||||
@ -85,6 +99,8 @@ object RouteConsts {
|
||||
const val adSdk = "/adSdk/adSdk"
|
||||
|
||||
const val oaid = "/oaid/oaid"
|
||||
|
||||
const val message = "/message/message"
|
||||
}
|
||||
|
||||
}
|
||||
@ -33,4 +33,40 @@ interface IDirectProvider : IProvider {
|
||||
fun directToHelpAndFeedback(context: Context, position: Int)
|
||||
|
||||
fun directToQqGroup(context: Context, groupNumber: String? = null): Boolean
|
||||
|
||||
fun directToHomeActivity(context: Context, userId: String?, entrance: String? = null, path: String? = null)
|
||||
|
||||
fun directToAnswerDetail(context: Context, id: String, entrance: String? = null, path: String? = null)
|
||||
|
||||
fun directToCommunityArticle(
|
||||
context: Context,
|
||||
articleId: String?,
|
||||
communityId: String?,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
)
|
||||
|
||||
fun directToVideoDetail(
|
||||
context: Context,
|
||||
videoId: String,
|
||||
entrance: String? = null,
|
||||
path: String? = ""
|
||||
)
|
||||
|
||||
fun directToAmway(
|
||||
context: Context,
|
||||
fixedTopAmwayCommentId: String? = null,
|
||||
entrance: String? = null,
|
||||
path: String? = ""
|
||||
)
|
||||
|
||||
fun directToOrderCenter(context: Context)
|
||||
|
||||
fun directToOrderDetail(context: Context, orderId: String)
|
||||
|
||||
fun directToEnergyRecord(context: Context, position: Int)
|
||||
|
||||
fun directToMyPrizePage(context: Context)
|
||||
|
||||
fun directToWinOrderDetail(context: Context, orderId: String, activityId: String)
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
package com.gh.gamecenter.core.provider
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface IMessageUnreadRepositoryProvider : IProvider {
|
||||
|
||||
fun loadMessageUnreadData()
|
||||
|
||||
}
|
||||
@ -1,10 +1,7 @@
|
||||
package com.gh.gamecenter.entity
|
||||
package com.gh.gamecenter.feature.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
|
||||
|
||||
/**
|
||||
@ -70,7 +67,7 @@ class MessageEntity {
|
||||
thumb = parcel.readString()
|
||||
communityId = parcel.readString()
|
||||
images = parcel.createStringArrayList() ?: arrayListOf()
|
||||
parcel.readTypedList(videos, Video.CREATOR)
|
||||
parcel.readTypedList(videos, Video)
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
@ -1,7 +1,6 @@
|
||||
package com.gh.gamecenter.entity
|
||||
package com.gh.gamecenter.feature.entity
|
||||
|
||||
import com.gh.gamecenter.common.utils.tryWithDefaultCatch
|
||||
import com.gh.gamecenter.feature.entity.UserEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import java.util.*
|
||||
|
||||
@ -11,4 +11,5 @@ interface IBindingAdaptersProvider : IProvider {
|
||||
|
||||
fun setGameTags(layout: LinearLayout, gameEntity: GameEntity)
|
||||
|
||||
fun setMessageUnread(view: TextView, unreadCount: Int)
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Parcelable
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface ICommentDetailProvider : IProvider {
|
||||
fun getIntent(context: Context, commentId: String? = "", message: Parcelable): Intent?
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.widget.TextView
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface ICommentUtilsProvider : IProvider {
|
||||
fun setCommentTime(textView: TextView, time: Long)
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface IGameCollectionDetailProvider : IProvider {
|
||||
fun getIntent(
|
||||
context: Context,
|
||||
gameCollectionId: String,
|
||||
isFromSquare: Boolean = false
|
||||
): Intent?
|
||||
|
||||
fun getSpecifiedCommentIntent(
|
||||
context: Context,
|
||||
gameCollectionId: String,
|
||||
topCommentId: String
|
||||
): Intent?
|
||||
}
|
||||
@ -19,4 +19,16 @@ interface IGameDetailProvider : IProvider {
|
||||
scrollToServer: Boolean = false,
|
||||
traceEvent: ExposureEvent? = null
|
||||
)
|
||||
|
||||
fun startGameDetailActivity(
|
||||
context: Context,
|
||||
gameId: String,
|
||||
entrance: String?,
|
||||
defaultTab: Int = -1,
|
||||
isSkipGameComment: Boolean = false,
|
||||
scrollToLibao: Boolean = false,
|
||||
openVideoStreaming: Boolean = false,
|
||||
openPlatformWindow: Boolean = false,
|
||||
traceEvent: ExposureEvent? = null
|
||||
)
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
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
|
||||
@ -44,4 +45,12 @@ interface ILinkDirectUtilsProvider : IProvider {
|
||||
)
|
||||
|
||||
fun directToSuggestion(context: Context, type: SuggestType, hiddenHint: String)
|
||||
|
||||
fun directToCommunityColumn(
|
||||
context: Context,
|
||||
community: CommunityEntity?,
|
||||
subjectId: String,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface IMessageDetailProvider : IProvider {
|
||||
fun getIntentById(
|
||||
context: Context,
|
||||
newsId: String,
|
||||
commentNum: Int,
|
||||
openSoftInput: Boolean,
|
||||
entrance: String
|
||||
): Intent?
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface IMessageProvider : IProvider {
|
||||
fun getIntent(context: Context, entrance: String): Intent
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
|
||||
interface IMessageUnreadRepositoryProvider : IProvider {
|
||||
|
||||
fun loadMessageUnreadData()
|
||||
|
||||
fun getUnreadLiveData(): MediatorLiveData<MessageUnreadEntity>?
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface INewCommentDetailProvider : IProvider {
|
||||
fun getAnswerCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
questionId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent?
|
||||
|
||||
fun getArticleCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
communityId: String,
|
||||
articleId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent?
|
||||
|
||||
fun getVideoCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
videoId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent?
|
||||
|
||||
fun getGameCollectionCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
gameCollectionId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent?
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface ISimpleAnswerDetailProvider : IProvider {
|
||||
fun getIntent(context: Context, answerId: String, entrance: String, path: String): Intent?
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.gh.gamecenter.feature.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface ISubjectProvider : IProvider {
|
||||
fun startSubjectActivity(
|
||||
context: Context,
|
||||
id: String?,
|
||||
name: String?,
|
||||
isOrder: Boolean,
|
||||
entrance: String?
|
||||
)
|
||||
}
|
||||
@ -81,6 +81,10 @@ class AppProviderImpl : IAppProvider {
|
||||
override fun logEvent(content: String) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun logCoreEvent() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,10 @@ class DirectProviderImpl : IDirectProvider {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToEnergyRecord")
|
||||
}
|
||||
|
||||
override fun directToEnergyRecord(context: Context, position: Int) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToEnergyRecord")
|
||||
}
|
||||
|
||||
override fun directToEnergyRulePage(context: Context) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToEnergyRulePage")
|
||||
}
|
||||
@ -70,6 +74,48 @@ class DirectProviderImpl : IDirectProvider {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun directToHomeActivity(context: Context, userId: String?, entrance: String?, path: String?) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToHomeActivity")
|
||||
}
|
||||
|
||||
override fun directToAnswerDetail(context: Context, id: String, entrance: String?, path: String?) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToAnswerDetail")
|
||||
}
|
||||
|
||||
override fun directToCommunityArticle(
|
||||
context: Context,
|
||||
articleId: String?,
|
||||
communityId: String?,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToCommunityArticle")
|
||||
}
|
||||
|
||||
override fun directToVideoDetail(context: Context, videoId: String, entrance: String?, path: String?) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToVideoDetail")
|
||||
}
|
||||
|
||||
override fun directToAmway(context: Context, fixedTopAmwayCommentId: String?, entrance: String?, path: String?) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToAmway")
|
||||
}
|
||||
|
||||
override fun directToOrderCenter(context: Context) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToOrderCenter")
|
||||
}
|
||||
|
||||
override fun directToOrderDetail(context: Context, orderId: String) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToOrderDetail")
|
||||
}
|
||||
|
||||
override fun directToMyPrizePage(context: Context) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToMyPrizePage")
|
||||
}
|
||||
|
||||
override fun directToWinOrderDetail(context: Context, orderId: String, activityId: String) {
|
||||
ToastUtils.toast("调用->DirectProviderImpl.directToWinOrderDetail")
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -4,11 +4,13 @@ import android.content.Context
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
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
|
||||
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feedback.view.suggest.SuggestionActivity
|
||||
|
||||
@Route(path = RouteConsts.provider.linkDirectUtils, name = "DirectUtils暴露服务,主要是暴露directToLinkPage方法")
|
||||
@ -117,6 +119,16 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
override fun directToCommunityColumn(
|
||||
context: Context,
|
||||
community: CommunityEntity?,
|
||||
subjectId: String,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
) {
|
||||
ToastUtils.toast("调用->LinkDirectUtilsProviderImpl.directToCommunityColumn")
|
||||
}
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
|
||||
@ -34,7 +34,7 @@ import com.gh.gamecenter.core.provider.IDataUtilsProvider;
|
||||
import com.gh.gamecenter.core.provider.IDownloadManagerProvider;
|
||||
import com.gh.gamecenter.core.provider.IErrorHelperProvider;
|
||||
import com.gh.gamecenter.core.provider.IGameSubstituteRepositoryProvider;
|
||||
import com.gh.gamecenter.core.provider.IMessageUnreadRepositoryProvider;
|
||||
import com.gh.gamecenter.feature.provider.IMessageUnreadRepositoryProvider;
|
||||
import com.gh.gamecenter.core.provider.IReservationRepositoryProvider;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
@ -244,9 +244,13 @@ public class UserRepository {
|
||||
userTokenHandle(response, loginTag);
|
||||
|
||||
IGameSubstituteRepositoryProvider gameSubstituteRepository = (IGameSubstituteRepositoryProvider) ARouter.getInstance().build(RouteConsts.provider.gameSubstituteRepository).navigation();
|
||||
gameSubstituteRepository.updateSubstitutableGames();
|
||||
if (gameSubstituteRepository != null) {
|
||||
gameSubstituteRepository.updateSubstitutableGames();
|
||||
}
|
||||
IWechatBindHelperProvider wechatBindHelper = (IWechatBindHelperProvider) ARouter.getInstance().build(RouteConsts.provider.wechatHelper).navigation();
|
||||
wechatBindHelper.getWechatConfig(null);
|
||||
if (wechatBindHelper != null) {
|
||||
wechatBindHelper.getWechatConfig(null);
|
||||
}
|
||||
|
||||
if (callback != null) {
|
||||
callback.onFirst(response);
|
||||
@ -449,14 +453,18 @@ public class UserRepository {
|
||||
|
||||
// 重启因为实名认证而处于等待中的任务
|
||||
IDownloadManagerProvider downloadManager = (IDownloadManagerProvider) ARouter.getInstance().build(RouteConsts.provider.downloadManager).navigation();
|
||||
downloadManager.resumeAllInvisiblePendingTask();
|
||||
if (downloadManager != null) {
|
||||
downloadManager.resumeAllInvisiblePendingTask();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception exception) {
|
||||
mEditObsResponseUserInfo.postValue(null);
|
||||
IErrorHelperProvider errorHelper = (IErrorHelperProvider) ARouter.getInstance().build(RouteConsts.provider.errorHelper).navigation();
|
||||
errorHelper.handleLoginError(HaloApp.getInstance(), (HttpException) exception, "", true);
|
||||
if (errorHelper != null) {
|
||||
errorHelper.handleLoginError(HaloApp.getInstance(), (HttpException) exception, "", true);
|
||||
}
|
||||
NewLogUtils.INSTANCE.logCertificationResult(isForcedToCertificate, 0);
|
||||
}
|
||||
});
|
||||
@ -502,7 +510,9 @@ public class UserRepository {
|
||||
userInfoHandle(response, false);
|
||||
|
||||
IReservationRepositoryProvider reservationRepository = (IReservationRepositoryProvider) ARouter.getInstance().build(RouteConsts.provider.reservationRepository).navigation();
|
||||
reservationRepository.refreshReservations();
|
||||
if (reservationRepository != null) {
|
||||
reservationRepository.refreshReservations();
|
||||
}
|
||||
|
||||
UserManager.getInstance().refreshUserRegulationTestStatus();
|
||||
|
||||
@ -511,7 +521,9 @@ public class UserRepository {
|
||||
EventBus.getDefault().post(new EBReuse(LOGIN_TAG));
|
||||
|
||||
IMessageUnreadRepositoryProvider messageUnreadRepository = (IMessageUnreadRepositoryProvider) ARouter.getInstance().build(RouteConsts.provider.messageUnreadRepository).navigation();
|
||||
messageUnreadRepository.loadMessageUnreadData();
|
||||
if (messageUnreadRepository != null) {
|
||||
messageUnreadRepository.loadMessageUnreadData();
|
||||
}
|
||||
}
|
||||
|
||||
if (UserManager.getInstance().getLoginTokenEntity() != null) {
|
||||
@ -533,7 +545,9 @@ public class UserRepository {
|
||||
mLoginObsResponseUserInfo.postValue(e);
|
||||
if (loginTag != null) {
|
||||
IErrorHelperProvider errorHelper = (IErrorHelperProvider) ARouter.getInstance().build(RouteConsts.provider.errorHelper).navigation();
|
||||
errorHelper.handleLoginError(mContext, e.getHttpException(), loginTag.toChinese(), false);
|
||||
if (errorHelper != null) {
|
||||
errorHelper.handleLoginError(mContext, e.getHttpException(), loginTag.toChinese(), false);
|
||||
}
|
||||
logout();
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ object LoginHelper {
|
||||
+ "friendships_groups_read,friendships_groups_write,statuses_to_me_read,"
|
||||
+ "follow_app_official_microblog," + "invitation_write") // weiboCode
|
||||
|
||||
private var mTencent: Tencent // QQ
|
||||
private var mTencent: Tencent? // QQ
|
||||
private var mIWXAPI: IWXAPI // 微信
|
||||
private lateinit var mWBAPI: IWBAPI // 微博
|
||||
|
||||
@ -59,8 +59,8 @@ object LoginHelper {
|
||||
val s = o.toString()
|
||||
Utils.log("QQLoginComplete::$s")
|
||||
try {
|
||||
mTencent.openId = o.getString("openid")
|
||||
mTencent.setAccessToken(
|
||||
mTencent?.openId = o.getString("openid")
|
||||
mTencent?.setAccessToken(
|
||||
o.getString("access_token"),
|
||||
o.getString("expires_in")
|
||||
)
|
||||
@ -140,16 +140,16 @@ object LoginHelper {
|
||||
@JvmStatic
|
||||
fun loginWithQQ(loginCallback: LoginCallback, activity: Activity) {
|
||||
mLoginCallback = loginCallback
|
||||
if (!mTencent.isSessionValid) {
|
||||
if (mTencent?.isSessionValid == false) {
|
||||
Utils.log("QQLogin")
|
||||
mTencent.login(activity, "all", mQqLoginListener)
|
||||
mTencent?.login(activity, "all", mQqLoginListener)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun logoutWithQQ() {
|
||||
if (mTencent.isSessionValid) {
|
||||
mTencent.logout(HaloApp.getInstance().applicationContext)
|
||||
if (mTencent?.isSessionValid == true) {
|
||||
mTencent?.logout(HaloApp.getInstance().applicationContext)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
module_message/.gitignore
vendored
Normal file
1
module_message/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
95
module_message/build.gradle
Normal file
95
module_message/build.gradle
Normal file
@ -0,0 +1,95 @@
|
||||
if (isRelease.toBoolean()) {
|
||||
apply plugin: 'com.android.library'
|
||||
} else {
|
||||
apply plugin: 'com.android.application'
|
||||
}
|
||||
apply plugin: 'org.jetbrains.kotlin.android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
if (!isRelease.toBoolean()) {
|
||||
applicationId "com.gh.message"
|
||||
multiDexEnabled true
|
||||
|
||||
buildConfigField "String", "API_HOST", "\"${API_HOST}\""
|
||||
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
|
||||
}
|
||||
|
||||
minSdk rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode rootProject.ext.versionCode
|
||||
versionName rootProject.ext.versionName
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
if (isRelease.toBoolean()) {
|
||||
manifest.srcFile 'src/main/AndroidManifest.xml'
|
||||
java {
|
||||
exclude 'manifest/**'
|
||||
}
|
||||
} else {
|
||||
java {
|
||||
srcDirs = ['src/main/java', "src/message/java"]
|
||||
}
|
||||
manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
|
||||
kapt {
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.name)
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
if (!isRelease.toBoolean()) {
|
||||
buildConfigField "String", "DEV_API_HOST", "\"${DEV_API_HOST}\""
|
||||
buildConfigField "String", "NEW_DEV_API_HOST", "\"${NEW_DEV_API_HOST}\""
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
consumerProguardFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||
kapt "com.alibaba:arouter-compiler:$arouterVersion"
|
||||
if (!isRelease.toBoolean()) {
|
||||
implementation "androidx.multidex:multidex:${multiDex}"
|
||||
}
|
||||
implementation(project(path: ":module_common")) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
implementation(project(path: ":module_login")) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
implementation(project(':module_core_feature')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
}
|
||||
21
module_message/proguard-rules.pro
vendored
Normal file
21
module_message/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,24 @@
|
||||
package com.gh.gamecenter.message
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.gh.gamecenter.message", appContext.packageName)
|
||||
}
|
||||
}
|
||||
27
module_message/src/main/AndroidManifest.xml
Normal file
27
module_message/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.gh.gamecenter.message">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name=".view.MessageActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".view.MessageKeFuActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".view.MessageVoteActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".view.MessageInviteActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -0,0 +1,43 @@
|
||||
package com.gh.gamecenter.message
|
||||
|
||||
import android.app.Application
|
||||
import android.content.res.Configuration
|
||||
import com.gh.gamecenter.core.iinterface.IApplication
|
||||
import com.google.auto.service.AutoService
|
||||
|
||||
@AutoService(IApplication::class)
|
||||
class HaloApp : IApplication {
|
||||
|
||||
override fun attachBaseContext() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun onCreate(application: Application) {
|
||||
mApp = application
|
||||
}
|
||||
|
||||
override fun onLowMemory() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun onTerminate() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun onTrimMemory(level: Int) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
companion object {
|
||||
private lateinit var mApp: Application
|
||||
|
||||
@JvmStatic
|
||||
fun getInstance(): Application {
|
||||
return mApp
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.entity
|
||||
package com.gh.gamecenter.message.entity
|
||||
|
||||
import com.gh.gamecenter.feature.entity.UserEntity
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.entity
|
||||
package com.gh.gamecenter.message.entity
|
||||
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.feature.entity.Auth
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.entity
|
||||
package com.gh.gamecenter.message.entity
|
||||
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
@ -0,0 +1,20 @@
|
||||
package com.gh.gamecenter.message.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.IMessageProvider
|
||||
import com.gh.gamecenter.message.view.MessageActivity
|
||||
|
||||
@Route(path = RouteConsts.provider.message, name = "MessageActivity暴露服务")
|
||||
class MessageProviderImpl : IMessageProvider {
|
||||
|
||||
override fun getIntent(context: Context, entrance: String): Intent {
|
||||
return MessageActivity.getIntent(context, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.gh.gamecenter.message.retrofit
|
||||
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity
|
||||
import com.gh.gamecenter.message.entity.*
|
||||
import io.reactivex.Observable
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.ResponseBody
|
||||
import retrofit2.http.*
|
||||
|
||||
interface ApiService {
|
||||
|
||||
@GET("users/{user_id}/messages")
|
||||
fun getMessage(
|
||||
@Path("user_id") user_id: String,
|
||||
@Query("view") type: String,
|
||||
@Query("timestamp") timestamp: Long,
|
||||
@Query("page") page: Int
|
||||
): Observable<List<MessageEntity>>
|
||||
|
||||
/**
|
||||
* 将消息删除
|
||||
*/
|
||||
@POST("users/{user_id}/messages/{message_id}:inactivate")
|
||||
fun deleteMessage(
|
||||
@Path("user_id") userId: String,
|
||||
@Path("message_id") messageId: String
|
||||
): Observable<ResponseBody>
|
||||
|
||||
/**
|
||||
* 将消息标记为已读
|
||||
*/
|
||||
@POST("users/{user_id}/messages/{message_id}:read")
|
||||
fun postMessageRead(
|
||||
@Path("user_id") userId: String,
|
||||
@Path("message_id") messageId: String,
|
||||
@Body body: RequestBody?
|
||||
): Observable<ResponseBody>
|
||||
|
||||
/**
|
||||
* 获取消息-客服数据
|
||||
*/
|
||||
@GET("users/{user_id}/private_messages")
|
||||
fun getMessageKeFuData(
|
||||
@Path("user_id") user_id: String,
|
||||
@Query("page") page: Int
|
||||
): Observable<List<MessageKeFuEntity>>
|
||||
|
||||
/**
|
||||
* 将消息删除
|
||||
*/
|
||||
@POST("users/{user_id}/private_messages/{message_id}:inactivate")
|
||||
fun deleteKaiFuMessage(
|
||||
@Path("user_id") userId: String,
|
||||
@Path("message_id") messageId: String
|
||||
): Observable<ResponseBody>
|
||||
|
||||
@GET("users/{user_id}/messages/{resource_id}/fold-list")
|
||||
fun getMessageFoldList(
|
||||
@Path("user_id") userId: String,
|
||||
@Path("resource_id") resourceId: String
|
||||
): Observable<List<MessageFold>>
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.gamecenter.message.retrofit
|
||||
|
||||
import com.gh.gamecenter.common.retrofit.BaseRetrofitManager
|
||||
import com.gh.gamecenter.common.utils.EnvHelper.getHost
|
||||
import com.gh.gamecenter.core.utils.SingletonHolder
|
||||
import com.gh.gamecenter.message.HaloApp
|
||||
|
||||
class RetrofitManager private constructor() : BaseRetrofitManager() {
|
||||
|
||||
val api: ApiService
|
||||
|
||||
init {
|
||||
val context = HaloApp.getInstance().applicationContext
|
||||
val okHttpNormalConfig = getOkHttpConfig(context, 0, 2)
|
||||
api = provideService(okHttpNormalConfig, getHost(), ApiService::class.java)
|
||||
}
|
||||
|
||||
companion object : SingletonHolder<RetrofitManager>(::RetrofitManager)
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.gh.gamecenter.message.utils
|
||||
|
||||
import com.gh.gamecenter.common.json.JsonObjectBuilder
|
||||
import com.gh.gamecenter.common.json.json
|
||||
import com.gh.gamecenter.common.loghub.LoghubUtils
|
||||
import com.gh.gamecenter.common.utils.LogUtils
|
||||
import com.lightgame.utils.Utils
|
||||
import org.json.JSONObject
|
||||
|
||||
object NewLogUtils {
|
||||
private const val KEY_EVENT = "event"
|
||||
private const val KEY_GAME_ID = "game_id"
|
||||
private const val KEY_CONTENT_ID = "content_id"
|
||||
|
||||
private const val LOG_STORE_EVENT = "event"
|
||||
|
||||
private fun log(jsonObject: JSONObject, logStore: String, uploadImmediately: Boolean = false) {
|
||||
Utils.log("NewLogUtils", jsonObject.toString(4))
|
||||
LoghubUtils.log(jsonObject, logStore, uploadImmediately)
|
||||
}
|
||||
|
||||
fun parseAndPutMeta(): JsonObjectBuilder.() -> Unit = {
|
||||
val meta = LogUtils.getMetaObject()
|
||||
val metaKeys = meta.keys()
|
||||
while (metaKeys.hasNext()) {
|
||||
val key: String = metaKeys.next().toString()
|
||||
val value = meta.getString(key)
|
||||
key to value
|
||||
}
|
||||
}
|
||||
|
||||
//点击消息中心-头部图标/赞同/系统图标
|
||||
@JvmStatic
|
||||
fun logMessageInformTopIconClick(
|
||||
isInform: Boolean,
|
||||
displayType: String,
|
||||
) {
|
||||
val json = json {
|
||||
KEY_EVENT to "message_inform_top_icon_click"
|
||||
"is_inform" to isInform
|
||||
"display_type" to displayType
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json, LOG_STORE_EVENT)
|
||||
}
|
||||
|
||||
//点击消息通知
|
||||
@JvmStatic
|
||||
fun logMessageInformClick(
|
||||
contentId: String,
|
||||
newsId: String,
|
||||
gameId: String,
|
||||
gameCollectionId: String,
|
||||
messageType: String
|
||||
) {
|
||||
val json = json {
|
||||
KEY_EVENT to "message_inform_click"
|
||||
KEY_CONTENT_ID to contentId
|
||||
"news_id" to newsId
|
||||
KEY_GAME_ID to gameId
|
||||
"game_collect_id" to gameCollectionId
|
||||
"message_type" to messageType
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json, LOG_STORE_EVENT)
|
||||
}
|
||||
|
||||
//点击消息通知信息用户头像/昵称
|
||||
@JvmStatic
|
||||
fun logMessageInformUserClick(event: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to event
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json, LOG_STORE_EVENT)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.gh.gamecenter.message.utils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class NewsUtils {
|
||||
public static String getFormattedTime(long time) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
try {
|
||||
long day = time * 1000;
|
||||
String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
format.applyPattern("yyyy");
|
||||
String currentYear = format.format(day);
|
||||
format.applyPattern("yyyyMMdd");
|
||||
long today = format.parse(format.format(new Date())).getTime();
|
||||
if (day >= today && day < today + 86400 * 1000) {
|
||||
long min = new Date().getTime() / 1000 - day / 1000;
|
||||
int hour = (int) (min / (60 * 60));
|
||||
if (hour == 0) {
|
||||
if (min < 60) {
|
||||
return "刚刚";
|
||||
} else {
|
||||
return (String.format(Locale.getDefault(), "%d分钟前", (int) (min / 60)));
|
||||
}
|
||||
} else {
|
||||
return (String.format(Locale.getDefault(), "%d小时前", hour));
|
||||
}
|
||||
} else if (day >= today - 86400 * 1000 && day < today) {
|
||||
format.applyPattern("HH:mm");
|
||||
return ("昨天 ");
|
||||
} else if (day >= today - 86400 * 1000 * 7 && day < today - 86400 * 1000) {
|
||||
format.applyPattern("HH:mm");
|
||||
long days = (today - day) / 86400000 + 1;
|
||||
return String.format(Locale.getDefault(), "%d天前 ", days);
|
||||
} else if (day < today - 86400 * 1000 * 7 && year.equals(currentYear)) {
|
||||
format.applyPattern("MM-dd");
|
||||
return (format.format(day));
|
||||
} else {
|
||||
format.applyPattern("yyyy-MM-dd");
|
||||
return (format.format(day));
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
format.applyPattern("yyyy-MM-dd");
|
||||
return (format.format(time * 1000));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.qa.dialog
|
||||
package com.gh.gamecenter.message.view
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
@ -9,14 +9,16 @@ 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.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
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
|
||||
import com.gh.gamecenter.core.provider.IDirectProvider
|
||||
import com.gh.gamecenter.message.databinding.DialogAskFollowMoreBinding
|
||||
import com.gh.gamecenter.message.databinding.ItemAskFollowMoreBinding
|
||||
import com.gh.gamecenter.message.utils.NewsUtils
|
||||
|
||||
class AskFollowMoreDialog : BaseDialogFragment() {
|
||||
|
||||
@ -77,7 +79,9 @@ class AskFollowMoreDialog : BaseDialogFragment() {
|
||||
binding.tvUsername.text = user.name
|
||||
binding.tvTime.text = NewsUtils.getFormattedTime(user.time ?: 0)
|
||||
binding.root.setOnClickListener {
|
||||
DirectUtils.directToHomeActivity(context, list[position].id, "问答-关注", path)
|
||||
val directUtils =
|
||||
ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
|
||||
directUtils?.directToHomeActivity(context, list[position].id, "问答-关注", path)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.gh.gamecenter.message.view
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter
|
||||
import com.gh.gamecenter.common.baselist.ListFragment
|
||||
import com.gh.gamecenter.common.utils.viewModelProvider
|
||||
import com.gh.gamecenter.core.utils.MtaHelper.onEvent
|
||||
import com.gh.gamecenter.message.R
|
||||
import com.gh.gamecenter.message.entity.MessageKeFuEntity
|
||||
|
||||
class KeFuFragment : ListFragment<MessageKeFuEntity, KeFuViewModel>() {
|
||||
private var mAdapter: KeFuFragmentAdapter? = null
|
||||
private var mUnreadViewModel: MessageUnreadViewModel? = null
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
setNavigationTitle("系统")
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mUnreadViewModel = viewModelProvider()
|
||||
}
|
||||
|
||||
override fun onLoadDone() {
|
||||
super.onLoadDone()
|
||||
mUnreadViewModel?.markRead(MessageUnreadViewModel.ReadType.SERVICE)
|
||||
}
|
||||
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
return if (mAdapter == null) KeFuFragmentAdapter(
|
||||
context,
|
||||
this,
|
||||
mListViewModel,
|
||||
mEntrance
|
||||
).also { mAdapter = it } else mAdapter!!
|
||||
}
|
||||
|
||||
override fun <LIST : Any?> onListClick(view: View?, position: Int, data: Any?) {
|
||||
if (view?.id == R.id.message_kaifu_item) {
|
||||
onEvent("消息中心", "系统_二级列表", "点击卡片")
|
||||
val keFuEntity: MessageKeFuEntity = data as MessageKeFuEntity
|
||||
if (!keFuEntity.isRead) {
|
||||
mListViewModel.postMessageRead(keFuEntity.id)
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,7 @@
|
||||
package com.gh.gamecenter.message;
|
||||
package com.gh.gamecenter.message.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
@ -13,37 +12,37 @@ import android.widget.TextView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
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.base.activity.BaseActivity;
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter;
|
||||
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.constant.ItemViewType;
|
||||
import com.gh.gamecenter.common.constant.RouteConsts;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity;
|
||||
import com.gh.gamecenter.entity.MessageLinkEntity;
|
||||
import com.gh.gamecenter.common.utils.DialogHelper;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.feature.provider.ICommentUtilsProvider;
|
||||
import com.gh.gamecenter.core.provider.IDirectProvider;
|
||||
import com.gh.gamecenter.feature.provider.ISubjectProvider;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.feature.exposure.ExposureSource;
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity;
|
||||
import com.gh.gamecenter.feature.provider.IGameDetailProvider;
|
||||
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider;
|
||||
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.gh.gamecenter.message.R;
|
||||
import com.gh.gamecenter.message.databinding.MessageKefuItemBinding;
|
||||
import com.gh.gamecenter.message.entity.MessageKeFuEntity;
|
||||
import com.gh.gamecenter.message.entity.MessageLinkEntity;
|
||||
import com.gh.gamecenter.message.utils.NewLogUtils;
|
||||
import com.google.android.flexbox.FlexboxLayout;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
@ -64,6 +63,12 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
|
||||
private int mImageSize;
|
||||
|
||||
private IDirectProvider mDirectUtils;
|
||||
|
||||
private ILinkDirectUtilsProvider mLinkDirectUtils;
|
||||
|
||||
private IGameDetailProvider mGameDetailProvider;
|
||||
|
||||
public KeFuFragmentAdapter(Context context, OnListClickListener listener, KeFuViewModel listViewModel, String entrance) {
|
||||
super(context);
|
||||
mListViewModel = listViewModel;
|
||||
@ -71,6 +76,10 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
mEntrance = entrance;
|
||||
|
||||
mImageSize = (mContext.getResources().getDisplayMetrics().widthPixels - DisplayUtils.dip2px(36)) / 3;
|
||||
|
||||
mDirectUtils = (IDirectProvider) ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation();
|
||||
mLinkDirectUtils = (ILinkDirectUtilsProvider) ARouter.getInstance().build(RouteConsts.provider.linkDirectUtils).navigation();
|
||||
mGameDetailProvider = (IGameDetailProvider) ARouter.getInstance().build(RouteConsts.provider.gameDetail).navigation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -135,11 +144,11 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
draweeView.setImageURI(image);
|
||||
int finalI = i;
|
||||
draweeView.setOnClickListener(v -> {
|
||||
Intent intent = ImageViewerActivity.getIntent(mContext,
|
||||
(ArrayList<String>) images,
|
||||
finalI,
|
||||
"(消息中心-系统)");
|
||||
mContext.startActivity(intent);
|
||||
ARouter.getInstance().build(RouteConsts.activity.imageViewerActivity)
|
||||
.withStringArrayList(EntranceConsts.KEY_URL_LIST, (ArrayList<String>) images)
|
||||
.withInt(EntranceConsts.KEY_CURRENT, finalI)
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, "(消息中心-系统)")
|
||||
.navigation();
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击图片");
|
||||
});
|
||||
|
||||
@ -243,7 +252,10 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
viewHolder.binding.messageUserBadge.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
CommentUtils.setCommentTime(viewHolder.binding.messageKefuTime, keFuEntity.getTime());
|
||||
ICommentUtilsProvider commentUtilsProvider = (ICommentUtilsProvider) ARouter.getInstance().build(RouteConsts.provider.commentUtils).navigation();
|
||||
if (commentUtilsProvider != null) {
|
||||
commentUtilsProvider.setCommentTime(viewHolder.binding.messageKefuTime, keFuEntity.getTime());
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(keFuEntity.getSuggestion())) {
|
||||
StringBuffer suggest = new StringBuffer();
|
||||
@ -262,15 +274,15 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
}
|
||||
|
||||
viewHolder.binding.messageKefuIcon.setOnClickListener(v -> {
|
||||
if (serviceEntity != null) {
|
||||
if (serviceEntity != null && mDirectUtils != null) {
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击头像");
|
||||
DirectUtils.directToHomeActivity(mContext, serviceEntity.getId(), mEntrance, "消息中心-系统");
|
||||
mDirectUtils.directToHomeActivity(mContext, serviceEntity.getId(), mEntrance, "消息中心-系统");
|
||||
}
|
||||
});
|
||||
viewHolder.binding.messageKefuName.setOnClickListener(v -> {
|
||||
if (serviceEntity != null) {
|
||||
if (serviceEntity != null && mDirectUtils != null) {
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击名字");
|
||||
DirectUtils.directToHomeActivity(mContext, serviceEntity.getId(), mEntrance, "消息中心-系统");
|
||||
mDirectUtils.directToHomeActivity(mContext, serviceEntity.getId(), mEntrance, "消息中心-系统");
|
||||
}
|
||||
});
|
||||
|
||||
@ -307,115 +319,119 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
}
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击链接");
|
||||
|
||||
if (mDirectUtils == null || mLinkDirectUtils == null || mGameDetailProvider == null) return;
|
||||
|
||||
switch (type) {
|
||||
case "游戏":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
GameDetailActivity.startGameDetailActivity(mContext, data.getId(), "", null);
|
||||
mGameDetailProvider.startGameDetailActivity(mContext, data.getId(), "", null);
|
||||
}
|
||||
break;
|
||||
case "QQ号":
|
||||
if (!TextUtils.isEmpty(data.getQq())) {
|
||||
DirectUtils.directToQqConversation(mContext, data.getQq());
|
||||
mDirectUtils.directToQqConversation(mContext, data.getQq());
|
||||
}
|
||||
break;
|
||||
case "web":
|
||||
if (!TextUtils.isEmpty(data.getUrl())) {
|
||||
DirectUtils.directToWebView(mContext, data.getUrl(), "(消息-公告)");
|
||||
mDirectUtils.directToWebView(mContext, data.getUrl(), "(消息-公告)");
|
||||
}
|
||||
break;
|
||||
case "QQ群":
|
||||
if (!TextUtils.isEmpty(data.getKey())) {
|
||||
DirectUtils.directToQqGroup(mContext, data.getKey());
|
||||
mDirectUtils.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);
|
||||
ARouter.getInstance().build(RouteConsts.activity.newsDetailActivity)
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, "(消息-公告)")
|
||||
.withString(EntranceConsts.KEY_NEWSID, data.getId())
|
||||
.navigation();
|
||||
}
|
||||
break;
|
||||
case "专题":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
SubjectActivity.startSubjectActivity(mContext, data.getId()
|
||||
, null, false, null, "(消息-客服)");
|
||||
ISubjectProvider subjectProvider = (ISubjectProvider) ARouter.getInstance().build(RouteConsts.provider.subject).navigation();
|
||||
if (!TextUtils.isEmpty(data.getId()) && subjectProvider != null) {
|
||||
subjectProvider.startSubjectActivity(mContext, data.getId(), null, false, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "7moor":
|
||||
if (mContext instanceof Activity) {
|
||||
// 去掉七陌支持,跳转到企点
|
||||
// ImManager.startChatActivity((Activity) mContext, null, null);
|
||||
DirectUtils.directToWebView(mContext, Constants.TENCENT_QIDIAN_ADDRESS, mEntrance);
|
||||
mDirectUtils.directToWebView(mContext, Constants.TENCENT_QIDIAN_ADDRESS, mEntrance);
|
||||
}
|
||||
break;
|
||||
case "问题":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
mContext.startActivity(NewQuestionDetailActivity.getIntent(mContext, data.getId(), mEntrance, "(消息-客服)"));
|
||||
ARouter.getInstance().build(RouteConsts.activity.questionDetailActivity)
|
||||
.withString(EntranceConsts.KEY_QUESTIONS_ID, data.getId())
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(mEntrance, "(消息-客服)"))
|
||||
.navigation();
|
||||
}
|
||||
break;
|
||||
case "回答":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
DirectUtils.directToAnswerDetail(mContext, data.getId(), mEntrance, "(消息-客服)");
|
||||
mDirectUtils.directToAnswerDetail(mContext, data.getId(), mEntrance, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "社区文章":
|
||||
if (!TextUtils.isEmpty(data.getId()) && data.getCommunity() != null) {
|
||||
DirectUtils.directToCommunityArticle(mContext, data.getId(), data.getCommunity().getId(), mEntrance, "(消息-客服)");
|
||||
mDirectUtils.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, "(消息-客服)");
|
||||
mLinkDirectUtils.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, "系统_二级列表", "");
|
||||
mDirectUtils.directToVideoDetail(mContext, data.getId(), mEntrance, "系统_二级列表");
|
||||
}
|
||||
break;
|
||||
case "安利墙评论":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
MtaHelper.onEvent("安利墙", "进入", "消息中心");
|
||||
DirectUtils.directToAmway(mContext, data.getId(), mEntrance, "(消息-客服)");
|
||||
mDirectUtils.directToAmway(mContext, data.getId(), mEntrance, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "个人主页":
|
||||
DirectUtils.directToHomeActivity(mContext, UserManager.getInstance().getUserId(), mEntrance, "(消息-客服)");
|
||||
mDirectUtils.directToHomeActivity(mContext, UserManager.getInstance().getUserId(), mEntrance, "(消息-客服)");
|
||||
break;
|
||||
case "游戏详情评论":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
GameDetailActivity.startGameDetailActivity(mContext, data.getId(), "", -1, true, false, false, false, null);
|
||||
mGameDetailProvider.startGameDetailActivity(mContext, data.getId(), "", -1, true, false, false, false, null);
|
||||
}
|
||||
break;
|
||||
case "订单中心":
|
||||
DirectUtils.directToOrderCenter(mContext);
|
||||
mDirectUtils.directToOrderCenter(mContext);
|
||||
break;
|
||||
case "订单详情":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
DirectUtils.directToOrderDetail(mContext, data.getId());
|
||||
mDirectUtils.directToOrderDetail(mContext, data.getId());
|
||||
}
|
||||
break;
|
||||
case "光能记录":
|
||||
case "光能记录获取":
|
||||
DirectUtils.directToEnergyRecord(mContext);
|
||||
mDirectUtils.directToEnergyRecord(mContext, 0);
|
||||
break;
|
||||
case "光能记录使用":
|
||||
DirectUtils.directToEnergyRecord(mContext, 1);
|
||||
mDirectUtils.directToEnergyRecord(mContext, 1);
|
||||
break;
|
||||
case "抽奖中心":
|
||||
DirectUtils.directToLotteryParadisePage(mContext);
|
||||
mDirectUtils.directToLotteryParadisePage(mContext);
|
||||
break;
|
||||
case "我的奖品":
|
||||
DirectUtils.directToMyPrizePage(mContext);
|
||||
mDirectUtils.directToMyPrizePage(mContext);
|
||||
break;
|
||||
case "兑换商品":
|
||||
DirectUtils.directToExchangeCommodityPage(mContext);
|
||||
mDirectUtils.directToExchangeCommodityPage(mContext);
|
||||
break;
|
||||
case "中奖订单详情":
|
||||
if (!TextUtils.isEmpty(data.getId()) && !TextUtils.isEmpty(data.getActivityId())) {
|
||||
DirectUtils.directToWinOrderDetail(mContext, data.getId(), data.getActivityId());
|
||||
mDirectUtils.directToWinOrderDetail(mContext, data.getId(), data.getActivityId());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -431,7 +447,7 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
entity.setText(data.getDocument());
|
||||
}
|
||||
entity.setCommunity(data.getCommunity());
|
||||
DirectUtils.directToLinkPage(mContext, entity, mEntrance, "(消息-客服)");
|
||||
mLinkDirectUtils.directToLinkPage(mContext, entity, mEntrance, "(消息-客服)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -444,54 +460,58 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
}
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击链接");
|
||||
|
||||
if (mDirectUtils == null || mLinkDirectUtils == null) return;
|
||||
|
||||
switch (type) {
|
||||
case "home":
|
||||
DirectUtils.directToHomeActivity(mContext, UserManager.getInstance().getUserId(), mEntrance, "(消息-客服)");
|
||||
mDirectUtils.directToHomeActivity(mContext, UserManager.getInstance().getUserId(), mEntrance, "(消息-客服)");
|
||||
break;
|
||||
case "7moor":
|
||||
case "qidian":
|
||||
DirectUtils.directToWebView(mContext, Constants.TENCENT_QIDIAN_ADDRESS, mEntrance);
|
||||
mDirectUtils.directToWebView(mContext, Constants.TENCENT_QIDIAN_ADDRESS, mEntrance);
|
||||
break;
|
||||
case "order_center":
|
||||
DirectUtils.directToOrderCenter(mContext);
|
||||
mDirectUtils.directToOrderCenter(mContext);
|
||||
break;
|
||||
case "order_detail":
|
||||
if (!TextUtils.isEmpty(data.getLink())) {
|
||||
DirectUtils.directToOrderDetail(mContext, data.getLink());
|
||||
mDirectUtils.directToOrderDetail(mContext, data.getLink());
|
||||
}
|
||||
break;
|
||||
case "energy_record":
|
||||
case "energy_record_get":
|
||||
DirectUtils.directToEnergyRecord(mContext);
|
||||
mDirectUtils.directToEnergyRecord(mContext, 0);
|
||||
break;
|
||||
case "energy_record_cost":
|
||||
DirectUtils.directToEnergyRecord(mContext, 1);
|
||||
mDirectUtils.directToEnergyRecord(mContext, 1);
|
||||
break;
|
||||
case "raffle_center":
|
||||
DirectUtils.directToLotteryParadisePage(mContext);
|
||||
mDirectUtils.directToLotteryParadisePage(mContext);
|
||||
break;
|
||||
case "raffle_prize":
|
||||
DirectUtils.directToMyPrizePage(mContext);
|
||||
mDirectUtils.directToMyPrizePage(mContext);
|
||||
break;
|
||||
case "exchange_commodity":
|
||||
DirectUtils.directToExchangeCommodityPage(mContext);
|
||||
mDirectUtils.directToExchangeCommodityPage(mContext);
|
||||
break;
|
||||
case "win_order_detail":
|
||||
if (!TextUtils.isEmpty(data.getLink()) && !TextUtils.isEmpty(data.getActivityId())) {
|
||||
DirectUtils.directToWinOrderDetail(mContext, data.getLink(), data.getActivityId());
|
||||
mDirectUtils.directToWinOrderDetail(mContext, data.getLink(), data.getActivityId());
|
||||
}
|
||||
break;
|
||||
case "game_comment_detail":
|
||||
mContext.startActivity(RatingReplyActivity.getSimpleIntent(
|
||||
mContext,
|
||||
data.getGameId(),
|
||||
data.getLink(),
|
||||
new ExposureSource("消息中心", ""),
|
||||
"消息中心-系统消息",
|
||||
""));
|
||||
ExposureSource exposureSource = new ExposureSource("消息中心", "");
|
||||
ArrayList<ExposureSource> exposureSourceList = new ArrayList<>();
|
||||
exposureSourceList.add(exposureSource);
|
||||
ARouter.getInstance().build(RouteConsts.activity.ratingReplyActivity)
|
||||
.withString(EntranceConsts.KEY_GAMEID, data.getGameId())
|
||||
.withString(EntranceConsts.KEY_COMMENTID, data.getLink())
|
||||
.withString(EntranceConsts.KEY_EXPOSURE_SOURCE, GsonUtils.toJson(exposureSourceList))
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, "消息中心-系统消息")
|
||||
.navigation();
|
||||
break;
|
||||
default:
|
||||
DirectUtils.directToLinkPage(mContext, data, mEntrance, "(消息-客服)");
|
||||
mLinkDirectUtils.directToLinkPage(mContext, data, mEntrance, "(消息-客服)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
package com.gh.gamecenter.message;
|
||||
package com.gh.gamecenter.message.view;
|
||||
|
||||
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;
|
||||
import com.gh.gamecenter.message.databinding.MessageKefuItemBinding;
|
||||
import com.gh.gamecenter.message.entity.MessageKeFuEntity;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/10.
|
||||
@ -1,11 +1,11 @@
|
||||
package com.gh.gamecenter.message
|
||||
package com.gh.gamecenter.message.view
|
||||
|
||||
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 com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.message.entity.MessageKeFuEntity
|
||||
import com.gh.gamecenter.message.retrofit.RetrofitManager
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
@ -15,9 +15,10 @@ import okhttp3.ResponseBody
|
||||
import org.json.JSONObject
|
||||
|
||||
class KeFuViewModel(application: Application) : ListViewModel<MessageKeFuEntity, MessageKeFuEntity>(application) {
|
||||
private val mApi = RetrofitManager.getInstance().api
|
||||
|
||||
override fun provideDataObservable(page: Int): Observable<MutableList<MessageKeFuEntity>>? {
|
||||
return RetrofitManager.getInstance().api.getMessageKeFuData(UserManager.getInstance().userId, page)
|
||||
override fun provideDataObservable(page: Int): Observable<List<MessageKeFuEntity>> {
|
||||
return mApi.getMessageKeFuData(UserManager.getInstance().userId, page)
|
||||
}
|
||||
|
||||
override fun mergeResultLiveData() {
|
||||
@ -50,8 +51,7 @@ class KeFuViewModel(application: Application) : ListViewModel<MessageKeFuEntity,
|
||||
}
|
||||
|
||||
fun deleteMessage(messageId: String) {
|
||||
RetrofitManager.getInstance().api
|
||||
.deleteKaiFuMessage(UserManager.getInstance().userId, messageId)
|
||||
mApi.deleteKaiFuMessage(UserManager.getInstance().userId, messageId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
@ -0,0 +1,42 @@
|
||||
package com.gh.gamecenter.message.view
|
||||
|
||||
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.updateStatusBarColor
|
||||
import com.gh.gamecenter.message.R
|
||||
|
||||
class MessageActivity : ToolBarActivity() {
|
||||
override fun provideNormalIntent(): Intent {
|
||||
return getTargetIntent(
|
||||
this,
|
||||
MessageActivity::class.java,
|
||||
MessageFragment::class.java,
|
||||
intent?.extras
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
updateStatusBarColor(R.color.background_white, R.color.background_white)
|
||||
}
|
||||
|
||||
override fun onDarkModeChanged() {
|
||||
super.onDarkModeChanged()
|
||||
updateStatusBarColor(R.color.background_white, R.color.background_white)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, entrance: String): Intent {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
return getTargetIntent(
|
||||
context,
|
||||
MessageActivity::class.java,
|
||||
MessageFragment::class.java, bundle
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,163 @@
|
||||
package com.gh.gamecenter.message.view
|
||||
|
||||
import android.content.Context
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter
|
||||
import com.gh.gamecenter.common.callback.OnListClickListener
|
||||
import com.gh.gamecenter.common.constant.ItemViewType
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.DialogHelper.showDialog
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.feature.provider.IBindingAdaptersProvider
|
||||
import com.gh.gamecenter.message.R
|
||||
|
||||
class MessageAdapter(
|
||||
context: Context,
|
||||
private val mClickListener: OnListClickListener,
|
||||
private val mEntrance: String,
|
||||
private val mViewModel: MessageNormalViewModel
|
||||
) : ListAdapter<MessageEntity>(context) {
|
||||
|
||||
private var mUnreadEntity: MessageUnreadEntity? = null
|
||||
|
||||
override fun setListData(updateData: List<MessageEntity>) {
|
||||
var oldSize = TOP_ITEM_COUNT
|
||||
if (mEntityList != null && mEntityList.size > 0) {
|
||||
oldSize += mEntityList.size
|
||||
}
|
||||
mEntityList = ArrayList<MessageEntity>(updateData)
|
||||
if (oldSize == TOP_ITEM_COUNT || oldSize > updateData.size) {
|
||||
notifyDataSetChanged()
|
||||
} else {
|
||||
notifyItemRangeInserted(oldSize, updateData.size + TOP_ITEM_COUNT - oldSize)
|
||||
}
|
||||
}
|
||||
|
||||
fun setMessageUnreadData(unreadEntity: MessageUnreadEntity) {
|
||||
mUnreadEntity = unreadEntity
|
||||
notifyItemChanged(0)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
return when (viewType) {
|
||||
ItemViewType.ITEM_HEADER -> MessageTopViewHolder(parent.toBinding(), mClickListener)
|
||||
|
||||
ItemViewType.ITEM_FOOTER -> FooterViewHolder(
|
||||
mLayoutInflater.inflate(
|
||||
R.layout.refresh_footerview,
|
||||
parent,
|
||||
false
|
||||
), mClickListener
|
||||
)
|
||||
|
||||
else -> MessageItemViewHolder(parent.toBinding(), mClickListener, "消息_一级列表")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
when (getItemViewType(position)) {
|
||||
ItemViewType.ITEM_HEADER -> {
|
||||
val topViewHolder: MessageTopViewHolder =
|
||||
holder as MessageTopViewHolder
|
||||
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.background = ContextCompat.getDrawable(
|
||||
mContext,
|
||||
R.drawable.reuse_listview_item_style
|
||||
)
|
||||
topViewHolder.mBinding.messageService.background = ContextCompat.getDrawable(
|
||||
mContext,
|
||||
R.drawable.reuse_listview_item_style
|
||||
)
|
||||
topViewHolder.mBinding.messageInvite.background = ContextCompat.getDrawable(
|
||||
mContext,
|
||||
R.drawable.reuse_listview_item_style
|
||||
)
|
||||
if (mUnreadEntity != null) {
|
||||
val provider = ARouter.getInstance().build(RouteConsts.provider.bindingAdapters)
|
||||
.navigation() as? IBindingAdaptersProvider
|
||||
provider?.setMessageUnread(topViewHolder.mBinding.unreadVote, mUnreadEntity!!.getVoteCount())
|
||||
topViewHolder.mBinding.unreadVote.goneIf(mUnreadEntity!!.getVoteCount() == 0)
|
||||
provider?.setMessageUnread(
|
||||
topViewHolder.mBinding.unreadInvite,
|
||||
mUnreadEntity!!.invited + mUnreadEntity!!.systemInvited
|
||||
)
|
||||
topViewHolder.mBinding.unreadInvite.goneIf(mUnreadEntity!!.invited + mUnreadEntity!!.systemInvited == 0)
|
||||
provider?.setMessageUnread(topViewHolder.mBinding.unreadService, mUnreadEntity!!.service)
|
||||
topViewHolder.mBinding.unreadService.goneIf(mUnreadEntity!!.service == 0)
|
||||
}
|
||||
}
|
||||
|
||||
ItemViewType.ITEM_BODY -> {
|
||||
val viewHolder: MessageItemViewHolder =
|
||||
holder as MessageItemViewHolder
|
||||
val entity: MessageEntity = mEntityList[position - TOP_ITEM_COUNT]
|
||||
viewHolder.setMessageItem(entity, mContext, mEntrance)
|
||||
viewHolder.itemView.setOnLongClickListener {
|
||||
showDialog(
|
||||
mContext,
|
||||
"删除消息",
|
||||
"消息删除将不可恢复,确定删除吗?",
|
||||
"确定",
|
||||
"取消",
|
||||
{ mViewModel.deleteMessage(entity.id) },
|
||||
{},
|
||||
true,
|
||||
"消息中心",
|
||||
"消息列表-删除"
|
||||
)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
ItemViewType.ITEM_FOOTER -> {
|
||||
val footerViewHolder = holder as FooterViewHolder
|
||||
footerViewHolder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver)
|
||||
footerViewHolder.initItemPadding()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return when (position) {
|
||||
0 -> {
|
||||
ItemViewType.ITEM_HEADER
|
||||
}
|
||||
|
||||
itemCount - 1 -> {
|
||||
ItemViewType.ITEM_FOOTER
|
||||
}
|
||||
|
||||
else -> {
|
||||
ItemViewType.ITEM_BODY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return if (mEntityList == null || mEntityList.isEmpty()) TOP_ITEM_COUNT else mEntityList.size + FOOTER_ITEM_COUNT + TOP_ITEM_COUNT
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
package com.gh.gamecenter.message.view
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
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.common.utils.ifLogin
|
||||
import com.gh.gamecenter.common.utils.toDrawable
|
||||
import com.gh.gamecenter.common.utils.viewModelProvider
|
||||
import com.gh.gamecenter.common.view.CustomDividerItemDecoration
|
||||
import com.gh.gamecenter.core.utils.MtaHelper.onEvent
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.message.HaloApp
|
||||
import com.gh.gamecenter.message.R
|
||||
import com.gh.gamecenter.message.utils.NewLogUtils
|
||||
|
||||
class MessageFragment : ListFragment<MessageEntity, MessageNormalViewModel>() {
|
||||
private var mAdapter: MessageAdapter? = null
|
||||
|
||||
private var mUnreadViewModel: MessageUnreadViewModel? = null
|
||||
|
||||
private var mUnreadEntity: MessageUnreadEntity? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mUnreadViewModel = viewModelProvider()
|
||||
if (savedInstanceState != null) {
|
||||
mUnreadViewModel?.retry()
|
||||
}
|
||||
mUnreadViewModel?.unreadLiveData?.observe(this) { messageUnread: MessageUnreadEntity ->
|
||||
mUnreadEntity = messageUnread
|
||||
provideListAdapter().setMessageUnreadData(messageUnread)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setNavigationTitle(getString(R.string.title_message_center))
|
||||
|
||||
ifLogin("") {}
|
||||
}
|
||||
|
||||
override fun provideListViewModel(): MessageNormalViewModel {
|
||||
val factory: MessageNormalViewModel.Factory = MessageNormalViewModel.Factory(HaloApp.getInstance(), "default")
|
||||
return ViewModelProviders.of(this, factory).get(MessageNormalViewModel::class.java)
|
||||
}
|
||||
|
||||
override fun provideListAdapter(): MessageAdapter {
|
||||
return mAdapter ?: MessageAdapter(requireContext(), this, mEntrance, mListViewModel).also { mAdapter = it }
|
||||
}
|
||||
|
||||
override fun getItemDecoration(): RecyclerView.ItemDecoration? {
|
||||
val decoration = CustomDividerItemDecoration(requireContext(), false, true, false, false)
|
||||
R.drawable.divider_item_line_space_16_h_1px.toDrawable(requireContext())?.let { decoration.setDrawable(it) }
|
||||
mItemDecoration = decoration
|
||||
return mItemDecoration
|
||||
}
|
||||
|
||||
override fun onLoadEmpty() {
|
||||
super.onLoadDone()
|
||||
mAdapter!!.loadChange(LoadStatus.LIST_OVER)
|
||||
mReuseNoData!!.visibility = View.VISIBLE
|
||||
mReuseNoData!!.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.transparent))
|
||||
}
|
||||
|
||||
override fun onLoadError() {
|
||||
super.onLoadDone()
|
||||
mAdapter!!.loadChange(LoadStatus.LIST_FAILED)
|
||||
}
|
||||
|
||||
override fun <LIST : Any?> onListClick(view: View?, position: Int, data: Any?) {
|
||||
when (view?.id) {
|
||||
R.id.footerview_item -> {
|
||||
if (mAdapter!!.isNetworkError) {
|
||||
mListViewModel.load(LoadType.RETRY)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
R.id.message_vote -> {
|
||||
onEvent("消息中心", "二级入口", "赞同")
|
||||
NewLogUtils.logMessageInformTopIconClick(mUnreadEntity?.getVoteCount() != 0, "赞同")
|
||||
startActivity(
|
||||
MessageVoteActivity.getIntent(
|
||||
requireContext(),
|
||||
MessageNormalFragment.MESSAGE_TYPE_VOTE,
|
||||
"赞同_二级列表",
|
||||
mEntrance
|
||||
)
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
R.id.message_invite -> {
|
||||
onEvent("消息中心", "二级入口", "邀请")
|
||||
NewLogUtils.logMessageInformTopIconClick(
|
||||
(mUnreadEntity?.invited ?: 0) + (mUnreadEntity?.systemInvited ?: 0) != 0,
|
||||
"邀请"
|
||||
)
|
||||
startActivity(
|
||||
MessageInviteActivity.getIntent(
|
||||
requireContext(),
|
||||
MessageNormalFragment.MESSAGE_TYPE_INVITE,
|
||||
"邀请_二级列表",
|
||||
mEntrance
|
||||
)
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
R.id.message_service -> {
|
||||
onEvent("消息中心", "二级入口", "系统")
|
||||
NewLogUtils.logMessageInformTopIconClick(mUnreadEntity?.service != 0, "系统")
|
||||
startActivity(MessageKeFuActivity.getIntent(requireContext(), mEntrance))
|
||||
return
|
||||
}
|
||||
}
|
||||
val entity: MessageEntity = data as MessageEntity
|
||||
val path = "我的光环-消息中心-列表"
|
||||
MessageItemViewHolder.messageItemClickSkip(
|
||||
view,
|
||||
entity,
|
||||
mEntrance,
|
||||
"消息_一级列表",
|
||||
path
|
||||
)
|
||||
if (!entity.read) {
|
||||
mListViewModel.postMessageRead(entity.id, entity.type)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.gh.gamecenter.message.view
|
||||
|
||||
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.updateStatusBarColor
|
||||
import com.gh.gamecenter.message.R
|
||||
|
||||
class MessageInviteActivity : ToolBarActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
updateStatusBarColor(R.color.background_white, R.color.background_white)
|
||||
}
|
||||
|
||||
override fun onDarkModeChanged() {
|
||||
super.onDarkModeChanged()
|
||||
updateStatusBarColor(R.color.background_white, R.color.background_white)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, messageType: String, outerInfo: String, entrance: String): Intent {
|
||||
val bundle = 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.java,
|
||||
MessageNormalFragment::class.java, bundle
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.message;
|
||||
package com.gh.gamecenter.message.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -11,45 +11,42 @@ import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.gh.common.util.NewLogUtils;
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity;
|
||||
import com.gh.common.databind.BindingAdapters;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.core.utils.ClickUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.gamecenter.CommentDetailActivity;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.MessageDetailActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder;
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity;
|
||||
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout;
|
||||
import com.gh.gamecenter.common.callback.OnListClickListener;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.databinding.MessageItemBinding;
|
||||
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.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.gh.gamecenter.entity.MessageFold;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.core.provider.IWebProvider;
|
||||
import com.gh.gamecenter.core.utils.ClickUtils;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity;
|
||||
import com.gh.gamecenter.feature.entity.Questions;
|
||||
import com.gh.gamecenter.feature.entity.UserEntity;
|
||||
import com.gh.gamecenter.feature.exposure.ExposureSource;
|
||||
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity;
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity;
|
||||
import com.gh.gamecenter.feature.provider.ICommentDetailProvider;
|
||||
import com.gh.gamecenter.core.provider.IDirectProvider;
|
||||
import com.gh.gamecenter.feature.provider.IGameCollectionDetailProvider;
|
||||
import com.gh.gamecenter.feature.provider.IGameDetailProvider;
|
||||
import com.gh.gamecenter.feature.provider.IMessageDetailProvider;
|
||||
import com.gh.gamecenter.feature.provider.INewCommentDetailProvider;
|
||||
import com.gh.gamecenter.feature.provider.ISimpleAnswerDetailProvider;
|
||||
import com.gh.gamecenter.login.user.UserManager;
|
||||
import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity;
|
||||
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity;
|
||||
import com.gh.gamecenter.qa.comment.NewCommentDetailActivity;
|
||||
import com.gh.gamecenter.feature.entity.Questions;
|
||||
import com.gh.gamecenter.qa.dialog.AskFollowMoreDialog;
|
||||
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity;
|
||||
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel;
|
||||
import com.gh.gamecenter.message.R;
|
||||
import com.gh.gamecenter.message.databinding.MessageItemBinding;
|
||||
import com.gh.gamecenter.message.entity.MessageFold;
|
||||
import com.gh.gamecenter.message.retrofit.RetrofitManager;
|
||||
import com.gh.gamecenter.message.utils.NewLogUtils;
|
||||
import com.gh.gamecenter.message.utils.NewsUtils;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -61,8 +58,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.HttpException;
|
||||
|
||||
import static com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity.LABEL_REGEX;
|
||||
|
||||
/**
|
||||
* Created by khy on 23/03/18.
|
||||
*/
|
||||
@ -73,6 +68,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
// 外层信息,MTA 用
|
||||
private String mOuterInfo;
|
||||
|
||||
private final static String LABEL_REGEX = "<tag>(\\S+)</tag>([\\S\\s\n]+)";
|
||||
|
||||
public MessageItemViewHolder(MessageItemBinding binding,
|
||||
OnListClickListener listClickListener,
|
||||
String outerInfo) {
|
||||
@ -99,7 +96,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
} else {
|
||||
mBinding.messageUserIcon.display(messageEntity.getUserEntity().getBorder(), messageEntity.getUserEntity().getIcon(), null);
|
||||
}
|
||||
BindingAdapters.showHide(mBinding.messageUnread, !messageEntity.getRead());
|
||||
ExtensionsKt.goneIf(mBinding.messageUnread, messageEntity.getRead());
|
||||
mBinding.messageUserName.setText(messageEntity.getUserEntity().getName());
|
||||
|
||||
|
||||
@ -554,6 +551,8 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
mBinding.messageOriginal.setLayoutParams(params);
|
||||
});
|
||||
|
||||
IDirectProvider directUtils = (IDirectProvider) ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation();
|
||||
|
||||
mBinding.messageUserMore.setOnClickListener(v -> {
|
||||
MessageEntity.Fold fold = messageEntity.getFold();
|
||||
if (fold != null && !ClickUtils.isFastDoubleClick(mBinding.messageUserMore.getId(), 1000)) {
|
||||
@ -563,12 +562,16 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
mBinding.messageUserIcon.setOnClickListener(v -> {
|
||||
MtaHelper.onEvent("消息中心", mOuterInfo, "点击头像");
|
||||
NewLogUtils.logMessageInformUserClick("message_inform_user_icon_click");
|
||||
DirectUtils.directToHomeActivity(itemView.getContext(), messageEntity.getUserEntity().getId(), entrance, "消息中心-赞同及邀请");
|
||||
if (directUtils != null) {
|
||||
directUtils.directToHomeActivity(itemView.getContext(), messageEntity.getUserEntity().getId(), entrance, "消息中心-赞同及邀请");
|
||||
}
|
||||
});
|
||||
mBinding.messageUserName.setOnClickListener(v -> {
|
||||
MtaHelper.onEvent("消息中心", mOuterInfo, "点击名字");
|
||||
NewLogUtils.logMessageInformUserClick("message_inform_user_name_click");
|
||||
DirectUtils.directToHomeActivity(itemView.getContext(), messageEntity.getUserEntity().getId(), entrance, "消息中心-邀同及赞请");
|
||||
if (directUtils != null) {
|
||||
directUtils.directToHomeActivity(itemView.getContext(), messageEntity.getUserEntity().getId(), entrance, "消息中心-邀同及赞请");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -583,7 +586,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
}
|
||||
|
||||
private void getFoldList(Context context, String resourceId) {
|
||||
RetrofitManager
|
||||
RetrofitManager.Companion
|
||||
.getInstance()
|
||||
.getApi()
|
||||
.getMessageFoldList(UserManager.getInstance().getUserId(), resourceId)
|
||||
@ -626,6 +629,10 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
|
||||
Intent intent;
|
||||
String messageType;
|
||||
|
||||
INewCommentDetailProvider newCommentDetailProvider = (INewCommentDetailProvider) ARouter.getInstance().build(RouteConsts.provider.newCommentDetail).navigation();
|
||||
IGameCollectionDetailProvider gameCollectionDetailProvider = (IGameCollectionDetailProvider) ARouter.getInstance().build(RouteConsts.provider.gameCollectionDetail).navigation();
|
||||
|
||||
switch (entity.getType()) {
|
||||
case "comment_vote":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -635,12 +642,16 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"赞同"
|
||||
);
|
||||
if (view.getId() == R.id.message_original) {
|
||||
intent = NewsDetailActivity.getIntentById(context, entity.getArticle().getId(), BaseActivity.mergeEntranceAndPath(entrance, path));
|
||||
context.startActivity(intent);
|
||||
ARouter.getInstance().build(RouteConsts.activity.newsDetailActivity)
|
||||
.withString(EntranceConsts.KEY_NEWSID, entity.getArticle().getId())
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.navigation();
|
||||
} else if (view.getId() == R.id.message_item) {
|
||||
intent = MessageDetailActivity.getIntentById(context,
|
||||
entity.getArticle().getId(), -1, false, BaseActivity.mergeEntranceAndPath(entrance, path));
|
||||
context.startActivity(intent);
|
||||
IMessageDetailProvider messageDetailProvider = (IMessageDetailProvider) ARouter.getInstance().build(RouteConsts.provider.messageDetail).navigation();
|
||||
if (messageDetailProvider != null) {
|
||||
context.startActivity(messageDetailProvider.getIntentById(context,
|
||||
entity.getArticle().getId(), -1, false, BaseActivity.mergeEntranceAndPath(entrance, path)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "reply":
|
||||
@ -651,11 +662,15 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"普通消息"
|
||||
);
|
||||
if (view.getId() == R.id.message_original) {
|
||||
intent = NewsDetailActivity.getIntentById(context, entity.getArticle().getId(), BaseActivity.mergeEntranceAndPath(entrance, path));
|
||||
context.startActivity(intent);
|
||||
ARouter.getInstance().build(RouteConsts.activity.newsDetailActivity)
|
||||
.withString(EntranceConsts.KEY_NEWSID, entity.getArticle().getId())
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.navigation();
|
||||
} else if (view.getId() == R.id.message_item) {
|
||||
intent = CommentDetailActivity.getIntent(context, entity.getDialogue().getFrom().getId(), entity.getArticle());
|
||||
context.startActivity(intent);
|
||||
ICommentDetailProvider commentDetailProvider = (ICommentDetailProvider) ARouter.getInstance().build(RouteConsts.provider.commentDetail).navigation();
|
||||
if (commentDetailProvider != null) {
|
||||
context.startActivity(commentDetailProvider.getIntent(context, entity.getDialogue().getFrom().getId(), entity.getArticle()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "system_invited":
|
||||
@ -667,7 +682,11 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
);
|
||||
if (view.getId() == R.id.message_original || view.getId() == R.id.message_item) {
|
||||
MessageEntity.Question question = entity.getQuestion();
|
||||
context.startActivity(NewQuestionDetailActivity.getIntent(context, question.getId(), entrance, path));
|
||||
ARouter.getInstance().build(RouteConsts.activity.questionDetailActivity)
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.withString(EntranceConsts.KEY_QUESTIONS_ID, question.getId())
|
||||
.withString(EntranceConsts.KEY_PATH, path)
|
||||
.navigation();
|
||||
|
||||
Questions questions = new Questions();
|
||||
questions.setId(question.getId());
|
||||
@ -686,14 +705,13 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"", "", "",
|
||||
messageType
|
||||
);
|
||||
intent = NewQuestionDetailActivity.getSpecifiedCommentIntent(
|
||||
context,
|
||||
entity.getQuestion().getId(),
|
||||
entity.getAnswer().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
ARouter.getInstance().build(RouteConsts.activity.questionDetailActivity)
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.withString(EntranceConsts.KEY_QUESTIONS_ID, entity.getQuestion().getId())
|
||||
.withString(EntranceConsts.KEY_TOP_COMMENT_ID, entity.getAnswer().getId())
|
||||
.withBoolean(EntranceConsts.KEY_SCROLL_TO_COMMENT_AREA, true)
|
||||
.withString(EntranceConsts.KEY_PATH, path)
|
||||
.navigation();
|
||||
break;
|
||||
case "update-answer":
|
||||
case "follow_question":
|
||||
@ -704,9 +722,18 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
);
|
||||
if (view.getId() == R.id.message_original) {
|
||||
MessageEntity.Question question = entity.getQuestion();
|
||||
context.startActivity(NewQuestionDetailActivity.getCommentIntent(context, question.getId(), entity.getAnswer().getId(), entrance, path));
|
||||
ARouter.getInstance().build(RouteConsts.activity.questionDetailActivity)
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.withString(EntranceConsts.KEY_QUESTIONS_ID, question.getId())
|
||||
.withString(EntranceConsts.KEY_ANSWER_ID, entity.getAnswer().getId())
|
||||
.withBoolean(EntranceConsts.KEY_SCROLL_TO_COMMENT_AREA, true)
|
||||
.withString(EntranceConsts.KEY_PATH, path)
|
||||
.navigation();
|
||||
} else if (view.getId() == R.id.message_item) {
|
||||
context.startActivity(SimpleAnswerDetailActivity.getIntent(context, entity.getAnswer().getId(), entrance, path));
|
||||
ISimpleAnswerDetailProvider simpleAnswerDetailProvider = (ISimpleAnswerDetailProvider) ARouter.getInstance().build(RouteConsts.provider.simpleAnswerDetail).navigation();
|
||||
if (simpleAnswerDetailProvider != null) {
|
||||
context.startActivity(simpleAnswerDetailProvider.getIntent(context, entity.getAnswer().getId(), entrance, path));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "reply_answer_comment":
|
||||
@ -715,15 +742,16 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"", "", "",
|
||||
"普通消息"
|
||||
);
|
||||
intent = NewCommentDetailActivity.Companion.getAnswerCommentIntent(
|
||||
context,
|
||||
entity.getAnswer().getId(),
|
||||
entity.getQuestion().getId(),
|
||||
entity.getDialogue().getFrom().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (newCommentDetailProvider != null) {
|
||||
context.startActivity(newCommentDetailProvider.getAnswerCommentIntent(
|
||||
context,
|
||||
entity.getAnswer().getId(),
|
||||
entity.getQuestion().getId(),
|
||||
entity.getDialogue().getFrom().getId(),
|
||||
entrance,
|
||||
path
|
||||
));
|
||||
}
|
||||
break;
|
||||
case "answer_comment_vote":
|
||||
case "answer_comment":
|
||||
@ -737,15 +765,16 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"", "", "",
|
||||
messageType
|
||||
);
|
||||
intent = NewCommentDetailActivity.Companion.getAnswerCommentIntent(
|
||||
context,
|
||||
entity.getAnswer().getId(),
|
||||
entity.getQuestion().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (newCommentDetailProvider != null) {
|
||||
context.startActivity(newCommentDetailProvider.getAnswerCommentIntent(
|
||||
context,
|
||||
entity.getAnswer().getId(),
|
||||
entity.getQuestion().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
));
|
||||
}
|
||||
break;
|
||||
case "community_article_comment_vote":
|
||||
case "community_article_comment":
|
||||
@ -760,15 +789,13 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
messageType
|
||||
);
|
||||
community = new CommunityEntity(entity.getArticle().getCommunityId(), "");
|
||||
intent = ArticleDetailActivity.getSpecifiedCommentIntent(
|
||||
context,
|
||||
community,
|
||||
entity.getArticle().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
ARouter.getInstance().build(RouteConsts.activity.articleDetailActivity)
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.withString(EntranceConsts.KEY_COMMUNITY_ID, entity.getArticle().getId())
|
||||
.withString(EntranceConsts.KEY_TOP_COMMENT_ID, entity.getComment().getId())
|
||||
.withParcelable(EntranceConsts.KEY_COMMUNITY_DATA, community)
|
||||
.withString(EntranceConsts.KEY_PATH, path)
|
||||
.navigation();
|
||||
break;
|
||||
case "community_article_comment_reply_vote":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -776,16 +803,17 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"", "", "",
|
||||
"赞同"
|
||||
);
|
||||
intent = NewCommentDetailActivity.Companion.getArticleCommentIntent(
|
||||
context,
|
||||
entity.getComment().getTopId(),
|
||||
entity.getArticle().getCommunityId(),
|
||||
entity.getArticle().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (newCommentDetailProvider != null) {
|
||||
context.startActivity(newCommentDetailProvider.getArticleCommentIntent(
|
||||
context,
|
||||
entity.getComment().getTopId(),
|
||||
entity.getArticle().getCommunityId(),
|
||||
entity.getArticle().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
));
|
||||
}
|
||||
break;
|
||||
case "community_article_vote":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -794,15 +822,12 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"赞同"
|
||||
);
|
||||
community = new CommunityEntity(entity.getArticle().getCommunityId(), "");
|
||||
intent = ArticleDetailActivity.getIntent(
|
||||
context,
|
||||
community,
|
||||
entity.getArticle().getId(),
|
||||
entrance,
|
||||
path,
|
||||
null
|
||||
);
|
||||
context.startActivity(intent);
|
||||
ARouter.getInstance().build(RouteConsts.activity.articleDetailActivity)
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.withString(EntranceConsts.KEY_COMMUNITY_ARTICLE_ID, entity.getArticle().getId())
|
||||
.withParcelable(EntranceConsts.KEY_COMMUNITY_DATA, community)
|
||||
.withString(EntranceConsts.KEY_PATH, path)
|
||||
.navigation();
|
||||
break;
|
||||
case "reply_community_article_comment":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -810,16 +835,17 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"", "", "",
|
||||
"普通消息"
|
||||
);
|
||||
intent = NewCommentDetailActivity.Companion.getArticleCommentIntent(
|
||||
context,
|
||||
entity.getDialogue().getTo().getTopId(),
|
||||
entity.getArticle().getCommunityId(),
|
||||
entity.getArticle().getId(),
|
||||
entity.getDialogue().getFrom().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (newCommentDetailProvider != null) {
|
||||
context.startActivity(newCommentDetailProvider.getArticleCommentIntent(
|
||||
context,
|
||||
entity.getDialogue().getTo().getTopId(),
|
||||
entity.getArticle().getCommunityId(),
|
||||
entity.getArticle().getId(),
|
||||
entity.getDialogue().getFrom().getId(),
|
||||
entrance,
|
||||
path
|
||||
));
|
||||
}
|
||||
break;
|
||||
case "game_comment_vote":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -828,17 +854,20 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"",
|
||||
"赞同"
|
||||
);
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
context,
|
||||
entity.getGame().getId(),
|
||||
BaseActivity.mergeEntranceAndPath(entrance, path),
|
||||
-1,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
null
|
||||
);
|
||||
IGameDetailProvider gameDetailProvider = (IGameDetailProvider) ARouter.getInstance().build(RouteConsts.provider.gameDetail).navigation();
|
||||
if (gameDetailProvider != null) {
|
||||
gameDetailProvider.startGameDetailActivity(
|
||||
context,
|
||||
entity.getGame().getId(),
|
||||
BaseActivity.mergeEntranceAndPath(entrance, path),
|
||||
-1,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
null
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "game_comment_reply":
|
||||
case "game_comment_reply_vote":
|
||||
@ -853,16 +882,17 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"",
|
||||
messageType
|
||||
);
|
||||
intent = RatingReplyActivity.getSpecifiedCommentIntent(
|
||||
context,
|
||||
entity.getGame().getId(),
|
||||
entity.getReply().getCommentId(),
|
||||
entity.getReply().getId(),
|
||||
new ExposureSource("消息中心", ""),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
ExposureSource exposureSource = new ExposureSource("消息中心", "");
|
||||
ArrayList<ExposureSource> exposureSourceList = new ArrayList<>();
|
||||
exposureSourceList.add(exposureSource);
|
||||
ARouter.getInstance().build(RouteConsts.activity.ratingReplyActivity)
|
||||
.withString(EntranceConsts.KEY_GAMEID, entity.getGame().getId())
|
||||
.withString(EntranceConsts.KEY_COMMENTID, entity.getGame().getId())
|
||||
.withString(EntranceConsts.KEY_TOP_COMMENT_ID, entity.getReply().getId())
|
||||
.withString(EntranceConsts.KEY_EXPOSURE_SOURCE, GsonUtils.toJson(exposureSourceList))
|
||||
.withString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.withString(EntranceConsts.KEY_PATH, path)
|
||||
.navigation();
|
||||
break;
|
||||
case "video_vote":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -870,15 +900,12 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"", "", "",
|
||||
"赞同"
|
||||
);
|
||||
DirectUtils.directToVideoDetail(
|
||||
IDirectProvider directUtils = (IDirectProvider) ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation();
|
||||
directUtils.directToVideoDetail(
|
||||
context,
|
||||
entity.getVideo().getId(),
|
||||
VideoDetailContainerViewModel.Location.SINGLE_VIDEO.getValue(),
|
||||
false,
|
||||
"",
|
||||
entrance,
|
||||
outerInfo,
|
||||
""
|
||||
outerInfo
|
||||
);
|
||||
break;
|
||||
case "video_comment":
|
||||
@ -893,12 +920,11 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"", "", "",
|
||||
messageType
|
||||
);
|
||||
intent = ForumVideoDetailActivity.Companion.getSpecifiedCommentIntent(
|
||||
context,
|
||||
entity.getVideo().getId(),
|
||||
entity.getComment().getId()
|
||||
);
|
||||
context.startActivity(intent);
|
||||
ARouter.getInstance().build(RouteConsts.activity.forumVideoDetailActivity)
|
||||
.withString(EntranceConsts.KEY_VIDEO_ID, entity.getVideo().getId())
|
||||
.withString(EntranceConsts.KEY_TOP_COMMENT_ID, entity.getComment().getId())
|
||||
.withInt(BaseFragment_TabLayout.PAGE_INDEX, 1)
|
||||
.navigation();
|
||||
break;
|
||||
case "video_comment_reply":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -912,15 +938,16 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
} else {
|
||||
commentId = entity.getDialogue().getTo().getId();
|
||||
}
|
||||
intent = NewCommentDetailActivity.Companion.getVideoCommentIntent(
|
||||
context,
|
||||
commentId,
|
||||
entity.getVideo().getId(),
|
||||
entity.getDialogue().getFrom().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (newCommentDetailProvider != null) {
|
||||
context.startActivity(newCommentDetailProvider.getVideoCommentIntent(
|
||||
context,
|
||||
commentId,
|
||||
entity.getVideo().getId(),
|
||||
entity.getDialogue().getFrom().getId(),
|
||||
entrance,
|
||||
path
|
||||
));
|
||||
}
|
||||
break;
|
||||
case "video_comment_reply_vote":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -928,24 +955,28 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
"", "", "",
|
||||
"赞同"
|
||||
);
|
||||
intent = NewCommentDetailActivity.Companion.getVideoCommentIntent(
|
||||
context,
|
||||
entity.getComment().getTopId(),
|
||||
entity.getVideo().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (newCommentDetailProvider != null) {
|
||||
context.startActivity(newCommentDetailProvider.getVideoCommentIntent(
|
||||
context,
|
||||
entity.getComment().getTopId(),
|
||||
entity.getVideo().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
));
|
||||
}
|
||||
break;
|
||||
|
||||
case "reply_activity_comment":
|
||||
case "activity_comment_vote":
|
||||
case "activity_comment_reply_vote":
|
||||
if (view.getId() == R.id.message_original) {
|
||||
context.startActivity(WebActivity.getIntent(context, entity.getActivity().getUrl(), true));
|
||||
} else if (view.getId() == R.id.message_item) {
|
||||
context.startActivity(WebActivity.getIntent(context, entity.getActivity().getUrlComment(), true));
|
||||
IWebProvider webProvider = (IWebProvider) ARouter.getInstance().build(RouteConsts.provider.webActivity).navigation();
|
||||
if (webProvider != null) {
|
||||
if (view.getId() == R.id.message_original) {
|
||||
context.startActivity(webProvider.getIntent(context, entity.getActivity().getUrl(), true));
|
||||
} else if (view.getId() == R.id.message_item) {
|
||||
context.startActivity(webProvider.getIntent(context, entity.getActivity().getUrlComment(), true));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -955,12 +986,13 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
entity.getGameList().getId(),
|
||||
"普通消息"
|
||||
);
|
||||
intent = GameCollectionDetailActivity.Companion.getSpecifiedCommentIntent(
|
||||
context,
|
||||
entity.getGameList().getId(),
|
||||
entity.getComment().getId()
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (gameCollectionDetailProvider != null) {
|
||||
context.startActivity(gameCollectionDetailProvider.getSpecifiedCommentIntent(
|
||||
context,
|
||||
entity.getGameList().getId(),
|
||||
entity.getComment().getId()
|
||||
));
|
||||
}
|
||||
break;
|
||||
case "game_list_comment_vote":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -968,23 +1000,25 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
entity.getGameList().getId(),
|
||||
"赞同"
|
||||
);
|
||||
if (TextUtils.isEmpty(entity.getComment().getTopId())) {
|
||||
intent = GameCollectionDetailActivity.Companion.getSpecifiedCommentIntent(
|
||||
context,
|
||||
entity.getGameList().getId(),
|
||||
entity.getComment().getId()
|
||||
);
|
||||
} else {
|
||||
intent = NewCommentDetailActivity.Companion.getGameCollectionCommentIntent(
|
||||
context,
|
||||
entity.getComment().getTopId(),
|
||||
entity.getGameList().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
if (gameCollectionDetailProvider != null && newCommentDetailProvider != null) {
|
||||
if (TextUtils.isEmpty(entity.getComment().getTopId())) {
|
||||
intent = gameCollectionDetailProvider.getSpecifiedCommentIntent(
|
||||
context,
|
||||
entity.getGameList().getId(),
|
||||
entity.getComment().getId()
|
||||
);
|
||||
} else {
|
||||
intent = newCommentDetailProvider.getGameCollectionCommentIntent(
|
||||
context,
|
||||
entity.getComment().getTopId(),
|
||||
entity.getGameList().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
}
|
||||
context.startActivity(intent);
|
||||
}
|
||||
context.startActivity(intent);
|
||||
break;
|
||||
case "game_list_comment_reply":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -992,15 +1026,17 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
entity.getGameList().getId(),
|
||||
"普通消息"
|
||||
);
|
||||
intent = NewCommentDetailActivity.Companion.getGameCollectionCommentIntent(
|
||||
context,
|
||||
entity.getComment().getTopId(),
|
||||
entity.getGameList().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (newCommentDetailProvider != null) {
|
||||
context.startActivity(newCommentDetailProvider.getGameCollectionCommentIntent(
|
||||
context,
|
||||
entity.getComment().getTopId(),
|
||||
entity.getGameList().getId(),
|
||||
entity.getComment().getId(),
|
||||
entrance,
|
||||
path
|
||||
));
|
||||
}
|
||||
|
||||
break;
|
||||
case "game_list_vote":
|
||||
NewLogUtils.logMessageInformClick(
|
||||
@ -1008,12 +1044,13 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
entity.getGameList().getId(),
|
||||
"赞同"
|
||||
);
|
||||
intent = GameCollectionDetailActivity.getIntent(
|
||||
context,
|
||||
entity.getGameList().getId(),
|
||||
false
|
||||
);
|
||||
context.startActivity(intent);
|
||||
if (gameCollectionDetailProvider != null) {
|
||||
context.startActivity(gameCollectionDetailProvider.getIntent(
|
||||
context,
|
||||
entity.getGameList().getId(),
|
||||
false
|
||||
));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.gh.gamecenter.message.view
|
||||
|
||||
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.updateStatusBarColor
|
||||
import com.gh.gamecenter.message.R
|
||||
|
||||
class MessageKeFuActivity : ToolBarActivity() {
|
||||
override fun provideNormalIntent(): Intent? {
|
||||
return getTargetIntent(this, MessageKeFuActivity::class.java, KeFuFragment::class.java)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
updateStatusBarColor(R.color.background_white, R.color.background_white)
|
||||
}
|
||||
|
||||
override fun onDarkModeChanged() {
|
||||
super.onDarkModeChanged()
|
||||
updateStatusBarColor(R.color.background_white, R.color.background_white)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, entrance: String): Intent {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
return getTargetIntent(
|
||||
context,
|
||||
MessageKeFuActivity::class.java,
|
||||
KeFuFragment::class.java, bundle
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.message;
|
||||
package com.gh.gamecenter.message.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
@ -6,14 +6,14 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter;
|
||||
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;
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity;
|
||||
import com.gh.gamecenter.message.R;
|
||||
import com.gh.gamecenter.message.databinding.MessageItemBinding;
|
||||
|
||||
/**
|
||||
* Created by khy on 23/03/18.
|
||||
@ -1,23 +1,21 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
package com.gh.gamecenter.message.view;
|
||||
|
||||
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 androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
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.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.view.CustomDividerItemDecoration;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.gh.gamecenter.message.HaloApp;
|
||||
import com.gh.gamecenter.message.R;
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity;
|
||||
|
||||
/**
|
||||
* Created by khy on 24/03/18.
|
||||
@ -44,13 +42,12 @@ public class MessageNormalFragment extends ListFragment<MessageEntity, MessageNo
|
||||
mOuterInfo = getArguments().getString(EntranceConsts.KEY_OUTER_INFO);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mUnreadViewModel = ViewModelProviders.of(this, new MessageUnreadViewModel.Factory(HaloApp.getInstance().getApplication()))
|
||||
.get(MessageUnreadViewModel.class);
|
||||
mUnreadViewModel = ViewModelProviders.of(this).get(MessageUnreadViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MessageNormalViewModel provideListViewModel() {
|
||||
MessageNormalViewModel.Factory factory = new MessageNormalViewModel.Factory(HaloApp.getInstance().getApplication(), mMessageType);
|
||||
MessageNormalViewModel.Factory factory = new MessageNormalViewModel.Factory(HaloApp.getInstance(), mMessageType);
|
||||
return ViewModelProviders.of(this, factory).get(MessageNormalViewModel.class);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user