diff --git a/app/src/main/java/com/gh/base/BaseActivity.java b/app/src/main/java/com/gh/base/BaseActivity.java index 9f4e2d0767..e1513ca175 100644 --- a/app/src/main/java/com/gh/base/BaseActivity.java +++ b/app/src/main/java/com/gh/base/BaseActivity.java @@ -165,7 +165,8 @@ public abstract class BaseActivity extends BaseToolBarActivity implements EasyPe , StringUtils.buildString("(", manufacturer, " - ", model, ")") , "知道了", "重新登录" , null - , () -> startActivity(LoginActivity.getIntent(BaseActivity.this)) + , () -> startActivity(LoginActivity.getIntent(BaseActivity.this, + "你的账号已在另外一台设备登录多设备-重新登录")) ); mBaseHandler.postDelayed(() -> mIsExistLogoutDialog = false, 5000); } catch (JSONException e) { diff --git a/app/src/main/java/com/gh/common/util/CheckLoginUtils.java b/app/src/main/java/com/gh/common/util/CheckLoginUtils.java index 12c1d8e63f..28854ce06f 100644 --- a/app/src/main/java/com/gh/common/util/CheckLoginUtils.java +++ b/app/src/main/java/com/gh/common/util/CheckLoginUtils.java @@ -14,12 +14,12 @@ import com.lightgame.utils.Utils; public class CheckLoginUtils { - public static void checkLogin(final Context context, OnLoginListener listener) { + public static void checkLogin(final Context context, String entrance, OnLoginListener listener) { if (TextUtils.isEmpty(UserManager.getInstance().getToken())) { Utils.toast(context, "需要登录"); - LogUtils.login("dialog", null); - LogUtils.login("activity", null); - Intent intent = LoginActivity.getIntent(context); + LogUtils.login("dialog", null, entrance); + LogUtils.login("activity", null, entrance); + Intent intent = LoginActivity.getIntent(context, entrance); context.startActivity(intent); } else { listener.onLogin(); diff --git a/app/src/main/java/com/gh/common/util/CommentHelper.kt b/app/src/main/java/com/gh/common/util/CommentHelper.kt index bba8ca0296..0781180046 100644 --- a/app/src/main/java/com/gh/common/util/CommentHelper.kt +++ b/app/src/main/java/com/gh/common/util/CommentHelper.kt @@ -55,7 +55,7 @@ object CommentHelper { dialog = createOptionsSelectDialog(context, dialogOptions) { when (it) { "回复" -> { - context.ifLogin { + context.ifLogin("社区文章详情-评论-回复") { if (listener != null) { listener.onCommentCallback(commentEntity) } else if (!TextUtils.isEmpty(commentEntity.id)) { @@ -68,7 +68,7 @@ object CommentHelper { "复制" -> copyText(commentEntity.content, context) - "举报" -> context.ifLogin { + "举报" -> context.ifLogin("社区文章详情-评论-举报") { showReportTypeDialog(context) { reportType -> PostCommentUtils.reportCommunityArticleComment(context, communityId, articleId, commentEntity.id, reportType, object : PostCommentUtils.PostCommentListener { @@ -132,7 +132,7 @@ object CommentHelper { showControlDialog(context, answerId, commentEntity.id!!, commentEntity.me!!) } "回复" -> { - context.ifLogin { + context.ifLogin("回答详情-评论-回复") { if (listener != null) { listener.onCommentCallback(commentEntity) } else if (!TextUtils.isEmpty(commentEntity.id)) { @@ -145,7 +145,7 @@ object CommentHelper { "复制" -> copyText(commentEntity.content, context) - "举报" -> context.ifLogin { + "举报" -> context.ifLogin("回答详情-评论-举报") { showReportTypeDialog(context) { reportType -> PostCommentUtils.postAnswerReportData(context, commentEntity.id, answerId, reportType, object : PostCommentUtils.PostCommentListener { diff --git a/app/src/main/java/com/gh/common/util/CommentUtils.java b/app/src/main/java/com/gh/common/util/CommentUtils.java index 5b58ba1370..48b8e0e84e 100644 --- a/app/src/main/java/com/gh/common/util/CommentUtils.java +++ b/app/src/main/java/com/gh/common/util/CommentUtils.java @@ -80,7 +80,10 @@ public class CommentUtils { } } - public static void showGameCommentOptions(final Context context, final RatingComment comment, final String gameId) { + public static void showGameCommentOptions(final Context context, + final RatingComment comment, + final String gameId, + final String entrance) { final Dialog dialog = new Dialog(context); @@ -115,7 +118,7 @@ public class CommentUtils { copyText(comment.getContent(), context); break; case "举报": - CheckLoginUtils.checkLogin(context, () -> showGameCommentReportDialog(gameId, comment, context)); + CheckLoginUtils.checkLogin(context, entrance, () -> showGameCommentReportDialog(gameId, comment, context)); break; } }); @@ -183,9 +186,12 @@ public class CommentUtils { } - public static void showReportDialog(final CommentEntity commentEntity, final Context context, final boolean showConversation, - final OnCommentCallBackListener listener, final String newsId) { - + public static void showReportDialog(final CommentEntity commentEntity, + final Context context, + final boolean showConversation, + final OnCommentCallBackListener listener, + final String newsId, + final String patch) { final Dialog dialog = new Dialog(context); LinearLayout container = new LinearLayout(context); @@ -225,7 +231,7 @@ public class CommentUtils { dialog.cancel(); switch (reportTv.getText().toString()) { case "回复": - CheckLoginUtils.checkLogin(context, () -> { + CheckLoginUtils.checkLogin(context, patch + "-回复", () -> { if (listener != null) { listener.onCommentCallback(commentEntity); } else if (!TextUtils.isEmpty(newsId)) { @@ -239,7 +245,8 @@ public class CommentUtils { copyText(commentEntity.getContent(), context); break; case "举报": - CheckLoginUtils.checkLogin(context, () -> showReportTypeDialog(commentEntity, context)); + CheckLoginUtils.checkLogin(context, patch + "-举报", + () -> showReportTypeDialog(commentEntity, context)); break; case "查看对话": @@ -442,64 +449,68 @@ public class CommentUtils { } public static void postVote(final Context context, final CommentEntity commentEntity, - final TextView commentLikeCountTv, final ImageView commentLikeIv, final OnVoteListener listener) { - CheckLoginUtils.checkLogin(context, () -> { - if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme)) { - Utils.toast(context, "已经点过赞啦!"); - return; - } - commentEntity.setVote(commentEntity.getVote() + 1); - commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.theme)); - commentLikeIv.setImageResource(R.drawable.vote_icon_select); - commentLikeCountTv.setText(String.valueOf(commentEntity.getVote())); - commentLikeCountTv.setVisibility(View.VISIBLE); + final TextView commentLikeCountTv, final ImageView commentLikeIv, + final OnVoteListener listener) { + if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme)) { + Utils.toast(context, "已经点过赞啦!"); + return; + } + commentEntity.setVote(commentEntity.getVote() + 1); + commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.theme)); + commentLikeIv.setImageResource(R.drawable.vote_icon_select); + commentLikeCountTv.setText(String.valueOf(commentEntity.getVote())); + commentLikeCountTv.setVisibility(View.VISIBLE); - PostCommentUtils.addCommentVote(context, commentEntity.getId(), - new PostCommentUtils.PostCommentListener() { - @Override - public void postSuccess(JSONObject response) { - if (listener != null) { - listener.onVote(); - } + PostCommentUtils.addCommentVote(context, commentEntity.getId(), + new PostCommentUtils.PostCommentListener() { + @Override + public void postSuccess(JSONObject response) { + if (listener != null) { + listener.onVote(); + } + } + + @Override + public void postFailed(Throwable e) { + + commentEntity.setVote(commentEntity.getVote() - 1); + commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint)); + commentLikeIv.setImageResource(R.drawable.vote_icon_unselect); + commentLikeCountTv.setText(String.valueOf(commentEntity.getVote())); + if (commentEntity.getVote() == 0) { + commentLikeCountTv.setVisibility(View.GONE); + } else { + commentLikeCountTv.setVisibility(View.VISIBLE); } - @Override - public void postFailed(Throwable e) { - - commentEntity.setVote(commentEntity.getVote() - 1); - commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint)); - commentLikeIv.setImageResource(R.drawable.vote_icon_unselect); - commentLikeCountTv.setText(String.valueOf(commentEntity.getVote())); - if (commentEntity.getVote() == 0) { - commentLikeCountTv.setVisibility(View.GONE); - } else { - commentLikeCountTv.setVisibility(View.VISIBLE); - } - - if (e instanceof HttpException) { - HttpException exception = (HttpException) e; - if (exception.code() == 403) { - try { - String detail = new JSONObject(exception.response().errorBody().string()).getString("detail"); - if ("voted".equals(detail)) { - Utils.toast(context, "已经点过赞啦!"); - } - } catch (Exception ex) { - ex.printStackTrace(); + if (e instanceof HttpException) { + HttpException exception = (HttpException) e; + if (exception.code() == 403) { + try { + String detail = new JSONObject(exception.response().errorBody().string()).getString("detail"); + if ("voted".equals(detail)) { + Utils.toast(context, "已经点过赞啦!"); } - return; + } catch (Exception ex) { + ex.printStackTrace(); } + return; } - Utils.toast(context, "网络异常,点赞失败"); } - }); - }); + Utils.toast(context, "网络异常,点赞失败"); + } + }); } public static void postVoteToAnswerComment(final Context context, String answerId, String articleId, String articleCommunityId, final CommentEntity commentEntity, final TextView commentLikeCountTv, final ImageView commentLikeIv, final OnVoteListener listener) { - CheckLoginUtils.checkLogin(context, () -> { + + String entrance = "回答详情-评论-点赞"; + if (TextUtils.isEmpty(articleId)) { + entrance = "社区文章详情-评论-点赞"; + } + CheckLoginUtils.checkLogin(context, entrance, () -> { if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme)) { Utils.toast(context, "已经点过赞啦!"); return; diff --git a/app/src/main/java/com/gh/common/util/Extensions.kt b/app/src/main/java/com/gh/common/util/Extensions.kt index 3f4f1098e0..1233a4476c 100644 --- a/app/src/main/java/com/gh/common/util/Extensions.kt +++ b/app/src/main/java/com/gh/common/util/Extensions.kt @@ -60,12 +60,12 @@ fun LiveData.observeNonNull(owner: LifecycleOwner, callback: (T) -> Unit /** * Login related extensions */ -fun Fragment.ifLogin(action: () -> Unit) { - requireContext().ifLogin(action) +fun Fragment.ifLogin(entrance: String, action: () -> Unit) { + requireContext().ifLogin(entrance, action) } -fun Context.ifLogin(action: () -> Unit) { - CheckLoginUtils.checkLogin(this) { action.invoke() } +fun Context.ifLogin(entrance: String, action: () -> Unit) { + CheckLoginUtils.checkLogin(this, entrance) { action.invoke() } } diff --git a/app/src/main/java/com/gh/common/util/LibaoUtils.java b/app/src/main/java/com/gh/common/util/LibaoUtils.java index e31393115f..c92b370400 100644 --- a/app/src/main/java/com/gh/common/util/LibaoUtils.java +++ b/app/src/main/java/com/gh/common/util/LibaoUtils.java @@ -231,161 +231,88 @@ public class LibaoUtils { String status = libaoEntity.getStatus(); setLiBaoBtnStatus(libaoBtn, status, context); - libaoBtn.setOnClickListener(v -> CheckLoginUtils.checkLogin(context, () -> { - // 领取限制 - if ("领取".equals(libaoBtn.getText().toString()) || "淘号".equals(libaoBtn.getText().toString())) { - if (isInstallRequired && !isAppInstalled(context, libaoEntity.getPackageName())) { - String platform; - if (TextUtils.isEmpty(libaoEntity.getPlatform())) { - platform = ""; - } else { - platform = PlatformUtils.getInstance(context) - .getPlatformName(libaoEntity.getPlatform()); - } + libaoBtn.setOnClickListener(v -> { + String btnStatus = libaoBtn.getText().toString(); + CheckLoginUtils.checkLogin(context, "礼包详情-[" + btnStatus + "]", () -> { + // 领取限制 - boolean isExistPlatform = false; - ArrayList apk = adapter.getGameEntity().getApk(); - for (ApkEntity apkEntity : apk) { - if (TextUtils.isEmpty(libaoEntity.getPlatform())) break; - if (libaoEntity.getPlatform().equals(apkEntity.getPlatform())) { - isExistPlatform = true; - break; + if ("领取".equals(btnStatus) || "淘号".equals(btnStatus)) { + if (isInstallRequired && !isAppInstalled(context, libaoEntity.getPackageName())) { + String platform; + if (TextUtils.isEmpty(libaoEntity.getPlatform())) { + platform = ""; + } else { + platform = PlatformUtils.getInstance(context) + .getPlatformName(libaoEntity.getPlatform()); } - } - String dialogContent = context.getString(R.string.ling_rules_dialog, libaoEntity.getGame().getName(), platform); - boolean finalIsExistPlatform = isExistPlatform; - DialogUtils.showWarningDialog(context, "条件不符", - Html.fromHtml(dialogContent), isExistPlatform ? "关闭" : null, - isExistPlatform ? "立即安装" : "关闭", - () -> { - if (finalIsExistPlatform) { - adapter.openDownload(libaoEntity.getPlatform()); - } - }, null); - return; - } - } + boolean isExistPlatform = false; + ArrayList apk = adapter.getGameEntity().getApk(); + for (ApkEntity apkEntity : apk) { + if (TextUtils.isEmpty(libaoEntity.getPlatform())) break; + if (libaoEntity.getPlatform().equals(apkEntity.getPlatform())) { + isExistPlatform = true; + break; + } + } - switch (libaoBtn.getText().toString()) { - case "未开始": - Utils.toast(context, "还没到开始领取时间"); - break; - case "查看": - DialogUtils.showAlertDialog(v.getContext(), "使用说明", - libaoEntity.getDes(), "关闭", null, null, null); - break; - case "再领一个": - case "领取": - if ("repeatLing".equals(status)) { - DialogUtils.showWarningDialog(context, "礼包刷新提醒" - , "礼包每天0点刷新,换新区或者换新角色需要继续领取礼包的童鞋,请于明天0点之后回来即可[再领一个]" - , null, "知道了", null, null); - } else { - libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, null, entrance); - } - break; - case "再淘一个": - case "淘号": - if ("repeatTao".equals(status)) { - Utils.toast(context, "没到重复淘号时间, 礼包每天0点刷新"); + String dialogContent = context.getString(R.string.ling_rules_dialog, libaoEntity.getGame().getName(), platform); + boolean finalIsExistPlatform = isExistPlatform; + DialogUtils.showWarningDialog(context, "条件不符", + Html.fromHtml(dialogContent), isExistPlatform ? "关闭" : null, + isExistPlatform ? "立即安装" : "关闭", + () -> { + if (finalIsExistPlatform) { + adapter.openDownload(libaoEntity.getPlatform()); + } + }, null); return; } - final Dialog loadingDialog = DialogUtils.showWaitDialog(context, "淘号中..."); - postLibaoTao(context, libaoEntity.getId(), new PostLibaoListener() { - @Override - public void postSucced(Object response) { + } - if (loadingDialog != null) loadingDialog.dismiss(); + switch (btnStatus) { + case "未开始": + Utils.toast(context, "还没到开始领取时间"); + break; + case "查看": + DialogUtils.showAlertDialog(v.getContext(), "使用说明", + libaoEntity.getDes(), "关闭", null, null, null); + break; + case "再领一个": + case "领取": + if ("repeatLing".equals(status)) { + DialogUtils.showWarningDialog(context, "礼包刷新提醒" + , "礼包每天0点刷新,换新区或者换新角色需要继续领取礼包的童鞋,请于明天0点之后回来即可[再领一个]" + , null, "知道了", null, null); + } else { + libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, null, entrance); + } + break; + case "再淘一个": + case "淘号": + if ("repeatTao".equals(status)) { + Utils.toast(context, "没到重复淘号时间, 礼包每天0点刷新"); + return; + } + final Dialog loadingDialog = DialogUtils.showWaitDialog(context, "淘号中..."); + postLibaoTao(context, libaoEntity.getId(), new PostLibaoListener() { + @Override + public void postSucced(Object response) { - JSONObject responseBody = (JSONObject) response; - String libaoCode = null; - try { - libaoCode = responseBody.getString("code"); - } catch (JSONException e) { - e.printStackTrace(); - } + if (loadingDialog != null) loadingDialog.dismiss(); - if (TextUtils.isEmpty(libaoCode)) { + JSONObject responseBody = (JSONObject) response; + String libaoCode = null; try { - String detail = responseBody.getString("detail"); - switch (detail) { - case "maintaining": - Utils.toast(context, "网络状态异常,请稍后再试"); - break; - case "fail to compete": - Utils.toast(context, "淘号失败,稍后重试"); - break; - default: - Utils.toast(context, "淘号异常"); - break; - } + libaoCode = responseBody.getString("code"); } catch (JSONException e) { e.printStackTrace(); } - return; - } - Utils.toast(context, "淘号成功"); - - libaoEntity.setStatus("taoed"); - - EventBus.getDefault().post(new EBReuse("libaoChanged")); - - adapter.initLibaoCode(new UserDataLibaoEntity(libaoCode, "tao", Utils.getTime(context))); - - final String finalLibaoCode = libaoCode; - - DialogUtils.showWarningDialog(context, "淘号成功" - , Html.fromHtml(context.getString(R.string.taoed_dialog, libaoCode)) - , "关闭", " 复制礼包码" - , () -> { - copyLink(finalLibaoCode, context); - if (isInstallRequired) { - libaoBtn.postDelayed(() -> { - Spanned msg = Html.fromHtml( - context.getString(R.string.taoed_copy_dialog - , finalLibaoCode)); - lunningAppDialog(context - , msg, libaoEntity); - }, 300); - } - }, null); - } - - @Override - public void postFailed(Throwable error) { - Utils.log("---" + error.toString()); - - if (loadingDialog != null) loadingDialog.dismiss(); - - if (error instanceof HttpException) { - HttpException exception = (HttpException) error; - if (exception.code() == 403) { + if (TextUtils.isEmpty(libaoCode)) { try { - JSONObject errorJson = new JSONObject(exception.response().errorBody().string()); - String detail = errorJson.getString("detail"); -// Utils.toast(context, "返回::" + detail); + String detail = responseBody.getString("detail"); switch (detail) { - case "coming": - Utils.toast(context, "礼包领取时间未开始"); - break; - case "finish": - Utils.toast(context, "礼包领取时间已结束"); - break; - case "fetched": - Utils.toast(context, "你今天已领过这个礼包了, 不能再淘号"); - - libaoBtn.setText("已淘号"); - libaoBtn.setBackgroundResource(R.drawable.libao_taoed_style); - libaoBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.libao_taoed_selector)); - libaoEntity.setStatus("taoed"); - break; - case "try tao": - case "used up": - DialogUtils.showHintDialog(context, "礼包已领光" - , "手速不够快,礼包已经被抢光了,十分抱歉", "知道了"); - break; case "maintaining": Utils.toast(context, "网络状态异常,请稍后再试"); break; @@ -393,25 +320,102 @@ public class LibaoUtils { Utils.toast(context, "淘号失败,稍后重试"); break; default: - Utils.toast(context, "操作失败"); + Utils.toast(context, "淘号异常"); break; - } - } catch (Exception ex) { - ex.printStackTrace(); - Utils.toast(context, "礼包处理异常" + ex.toString()); + } catch (JSONException e) { + e.printStackTrace(); } return; - } else if (exception.code() == 401) { - return; } + + Utils.toast(context, "淘号成功"); + + libaoEntity.setStatus("taoed"); + + EventBus.getDefault().post(new EBReuse("libaoChanged")); + + adapter.initLibaoCode(new UserDataLibaoEntity(libaoCode, "tao", Utils.getTime(context))); + + final String finalLibaoCode = libaoCode; + + DialogUtils.showWarningDialog(context, "淘号成功" + , Html.fromHtml(context.getString(R.string.taoed_dialog, libaoCode)) + , "关闭", " 复制礼包码" + , () -> { + copyLink(finalLibaoCode, context); + if (isInstallRequired) { + libaoBtn.postDelayed(() -> { + Spanned msg = Html.fromHtml( + context.getString(R.string.taoed_copy_dialog + , finalLibaoCode)); + lunningAppDialog(context + , msg, libaoEntity); + }, 300); + } + }, null); } - Utils.toast(context, "发生异常"); - } - }); - break; - } - })); + + @Override + public void postFailed(Throwable error) { + Utils.log("---" + error.toString()); + + if (loadingDialog != null) loadingDialog.dismiss(); + + if (error instanceof HttpException) { + HttpException exception = (HttpException) error; + if (exception.code() == 403) { + try { + JSONObject errorJson = new JSONObject(exception.response().errorBody().string()); + String detail = errorJson.getString("detail"); +// Utils.toast(context, "返回::" + detail); + switch (detail) { + case "coming": + Utils.toast(context, "礼包领取时间未开始"); + break; + case "finish": + Utils.toast(context, "礼包领取时间已结束"); + break; + case "fetched": + Utils.toast(context, "你今天已领过这个礼包了, 不能再淘号"); + + libaoBtn.setText("已淘号"); + libaoBtn.setBackgroundResource(R.drawable.libao_taoed_style); + libaoBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.libao_taoed_selector)); + libaoEntity.setStatus("taoed"); + break; + case "try tao": + case "used up": + DialogUtils.showHintDialog(context, "礼包已领光" + , "手速不够快,礼包已经被抢光了,十分抱歉", "知道了"); + break; + case "maintaining": + Utils.toast(context, "网络状态异常,请稍后再试"); + break; + case "fail to compete": + Utils.toast(context, "淘号失败,稍后重试"); + break; + default: + Utils.toast(context, "操作失败"); + break; + + } + } catch (Exception ex) { + ex.printStackTrace(); + Utils.toast(context, "礼包处理异常" + ex.toString()); + } + return; + } else if (exception.code() == 401) { + return; + } + } + Utils.toast(context, "发生异常"); + } + }); + break; + } + }); + }); } private static void libaoLing(final Context context, final TextView libaoBtn, final LibaoEntity libaoEntity, final LibaoDetailAdapter adapter, diff --git a/app/src/main/java/com/gh/common/util/LogUtils.java b/app/src/main/java/com/gh/common/util/LogUtils.java index 6516dd08c4..a2c6c3dfb0 100644 --- a/app/src/main/java/com/gh/common/util/LogUtils.java +++ b/app/src/main/java/com/gh/common/util/LogUtils.java @@ -122,9 +122,10 @@ public class LogUtils { upload(object); } - public static void login(String loginStep, String loginType) { + public static void login(String loginStep, String loginType, String entrance) { JSONObject object = new JSONObject(); try { + object.put("entrance", entrance); object.put("subject", "login"); object.put("step", loginStep); object.put("login_type", loginType); diff --git a/app/src/main/java/com/gh/gamecenter/LoginActivity.java b/app/src/main/java/com/gh/gamecenter/LoginActivity.java index 00d32a222e..7ef1151056 100644 --- a/app/src/main/java/com/gh/gamecenter/LoginActivity.java +++ b/app/src/main/java/com/gh/gamecenter/LoginActivity.java @@ -2,8 +2,10 @@ package com.gh.gamecenter; import android.content.Context; import android.content.Intent; +import android.os.Bundle; import android.support.annotation.NonNull; +import com.gh.common.util.EntranceUtils; import com.gh.gamecenter.fragment.LoginFragment; /** @@ -13,7 +15,9 @@ import com.gh.gamecenter.fragment.LoginFragment; public class LoginActivity extends NormalActivity { @NonNull - public static Intent getIntent(Context context) { - return getTargetIntent(context, LoginActivity.class, LoginFragment.class); + public static Intent getIntent(Context context, String entrance) { + Bundle bundle = new Bundle(); + bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance); + return getTargetIntent(context, LoginActivity.class, LoginFragment.class, bundle); } } diff --git a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java index 8f5dfe58bc..9e97a0d619 100644 --- a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java @@ -310,7 +310,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener, } break; case R.id.menu_collect: - CheckLoginUtils.checkLogin(this, () -> { + CheckLoginUtils.checkLogin(this, "资讯文章详情-收藏", () -> { final NewsDetailEntity newsDetailEntity = adapter.getNewsDetailEntity(); mNewsCollection.setEnabled(false); if (newsDetailEntity.getMe() != null && newsDetailEntity.getMe().isArticleFavorite()) { @@ -563,7 +563,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener, mNoConn.setVisibility(View.GONE); handler.postDelayed(runnable, 1000); } else if (v == mDetailCommentLl) { - CheckLoginUtils.checkLogin(this, () -> { + CheckLoginUtils.checkLogin(this, "资讯文章详情-写评论", () -> { Intent intent = MessageDetailActivity.getIntentById(NewsDetailActivity.this, adapter.getId(), null, true , mEntrance + "(新闻详情[" + adapter.getTitle() + "])"); startActivity(intent); diff --git a/app/src/main/java/com/gh/gamecenter/SuggestionActivity.java b/app/src/main/java/com/gh/gamecenter/SuggestionActivity.java index b4bbca9f20..5536de6f0b 100644 --- a/app/src/main/java/com/gh/gamecenter/SuggestionActivity.java +++ b/app/src/main/java/com/gh/gamecenter/SuggestionActivity.java @@ -140,6 +140,7 @@ public class SuggestionActivity extends BaseActivity implements OnRequestCallBac private String mGameInfo; private String mHideHint; + private String mSuggestContent; private boolean mAgreePostPic; @@ -219,7 +220,7 @@ public class SuggestionActivity extends BaseActivity implements OnRequestCallBac } else { mSuggestType = SuggestType.normal; } - String suggestContent = extras.getString(EntranceUtils.KEY_CONTENT); + mSuggestContent = extras.getString(EntranceUtils.KEY_CONTENT); String suggestHintType = extras.getString(EntranceUtils.KEY_SUGGEST_HINT_TYPE); mHideHint = extras.getString(EntranceUtils.KEY_HIDE_SUGGEST_HINT, ""); mFunctionTypeName = getResources().getStringArray(R.array.suggest_function_type); @@ -238,8 +239,8 @@ public class SuggestionActivity extends BaseActivity implements OnRequestCallBac mAdapter = new SuggestPicAdapter(this, this); mSuggestPicRv.setAdapter(mAdapter); - if (!TextUtils.isEmpty(suggestContent)) { - mSuggestContentEt.setText(suggestContent); + if (!TextUtils.isEmpty(mSuggestContent)) { + mSuggestContentEt.setText(mSuggestContent); mSuggestContentEt.setSelection(mSuggestContentEt.getText().length()); } @@ -440,7 +441,15 @@ public class SuggestionActivity extends BaseActivity implements OnRequestCallBac } } - CheckLoginUtils.checkLogin(this, () -> { + String entrance = "我的光环-反馈-[提交]"; + if (mSuggestContent.contains("问题举报")) { + entrance = "问题详情-举报-提交反馈"; + } else if (mSuggestContent.contains("回答举报")) { + entrance = "回答详情-举报-提交反馈"; + } else if (mSuggestContent.contains("文章举报")) { + entrance = "社区文章详情-举报-提交反馈"; + } + CheckLoginUtils.checkLogin(this, entrance, () -> { if (TextUtils.isEmpty(email)) { if (mSuggestType == SuggestType.functionSuggest || mSuggestType == SuggestType.gameCollect) { toast("请填写联系方式"); diff --git a/app/src/main/java/com/gh/gamecenter/adapter/CommentDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/CommentDetailAdapter.java index 5c11c6424f..d364ef7a9e 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/CommentDetailAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/CommentDetailAdapter.java @@ -8,6 +8,7 @@ import android.view.View; import android.view.ViewGroup; import com.gh.common.constant.ItemViewType; +import com.gh.common.util.CheckLoginUtils; import com.gh.common.util.CommentUtils; import com.gh.gamecenter.PersonalHomeActivity; import com.gh.gamecenter.R; @@ -168,19 +169,16 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter { holder.quoteContainer.setVisibility(View.GONE); } - holder.commentLikeIv.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - CommentUtils.postVote(mContext, commentEntity, holder.commentLikeCountTv, holder.commentLikeIv, null); - } - }); + holder.commentLikeIv.setOnClickListener(v -> CheckLoginUtils.checkLogin(mContext, + "资讯文章-评论-查看对话-点赞", () -> + CommentUtils.postVote(mContext, + commentEntity, holder.commentLikeCountTv, + holder.commentLikeIv, null))); - holder.itemView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - CommentUtils.showReportDialog(commentEntity, mContext, false, mOnCommentCallBackListener, null); - } - }); + holder.itemView.setOnClickListener(v -> + CommentUtils.showReportDialog(commentEntity, + mContext, false, + mOnCommentCallBackListener, null, "资讯文章-评论-查看对话")); holder.commentUserIconDv.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(mContext, commentEntity.getUser().getId(), "", "文章-评论详情")); holder.commentUserNameTv.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(mContext, commentEntity.getUser().getId(), "", "文章-评论详情")); diff --git a/app/src/main/java/com/gh/gamecenter/adapter/MessageDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/MessageDetailAdapter.java index 998716bb17..ce78d7dfb9 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/MessageDetailAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/MessageDetailAdapter.java @@ -384,7 +384,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter { final boolean finalIsHotComment = isHotComment; final int finalCommentPosition = commentPosition; holder.commentLikeIv.setOnClickListener(v -> - CheckLoginUtils.checkLogin(mContext, + CheckLoginUtils.checkLogin(mContext, "资讯文章详情-评论详情-点赞", () -> CommentUtils.postVote(mContext, finalCommentEntity, holder.commentLikeCountTv, holder.commentLikeIv, () -> { int index1 = (finalCommentPosition / 10) * 10; @@ -404,7 +404,9 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter { )); holder.itemView.setOnClickListener(v -> - CommentUtils.showReportDialog(finalCommentEntity, mContext, true, mOnCommentCallBackListener, null)); + CommentUtils.showReportDialog(finalCommentEntity, + mContext, true, + mOnCommentCallBackListener, null, "资讯文章详情-评论详情")); holder.commentUserNameTv.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(mContext, finalCommentEntity.getUser().getId(), mEntrance, "文章-评论详情")); holder.commentUserIconDv.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(mContext, finalCommentEntity.getUser().getId(), mEntrance, "文章-评论详情")); diff --git a/app/src/main/java/com/gh/gamecenter/fragment/LoginFragment.java b/app/src/main/java/com/gh/gamecenter/fragment/LoginFragment.java index 86b9798bbf..0cded61359 100644 --- a/app/src/main/java/com/gh/gamecenter/fragment/LoginFragment.java +++ b/app/src/main/java/com/gh/gamecenter/fragment/LoginFragment.java @@ -202,9 +202,9 @@ public class LoginFragment extends NormalFragment implements LoginUtils.onCaptch String loginType = loginTokenEntity.getLoginType(); if (LoginTag.qq.name().equals(loginType) || LoginTag.wechat.name().equals(loginType) || LoginTag.weibo.name().equals(loginType)) { - LogUtils.login("success", loginType); + LogUtils.login("success", loginType, mEntrance); } else { - LogUtils.login("success", "mobile"); + LogUtils.login("success", "mobile", mEntrance); } } // 防止UserManager数据丢失后重复登录 @@ -224,9 +224,9 @@ public class LoginFragment extends NormalFragment implements LoginUtils.onCaptch private void login(JSONObject content, LoginTag loginTag) { if (loginTag.equals(LoginTag.phone)) { - LogUtils.login("logging", "mobile"); + LogUtils.login("logging", "mobile", mEntrance); } else { - LogUtils.login("logging", loginTag.name()); + LogUtils.login("logging", loginTag.name(), mEntrance); } if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) { mLoginDialog = WaitingDialogFragment.newInstance(getString(R.string.logging)); diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailFragment.java b/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailFragment.java index 29acd1c7d3..e87979bef5 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailFragment.java +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailFragment.java @@ -398,7 +398,7 @@ public class GameDetailFragment extends NormalFragment { public void onMenuItemClick(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.menu_concern: - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "游戏详情-[关注]", () -> { if (mGameDetailEntity != null && mGameDetailEntity.getMe().isGameConcerned()) { DialogUtils.showCancelDialog(getContext(), () -> mViewModel.concernCommand(false), null); } else { diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt index f960ed8b8e..25f52a5db3 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/desc/DescCommentsAdapter.kt @@ -61,7 +61,7 @@ class DescCommentsAdapter(context: Context, private fun setCommentClick(binding: RatingCommentItemBinding, comment: RatingComment) { binding.run { vote.setOnClickListener { - mContext.ifLogin { + mContext.ifLogin("游戏详情-介绍-点赞评论") { if (!vote.isChecked) { mViewModel.voteComment(comment.id, callback = { MtaHelper.onEvent("游戏详情", "玩家评论_点赞", mViewModel.game?.name) @@ -75,7 +75,7 @@ class DescCommentsAdapter(context: Context, } commentItem.setOnClickListener { MtaHelper.onEvent("游戏详情", "玩家评论_点击评论", mViewModel.game?.name) - CommentUtils.showGameCommentOptions(mContext, comment, mViewModel.gameId) + CommentUtils.showGameCommentOptions(mContext, comment, mViewModel.gameId, "游戏详情-介绍-举报评论") } userIcon.setOnClickListener { PersonalHomeActivity.startTargetActivity(mContext, comment.user.id, mEntrance, "(游戏详情:介绍)") diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt index 78bf9fba33..4e29e1e3ad 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/rating/RatingAdapter.kt @@ -82,7 +82,7 @@ class RatingAdapter(context: Context, ratingSelector.setOnRatingChangeListener { ratingBar, rating -> MtaHelper.onEvent("游戏详情", "评论Tab_点击星星", mListViewModel.game.name + "- ${rating.toInt()}") if (!ClickUtils.isFastDoubleClick(ratingBar.id, 1000)) { - skipRatingEdit(rating) + skipRatingEdit(rating, "游戏详情-评论-点击星星") // 与传进评论编辑的星星保持一致 ratingSelector.postDelayed({ ratingSelector.rating = 0F @@ -91,7 +91,7 @@ class RatingAdapter(context: Context, } ratingEditBtn.setOnClickListener { MtaHelper.onEvent("游戏详情", "评论Tab_点击我来评论", mListViewModel.game.name) - skipRatingEdit(0.0F) + skipRatingEdit(0.0F, "游戏详情-评论-[我来评论]") } } } else if (holder is RatingCommentItemViewHolder) { @@ -116,8 +116,8 @@ class RatingAdapter(context: Context, } } - private fun skipRatingEdit(starCount: Float) { - mContext.ifLogin { + private fun skipRatingEdit(starCount: Float, entrance: String) { + mContext.ifLogin(entrance) { if (mListViewModel.canUserCommentThisGame()) { if (mContext is Activity) { val intent = RatingEditActivity.getIntent(mContext, mListViewModel.game, ratingData?.device, starCount) @@ -132,7 +132,7 @@ class RatingAdapter(context: Context, private fun setCommentClick(binding: RatingCommentItemBinding, comment: RatingComment) { binding.run { vote.setOnClickListener { - mContext.ifLogin { + mContext.ifLogin("游戏详情-评论-点赞评论") { if (!vote.isChecked) { mListViewModel.voteComment(comment.id, callback = { vote.text = (comment.vote + 1).toString() @@ -145,7 +145,7 @@ class RatingAdapter(context: Context, } } commentItem.setOnClickListener { - CommentUtils.showGameCommentOptions(mContext, comment, mListViewModel.game.id) + CommentUtils.showGameCommentOptions(mContext, comment, mListViewModel.game.id, "游戏详情-评论-举报评论") MtaHelper.onEvent("游戏详情", "评论Tab_点击评论", mListViewModel.game.name) } userIcon.setOnClickListener { diff --git a/app/src/main/java/com/gh/gamecenter/info/ConcernFragment.java b/app/src/main/java/com/gh/gamecenter/info/ConcernFragment.java index d04214a21b..62d3f90ad7 100644 --- a/app/src/main/java/com/gh/gamecenter/info/ConcernFragment.java +++ b/app/src/main/java/com/gh/gamecenter/info/ConcernFragment.java @@ -30,7 +30,6 @@ import com.gh.common.util.StringUtils; import com.gh.common.view.VerticalItemDecoration; import com.gh.gamecenter.ConcernActivity; import com.gh.gamecenter.LibaoDetailActivity; -import com.gh.gamecenter.LoginActivity; import com.gh.gamecenter.MessageDetailActivity; import com.gh.gamecenter.NewsDetailActivity; import com.gh.gamecenter.R; @@ -155,7 +154,7 @@ public class ConcernFragment extends NormalFragment implements SwipeRefreshLayou mEmptyTv.setOnClickListener(v -> { if (mEmptyTv.getText().equals(getString(R.string.login_hint))) { - startActivity(LoginActivity.getIntent(getContext())); + CheckLoginUtils.checkLogin(getContext(), "游戏动态-请先登录", null); } }); } @@ -446,7 +445,7 @@ public class ConcernFragment extends NormalFragment implements SwipeRefreshLayou @OnClick(R.id.news1_tv_concern) public void concern() { // 关注 推荐关注的游戏 - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "游戏动态-推荐关注-[关注]", () -> { ArrayList list = new ArrayList<>(); for (int key : concernMap.keySet()) { if (concernMap.get(key)) { diff --git a/app/src/main/java/com/gh/gamecenter/libao/Libao2Fragment.java b/app/src/main/java/com/gh/gamecenter/libao/Libao2Fragment.java index 5e4b64cdba..6fec61eb94 100644 --- a/app/src/main/java/com/gh/gamecenter/libao/Libao2Fragment.java +++ b/app/src/main/java/com/gh/gamecenter/libao/Libao2Fragment.java @@ -12,10 +12,10 @@ import android.widget.TextView; import com.gc.materialdesign.views.ProgressBarCircularIndeterminate; import com.gh.base.fragment.BaseFragment; +import com.gh.common.util.CheckLoginUtils; import com.gh.common.view.VerticalItemDecoration; import com.gh.gamecenter.ConcernActivity; import com.gh.gamecenter.LibaoDetailActivity; -import com.gh.gamecenter.LoginActivity; import com.gh.gamecenter.R; import com.gh.gamecenter.entity.LibaoEntity; import com.gh.gamecenter.eventbus.EBConcernChanged; @@ -176,8 +176,10 @@ public class Libao2Fragment extends BaseFragment implements SwipeRefreshLayout.O break; case R.id.reuse_tv_none_data: String hint = getString(R.string.login_hint); - if (hint.equals(mNoDataTv.getText().toString())) - startActivity(LoginActivity.getIntent(getContext())); + if (hint.equals(mNoDataTv.getText().toString())) { + CheckLoginUtils.checkLogin(getContext(), "礼包中心-关注-请先登录", null); + } + break; } } diff --git a/app/src/main/java/com/gh/gamecenter/libao/Libao3Fragment.java b/app/src/main/java/com/gh/gamecenter/libao/Libao3Fragment.java index 7436f579fc..8d634d77e6 100644 --- a/app/src/main/java/com/gh/gamecenter/libao/Libao3Fragment.java +++ b/app/src/main/java/com/gh/gamecenter/libao/Libao3Fragment.java @@ -12,8 +12,8 @@ import android.widget.TextView; import com.gc.materialdesign.views.ProgressBarCircularIndeterminate; import com.gh.base.fragment.BaseFragment; +import com.gh.common.util.CheckLoginUtils; import com.gh.common.view.VerticalItemDecoration; -import com.gh.gamecenter.LoginActivity; import com.gh.gamecenter.R; import com.gh.gamecenter.eventbus.EBReuse; import com.gh.gamecenter.eventbus.EBUISwitch; @@ -135,8 +135,9 @@ public class Libao3Fragment extends BaseFragment implements SwipeRefreshLayout.O break; case R.id.reuse_tv_none_data: String hint = getString(R.string.login_hint); - if (hint.equals(mNoDataTv.getText().toString())) - startActivity(LoginActivity.getIntent(getContext())); + if (hint.equals(mNoDataTv.getText().toString())) { + CheckLoginUtils.checkLogin(getContext(), "礼包中心-存号箱-请先登录", null); + } break; } } diff --git a/app/src/main/java/com/gh/gamecenter/message/MessageDetailFragment.java b/app/src/main/java/com/gh/gamecenter/message/MessageDetailFragment.java index a83dcb9c39..e7767fe8db 100644 --- a/app/src/main/java/com/gh/gamecenter/message/MessageDetailFragment.java +++ b/app/src/main/java/com/gh/gamecenter/message/MessageDetailFragment.java @@ -271,7 +271,11 @@ public class MessageDetailFragment extends NormalFragment implements OnCommentCa //软键盘控制 private void setSoftInput(boolean isShow) { if (isShow) { - CheckLoginUtils.checkLogin(getContext(), () -> { + String entrance = "资讯文章详情-评论详情-回复"; + if (mCommentEntity == null) { + entrance = "资讯文章详情-评论详情-评论数"; + } + CheckLoginUtils.checkLogin(getContext(), entrance, () -> { Util_System_Keyboard.showSoftKeyboard(getContext(), mMessageDetailEt); mMessageDetailEt.setFocusable(true); mMessageDetailEt.setFocusableInTouchMode(true); @@ -303,7 +307,7 @@ public class MessageDetailFragment extends NormalFragment implements OnCommentCa return; } - CheckLoginUtils.checkLogin(requireContext(), () -> { + CheckLoginUtils.checkLogin(requireContext(), "资讯文章详情-评论详情-写评论", () -> { mSendingDialog = DialogUtils.showWaitDialog(getActivity(), getString(R.string.post_dialog_hint)); JSONObject jsonObject = new JSONObject(); diff --git a/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java index c6a720daa0..601d6d0250 100644 --- a/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java @@ -169,7 +169,7 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter { initGameViewHolder((NewsDetailGameViewHolder) holder); } else if (holder instanceof GameDetailNewsViewHolder) { initNewsDetailNewsViewHolder((GameDetailNewsViewHolder) holder); - ((GameDetailNewsViewHolder)holder).newsTitle.setText("大家都在看"); + ((GameDetailNewsViewHolder) holder).newsTitle.setText("大家都在看"); } else if (holder instanceof NewsDetailCommentListViewHolder) { initNewsDetailNewsCommentViewHolder((NewsDetailCommentListViewHolder) holder); } @@ -384,7 +384,7 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter { viewHolder.gameConcern.setOnClickListener(v -> { final TextView concern = ((TextView) v); - CheckLoginUtils.checkLogin(mContext, () -> { + CheckLoginUtils.checkLogin(mContext, "资讯文章详情-[关注]游戏", () -> { String str = concern.getText().toString(); viewHolder.gameConcern.setEnabled(false); if (mContext.getString(R.string.concern).equals(str)) { @@ -543,18 +543,15 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter { CommentUtils.setCommentUserView(mContext, viewHolder, commentEntity); - viewHolder.commentLikeIv.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - CommentUtils.postVote(mContext, commentEntity, viewHolder.commentLikeCountTv, viewHolder.commentLikeIv, null); - } - }); - contentView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - CommentUtils.showReportDialog(commentEntity, mContext, true, null, mNewsDetailEntity.getId()); - } - }); + viewHolder.commentLikeIv.setOnClickListener(v -> + CheckLoginUtils.checkLogin(mContext, "资讯文章详情-评论-点赞", + () -> CommentUtils.postVote(mContext, commentEntity, + viewHolder.commentLikeCountTv, + viewHolder.commentLikeIv, null))); + contentView.setOnClickListener(v -> + CommentUtils.showReportDialog(commentEntity, + mContext, true, null, + mNewsDetailEntity.getId(), "资讯文章详情-评论")); viewHolder.commentUserNameTv.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(mContext, commentEntity.getUser().getId(), mEntrance, "文章-评论列表")); viewHolder.commentUserIconDv.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(mContext, commentEntity.getUser().getId(), mEntrance, "文章-评论列表")); diff --git a/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java b/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java index 4d0e690d0e..311fa093c5 100644 --- a/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java +++ b/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java @@ -1,5 +1,6 @@ package com.gh.gamecenter.personal; +import android.annotation.SuppressLint; import android.arch.lifecycle.Lifecycle; import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModelProviders; @@ -24,12 +25,12 @@ import com.gh.common.util.DialogUtils; import com.gh.common.util.EntranceUtils; import com.gh.common.util.GetLoginDataUtils; import com.gh.common.util.ImageUtils; +import com.gh.common.util.LogUtils; import com.gh.common.util.PackageUtils; import com.gh.common.util.StringUtils; import com.gh.gamecenter.CollectionActivity; import com.gh.gamecenter.GameDetailActivity; import com.gh.gamecenter.InstallActivity; -import com.gh.gamecenter.LoginActivity; import com.gh.gamecenter.MainActivity; import com.gh.gamecenter.MessageActivity; import com.gh.gamecenter.NewsDetailActivity; @@ -147,6 +148,8 @@ public class PersonalFragment extends BaseFragment implements Observer startActivity(MyAskActivity.getIntent(getContext()))); + CheckLoginUtils.checkLogin(getContext(), "我的光环-我的问答", () -> startActivity(MyAskActivity.getIntent(getContext()))); break; case R.id.personal_home: - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "我的光环-个人主页", () -> { PersonalHomeActivity.startTargetActivity(getContext(), UserManager.getInstance().getUserId(), "", "我的光环"); }); break; case R.id.personal_draft: - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "我的光环-我的草稿", () -> { startActivity(CommunityDraftWrapperActivity.getIntent(getContext())); }); break; @@ -514,7 +518,10 @@ public class PersonalFragment extends BaseFragment implements Observer { + mViewModel.getHide().observe(this, isHidden -> { if (isHidden == null) return; if (isHidden) { @@ -560,7 +560,7 @@ public class AnswerDetailFragment extends NormalFragment { break; case R.id.menu_collect: if (mDetailEntity == null) return; - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "回答详情-收藏", () -> { if (!mDetailEntity.getMe().isAnswerFavorite()) { CollectionUtils.INSTANCE.postCollection(getContext(), mAnswerId , CollectionUtils.CollectionType.answer, new CollectionUtils.OnCollectionListener() { @@ -714,7 +714,7 @@ public class AnswerDetailFragment extends NormalFragment { } break; case R.id.answer_detail_like_container: - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "回答详情-赞同", () -> { if (mDetailEntity != null && !mDetailEntity.getMe().isAnswerVoted()) { mViewModel.postVote(mAnswerId); @@ -753,7 +753,7 @@ public class AnswerDetailFragment extends NormalFragment { startActivityForResult(AnswerDetailActivity.getIntent(getContext(), mDetailEntity.getMe().getMyAnswerId(), mEntrance, "答案详情"), ANSWER_PATCH_REQUEST); break; case NOT_ANSWERED_YET: - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "回答详情-[我来回答]", () -> { Questions question = mDetailEntity.getQuestion(); startActivity(AnswerEditActivity.getIntent(getContext(), question.getId(), question.getTitle(), true, question.getCommunityName())); }); @@ -766,7 +766,7 @@ public class AnswerDetailFragment extends NormalFragment { PersonalHomeActivity.startTargetActivity(getContext(), mDetailEntity.getUser().getId(), mEntrance, "回答详情"); break; case R.id.answer_detail_follow: - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "回答详情-[关注]用户", () -> { if (mBinding.answerDetailFollow.getText().equals("关注")) { mViewModel.follow(mDetailEntity.getUser().getId()); } diff --git a/app/src/main/java/com/gh/gamecenter/qa/answer/edit/AnswerEditFragment.java b/app/src/main/java/com/gh/gamecenter/qa/answer/edit/AnswerEditFragment.java index dce90deffa..eeb428ff98 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/answer/edit/AnswerEditFragment.java +++ b/app/src/main/java/com/gh/gamecenter/qa/answer/edit/AnswerEditFragment.java @@ -275,7 +275,7 @@ public class AnswerEditFragment extends NormalFragment { public void postAnswer() { if (getContext() == null) return; - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "回答编辑-提交", () -> { postDialog = WaitingDialogFragment.newInstance(getString(R.string.vote_post)); postDialog.show(getChildFragmentManager(), null); String answerContent = mEditContent.getHtml(); diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/MyArticleFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/article/MyArticleFragment.kt index d523962f56..4e1d085760 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/MyArticleFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/MyArticleFragment.kt @@ -6,6 +6,7 @@ import android.content.Intent import android.os.Bundle import android.view.MenuItem import com.gh.common.util.EntranceUtils +import com.gh.common.util.ifLogin import com.gh.gamecenter.R import com.gh.gamecenter.baselist.ListFragment import com.gh.gamecenter.baselist.LoadType @@ -66,7 +67,9 @@ class MyArticleFragment : ListFragment showMoreItemDialog() R.id.menu_collect -> { - mViewModel.collectionCommand(!mViewModel.detailEntity?.me?.isCommunityArticleFavorite!!, callback = { - mViewModel.detailEntity?.me?.isCommunityArticleFavorite = it - if (it) { - mCollectMenuItem?.setIcon(R.drawable.menu_ic_collect_select) - } else { - mCollectMenuItem?.setIcon(R.drawable.menu_ic_collect_unselect) - } - }) + CheckLoginUtils.checkLogin(this, "社区文章详情-收藏") { + mViewModel.collectionCommand(!mViewModel.detailEntity?.me?.isCommunityArticleFavorite!!, callback = { + mViewModel.detailEntity?.me?.isCommunityArticleFavorite = it + if (it) { + mCollectMenuItem?.setIcon(R.drawable.menu_ic_collect_select) + } else { + mCollectMenuItem?.setIcon(R.drawable.menu_ic_collect_unselect) + } + }) + } } } } @@ -276,7 +278,7 @@ class ArticleDetailActivity : BaseActivity() { } R.id.article_detail_like_container -> { if (mViewModel.detailEntity != null) { - ifLogin { + ifLogin("社区文章详情-赞同") { if (!mViewModel.detailEntity?.me?.isCommunityArticleVote!!) { mViewModel.vote() } else { @@ -292,7 +294,7 @@ class ArticleDetailActivity : BaseActivity() { } R.id.article_detail_follow -> { if (mViewModel.detailEntity != null) { - ifLogin { + ifLogin("社区文章详情-[关注]用户") { if (mBinding.articleDetailFollow.text == "关注") { mViewModel.follow() } else { diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/edit/ArticleEditActivity.kt b/app/src/main/java/com/gh/gamecenter/qa/article/edit/ArticleEditActivity.kt index 4a25b2bd72..0222f843e5 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/edit/ArticleEditActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/edit/ArticleEditActivity.kt @@ -322,7 +322,7 @@ class ArticleEditActivity : BaseActivity() { override fun onMenuItemClick(item: MenuItem?): Boolean { if (item?.itemId == R.id.menu_answer_post) { - ifLogin { + ifLogin("社区文章编辑-[发布]") { mViewModel?.title = mEditTitle.text.toString() mViewModel?.content = mEditContent.html mViewModel?.checkDataAndLoadTitleTag() diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/CommentFragment.java b/app/src/main/java/com/gh/gamecenter/qa/comment/CommentFragment.java index baec81416f..1581bd7e8b 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/CommentFragment.java +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/CommentFragment.java @@ -296,7 +296,11 @@ public class CommentFragment extends ListFragment { + String entrance; + if (TextUtils.isEmpty(mArticleId)) { + if (mCommentEntity != null) { + entrance = "社区文章详情-评论-写评论"; + } else { + entrance = "社区文章详情-评论-回复"; + } + } else { + if (mCommentEntity != null) { + entrance = "回答详情-评论-写评论"; + } else { + entrance = "回答详情-评论-回复"; + } + } + CheckLoginUtils.checkLogin(getContext(), entrance, () -> { InputMethodManager keyboard = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); keyboard.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); mCommentDetailCommentEt.setFocusable(true); diff --git a/app/src/main/java/com/gh/gamecenter/qa/follow/AskFollowFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/follow/AskFollowFragment.kt index 5e00b2bfc2..2bad33591c 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/follow/AskFollowFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/follow/AskFollowFragment.kt @@ -10,10 +10,10 @@ import android.widget.TextView import butterknife.BindView import butterknife.OnClick import com.facebook.drawee.view.SimpleDraweeView +import com.gh.common.util.CheckLoginUtils import com.gh.common.util.DisplayUtils import com.gh.common.util.ImageUtils import com.gh.common.util.NumberUtils -import com.gh.gamecenter.LoginActivity import com.gh.gamecenter.R import com.gh.gamecenter.baselist.ListFragment import com.gh.gamecenter.entity.PersonalEntity @@ -181,7 +181,7 @@ class AskFollowFragment : ListFragment { val hint = getString(R.string.login_hint) if (hint == noDataTv.text.toString()) { - startActivity(LoginActivity.getIntent(context)) + CheckLoginUtils.checkLogin(context, "问答-关注-请先登录", null) } } } diff --git a/app/src/main/java/com/gh/gamecenter/qa/newest/AskQuestionsNewBodyFragment.java b/app/src/main/java/com/gh/gamecenter/qa/newest/AskQuestionsNewBodyFragment.java index 5641374f6d..9d862ce658 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/newest/AskQuestionsNewBodyFragment.java +++ b/app/src/main/java/com/gh/gamecenter/qa/newest/AskQuestionsNewBodyFragment.java @@ -67,7 +67,7 @@ public class AskQuestionsNewBodyFragment extends ListFragment { + CheckLoginUtils.checkLogin(getContext(), "问题详情-[我来回答]", () -> { if (mQuestionsDetailEntity != null && !TextUtils.isEmpty(mQuestionsDetailEntity.getMe().getMyAnswerId())) { Intent intent = AnswerDetailActivity.getIntent(getContext(), mQuestionsDetailEntity.getMe().getMyAnswerId(), mEntrance, "问题详情-答案列表"); @@ -311,7 +311,7 @@ public class QuestionsDetailFragment startActivity(QuestionsInviteActivity.getIntent(getContext(), mQuestionsDetailEntity, mEntrance + "+(问题详情)")); break; case R.id.questionsdetail_concern: - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "问题详情-[关注问题]", () -> { if (mQuestionsDetailEntity.getMe().isQuestionOwn()) { startActivityForResult(QuestionEditActivity.Companion.getIntent(getContext(), mQuestionsDetailEntity), QUESTIONS_EDIT_REQUEST); } else if (!mQuestionsDetailEntity.getMe().isQuestionFollowed()) { @@ -337,7 +337,7 @@ public class QuestionsDetailFragment break; case R.id.reuse_nodata_skip: - CheckLoginUtils.checkLogin(getContext(), () -> { + CheckLoginUtils.checkLogin(getContext(), "问题详情-[我来回答]", () -> { startActivityForResult(AnswerEditActivity.getIntent(getContext(), mQuestionsId , getQuestionsTitle(), mQuestionsDetailEntity.getCommunity().getName()), QUESTIONS_DETAIL_ANSWER_REQUEST); }); diff --git a/app/src/main/java/com/gh/gamecenter/qa/questions/invite/QuestionsInviteFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/questions/invite/QuestionsInviteFragment.kt index 254da096e5..46cd6812e5 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/questions/invite/QuestionsInviteFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/questions/invite/QuestionsInviteFragment.kt @@ -72,7 +72,7 @@ class QuestionsInviteFragment : ListFragment { val inviteEntity = data as InviteEntity val me = inviteEntity.me - if (me == null || !me.isUserInvite) ifLogin { postInvite(inviteEntity.id) } + if (me == null || !me.isUserInvite) ifLogin("问题详情-邀请回答-[邀请]") { postInvite(inviteEntity.id) } } } } diff --git a/app/src/main/java/com/gh/gamecenter/qa/recommends/AskQuestionsRecommendsFragment.java b/app/src/main/java/com/gh/gamecenter/qa/recommends/AskQuestionsRecommendsFragment.java index a0e6f501f9..8c17640ceb 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/recommends/AskQuestionsRecommendsFragment.java +++ b/app/src/main/java/com/gh/gamecenter/qa/recommends/AskQuestionsRecommendsFragment.java @@ -177,7 +177,7 @@ public class AskQuestionsRecommendsFragment extends ListFragment { + CheckLoginUtils.checkLogin(this, "问答-搜索-提问", () -> { startActivityForResult(QuestionEditActivity.Companion.getIntent(this, mSearchKey), QUESTION_REQUEST_CODE); }); } else if (v.getId() == R.id.bar_question_btn) { @@ -175,7 +175,15 @@ public class AskSearchActivity extends BaseActivity { mDao.add(mSearchKey); Util_System_Keyboard.hideSoftKeyboard(this, mSearchEt); } else { - CheckLoginUtils.checkLogin(this, () -> { + String entrance; + if (!TextUtils.isEmpty(mColumnId)) { + entrance = "专栏详情-搜索-点我提问"; + } else if (!TextUtils.isEmpty(mQuestionTag)) { + entrance = "问题标签详情-搜索-点我提问"; + } else { + entrance = "问答-搜索-点我提问"; + } + CheckLoginUtils.checkLogin(this, entrance, () -> { startActivityForResult(QuestionEditActivity.Companion.getIntent(this, mSearchKey), QUESTION_REQUEST_CODE); }); } diff --git a/app/src/main/java/com/gh/gamecenter/qa/select/OpenedAdapter.kt b/app/src/main/java/com/gh/gamecenter/qa/select/OpenedAdapter.kt index 4ad17108c1..d7e5a9381e 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/select/OpenedAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/select/OpenedAdapter.kt @@ -116,7 +116,7 @@ class OpenedAdapter(context: Context, val mListViewModel: OpenedViewModel) : Lis holder.itemView.setOnClickListener { if (mIsOver && mContext !is CommunitiesSelectActivity) { - mContext.ifLogin { + mContext.ifLogin("问答-选择游戏-没有我的游戏?点击提交") { val bundle = Bundle() bundle.putBoolean(EntranceUtils.KEY_SHOW_SELECT_COMMUNITY, true) val intent = CommunitiesSelectActivity.getIntent(mContext, bundle) diff --git a/app/src/main/java/com/gh/gamecenter/qa/select/VotingFragment.java b/app/src/main/java/com/gh/gamecenter/qa/select/VotingFragment.java index 8287bdf5dc..0ddfa77eab 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/select/VotingFragment.java +++ b/app/src/main/java/com/gh/gamecenter/qa/select/VotingFragment.java @@ -79,7 +79,7 @@ public class VotingFragment extends ListFragment CheckLoginUtils.checkLogin(getContext(), this::showAddVoteDialog)); + mAddTv.setOnClickListener(v -> CheckLoginUtils.checkLogin(getContext(), + "下载游戏-求版本-[添加选项]", this::showAddVoteDialog)); } @Override @@ -95,7 +96,7 @@ public class VoteFragment extends ListFragment { + CheckLoginUtils.checkLogin(getContext(), "下载游戏-求版本-[投票]", () -> { postVersionVote((String) obj, false); // 投票 }); } @@ -264,6 +265,6 @@ public class VoteFragment extends ListFragment { + CheckLoginUtils.checkLogin(getActivity(), "工具详情-收藏", () -> { mMenuCollect.setEnabled(false); if (mToolBoxEntity.getMe() != null && mToolBoxEntity.getMe().isToolkitFavorite()) { CollectionUtils.INSTANCE.deleteCollection(getContext(), mToolBoxEntity.getId(), diff --git a/app/src/main/java/com/halo/assistant/fragment/comment/CommentDetailFragment.java b/app/src/main/java/com/halo/assistant/fragment/comment/CommentDetailFragment.java index 4ac93f85c1..52f43a7d17 100644 --- a/app/src/main/java/com/halo/assistant/fragment/comment/CommentDetailFragment.java +++ b/app/src/main/java/com/halo/assistant/fragment/comment/CommentDetailFragment.java @@ -204,7 +204,11 @@ public class CommentDetailFragment extends NormalFragment implements OnCommentCa //软键盘控制 private void setSoftInput(boolean isShow) { if (isShow) { - CheckLoginUtils.checkLogin(getContext(), () -> { + String entrance = "资讯文章详情-评论-查看对话-写评论"; + if (mCommentEntity == null) { + entrance = "资讯文章详情-评论-查看对话-回复"; + } + CheckLoginUtils.checkLogin(getContext(), entrance, () -> { Util_System_Keyboard.showSoftKeyboard(getContext(), mCommentDetailCommentEt); mCommentContentContainer.setVisibility(View.VISIBLE); mCommentLine.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernAdapter.java b/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernAdapter.java index 46c620a1f6..5924c97972 100644 --- a/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernAdapter.java +++ b/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernAdapter.java @@ -8,7 +8,6 @@ import android.view.ViewGroup; import com.gh.base.OnRequestCallBackListener; import com.gh.common.util.ApkActiveUtils; -import com.gh.common.util.CheckLoginUtils; import com.gh.common.util.ConcernUtils; import com.gh.common.util.DataCollectionUtils; import com.gh.common.util.DataUtils; @@ -112,43 +111,42 @@ class MyConcernAdapter extends BaseRecyclerAdapter { public void onClick(View v) { holder.concern_item_concern.setClickable(false); holder.itemView.setClickable(false); - CheckLoginUtils.checkLogin(mContext, () -> { - holder.concern_item_concern.setClickable(false); - holder.itemView.setClickable(false); - // 删除关注表中的数据,并更新界面 - DialogUtils.showCancelDialog(mContext, new DialogUtils.ConfirmListener() { - @Override - public void onConfirm() { - ConcernUtils.INSTANCE.deleteConcernData(mContext, gameEntity.getId(), new ConcernUtils.onConcernListener() { - @Override - public void onSuccess() { - // 更新界面->cancelConcern() + holder.concern_item_concern.setClickable(false); + holder.itemView.setClickable(false); + // 删除关注表中的数据,并更新界面 + DialogUtils.showCancelDialog(mContext, new DialogUtils.ConfirmListener() { + @Override + public void onConfirm() { - Map kv = new HashMap<>(); - kv.put("状态", R.string.cancel_concern); - DataUtils.onEvent(mContext, "游戏关注", gameEntity.getName(), kv); + ConcernUtils.INSTANCE.deleteConcernData(mContext, gameEntity.getId(), new ConcernUtils.onConcernListener() { + @Override + public void onSuccess() { + // 更新界面->cancelConcern() - DataCollectionUtils.uploadConcern(mContext, - gameEntity.getName(), gameEntity.getId(), mContext.getString(R.string.cancel_concern)); + Map kv = new HashMap<>(); + kv.put("状态", R.string.cancel_concern); + DataUtils.onEvent(mContext, "游戏关注", gameEntity.getName(), kv); - } + DataCollectionUtils.uploadConcern(mContext, + gameEntity.getName(), gameEntity.getId(), mContext.getString(R.string.cancel_concern)); - @Override - public void onError() { - Utils.toast(mContext, R.string.concern_cancel_failure); - holder.concern_item_concern.setClickable(true); - holder.itemView.setClickable(true); - } - }); - } - }, new DialogUtils.CancelListener() { - @Override - public void onCancel() { - holder.concern_item_concern.setClickable(true); - holder.itemView.setClickable(true); - } - }); + } + + @Override + public void onError() { + Utils.toast(mContext, R.string.concern_cancel_failure); + holder.concern_item_concern.setClickable(true); + holder.itemView.setClickable(true); + } + }); + } + }, new DialogUtils.CancelListener() { + @Override + public void onCancel() { + holder.concern_item_concern.setClickable(true); + holder.itemView.setClickable(true); + } }); } }); diff --git a/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernFragment.java b/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernFragment.java index 2917521d60..7edf4b3022 100644 --- a/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernFragment.java +++ b/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernFragment.java @@ -10,8 +10,8 @@ import android.widget.RelativeLayout; import android.widget.TextView; import com.gh.base.OnRequestCallBackListener; +import com.gh.common.util.CheckLoginUtils; import com.gh.common.view.Concern_LinearLayout; -import com.gh.gamecenter.LoginActivity; import com.gh.gamecenter.R; import com.gh.gamecenter.entity.GameEntity; import com.gh.gamecenter.eventbus.EBConcernChanged; @@ -144,8 +144,9 @@ public class MyConcernFragment extends NormalFragment implements View.OnClickLis break; case R.id.reuse_tv_none_data: String hint = getString(R.string.login_hint); - if (hint.equals(mNoDataTv.getText().toString())) - startActivity(LoginActivity.getIntent(getContext())); + if (hint.equals(mNoDataTv.getText().toString())) { + CheckLoginUtils.checkLogin(getContext(), "我的关注-请先登录", null); + } break; } } diff --git a/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernRecommendAdapter.java b/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernRecommendAdapter.java index 2f3aefa29f..a13e5b5400 100644 --- a/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernRecommendAdapter.java +++ b/app/src/main/java/com/halo/assistant/fragment/myconcern/MyConcernRecommendAdapter.java @@ -163,11 +163,8 @@ class MyConcernRecommendAdapter extends BaseRecyclerAdapter { holder.concern_item_concern.setText(R.string.concern); holder.concern_item_concern.setTextColor(Color.WHITE); holder.concern_item_concern.setBackgroundResource(R.drawable.textview_blue_style); - holder.concern_item_concern.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - - CheckLoginUtils.checkLogin(mContext, () -> { + holder.concern_item_concern.setOnClickListener(v -> + CheckLoginUtils.checkLogin(mContext, "我的关注-热门游戏推荐-[关注]", () -> { holder.concern_item_concern.setClickable(false); holder.itemView.setClickable(false); ConcernUtils.INSTANCE.postConcernGameId(mContext, gameEntity.getId(), new ConcernUtils.onConcernListener() { @@ -197,9 +194,7 @@ class MyConcernRecommendAdapter extends BaseRecyclerAdapter { } }); - }); - } - }); + })); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {