Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d622d2be9 | |||
| 800525227d | |||
| c9dec9a31e | |||
| 2ae4fda6e8 | |||
| 609702715f | |||
| ec7e138208 | |||
| bfd64a8bce | |||
| 5571b6481f | |||
| 6d6574988c | |||
| af8d075bf2 | |||
| b7db66e90b | |||
| 13ac4658d9 | |||
| 8ad3420822 | |||
| f842ced67e | |||
| e0081e56df | |||
| 3202764f22 | |||
| f477876359 | |||
| 86ffcb92f8 | |||
| a2088e5cd9 | |||
| 6e1247f393 | |||
| c33faa4918 | |||
| d0aeb1c411 | |||
| 485924527e | |||
| ca1bfda326 | |||
| c7c786d662 | |||
| acf9fe308c | |||
| 3b32231709 | |||
| 9dae198af2 | |||
| 29bfd5bb93 | |||
| 8da51d7f5a | |||
| 91964a0ffc | |||
| 479ef20859 | |||
| f458b7dcb8 | |||
| 2d25ff7836 | |||
| 57dd5d0584 | |||
| 757efec05e | |||
| 4979045be2 | |||
| f59af60f70 | |||
| 60bc2a02f4 | |||
| 996be3906e | |||
| 14a054bdbc | |||
| 07a9fd6273 | |||
| a067f7bc43 | |||
| a5eefbb6f4 | |||
| 8d9f83c432 | |||
| ae0df36a89 | |||
| 72539671a1 | |||
| 94277a4aeb | |||
| e276d148cf | |||
| a7152034e8 | |||
| 4a5e9da34a | |||
| 1422365cc5 | |||
| 7f55ff6340 | |||
| 4722626fb7 | |||
| 39d87ad98d | |||
| 85333b9eed | |||
| c99ae6db3e | |||
| c5be98adc2 | |||
| 5321aa2e9f | |||
| 345707ef42 | |||
| 6a9d05d916 | |||
| faf2a89706 | |||
| ada51f90f1 | |||
| 53962116d5 | |||
| 3ea52745b3 | |||
| a8f2289b27 | |||
| 6dd56b5d16 | |||
| eb739cf6cb | |||
| 4853cd9047 | |||
| 4e0f14aeed | |||
| 5e37dac0f6 | |||
| 22bfa9051a | |||
| 0a1dca3aa3 |
@ -1,7 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="user-scalable=no">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="normalize.css">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
|
||||
@ -4,6 +4,7 @@ package com.gh.common.constant;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.util.GsonUtils;
|
||||
@ -157,6 +158,7 @@ public class Config {
|
||||
mSettingsEntity = settingsEntity;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static SettingsEntity getSettings() {
|
||||
if (mSettingsEntity == null) {
|
||||
try {
|
||||
|
||||
@ -11,10 +11,12 @@ import com.gh.gamecenter.SuggestSelectActivity
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.m7.imkfsdk.KfStartHelper
|
||||
import com.m7.imkfsdk.utils.Utils
|
||||
import com.moor.imkf.ChatListener
|
||||
import com.moor.imkf.IMChat
|
||||
import com.moor.imkf.IMChatManager
|
||||
import com.moor.imkf.IMMessage
|
||||
import com.moor.imkf.utils.MoorUtils
|
||||
|
||||
object ImManager {
|
||||
|
||||
@ -29,6 +31,8 @@ object ImManager {
|
||||
fun attachIm() {
|
||||
try {
|
||||
if (UserManager.getInstance().userInfoEntity != null) {
|
||||
MoorUtils.init(HaloApp.getInstance().application)
|
||||
Utils.init(HaloApp.getInstance().application)
|
||||
IMChatManager.getInstance().init(
|
||||
HaloApp.getInstance().application,
|
||||
ImReceiver.UNIQUE_BROADCAST_ACTION,
|
||||
|
||||
@ -12,8 +12,8 @@ import android.support.v4.app.NotificationCompat
|
||||
import com.gh.base.CurrentActivityHolder
|
||||
import com.gh.gamecenter.R
|
||||
import com.m7.imkfsdk.chat.ChatActivity
|
||||
import com.m7.imkfsdk.utils.Utils
|
||||
import com.moor.imkf.IMChatManager
|
||||
import com.moor.imkf.utils.Utils
|
||||
|
||||
class ImReceiver : BroadcastReceiver() {
|
||||
|
||||
|
||||
@ -15,14 +15,16 @@ import com.lightgame.utils.Utils;
|
||||
public class CheckLoginUtils {
|
||||
|
||||
public static void checkLogin(final Context context, String entrance, OnLoginListener listener) {
|
||||
if (TextUtils.isEmpty(UserManager.getInstance().getToken())) {
|
||||
if (!isLogin()) {
|
||||
if (listener != null) Utils.toast(context, "需要登录");
|
||||
LogUtils.login("dialog", null, entrance);
|
||||
LogUtils.login("activity", null, entrance);
|
||||
Intent intent = LoginActivity.getIntent(context, entrance);
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
listener.onLogin();
|
||||
if (listener != null) {
|
||||
listener.onLogin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import com.gh.gamecenter.eventbus.EBConcernChanged
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.retrofit.Response
|
||||
@ -20,9 +21,14 @@ import retrofit2.HttpException
|
||||
*/
|
||||
object ConcernUtils {
|
||||
|
||||
fun postConcernGameId(context: Context, gameId: String, listener: onConcernListener?) {
|
||||
RetrofitManager.getInstance(context).getApi()
|
||||
.postConcern(UserManager.getInstance().userId, gameId)
|
||||
fun postConcernGameId(context: Context, gameId: String, listener: onConcernListener?, autoConcern: Boolean = false) {
|
||||
val mode = if (autoConcern) "auto" else "manual"
|
||||
|
||||
val userId = UserManager.getInstance().userId
|
||||
if (TextUtils.isEmpty(userId)) return
|
||||
|
||||
RetrofitManager.getInstance(context).api
|
||||
.postConcern(UserManager.getInstance().userId, gameId, mode)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
@ -40,7 +46,7 @@ object ConcernUtils {
|
||||
}
|
||||
|
||||
fun deleteConcernData(context: Context, gameId: String, listener: onConcernListener?) {
|
||||
RetrofitManager.getInstance(context).getApi()
|
||||
RetrofitManager.getInstance(context).api
|
||||
.deleteConcern(UserManager.getInstance().userId, gameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -61,7 +67,7 @@ object ConcernUtils {
|
||||
fun updateConcernData(context: Context, data: JSONArray) {
|
||||
val body = RequestBody.create(MediaType.parse("application/json"),
|
||||
data.toString())
|
||||
RetrofitManager.getInstance(context).getApi()
|
||||
RetrofitManager.getInstance(context).api
|
||||
.putConcern(UserManager.getInstance().userId, body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
@ -73,7 +79,7 @@ object ConcernUtils {
|
||||
}
|
||||
|
||||
fun deleteConcernQuestions(context: Context, questionsId: String, listener: onConcernListener?) {
|
||||
RetrofitManager.getInstance(context).getApi()
|
||||
RetrofitManager.getInstance(context).api
|
||||
.deleteConcernQuestions(UserManager.getInstance().userId, questionsId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -92,7 +98,7 @@ object ConcernUtils {
|
||||
}
|
||||
|
||||
fun postConcernQuestions(context: Context, questionsId: String, listener: onConcernListener?) {
|
||||
RetrofitManager.getInstance(context).getApi()
|
||||
RetrofitManager.getInstance(context).api
|
||||
.postConcernQuestions(UserManager.getInstance().userId, questionsId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
||||
@ -128,6 +128,20 @@ public class DeviceUtils {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static String getUserAgent() {
|
||||
String userAgent = "";
|
||||
userAgent = System.getProperty("http.agent");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0, length = userAgent.length(); i < length; i++) {
|
||||
char c = userAgent.charAt(i);
|
||||
if (c <= '\u001f' || c >= '\u007f') {
|
||||
sb.append(String.format("\\u%04x", (int) c));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getIPAddress(Context context) {
|
||||
NetworkInfo info = ((ConnectivityManager) context
|
||||
|
||||
@ -69,7 +69,7 @@ public class DownloadItemUtils {
|
||||
// adapter.notifyItemChanged(index);
|
||||
// }
|
||||
} else {
|
||||
if (!queue.contains(platform)) {
|
||||
if (!queue.contains(platform) && !TextUtils.isEmpty(platform)) {
|
||||
queue.offer(platform);
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(DownloadItemUtils.class, queue.size(), gameEntity.getBrief(), downloadEntity.getPlatform(), index);
|
||||
@ -159,6 +159,7 @@ public class DownloadItemUtils {
|
||||
// 更新插件的条目,有多个apk包
|
||||
private static void updatePluginItem(Context context, GameViewHolder holder, GameEntity gameEntity,
|
||||
boolean isShowPlatform, PluginLocation pluginLocation) {
|
||||
GameUtils.setDownloadBtnStatus(context, gameEntity, holder.gameDownloadBtn, pluginLocation);
|
||||
|
||||
ArrayMap<String, DownloadEntity> entryMap = gameEntity.getEntryMap();
|
||||
if (entryMap != null && !entryMap.isEmpty()) {
|
||||
@ -177,8 +178,6 @@ public class DownloadItemUtils {
|
||||
}
|
||||
}
|
||||
|
||||
GameUtils.setDownloadBtnStatus(context, gameEntity, holder.gameDownloadBtn, pluginLocation);
|
||||
|
||||
holder.gameDes.setVisibility(View.VISIBLE);
|
||||
holder.gameProgressbar.setVisibility(View.GONE);
|
||||
holder.gameInfo.setVisibility(View.GONE);
|
||||
|
||||
@ -28,7 +28,7 @@ object ErrorHelper {
|
||||
/**
|
||||
* [important] 用来标识有同样错误码可以触发两种处理时,为 true 时选择重要的
|
||||
*/
|
||||
fun handleError(context: Context, errorString: String?, important: Boolean? = false) {
|
||||
fun handleError(context: Context, errorString: String?, important: Boolean = false) {
|
||||
val errorEntity = errorString?.fromObject<ErrorEntity>()
|
||||
|
||||
if (errorEntity == null) {
|
||||
|
||||
@ -5,6 +5,7 @@ import android.content.Context
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v4.app.FragmentActivity
|
||||
import android.support.v4.view.ViewPager
|
||||
import android.view.View
|
||||
|
||||
/**
|
||||
* 创建以 activity 为观察者上下文的 viewModel
|
||||
@ -92,4 +93,8 @@ fun fastDoubleClickAction(id: Int, interval: Long = 300, action: (() -> Unit)? =
|
||||
if (ClickUtils.isFastDoubleClick(id, interval)) {
|
||||
action?.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
fun View.fastDoubleClickAction(interval: Long, action: (() -> Unit)? = null) {
|
||||
fastDoubleClickAction(id, interval, action)
|
||||
}
|
||||
@ -6,13 +6,14 @@ import android.support.v4.content.ContextCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameCollectionEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.entity.PluginLocation;
|
||||
import com.gh.gamecenter.entity.SettingsEntity;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.DownloadStatus;
|
||||
@ -71,15 +72,18 @@ public class GameUtils {
|
||||
int installCount = 0; // 已安装数量
|
||||
DownloadEntity downloadEntity;
|
||||
Object gh_id;
|
||||
apkFor:
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
|
||||
// 去除下载合集判断
|
||||
boolean isCollection = false;
|
||||
for (GameCollectionEntity collectionEntity : gameEntity.getCollection()) {
|
||||
if (collectionEntity.getPackage().contains(apkEntity.getPackageName()))
|
||||
isCollection = true;
|
||||
// filter by packageName
|
||||
SettingsEntity settings = Config.getSettings();
|
||||
if (settings != null && gameEntity.getApk().size() > 1) {
|
||||
for (String pkgName : settings.getGameDownloadBlackList()) {
|
||||
if (pkgName.equals(apkEntity.getPackageName())) {
|
||||
continue apkFor;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isCollection) continue;
|
||||
|
||||
downloadEntity = DownloadManager.getInstance(context).getDownloadEntityByUrl(apkEntity.getUrl());
|
||||
if (downloadEntity != null) {
|
||||
|
||||
@ -231,12 +231,23 @@ object ImageUtils {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun display(view: SimpleDraweeView?, url: String?) {
|
||||
val width = view?.layoutParams?.width
|
||||
if (width != null && width > 0) {
|
||||
view.setImageURI(getTransformLimitUrl(url, width, view.context))
|
||||
} else {
|
||||
view?.post {
|
||||
view.setImageURI(getTransformLimitUrl(url, view.width, view.context))
|
||||
url?.let {
|
||||
// 图片是以 gif 结尾的就
|
||||
if (it.endsWith(".gif")) {
|
||||
val controller = Fresco.newDraweeControllerBuilder()
|
||||
.setUri(url)
|
||||
.setAutoPlayAnimations(true)
|
||||
.build()
|
||||
view?.controller = controller
|
||||
} else {
|
||||
val width = view?.layoutParams?.width
|
||||
if (width != null && width > 0) {
|
||||
view.setImageURI(getTransformLimitUrl(url, width, view.context))
|
||||
} else {
|
||||
view?.post {
|
||||
view.setImageURI(getTransformLimitUrl(url, view.width, view.context))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
import com.gh.gamecenter.qa.entity.Questions;
|
||||
@ -137,6 +138,10 @@ public class LogUtils {
|
||||
}
|
||||
|
||||
private static void upload(JSONObject object) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Utils.log("LogUtils->" + object.toString());
|
||||
}
|
||||
|
||||
Context context = HaloApp.getInstance().getApplication();
|
||||
try {
|
||||
object.put("version", PackageUtils.getVersionName());
|
||||
|
||||
@ -255,6 +255,11 @@ public class MessageShareUtils {
|
||||
private void wechatSahre() {
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
|
||||
if (!PackageHelper.INSTANCE.getLocalPackageNameSet().contains("com.tencent.mm")) {
|
||||
Utils.toast(mContext, "没安装微信,分享失败");
|
||||
return;
|
||||
}
|
||||
|
||||
//官方分享
|
||||
// WXImageObject imgObj = new WXImageObject();
|
||||
// imgObj.setImagePath(mContext.getExternalCacheDir().getPath() + "/ShareImg/" + picName);
|
||||
@ -286,6 +291,11 @@ public class MessageShareUtils {
|
||||
private void wechatMomentsSahre() {
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
|
||||
if (!PackageHelper.INSTANCE.getLocalPackageNameSet().contains("com.tencent.mm")) {
|
||||
Utils.toast(mContext, "没安装微信,分享失败");
|
||||
return;
|
||||
}
|
||||
|
||||
WXImageObject imgObj = new WXImageObject();
|
||||
imgObj.setImagePath(mContext.getExternalCacheDir().getPath() + "/ShareImg/" + picName);
|
||||
WXMediaMessage msg = new WXMediaMessage();
|
||||
|
||||
@ -2,7 +2,6 @@ package com.gh.common.util
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import com.gh.common.AppExecutor
|
||||
import com.gh.common.constant.Config
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
@ -23,9 +22,7 @@ object PackageHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun refreshLocalPackageList() {
|
||||
AppExecutor.ioExecutor.execute {
|
||||
localPackageNameSet = getAllPackageName(HaloApp.getInstance().application)
|
||||
}
|
||||
localPackageNameSet = getAllPackageName(HaloApp.getInstance().application)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
||||
@ -251,6 +251,12 @@ public class ShareUtils {
|
||||
//微信好友分享
|
||||
private void wechatShare() {
|
||||
Utils.toast(mContext, R.string.share_skip);
|
||||
|
||||
if (!PackageHelper.INSTANCE.getLocalPackageNameSet().contains("com.tencent.mm")) {
|
||||
Utils.toast(mContext, "没安装微信,分享失败");
|
||||
return;
|
||||
}
|
||||
|
||||
WXWebpageObject webpage = new WXWebpageObject();
|
||||
WXMediaMessage msg = new WXMediaMessage(webpage);
|
||||
webpage.webpageUrl = shareUrl;
|
||||
@ -387,6 +393,12 @@ public class ShareUtils {
|
||||
//微信朋友圈分享
|
||||
private void wechatMomentsShare() {
|
||||
Utils.toast(mContext, R.string.share_skip);
|
||||
|
||||
if (!PackageHelper.INSTANCE.getLocalPackageNameSet().contains("com.tencent.mm")) {
|
||||
Utils.toast(mContext, "没安装微信,分享失败");
|
||||
return;
|
||||
}
|
||||
|
||||
WXWebpageObject webpage = new WXWebpageObject();
|
||||
WXMediaMessage msg = new WXMediaMessage(webpage);
|
||||
|
||||
|
||||
39
app/src/main/java/com/gh/common/util/TextHelper.kt
Normal file
39
app/src/main/java/com/gh/common/util/TextHelper.kt
Normal file
@ -0,0 +1,39 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.widget.EditText
|
||||
import com.gh.gamecenter.R
|
||||
|
||||
object TextHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun limitTheLengthOfEditText(editText: EditText, length: Int, exceedCallback: ExceedTextLengthLimitCallback? = null) {
|
||||
editText.addTextChangedListener(object :TextWatcher {
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
val tvCount = editText.text.toString().length
|
||||
if (tvCount > length) {
|
||||
val str = editText.text.toString().substring(0, length)
|
||||
editText.setText(str)
|
||||
editText.setSelection(str.length)
|
||||
if (!ClickUtils.isFastDoubleClick(R.id.userinfo_nickname_et, 2000)) {
|
||||
exceedCallback?.onExceed()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
interface ExceedTextLengthLimitCallback {
|
||||
fun onExceed()
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.gh.common.util
|
||||
|
||||
/**
|
||||
* 第三方安装包(即安装包里没有 gh-id)的辅助类
|
||||
*/
|
||||
object ThirdPartyPackageHelper {
|
||||
|
||||
private const val PREFIX = "third_party_package"
|
||||
|
||||
@JvmStatic
|
||||
fun saveGameId(packageName: String, gameId: String) {
|
||||
SPUtils.setString(PREFIX + packageName, gameId)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getGameId(packageName: String): String {
|
||||
return SPUtils.getString(PREFIX + packageName, "")!!
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,7 +8,6 @@ import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
@ -146,14 +145,14 @@ public class DownloadDialog implements OnCollectionCallBackListener {
|
||||
// 一个自定义的布局,作为显示的内容
|
||||
View contentView = View.inflate(mContext, R.layout.game_download_dialog, null);
|
||||
|
||||
TextView title = (TextView) contentView.findViewById(R.id.dialog_title);
|
||||
TextView title = contentView.findViewById(R.id.dialog_title);
|
||||
title.setText(gameEntity.getName());
|
||||
|
||||
viewPager = (ViewPager) contentView.findViewById(R.id.dialog_viewPager);
|
||||
dialog_ll_hint = (LinearLayout) contentView.findViewById(R.id.dialog_ll_hint);
|
||||
dialog_ll_collection = (LinearLayout) contentView.findViewById(R.id.dialog_ll_collection);
|
||||
dialog_ll_collection_hint = (LinearLayout) contentView.findViewById(R.id.dialog_ll_collection_hint);
|
||||
collectionViewPager = (ViewPager) contentView.findViewById(R.id.dialog_collection_viewPager);
|
||||
viewPager = contentView.findViewById(R.id.dialog_viewPager);
|
||||
dialog_ll_hint = contentView.findViewById(R.id.dialog_ll_hint);
|
||||
dialog_ll_collection = contentView.findViewById(R.id.dialog_ll_collection);
|
||||
dialog_ll_collection_hint = contentView.findViewById(R.id.dialog_ll_collection_hint);
|
||||
collectionViewPager = contentView.findViewById(R.id.dialog_collection_viewPager);
|
||||
|
||||
isLoadPlatform = false;
|
||||
|
||||
@ -164,32 +163,21 @@ public class DownloadDialog implements OnCollectionCallBackListener {
|
||||
popupWindow = new PopupWindow(contentView, LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT, true);
|
||||
|
||||
contentView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
contentView.setOnClickListener(v -> popupWindow.dismiss());
|
||||
contentView.setFocusable(true);
|
||||
contentView.setFocusableInTouchMode(true);
|
||||
contentView.setOnKeyListener(new View.OnKeyListener() {
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
|
||||
&& popupWindow != null && popupWindow.isShowing()) {
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
return false;
|
||||
contentView.setOnKeyListener((v, keyCode, event) -> {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
|
||||
&& popupWindow != null && popupWindow.isShowing()) {
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
isShow = false;
|
||||
EventBus.getDefault().unregister(DownloadDialog.this);
|
||||
DownloadManager.getInstance(mContext).removeObserver(dataWatcher);
|
||||
}
|
||||
popupWindow.setOnDismissListener(() -> {
|
||||
isShow = false;
|
||||
EventBus.getDefault().unregister(DownloadDialog.this);
|
||||
DownloadManager.getInstance(mContext).removeObserver(dataWatcher);
|
||||
});
|
||||
|
||||
popupWindow.setTouchable(true);
|
||||
|
||||
@ -10,8 +10,13 @@ object DrawableView {
|
||||
|
||||
@JvmStatic
|
||||
fun getServerDrawable(colorCode: String): Drawable {
|
||||
return getServerDrawable(Color.parseColor(colorCode))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getServerDrawable(colorCode: Int): Drawable {
|
||||
val drawable = GradientDrawable()
|
||||
drawable.setColor(Color.parseColor(colorCode))
|
||||
drawable.setColor(colorCode)
|
||||
drawable.cornerRadius = DisplayUtils.dip2px(2F).toFloat()
|
||||
return drawable
|
||||
}
|
||||
|
||||
@ -0,0 +1,136 @@
|
||||
package com.gh.common.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.gamecenter.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MessageSpannableTextView extends android.support.v7.widget.AppCompatTextView {
|
||||
|
||||
private OnSpannableClickListener mSpannableClickListener;
|
||||
|
||||
private final String mStartMarkKey = "{{";
|
||||
private final String mEndMarkKey = "}}";
|
||||
|
||||
private List<MarkData> mMarkList;
|
||||
|
||||
public MessageSpannableTextView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MessageSpannableTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mMarkList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(CharSequence text, BufferType type) {
|
||||
if (TextUtils.isEmpty(text) ||
|
||||
!text.toString().contains(mStartMarkKey) && !text.toString().contains(mEndMarkKey)) {
|
||||
super.setText(text, type);
|
||||
return;
|
||||
}
|
||||
|
||||
mMarkList.clear();
|
||||
String sText = text.toString();
|
||||
String[] split = sText.split("\\}\\}");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
String s = split[i];
|
||||
int p = s.lastIndexOf(mStartMarkKey);
|
||||
if (p != -1) {
|
||||
MarkData markData = new MarkData();
|
||||
String substring = s.substring(p);
|
||||
String content = s.replace(substring, "");
|
||||
builder.append(content);
|
||||
markData.setStart(builder.length() + 1);
|
||||
|
||||
String key = substring.replace(mStartMarkKey, " ") + " ";
|
||||
builder.append(key);
|
||||
markData.setEnd(builder.length() - 1);
|
||||
markData.setKey(key);
|
||||
|
||||
mMarkList.add(markData);
|
||||
System.out.println(substring);
|
||||
System.out.println(s);
|
||||
} else {
|
||||
builder.append(s);
|
||||
if (i != split.length - 1 || sText.substring(sText.length() - 2, sText.length()).equals("}}")) {
|
||||
builder.append("}}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpannableStringBuilder msp = new SpannableStringBuilder(builder);
|
||||
for (MarkData markData : mMarkList) {
|
||||
msp.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setColor(getContext().getResources().getColor(R.color.tag_orange));
|
||||
ds.setUnderlineText(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View widget) {
|
||||
if (mSpannableClickListener != null) {
|
||||
mSpannableClickListener.onClick(markData.getKey().trim());
|
||||
}
|
||||
}
|
||||
}, markData.getStart(), markData.getEnd(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
}
|
||||
|
||||
setMovementMethod(CustomLinkMovementMethod.getInstance());
|
||||
super.setText(msp, type);
|
||||
}
|
||||
|
||||
public void setOnSpannableClickListener(OnSpannableClickListener spannableClickListener) {
|
||||
this.mSpannableClickListener = spannableClickListener;
|
||||
}
|
||||
|
||||
|
||||
public interface OnSpannableClickListener {
|
||||
void onClick(String spannableText);
|
||||
}
|
||||
|
||||
class MarkData {
|
||||
private int start;
|
||||
private int end;
|
||||
private String key;
|
||||
|
||||
public int getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public void setStart(int start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public int getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(int end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,12 +60,12 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
if (v.id == R.id.start || v.id == R.id.thumb) {
|
||||
if (Jzvd.CURRENT_STATE_PLAYING != currentState) {
|
||||
if ((currentScreen == SCREEN_WINDOW_NORMAL || currentScreen == SCREEN_WINDOW_LIST)) {
|
||||
MtaHelper.onEvent("游戏详情", "视频_点击播放", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "视频_点击播放", gameName)
|
||||
} else {
|
||||
MtaHelper.onEvent("游戏详情", "视频全屏_点击播放", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "视频全屏_点击播放", gameName)
|
||||
}
|
||||
} else {
|
||||
MtaHelper.onEvent("游戏详情", "视频_点击暂停", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "视频_点击暂停", gameName)
|
||||
}
|
||||
|
||||
if (showAlertDialogForTheFistTime
|
||||
@ -86,7 +86,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
Jzvd.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
JZUtils.setRequestedOrientation(context, Jzvd.FULLSCREEN_ORIENTATION)
|
||||
}
|
||||
MtaHelper.onEvent("游戏详情", "视频全屏_点击旋转", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "视频全屏_点击旋转", gameName)
|
||||
}
|
||||
R.id.mute -> {
|
||||
toggleMute()
|
||||
@ -130,7 +130,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
} else {
|
||||
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0)
|
||||
}
|
||||
MtaHelper.onEvent("游戏详情", "视频_点击静音", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "视频_点击静音", gameName)
|
||||
}
|
||||
|
||||
private fun unmute() {
|
||||
@ -143,7 +143,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
60 * mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
|
||||
0)
|
||||
}
|
||||
MtaHelper.onEvent("游戏详情", "视频_解除静音", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "视频_解除静音", gameName)
|
||||
}
|
||||
|
||||
override fun onStatePlaying() {
|
||||
@ -257,7 +257,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
if (currentScreen == SCREEN_WINDOW_NORMAL || currentScreen == SCREEN_WINDOW_LIST) {
|
||||
progressBar.visibility = View.INVISIBLE
|
||||
totalTimeTextView.visibility = View.INVISIBLE
|
||||
MtaHelper.onEvent("游戏详情", "视频全屏_点击后退", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "视频全屏_点击后退", gameName)
|
||||
} else {
|
||||
progressBar.visibility = View.VISIBLE
|
||||
totalTimeTextView.visibility = View.VISIBLE
|
||||
@ -267,7 +267,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
override fun startWindowFullscreen() {
|
||||
super.startWindowFullscreen()
|
||||
unmute()
|
||||
MtaHelper.onEvent("游戏详情", "视频_点击进入全屏", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "视频_点击进入全屏", gameName)
|
||||
}
|
||||
|
||||
override fun startDismissControlViewTimer() {
|
||||
|
||||
@ -398,7 +398,11 @@ public class RichEditor extends WebView {
|
||||
|
||||
private void load(String trigger) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
evaluateJavascript(trigger, null);
|
||||
try {
|
||||
evaluateJavascript(trigger, null);
|
||||
} catch (IllegalStateException ignore) {
|
||||
loadUrl(trigger);
|
||||
}
|
||||
} else {
|
||||
loadUrl(trigger);
|
||||
}
|
||||
|
||||
@ -70,10 +70,12 @@ public class InstallActivity extends BaseActivity implements InstallFragmentAdap
|
||||
if (locationList != null && locationList.size() != 0) {
|
||||
GameEntity gameEntity;
|
||||
for (int location : locationList) {
|
||||
gameEntity = mAdapter.getGameList().get(location);
|
||||
if (gameEntity != null) {
|
||||
DownloadItemUtils.processDate(InstallActivity.this, gameEntity,
|
||||
downloadEntity, mAdapter, location);
|
||||
if (location < mAdapter.getGameList().size()) {
|
||||
gameEntity = mAdapter.getGameList().get(location);
|
||||
if (gameEntity != null) {
|
||||
DownloadItemUtils.processDate(InstallActivity.this, gameEntity,
|
||||
downloadEntity, mAdapter, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,8 @@ import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ethanhua.skeleton.Skeleton;
|
||||
import com.ethanhua.skeleton.ViewSkeletonScreen;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.base.OnRequestCallBackListener;
|
||||
import com.gh.common.util.ApkActiveUtils;
|
||||
@ -75,6 +77,10 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
|
||||
LinearLayout mNoneData;
|
||||
@BindView(R.id.detail_progressbar)
|
||||
DownloadProgressBar mDownloadPb;
|
||||
@BindView(R.id.list_skeleton)
|
||||
View mListSkeleton;
|
||||
|
||||
private ViewSkeletonScreen mSkeleton;
|
||||
|
||||
private LibaoDetailAdapter mAdapter;
|
||||
|
||||
@ -174,6 +180,7 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
|
||||
|
||||
mIsScroll = true;
|
||||
|
||||
mSkeleton = Skeleton.bind(mListSkeleton).shimmer(false).load(R.layout.activity_libaodetail_skeleton).show();
|
||||
mAdapter = new LibaoDetailAdapter(this, this, this, mLibaoEntity, mDownloadPb, mEntrance);
|
||||
mLibaoDetailRv.setLayoutManager(new LinearLayoutManager(this) {
|
||||
@Override
|
||||
@ -184,13 +191,11 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
|
||||
mLibaoDetailRv.addItemDecoration(new VerticalItemDecoration(this, 8, true));
|
||||
mLibaoDetailRv.setAdapter(mAdapter);
|
||||
|
||||
mNoConnection.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mNoConnection.setVisibility(View.GONE);
|
||||
mLlLoading.setVisibility(View.VISIBLE);
|
||||
mBaseHandler.postDelayed(() -> getGameDigest(), 1000);
|
||||
}
|
||||
mNoConnection.setOnClickListener(v -> {
|
||||
mSkeleton.show();
|
||||
mNoConnection.setVisibility(View.GONE);
|
||||
mLlLoading.setVisibility(View.VISIBLE);
|
||||
mBaseHandler.postDelayed(() -> getGameDigest(), 1000);
|
||||
});
|
||||
|
||||
if (mLibaoEntity == null) {
|
||||
@ -411,6 +416,8 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
|
||||
|
||||
checkLibaoStatus();
|
||||
}
|
||||
|
||||
mSkeleton.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -428,6 +435,8 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
|
||||
mLlLoading.setVisibility(View.GONE);
|
||||
mLibaoDetailRv.setPadding(0, 0, 0, 0);
|
||||
mNoConnection.setVisibility(View.VISIBLE);
|
||||
|
||||
mSkeleton.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -442,6 +451,8 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
|
||||
} else {
|
||||
mNoneDataTv.setText("天了噜~页面不见了");
|
||||
}
|
||||
|
||||
mSkeleton.hide();
|
||||
}
|
||||
|
||||
// 领取/淘号失败,根据返回的时间重新倒数
|
||||
|
||||
@ -48,6 +48,7 @@ import com.gh.common.util.MtaHelper;
|
||||
import com.gh.common.util.NetworkUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.ThirdPartyPackageHelper;
|
||||
import com.gh.common.util.UrlFilterUtils;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.DownloadNotification;
|
||||
@ -261,6 +262,7 @@ public class MainActivity extends BaseActivity {
|
||||
if (isNewFirstLaunch) {
|
||||
LogUtils.uploadDevice(DeviceTokenUtils.getLaunchType());
|
||||
getPluginUpdate();
|
||||
sendActivationInfo();
|
||||
mSp.edit().putBoolean("isNewFirstLaunchV" + PackageUtils.getVersionName(), false).apply();
|
||||
|
||||
checkDevice(); // 根据设备信息判断用户是否是新用户
|
||||
@ -332,6 +334,13 @@ public class MainActivity extends BaseActivity {
|
||||
return intent;
|
||||
}
|
||||
|
||||
private void sendActivationInfo() {
|
||||
RetrofitManager.getInstance(this)
|
||||
.getApi().postBaiduActivationInfo()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Response<>());
|
||||
}
|
||||
|
||||
private void doSkip() {
|
||||
handler.postDelayed(() -> {
|
||||
isSkipped = true;
|
||||
@ -420,7 +429,11 @@ public class MainActivity extends BaseActivity {
|
||||
"网络状态", DeviceUtils.getNetwork(HaloApp.getInstance().getApplication()));
|
||||
}
|
||||
|
||||
ExposureUtils.logADownloadCompleteExposureEvent(new GameEntity(downloadEntity.getGameId()), downloadEntity.getPlatform(), downloadEntity.getExposureTrace(), type);
|
||||
ExposureUtils.logADownloadCompleteExposureEvent(
|
||||
new GameEntity(downloadEntity.getGameId(), downloadEntity.getName()),
|
||||
downloadEntity.getPlatform(),
|
||||
downloadEntity.getExposureTrace(),
|
||||
type);
|
||||
|
||||
DataCollectionUtils.uploadDownload(this, downloadEntity, "完成");
|
||||
}
|
||||
@ -769,6 +782,12 @@ public class MainActivity extends BaseActivity {
|
||||
"操作", "安装完成",
|
||||
"网络状态", DeviceUtils.getNetwork(HaloApp.getInstance().getApplication()));
|
||||
}
|
||||
|
||||
// 没有光环 ID 的都记录一下游戏 ID,供'我的游戏'区分同包名不同插件用
|
||||
Object gh_id = PackageUtils.getMetaData(this, mDownloadEntity.getPackageName(), "gh_id");
|
||||
if (gh_id == null) {
|
||||
ThirdPartyPackageHelper.saveGameId(mDownloadEntity.getPackageName(), mDownloadEntity.getGameId());
|
||||
}
|
||||
DownloadManager.getInstance(getApplicationContext()).cancel(
|
||||
mDownloadEntity.getUrl(), false); // 默认不删除安装包 mSp.getBoolean("autodelete", true)
|
||||
}
|
||||
@ -786,7 +805,7 @@ public class MainActivity extends BaseActivity {
|
||||
for (GameDigestEntity gameDigestEntity : response) {
|
||||
if (!TextUtils.isEmpty(gameDigestEntity.getId())) { // 关注游戏
|
||||
if (finalDownloadEntity != null && gameDigestEntity.getId().equals(finalDownloadEntity.getGameId())) {
|
||||
ConcernUtils.INSTANCE.postConcernGameId(MainActivity.this, gameDigestEntity.getId(), null);
|
||||
ConcernUtils.INSTANCE.postConcernGameId(MainActivity.this, gameDigestEntity.getId(), null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import com.gh.base.BaseActivity
|
||||
import com.gh.common.util.DataUtils
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.common.util.StringUtils
|
||||
@ -144,7 +145,7 @@ class PersonalHomeActivity : ListActivity<PersonalHistoryEntity, PersonalHomeVie
|
||||
val intent = Intent(context, PersonalHomeActivity::class.java)
|
||||
intent.putExtra(EntranceUtils.KEY_USER_ID, userId)
|
||||
intent.putExtra(EntranceUtils.KEY_PATH, path)
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, "$entrance+($path)")
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,12 +19,14 @@ import com.gh.base.BaseActivity;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.GdtHelper;
|
||||
import com.gh.common.util.TextHelper;
|
||||
import com.gh.gamecenter.db.SearchHistoryDao;
|
||||
import com.gh.gamecenter.eventbus.EBSearch;
|
||||
import com.gh.gamecenter.search.SearchGameDetailFragment;
|
||||
import com.gh.gamecenter.search.SearchGameListFragment;
|
||||
import com.gh.gamecenter.search.SearchHistoryFragment;
|
||||
import com.lightgame.utils.Util_System_Keyboard;
|
||||
import com.lightgame.utils.Utils;
|
||||
import com.qq.gdt.action.ActionType;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -177,6 +179,9 @@ public class SearchActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
});
|
||||
TextHelper.limitTheLengthOfEditText(searchInput, 50, () -> {
|
||||
Utils.toast(searchInput.getContext(), "最多输入50个字");
|
||||
});
|
||||
|
||||
findViewById(R.id.btnGoBack).setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ public class SuggestionActivity extends BaseActivity implements OnRequestCallBac
|
||||
mSuggestGameLl.setVisibility(View.VISIBLE);
|
||||
mGameNameTitle.setText(Html.fromHtml(getString(R.string.suggestion_game_name)));
|
||||
mSuggestTypeContainer.setVisibility(View.GONE);
|
||||
mSuggestContentEt.setHint("你想收录哪个游戏或游戏版本... \n ↓↓你还可以上传截图");
|
||||
mSuggestContentEt.setHint("请在上方选择或填写游戏名↑↑ \n 在此处可输入补充信息(例如游戏的平台版本等)");
|
||||
mEmailName.setText(Html.fromHtml(getString(R.string.suggestion_contact)));
|
||||
} else if (type == SuggestType.functionSuggest) {
|
||||
mSuggestContentEt.setHint("请详细描述你的建议... \n ↓↓你还可以上传截图");
|
||||
|
||||
@ -16,6 +16,7 @@ import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
import com.gh.common.util.TextHelper;
|
||||
import com.gh.common.util.UrlFilterUtils;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.NewsSearchActivity;
|
||||
@ -249,6 +250,10 @@ public class GameNewsAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TextHelper.limitTheLengthOfEditText(searchViewHolder.searchEt, 50, () -> {
|
||||
Utils.toast(searchViewHolder.searchEt.getContext(), "最多输入50个字");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import android.preference.PreferenceManager;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.util.ArrayMap;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
@ -23,6 +24,7 @@ import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.ThirdPartyPackageHelper;
|
||||
import com.gh.common.view.SwipeLayout;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -101,6 +103,11 @@ public class InstallFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
Object gh_id = PackageUtils.getMetaData(mContext, gameInstall.getPackageName(), "gh_id");
|
||||
if (gh_id != null && !gh_id.equals(gameInstall.getId())) {
|
||||
gameInstall.setId(gh_id.toString());
|
||||
} else {
|
||||
String gameId = ThirdPartyPackageHelper.getGameId(gameInstall.getPackageName());
|
||||
if (!TextUtils.isEmpty(gameId)) {
|
||||
gameInstall.setId(gameId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,7 +305,7 @@ public class InstallFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
private void initGameNormal(final GameNormalSwipeViewHolder holder, final GameEntity gameEntity, final int i) {
|
||||
|
||||
gameEntity.setCollection(new ArrayList<>()); // 清空集合,防止下载按钮会因为存在集合而清空合集包的状态判断
|
||||
holder.initServerType(gameEntity, mContext);
|
||||
holder.initServerType(gameEntity);
|
||||
|
||||
holder.swipeText.setPadding(0, 0, DisplayUtils.dip2px(mContext, 15), 0);
|
||||
String name;
|
||||
|
||||
@ -411,7 +411,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
holder.commentUserNameTv.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(mContext, finalCommentEntity.getUser().getId(), mEntrance, "文章-评论详情"));
|
||||
holder.commentUserIconDv.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(mContext, finalCommentEntity.getUser().getId(), mEntrance, "文章-评论详情"));
|
||||
|
||||
if (commentEntity.getPriority() != 0 && !isHotComment) {
|
||||
if (commentEntity.getPriority() != 0) {
|
||||
holder.commentBadge.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.commentBadge.setVisibility(View.GONE);
|
||||
|
||||
@ -17,6 +17,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.exposure.ExposureEvent;
|
||||
import com.gh.common.exposure.ExposureUtils;
|
||||
import com.gh.common.util.DataUtils;
|
||||
@ -25,6 +26,7 @@ import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.PackageHelper;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.download.DownloadManager;
|
||||
@ -39,6 +41,7 @@ import com.gh.gamecenter.entity.CollectionCloseEntity;
|
||||
import com.gh.gamecenter.entity.GameCollectionEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.PluginLocation;
|
||||
import com.gh.gamecenter.entity.SettingsEntity;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
@ -120,65 +123,59 @@ public class PlatformAdapter extends BaseRecyclerAdapter<PlatformViewHolder> {
|
||||
viewHolder.mDownloadItemTvStatus.setVisibility(View.GONE);
|
||||
ImageUtils.display(viewHolder.mDownloadItemIvPic, R.drawable.platform_vote);
|
||||
viewHolder.itemView.setBackgroundDrawable(new ColorDrawable(0));
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = VoteActivity.getIntent(mContext, mGameEntity.getName(), mGameEntity.getId());
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
viewHolder.itemView.setOnClickListener(v -> {
|
||||
Intent intent = VoteActivity.getIntent(mContext, mGameEntity.getName(), mGameEntity.getId());
|
||||
mContext.startActivity(intent);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (apkEntity.getApkCollection() == null) {
|
||||
// 非合集
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ApkLink apkLink = apkEntity.getApkLink();
|
||||
if (apkLink != null) {
|
||||
String entrance = mEntrance + "(" + apkLink.getName() + ")";
|
||||
DirectUtils.directToLinkPage(mContext, apkLink.getLinkEntity(), entrance, "下载多平台弹窗");
|
||||
} else if (viewHolder.mDownloadItemTvStatus.getVisibility() == View.GONE) {
|
||||
//下载游戏
|
||||
DialogUtils.checkDownload(mContext, apkEntity.getSize(),
|
||||
isSubscribe -> download(apkEntity, viewHolder.mDownloadItemTvStatus, "下载", isSubscribe));
|
||||
} else {
|
||||
String status = viewHolder.mDownloadItemTvStatus.getText().toString();
|
||||
switch (status) {
|
||||
case "下载中":
|
||||
case "等待中":
|
||||
case "插件化下载中":
|
||||
case "更新下载中":
|
||||
case "插件化等待中":
|
||||
case "更新等待中":
|
||||
// 打开下载管理界面
|
||||
mContext.startActivity(DownloadManagerActivity.getDownloadMangerIntent(mContext, apkEntity.getUrl()
|
||||
, mEntrance + "(" + mLocation.split(":")[0] + ")"));
|
||||
break;
|
||||
case "已安装":
|
||||
case "启动":
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("版本", apkEntity.getPlatform());
|
||||
DataUtils.onEvent(mContext, "游戏启动", mGameEntity.getName(), kv);
|
||||
viewHolder.itemView.setOnClickListener(v -> {
|
||||
ApkLink apkLink = apkEntity.getApkLink();
|
||||
if (apkLink != null) {
|
||||
String entrance = mEntrance + "(" + apkLink.getName() + ")";
|
||||
DirectUtils.directToLinkPage(mContext, apkLink.getLinkEntity(), entrance, "下载多平台弹窗");
|
||||
} else if (viewHolder.mDownloadItemTvStatus.getVisibility() == View.GONE) {
|
||||
//下载游戏
|
||||
DialogUtils.checkDownload(mContext, apkEntity.getSize(),
|
||||
isSubscribe -> download(apkEntity, viewHolder.mDownloadItemTvStatus, "下载", isSubscribe));
|
||||
} else {
|
||||
String status = viewHolder.mDownloadItemTvStatus.getText().toString();
|
||||
switch (status) {
|
||||
case "下载中":
|
||||
case "等待中":
|
||||
case "插件化下载中":
|
||||
case "更新下载中":
|
||||
case "插件化等待中":
|
||||
case "更新等待中":
|
||||
// 打开下载管理界面
|
||||
mContext.startActivity(DownloadManagerActivity.getDownloadMangerIntent(mContext, apkEntity.getUrl()
|
||||
, mEntrance + "(" + mLocation.split(":")[0] + ")"));
|
||||
break;
|
||||
case "已安装":
|
||||
case "启动":
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("版本", apkEntity.getPlatform());
|
||||
DataUtils.onEvent(mContext, "游戏启动", mGameEntity.getName(), kv);
|
||||
|
||||
PackageUtils.launchApplicationByPackageName(mContext, apkEntity.getPackageName());
|
||||
break;
|
||||
case "安装":
|
||||
case "安装更新":
|
||||
install(apkEntity, viewHolder.getAdapterPosition());
|
||||
break;
|
||||
case "插件化":
|
||||
DialogUtils.checkDownload(mContext, apkEntity.getSize(),
|
||||
isSubscribe -> download(apkEntity, viewHolder.mDownloadItemTvStatus, "插件化", isSubscribe));
|
||||
break;
|
||||
case "安装插件":
|
||||
showPluginDialog(apkEntity, PlatformAdapter.this, viewHolder.getAdapterPosition());
|
||||
break;
|
||||
case "更新":
|
||||
DialogUtils.checkDownload(mContext, apkEntity.getSize(), isSubscribe -> update(apkEntity, isSubscribe));
|
||||
break;
|
||||
}
|
||||
PackageUtils.launchApplicationByPackageName(mContext, apkEntity.getPackageName());
|
||||
break;
|
||||
case "安装":
|
||||
case "安装更新":
|
||||
install(apkEntity, viewHolder.getAdapterPosition());
|
||||
break;
|
||||
case "插件化":
|
||||
DialogUtils.checkDownload(mContext, apkEntity.getSize(),
|
||||
isSubscribe -> download(apkEntity, viewHolder.mDownloadItemTvStatus, "插件化", isSubscribe));
|
||||
break;
|
||||
case "安装插件":
|
||||
showPluginDialog(apkEntity, PlatformAdapter.this, viewHolder.getAdapterPosition());
|
||||
break;
|
||||
case "更新":
|
||||
DialogUtils.checkDownload(mContext, apkEntity.getSize(), isSubscribe -> update(apkEntity, isSubscribe));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -194,7 +191,7 @@ public class PlatformAdapter extends BaseRecyclerAdapter<PlatformViewHolder> {
|
||||
viewHolder.itemView.setBackgroundDrawable(new ColorDrawable(0));
|
||||
} else {
|
||||
Object gh_id = PackageUtils.getMetaData(mContext, apkEntity.getPackageName(), "gh_id");
|
||||
if (PackagesManager.INSTANCE.isInstalled(apkEntity.getPackageName())
|
||||
if (PackageHelper.INSTANCE.getLocalPackageNameSet().contains(apkEntity.getPackageName())
|
||||
&& (gh_id == null || gh_id.equals(mGameEntity.getId()))) {
|
||||
// 已安装
|
||||
viewHolder.mDownloadItemIvPic.setVisibility(View.GONE);
|
||||
@ -233,7 +230,16 @@ public class PlatformAdapter extends BaseRecyclerAdapter<PlatformViewHolder> {
|
||||
} else if (PackagesManager.INSTANCE.isCanUpdate(mGameEntity.getId(), apkEntity.getPackageName())) {
|
||||
viewHolder.mDownloadItemTvStatus.setText(R.string.update);
|
||||
} else {
|
||||
if (mOnCollectionCallBackListener == null) {
|
||||
boolean isFilter = false;
|
||||
SettingsEntity settings = Config.getSettings();
|
||||
if (settings != null) {
|
||||
for (String pkgName : settings.getGameDownloadBlackList()) {
|
||||
if (pkgName.equals(apkEntity.getPackageName())) {
|
||||
isFilter = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isFilter) {
|
||||
viewHolder.mDownloadItemTvStatus.setText("已安装");
|
||||
} else {
|
||||
viewHolder.mDownloadItemTvStatus.setText(R.string.launch);
|
||||
@ -342,32 +348,29 @@ public class PlatformAdapter extends BaseRecyclerAdapter<PlatformViewHolder> {
|
||||
viewHolder.mDownloadItemOpenCollection.setVisibility(View.VISIBLE);
|
||||
viewHolder.mDownloadItemColseCollection.setVisibility(View.GONE);
|
||||
}
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (viewHolder.mDownloadItemOpenCollection.getVisibility() == View.VISIBLE) {
|
||||
if (mOnCollectionCallBackListener != null) {
|
||||
mOnCollectionCallBackListener.showCollection(apkEntity.getApkCollection());
|
||||
}
|
||||
mCloseEntity.setPosition(viewHolder.getAdapterPosition());
|
||||
mCloseEntity.setAdapterPosition(mAdapterPosition);
|
||||
for (int[] ints : mCloseEntity.getList()) {
|
||||
mAdapterMap.get(ints[0]).notifyItemChanged(ints[1]);
|
||||
}
|
||||
mCloseEntity.getList().clear();
|
||||
int[] arrCollectionPosition = {mAdapterPosition, viewHolder.getAdapterPosition()};
|
||||
mCloseEntity.getList().add(arrCollectionPosition);
|
||||
viewHolder.mDownloadItemOpenCollection.setVisibility(View.GONE);
|
||||
viewHolder.mDownloadItemColseCollection.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (mOnCollectionCallBackListener != null) {
|
||||
mOnCollectionCallBackListener.hideCollection();
|
||||
}
|
||||
mCloseEntity.setPosition(-1);
|
||||
mCloseEntity.setAdapterPosition(-1);
|
||||
viewHolder.mDownloadItemOpenCollection.setVisibility(View.VISIBLE);
|
||||
viewHolder.mDownloadItemColseCollection.setVisibility(View.GONE);
|
||||
viewHolder.itemView.setOnClickListener(v -> {
|
||||
if (viewHolder.mDownloadItemOpenCollection.getVisibility() == View.VISIBLE) {
|
||||
if (mOnCollectionCallBackListener != null) {
|
||||
mOnCollectionCallBackListener.showCollection(apkEntity.getApkCollection());
|
||||
}
|
||||
mCloseEntity.setPosition(viewHolder.getAdapterPosition());
|
||||
mCloseEntity.setAdapterPosition(mAdapterPosition);
|
||||
for (int[] ints : mCloseEntity.getList()) {
|
||||
mAdapterMap.get(ints[0]).notifyItemChanged(ints[1]);
|
||||
}
|
||||
mCloseEntity.getList().clear();
|
||||
int[] arrCollectionPosition = {mAdapterPosition, viewHolder.getAdapterPosition()};
|
||||
mCloseEntity.getList().add(arrCollectionPosition);
|
||||
viewHolder.mDownloadItemOpenCollection.setVisibility(View.GONE);
|
||||
viewHolder.mDownloadItemColseCollection.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (mOnCollectionCallBackListener != null) {
|
||||
mOnCollectionCallBackListener.hideCollection();
|
||||
}
|
||||
mCloseEntity.setPosition(-1);
|
||||
mCloseEntity.setAdapterPosition(-1);
|
||||
viewHolder.mDownloadItemOpenCollection.setVisibility(View.VISIBLE);
|
||||
viewHolder.mDownloadItemColseCollection.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -86,35 +86,35 @@ public class DetailViewHolder {
|
||||
// 这个 switch 纯粹是为了 MTA 统计用的
|
||||
switch (mViewHolder.mDownloadPb.getDownloadType()) {
|
||||
case DOWNLOADING_PLUGIN:
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "插件化中", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "插件化中", mGameEntity.getName());
|
||||
break;
|
||||
case DOWNLOADING_NORMAL:
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "下载中", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "下载中", mGameEntity.getName());
|
||||
break;
|
||||
case NONE:
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "关闭下载", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "关闭下载", mGameEntity.getName());
|
||||
break;
|
||||
case NORMAL:
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "下载", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "下载", mGameEntity.getName());
|
||||
break;
|
||||
case PLUGIN:
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "插件化", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "插件化", mGameEntity.getName());
|
||||
break;
|
||||
case INSTALL_PLUGIN:
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "安装插件化", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "安装插件化", mGameEntity.getName());
|
||||
break;
|
||||
case INSTALL_NORMAL:
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "安装", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "安装", mGameEntity.getName());
|
||||
break;
|
||||
}
|
||||
// 由于部分状态不包含在 downloadType 里,所以还是需要手动获取下载按钮文字判断点击时的状态
|
||||
String downloadText = mViewHolder.mDownloadPb.getText();
|
||||
if (downloadText.contains("打开")) {
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "打开", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "打开", mGameEntity.getName());
|
||||
} else if (downloadText.contains("启动")) {
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "启动", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "启动", mGameEntity.getName());
|
||||
} else if (downloadText.contains("更新")) {
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情", "更新", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "游戏详情_新", "更新", mGameEntity.getName());
|
||||
}
|
||||
|
||||
String autoDownloadPlatform = v.getTag() instanceof String ? (String) v.getTag() : "";
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.gh.gamecenter.adapter.viewholder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
@ -9,7 +8,6 @@ import android.widget.TextView;
|
||||
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.base.BaseRecyclerViewHolder;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.view.DrawableView;
|
||||
import com.gh.gamecenter.databinding.GameItemBinding;
|
||||
import com.gh.gamecenter.entity.ColorEntity;
|
||||
@ -46,8 +44,7 @@ public class GameViewHolder extends BaseRecyclerViewHolder {
|
||||
gameDownloadSpeed = binding.downloadSpeed;
|
||||
}
|
||||
|
||||
public void initServerType(GameEntity gameEntity, Context context) {
|
||||
int paddRight = 0;
|
||||
public void initServerType(GameEntity gameEntity) {
|
||||
ColorEntity serverLabel = gameEntity.getServerLabel();
|
||||
if (gameEntity.getTest() != null) {
|
||||
gameServerType.setVisibility(View.GONE);
|
||||
@ -55,15 +52,12 @@ public class GameViewHolder extends BaseRecyclerViewHolder {
|
||||
gameServerType.setVisibility(View.VISIBLE);
|
||||
gameServerType.setText(serverLabel.getValue());
|
||||
gameServerType.setBackground(DrawableView.getServerDrawable(serverLabel.getColor()));
|
||||
int i;
|
||||
if (serverLabel.getValue().length() <= 2) i = 30;
|
||||
else if (serverLabel.getValue().length() <= 4) i = 50;
|
||||
else i = 60;
|
||||
paddRight = DisplayUtils.dip2px(context, i);
|
||||
} else {
|
||||
gameServerType.setVisibility(View.GONE);
|
||||
}
|
||||
gameName.setPadding(0, 0, paddRight, 0);
|
||||
|
||||
// 由于RecyclerView的复用机制 需要每次测量gameName的宽
|
||||
gameName.requestLayout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -67,7 +67,8 @@ public abstract class ListViewModel<LD /*ListData*/, ID /*ItemData*/> extends Ba
|
||||
@Override
|
||||
public void onResponse(List<LD> response) {
|
||||
List<LD> previousData = mListLiveData.getValue();
|
||||
if (previousData == null || mCurLoadParams.getLoadOffset() == LoadParams.DEFAULT_OFFSET) {
|
||||
if (previousData == null || mCurLoadParams.getLoadOffset() == LoadParams.DEFAULT_OFFSET ||
|
||||
curStatus == LoadStatus.INIT) {
|
||||
previousData = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@ -5,16 +5,28 @@ import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import com.ethanhua.skeleton.Skeleton
|
||||
import com.ethanhua.skeleton.ViewSkeletonScreen
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.common.view.VerticalItemDecoration
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.CategoryEntity
|
||||
import kotterknife.bindView
|
||||
|
||||
class CategoryDirectoryFragment : ListFragment<CategoryEntity, CategoryDirectoryListViewModel>() {
|
||||
|
||||
private val mListSkeleton by bindView<View>(R.id.list_skeleton)
|
||||
|
||||
private lateinit var mViewModel: CategoryDirectoryListViewModel
|
||||
private lateinit var mAdapter: CategoryDirectoryAdapter
|
||||
private lateinit var mSkeleton: ViewSkeletonScreen
|
||||
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_list_base_skeleton
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
mViewModel = ViewModelProviders.of(this).get(CategoryDirectoryListViewModel::class.java)
|
||||
@ -28,6 +40,27 @@ class CategoryDirectoryFragment : ListFragment<CategoryEntity, CategoryDirectory
|
||||
setNavigationTitle(arguments?.getString(EntranceUtils.KEY_CATEGORY_TITLE))
|
||||
mListRv.setBackgroundColor(Color.WHITE)
|
||||
mListRefresh?.isEnabled = false
|
||||
mSkeleton = Skeleton.bind(mListSkeleton).shimmer(false).load(R.layout.fragment_category_skeleton).show()
|
||||
}
|
||||
|
||||
override fun onLoadDone() {
|
||||
super.onLoadDone()
|
||||
mSkeleton.hide()
|
||||
}
|
||||
|
||||
override fun onLoadEmpty() {
|
||||
super.onLoadEmpty()
|
||||
mSkeleton.hide()
|
||||
}
|
||||
|
||||
override fun onLoadError() {
|
||||
super.onLoadError()
|
||||
mSkeleton.hide()
|
||||
}
|
||||
|
||||
override fun onRefresh() {
|
||||
mSkeleton.show()
|
||||
super.onRefresh()
|
||||
}
|
||||
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
|
||||
@ -29,10 +29,12 @@ import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameImageViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameTestViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameViewHolder;
|
||||
import com.gh.gamecenter.databinding.GameItemBinding;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.game.GameItemViewHolder;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.gh.gamecenter.subject.SubjectActivity;
|
||||
@ -200,12 +202,8 @@ public class CategoryListAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHo
|
||||
case ItemViewType.LOADING:
|
||||
view = mLayoutInflater.inflate(R.layout.refresh_footerview, viewGroup, false);
|
||||
return new FooterViewHolder(view);
|
||||
case ItemViewType.GAME_TEST:
|
||||
view = mLayoutInflater.inflate(R.layout.game_test_item, viewGroup, false);
|
||||
return new GameTestViewHolder(view);
|
||||
case ItemViewType.GAME_NORMAL:
|
||||
view = mLayoutInflater.inflate(R.layout.game_normal_item, viewGroup, false);
|
||||
return new GameNormalViewHolder(view);
|
||||
return new GameItemViewHolder(GameItemBinding.bind(mLayoutInflater.inflate(R.layout.game_item, viewGroup, false)));
|
||||
case ItemViewType.GAME_IMAGE:
|
||||
view = mLayoutInflater.inflate(R.layout.game_image_item, viewGroup, false);
|
||||
return new GameImageViewHolder(view);
|
||||
@ -216,10 +214,8 @@ public class CategoryListAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHo
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
||||
if (viewHolder instanceof GameNormalViewHolder) {
|
||||
initGameNormalViewHolder((GameNormalViewHolder) viewHolder, position);
|
||||
} else if (viewHolder instanceof GameTestViewHolder) {
|
||||
initGameTestViewHolder((GameTestViewHolder) viewHolder, position);
|
||||
if (viewHolder instanceof GameItemViewHolder) {
|
||||
initGameNormalViewHolder(((GameItemViewHolder) viewHolder), position);
|
||||
} else if (viewHolder instanceof FooterViewHolder) {
|
||||
initFooterViewHolder((FooterViewHolder) viewHolder);
|
||||
} else if (viewHolder instanceof GameImageViewHolder) {
|
||||
@ -263,8 +259,6 @@ public class CategoryListAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHo
|
||||
}
|
||||
if (position == 0 && mSubjectList.size() > 0 && !TextUtils.isEmpty(mSubjectList.get(0).getImage())) {
|
||||
return ItemViewType.GAME_IMAGE;
|
||||
} else if (mSubjectList.get(position).getTest() != null) {
|
||||
return ItemViewType.GAME_TEST;
|
||||
} else {
|
||||
return ItemViewType.GAME_NORMAL;
|
||||
}
|
||||
@ -278,33 +272,25 @@ public class CategoryListAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHo
|
||||
return mSubjectList.size() + 1;
|
||||
}
|
||||
|
||||
private void initGameNormalViewHolder(final GameNormalViewHolder holder, final int position) {
|
||||
private void initGameNormalViewHolder(final GameItemViewHolder holder, final int position) {
|
||||
GameEntity gameEntity = mSubjectList.get(position);
|
||||
|
||||
holder.getBinding().setGame(gameEntity);
|
||||
holder.getBinding().setSubjectTag("type");
|
||||
holder.initServerType(gameEntity);
|
||||
holder.getBinding().executePendingBindings();
|
||||
|
||||
if (mIsOrder) {
|
||||
int index = 1;
|
||||
if (!TextUtils.isEmpty(mSubjectList.get(0).getImage())) {
|
||||
index = 0;
|
||||
}
|
||||
holder.gameOrder.setVisibility(View.VISIBLE);
|
||||
holder.gameOrder.setText(String.valueOf(position + index));
|
||||
holder.getBinding().gameOrder.setVisibility(View.VISIBLE);
|
||||
holder.getBinding().gameOrder.setText(String.valueOf(position + index));
|
||||
} else {
|
||||
holder.gameOrder.setVisibility(View.GONE);
|
||||
holder.getBinding().gameOrder.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final GameEntity gameEntity = mSubjectList.get(position);
|
||||
|
||||
// holder.gameThumb.setImageURI(gameEntity.getIcon());
|
||||
ImageUtils.display(holder.gameThumb, gameEntity.getIcon());
|
||||
holder.gameName.setText(gameEntity.getName());
|
||||
if (gameEntity.getApk() == null || gameEntity.getApk().isEmpty()) {
|
||||
holder.gameDes.setText(gameEntity.getBrief());
|
||||
} else {
|
||||
holder.gameDes.setText(String.format("%s %s", gameEntity.getApk().get(0).getSize(), gameEntity.getBrief()));
|
||||
}
|
||||
|
||||
holder.initServerType(gameEntity, mContext);
|
||||
GameViewUtils.setLabelList(mContext, holder.gameLabelList, gameEntity.getTag(), "type", gameEntity.getTagStyle());
|
||||
|
||||
ArrayList<ExposureSource> exposureSources = new ArrayList<>();
|
||||
exposureSources.add(new ExposureSource(mTitle, mName));
|
||||
exposureSources.add(new ExposureSource("二级分类", mType + "+" + ("download:-1".equals(mOrder) ? "最热" : "最新")));
|
||||
@ -319,12 +305,12 @@ public class CategoryListAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHo
|
||||
StringUtils.buildString(mEntrance, "+(", mName, ":列表[", mType, "=", ("download:-1".equals(mOrder) ? "最热" : "最新"), "=", String.valueOf(position + 1), "])"), event);
|
||||
});
|
||||
|
||||
DownloadItemUtils.setOnClickListener(mContext, holder.gameDownloadBtn,
|
||||
DownloadItemUtils.setOnClickListener(mContext, holder.getBinding().downloadBtn,
|
||||
gameEntity, position, this,
|
||||
StringUtils.buildString(mEntrance, "+(", mName, ":列表[", mType, "=", ("download:-1".equals(mOrder) ? "最热" : "最新"), "=", String.valueOf(position + 1), "])"),
|
||||
StringUtils.buildString(mName, ":", gameEntity.getName()), event);
|
||||
|
||||
DownloadItemUtils.updateItem(mContext, gameEntity, holder, true);
|
||||
DownloadItemUtils.updateItem(mContext, gameEntity, new GameViewHolder(holder.getBinding()), true);
|
||||
}
|
||||
|
||||
private void initGameTestViewHolder(final GameTestViewHolder holder, final int position) {
|
||||
|
||||
@ -11,6 +11,7 @@ import butterknife.OnClick
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.gh.base.fragment.BaseFragment
|
||||
import com.gh.common.AppExecutor
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.*
|
||||
import com.gh.gamecenter.databinding.PieceDiscoverItemBinding
|
||||
@ -31,6 +32,12 @@ class DiscoverFragment : BaseFragment<Any>() {
|
||||
lateinit var mDiscoverGameUnreadIcon: SimpleDraweeView
|
||||
@BindView(R.id.discover_container)
|
||||
lateinit var mDiscoverContainer: LinearLayout
|
||||
@BindView(R.id.discover_game_trends)
|
||||
lateinit var mDiscoverGameTrends: View
|
||||
@BindView(R.id.discover_info)
|
||||
lateinit var mDiscoverInfo: View
|
||||
@BindView(R.id.discover_libao_line)
|
||||
lateinit var mDiscoverLibaoLine: View
|
||||
|
||||
private val mGameTrendsDao by lazy { GameTrendsDao(context) }
|
||||
|
||||
@ -76,6 +83,8 @@ class DiscoverFragment : BaseFragment<Any>() {
|
||||
mDiscoverContainer.addView(discoverAdView)
|
||||
}
|
||||
}
|
||||
|
||||
checkArticleStatus()
|
||||
}
|
||||
|
||||
@OnClick(R.id.discover_game_trends,
|
||||
@ -155,6 +164,15 @@ class DiscoverFragment : BaseFragment<Any>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkArticleStatus() {
|
||||
val showArticleEntrance = Config.getSettings()?.showArticleEntrance
|
||||
if (showArticleEntrance == "off") {
|
||||
mDiscoverGameTrends.visibility = View.GONE
|
||||
mDiscoverInfo.visibility = View.GONE
|
||||
mDiscoverLibaoLine.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
// 登录事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(reuse: EBReuse) {
|
||||
@ -162,6 +180,8 @@ class DiscoverFragment : BaseFragment<Any>() {
|
||||
showDot()
|
||||
} else if (reuse.type == LOGOUT_TAG) {
|
||||
mDiscoverGameUnread.visibility = View.GONE
|
||||
} else if (reuse.type == "Refresh") {
|
||||
checkArticleStatus()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -146,10 +146,20 @@ class DownloadFragment : BaseFragment_TabLayout() {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(skip: EBSkip) {
|
||||
if (DownloadManagerActivity.TAG == skip.type) {
|
||||
if (skip.currentItem == DownloadManagerActivity.INDEX_UPDATE) {
|
||||
if (view != null) {
|
||||
view!!.postDelayed({ mViewPager.currentItem = DownloadManagerActivity.INDEX_DOWNLOAD }, 300)
|
||||
}
|
||||
if (view != null) {
|
||||
view!!.postDelayed({
|
||||
mViewPager.currentItem = skip.currentItem
|
||||
if (skip.currentItem == DownloadManagerActivity.INDEX_DOWNLOAD) {
|
||||
val fragments = childFragmentManager.fragments
|
||||
if (fragments != null) {
|
||||
for (fragment in fragments) {
|
||||
if (fragment is GameDownloadFragment) {
|
||||
fragment.onResume() // auto refresh list
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
DialogUtils.checkResumeDownload(mContext, isSubscribe -> {
|
||||
if (isSubscribe) {
|
||||
DownloadManager.getInstance(mContext).subscribe(downloadEntity);
|
||||
statusMap.put(url, "subscribe");
|
||||
statusMap.put(url, DownloadStatus.subscribe.getStatus());
|
||||
notifyItemChanged(doneList.isEmpty() ? 0 : 1 + doneList.size());
|
||||
} else {
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
@ -269,7 +269,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
viewHolder.dmStartorpause.setBackgroundResource(R.drawable.game_item_btn_downloading_bg);
|
||||
viewHolder.dmStartorpause.setText("暂停");
|
||||
viewHolder.dmStartorpause.setTextColor(ContextCompat.getColor(mContext, R.color.theme));
|
||||
statusMap.put(url, "downloading");
|
||||
statusMap.put(url, DownloadStatus.downloading.getStatus());
|
||||
notifyItemChanged(doneList.isEmpty() ? 0 : 1 + doneList.size());
|
||||
|
||||
Message msg = Message.obtain();
|
||||
@ -307,7 +307,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
viewHolder.dmDownloads.setTextColor(0xFF9A9A9A);
|
||||
viewHolder.dmDownloads.setText("已暂停");
|
||||
viewHolder.dmDelete.setVisibility(View.VISIBLE);
|
||||
statusMap.put(url, "pause");
|
||||
statusMap.put(url, DownloadStatus.pause.getStatus());
|
||||
notifyItemChanged(doneList.isEmpty() ? 0 : 1 + doneList.size());
|
||||
Message msg = Message.obtain();
|
||||
msg.what = DownloadConfig.PAUSE_DOWNLOAD_TASK;
|
||||
@ -407,7 +407,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
msg.obj = downloadEntity.getUrl();
|
||||
DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
|
||||
// DownloadManager.getInstance(mContext).add(downloadEntity);
|
||||
statusMap.put(downloadEntity.getUrl(), "downloading");
|
||||
statusMap.put(downloadEntity.getUrl(), DownloadStatus.downloading.getStatus());
|
||||
}
|
||||
|
||||
// DownloadManager.getInstance(mContext).startAll();
|
||||
|
||||
@ -232,13 +232,16 @@ class GameUpdateFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
int done = 0;
|
||||
for (int i = 0; i < updateList.size(); i++) {
|
||||
String str = updateList.get(i).getSize();
|
||||
str = str.substring(0, str.lastIndexOf("M"));
|
||||
size += Float.valueOf(str);
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance(mContext).getDownloadEntityByUrl(updateList.get(i).getUrl());
|
||||
if (downloadEntity != null) {
|
||||
count++;
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
done++;
|
||||
int lastM = str.lastIndexOf("M");
|
||||
if (lastM != -1) {
|
||||
str = str.substring(0, lastM);
|
||||
size += Float.valueOf(str);
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance(mContext).getDownloadEntityByUrl(updateList.get(i).getUrl());
|
||||
if (downloadEntity != null) {
|
||||
count++;
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
done++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -355,7 +358,7 @@ class GameUpdateFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
updateEntity.getPackageName());
|
||||
} else if (mContext.getString(R.string.updating).equals(str) || "插件化中".equals(str)) {
|
||||
notifyItemChanged(0);
|
||||
EventBus.getDefault().post(new EBSkip(DownloadManagerActivity.TAG, DownloadManagerActivity.INDEX_UPDATE));
|
||||
EventBus.getDefault().post(new EBSkip(DownloadManagerActivity.TAG, DownloadManagerActivity.INDEX_DOWNLOAD));
|
||||
}
|
||||
|
||||
DataUtils.onMtaEvent(HaloApp.getInstance().getApplication(), "下载管理", "游戏更新", str);
|
||||
@ -401,7 +404,14 @@ class GameUpdateFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
|
||||
if (mPackageName != null && mPackageName.equals(updateEntity.getPackageName())) {
|
||||
// 插件跳转游戏更新页面造成闪退,可能是页面未绘制完成点击造成的闪退
|
||||
AppExecutor.getUiExecutor().execute(() -> viewHolder.guUpdate.performClick());
|
||||
AppExecutor.getUiExecutor().execute(() -> {
|
||||
DownloadEntity entity = DownloadManager.getInstance(mContext).getDownloadEntityByUrl(updateEntity.getUrl());
|
||||
if (entity != null && DownloadStatus.pause == entity.getStatus()) {
|
||||
addUpdateDownload(viewHolder.getPosition() - 1, false);
|
||||
} else {
|
||||
viewHolder.guUpdate.performClick();
|
||||
}
|
||||
});
|
||||
mPackageName = null;
|
||||
}
|
||||
}
|
||||
@ -448,6 +458,7 @@ class GameUpdateFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
DataUtils.onEvent(mContext, "游戏更新", updateEntity.getName(), kv);
|
||||
|
||||
DownloadEntity downloadEntity = new DownloadEntity();
|
||||
downloadEntity.setGameId(updateEntity.getId());
|
||||
downloadEntity.setUrl(updateEntity.getUrl());
|
||||
downloadEntity.setName(updateEntity.getName());
|
||||
downloadEntity.setPath(FileUtils.getDownloadPath(mContext,
|
||||
@ -495,7 +506,7 @@ class GameUpdateFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
GdtHelper.PLATFORM, downloadEntity.getPlatform());
|
||||
|
||||
notifyItemChanged(0);
|
||||
EventBus.getDefault().post(new EBSkip(DownloadManagerActivity.TAG, DownloadManagerActivity.INDEX_UPDATE));
|
||||
EventBus.getDefault().post(new EBSkip(DownloadManagerActivity.TAG, DownloadManagerActivity.INDEX_DOWNLOAD));
|
||||
}
|
||||
|
||||
public ArrayMap<String, ArrayList<Integer>> getLocationMap() {
|
||||
|
||||
@ -33,6 +33,8 @@ class MessageEntity {
|
||||
|
||||
var game: Game = Game()
|
||||
|
||||
var fold: Fold? = null
|
||||
|
||||
|
||||
class Article() : Parcelable {
|
||||
@SerializedName("_id")
|
||||
@ -172,5 +174,11 @@ class MessageEntity {
|
||||
var name: String? = null
|
||||
}
|
||||
|
||||
class Fold {
|
||||
@SerializedName("resource_id")
|
||||
var resourceId: String = ""
|
||||
|
||||
var number: Int = 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
data class MessageFold(val time: Long = 0,
|
||||
var user: UserEntity = UserEntity())
|
||||
@ -22,7 +22,7 @@ class MessageKeFuEntity {
|
||||
|
||||
var suggestion: String? = null
|
||||
|
||||
var link: MessageLinkEntity? = null
|
||||
var links : List<MessageLinkEntity>? = null
|
||||
|
||||
@SerializedName("service")
|
||||
var serviceEntity: ServiceEntity? = null
|
||||
|
||||
@ -13,8 +13,12 @@ data class SettingsEntity(
|
||||
var communityEntrance: String? = "",
|
||||
@SerializedName("game_comment_blacklist")
|
||||
var gameCommentBlackList: List<String>? = listOf(),
|
||||
@SerializedName("game_download_blacklist")
|
||||
var gameDownloadBlackList: List<String> = listOf(),
|
||||
@SerializedName("ad")
|
||||
var adList: List<AD>? = listOf()) {
|
||||
var adList: List<AD>? = listOf(),
|
||||
@SerializedName("article_entrance")
|
||||
var showArticleEntrance: String = "on") {
|
||||
|
||||
data class Support(
|
||||
@SerializedName("qq-group")
|
||||
|
||||
@ -54,6 +54,9 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
|
||||
private var mIsOpenPluginList: Boolean = false
|
||||
|
||||
// 有点蠢,不过想要获取引用的话好像只能把这个 viewHolder 记起来了,要是到时要显示两个插件区域这里就要改了.
|
||||
private var mPluginViewHolder: GamePluginViewHolder? = null
|
||||
|
||||
var isAutoScroll: Boolean = true
|
||||
|
||||
init {
|
||||
@ -110,7 +113,8 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
GameHeadViewHolder(GameHeadItemBinding.bind(mLayoutInflater.inflate(R.layout.game_head_item, parent, false)))
|
||||
}
|
||||
ItemViewType.GAME_PLUGIN -> {
|
||||
GamePluginViewHolder(mLayoutInflater.inflate(R.layout.game_plugin_item, parent, false))
|
||||
mPluginViewHolder = GamePluginViewHolder(mLayoutInflater.inflate(R.layout.game_plugin_item, parent, false))
|
||||
mPluginViewHolder as GamePluginViewHolder
|
||||
}
|
||||
else -> GameItemViewHolder(GameItemBinding.bind(mLayoutInflater.inflate(R.layout.game_item, parent, false)))
|
||||
}
|
||||
@ -437,7 +441,15 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
val entryMap = gameAndPosition.entity.getEntryMap()
|
||||
entryMap[download.platform] = download
|
||||
}
|
||||
notifyItemChanged(gameAndPosition.position)
|
||||
|
||||
if (getItemViewType(gameAndPosition.position) == ItemViewType.GAME_PLUGIN) {
|
||||
val adapter = mPluginViewHolder?.mPluginRv?.adapter
|
||||
if (adapter is GamePluginAdapter) {
|
||||
adapter.notifyItemByDownload(download)
|
||||
}
|
||||
} else {
|
||||
notifyItemChanged(gameAndPosition.position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,8 @@ import android.widget.CheckedTextView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ethanhua.skeleton.Skeleton;
|
||||
import com.ethanhua.skeleton.ViewSkeletonScreen;
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.exposure.ExposureEvent;
|
||||
@ -125,6 +127,10 @@ public class GameDetailFragment extends NormalFragment {
|
||||
View mNoneDataView;
|
||||
@BindView(R.id.reuse_tv_none_data)
|
||||
TextView mNoneDataTv;
|
||||
@BindView(R.id.list_skeleton)
|
||||
View mListSkeleton;
|
||||
|
||||
private ViewSkeletonScreen mSkeleton;
|
||||
|
||||
private GameDetailViewModel mViewModel;
|
||||
|
||||
@ -145,6 +151,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
private boolean mAutoDownload;
|
||||
private boolean mSwitchToFirstTabInStartup;
|
||||
private boolean mSkipGameComment;
|
||||
private boolean mIsPageChanged;
|
||||
private int mCurVpPosition;
|
||||
private int mMaxWidth;
|
||||
|
||||
@ -207,6 +214,8 @@ public class GameDetailFragment extends NormalFragment {
|
||||
mTraceEvent = args.getParcelable(EntranceUtils.KEY_TRACE_EVENT);
|
||||
mSkipGameComment = args.getBoolean(EntranceUtils.KEY_SKIP_GAME_COMMENT);
|
||||
|
||||
mSkeleton = Skeleton.bind(mListSkeleton).shimmer(false).load(R.layout.fragment_gamedetail_skeleton).show();
|
||||
|
||||
GameDetailViewModel.Factory factory = new GameDetailViewModel.Factory(HaloApp.getInstance().getApplication(),
|
||||
args.getString(EntranceUtils.KEY_GAMEID),
|
||||
args.getParcelable(GameEntity.TAG));
|
||||
@ -231,7 +240,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
|
||||
pauseVideo();
|
||||
if (mFirstTimeSelected) {
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "默认_动态", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "默认_动态", mGameEntity.getName());
|
||||
}
|
||||
} else if (position == INDEX_DESCRIPTION) {
|
||||
mKaifuHint.setVisibility(View.GONE);
|
||||
@ -240,7 +249,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
mTabBarRatingTv.setChecked(false);
|
||||
|
||||
if (mFirstTimeSelected) {
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "默认_介绍", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "默认_介绍", mGameEntity.getName());
|
||||
}
|
||||
} else {
|
||||
mKaifuHint.setVisibility(View.GONE);
|
||||
@ -250,10 +259,11 @@ public class GameDetailFragment extends NormalFragment {
|
||||
|
||||
pauseVideo();
|
||||
if (mFirstTimeSelected) {
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "默认_评分", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "默认_评分", mGameEntity.getName());
|
||||
}
|
||||
}
|
||||
mFirstTimeSelected = false;
|
||||
mIsPageChanged = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -330,7 +340,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
|
||||
if (!mGameDetailEntity.getMe().isGameConcerned()) {
|
||||
if (PackagesManager.findInstallById(mGameEntity.getId()) == null) {
|
||||
mTabBarXinXiTv.performClick();
|
||||
tabPerformClick(mTabBarXinXiTv);
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,8 +351,10 @@ public class GameDetailFragment extends NormalFragment {
|
||||
|
||||
if (mSwitchToFirstTabInStartup) mViewPager.setCurrentItem(0);
|
||||
|
||||
mSkeleton.hide();
|
||||
} else if (detailResource.status == Status.ERROR) {
|
||||
loadErrorControl(detailResource.exception);
|
||||
mSkeleton.hide();
|
||||
}
|
||||
});
|
||||
|
||||
@ -353,7 +365,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("状态", R.string.concern);
|
||||
DataUtils.onEvent(getContext(), "游戏关注", mGameEntity.getName(), kv);
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "关注", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "关注", mGameEntity.getName());
|
||||
DataCollectionUtils.uploadConcern(getContext(), mGameEntity.getName(), mGameEntity.getId(), "关注");
|
||||
GdtHelper.INSTANCE.logAction(ActionType.ADD_TO_WISHLIST,
|
||||
GdtHelper.CONTENT_TYPE, "GAME",
|
||||
@ -372,7 +384,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
|
||||
DataCollectionUtils.uploadConcern(getContext(),
|
||||
mGameEntity.getName(), mGameEntity.getId(), "取消关注");
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "取消关注", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "取消关注", mGameEntity.getName());
|
||||
|
||||
mConcernMenuItem.setIcon(R.drawable.game_detail_concern_unselect);
|
||||
} else {
|
||||
@ -440,7 +452,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
mGameEntity.getName(), shareType);
|
||||
}
|
||||
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "分享按钮", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "分享按钮", mGameEntity.getName());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -470,7 +482,7 @@ public class GameDetailFragment extends NormalFragment {
|
||||
mTabBarRatingTv.setVisibility(View.VISIBLE);
|
||||
tabParams.width = mMaxWidth;
|
||||
if (mSkipGameComment) {
|
||||
mTabBarRatingTv.performClick();
|
||||
tabPerformClick(mTabBarRatingTv);
|
||||
mSkipGameComment = false;
|
||||
}
|
||||
} else {
|
||||
@ -552,16 +564,16 @@ public class GameDetailFragment extends NormalFragment {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(EBReuse reuse) {
|
||||
if (SKIP_DESC.equals(reuse.getType())) {
|
||||
mViewPager.setCurrentItem(1);
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "默认_介绍", mGameEntity.getName());
|
||||
tabPerformClick(mTabBarXinXiTv);
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "默认_介绍", mGameEntity.getName());
|
||||
} else if (OPEN_APPBAR.equals(reuse.getType()) && !mIsTouchScreen) {
|
||||
mAppBarLayout.setExpanded(true, true);
|
||||
} else if (SKIP_FULI.equals(reuse.getType())) {
|
||||
mViewPager.setCurrentItem(0);
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "默认_动态", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "默认_动态", mGameEntity.getName());
|
||||
} else if (SKIP_RATING.equals(reuse.getType())) {
|
||||
mViewPager.setCurrentItem(2);
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "默认_评分", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "默认_评分", mGameEntity.getName());
|
||||
} else if ("hideKaifuHint".equals(reuse.getType())) {
|
||||
mIsShowKaifuHint = false;
|
||||
mKaifuHint.setVisibility(View.GONE);
|
||||
@ -613,20 +625,20 @@ public class GameDetailFragment extends NormalFragment {
|
||||
switch (v.getId()) {
|
||||
case R.id.gamedetail_tabbar_fuli_tv:
|
||||
mViewPager.setCurrentItem(INDEX_DYNAMIC);
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "点击_动态", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "点击_动态", mGameEntity.getName());
|
||||
break;
|
||||
case R.id.gamedetail_tabbar_xinxi_tv:
|
||||
mViewPager.setCurrentItem(INDEX_DESCRIPTION);
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "点击_介绍", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "点击_介绍", mGameEntity.getName());
|
||||
break;
|
||||
case R.id.gamedetail_tabbar_rating:
|
||||
mViewPager.setCurrentItem(INDEX_RATING);
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情", "点击_评分", mGameEntity.getName());
|
||||
DataUtils.onMtaEvent(getContext(), "游戏详情_新", "点击_评分", mGameEntity.getName());
|
||||
break;
|
||||
case R.id.reuse_no_connection:
|
||||
mLoading.setVisibility(View.VISIBLE);
|
||||
mNoConnection.setVisibility(View.GONE);
|
||||
|
||||
mSkeleton.show();
|
||||
mViewModel.loadData();
|
||||
break;
|
||||
case R.id.gamedetail_kaifu_hint:
|
||||
@ -635,4 +647,8 @@ public class GameDetailFragment extends NormalFragment {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void tabPerformClick(View view) {
|
||||
if (!mIsPageChanged) view.performClick();
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ class DescAdapter(context: Context,
|
||||
|
||||
holder.itemView.setOnClickListener { v ->
|
||||
EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_FULI))
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "查看游戏动态", gameName)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "查看游戏动态", gameName)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -193,7 +193,7 @@ class DescAdapter(context: Context,
|
||||
viewHolder.binding.recyclerview.layoutManager = LinearLayoutManager(mContext)
|
||||
viewHolder.binding.tvAll.setOnClickListener {
|
||||
EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_RATING))
|
||||
MtaHelper.onEvent("游戏详情", "玩家评论_点击全部", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "玩家评论_点击全部", gameName)
|
||||
}
|
||||
commentsAdapter.comments = comments!!
|
||||
commentsAdapter.notifyDataSetChanged()
|
||||
@ -202,7 +202,7 @@ class DescAdapter(context: Context,
|
||||
private fun bindImageViewHolder(viewHolder: GameDetailRecommendImageViewHolder, recommendedImage: LinkEntity?) {
|
||||
viewHolder.binding.link = recommendedImage
|
||||
viewHolder.binding.image.setOnClickListener {
|
||||
MtaHelper.onEvent("游戏详情", "图片推荐", gameName + "->${recommendedImage?.title}")
|
||||
MtaHelper.onEvent("游戏详情_新", "图片推荐", gameName + "->${recommendedImage?.title}")
|
||||
if (!TextUtils.isEmpty(recommendedImage?.communityId)) {
|
||||
recommendedImage?.community = CommunityEntity(recommendedImage?.communityId!!, "")
|
||||
}
|
||||
@ -242,11 +242,11 @@ class DescAdapter(context: Context,
|
||||
if (viewHolder.binding.updateTv.maxLines == 5) {
|
||||
viewHolder.binding.updateTv.maxLines = 100
|
||||
viewHolder.binding.expandIv.setImageResource(R.drawable.ic_arrow_up)
|
||||
MtaHelper.onEvent("游戏详情", "展开更新内容", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "展开更新内容", gameName)
|
||||
} else {
|
||||
viewHolder.binding.updateTv.maxLines = 5
|
||||
viewHolder.binding.expandIv.setImageResource(R.drawable.ic_arrow_down)
|
||||
MtaHelper.onEvent("游戏详情", "收起更新内容", gameName)
|
||||
MtaHelper.onEvent("游戏详情_新", "收起更新内容", gameName)
|
||||
}
|
||||
notifyItemChanged(viewHolder.adapterPosition)
|
||||
}
|
||||
@ -312,9 +312,9 @@ class DescAdapter(context: Context,
|
||||
viewHolder.gamedetailPluginOpen.setOnClickListener { _ ->
|
||||
mIsPluginExpanded = !mIsPluginExpanded
|
||||
if (mIsPluginExpanded) {
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "展开插件介绍", gameName)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "展开插件介绍", gameName)
|
||||
} else {
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "收起插件介绍", gameName)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "收起插件介绍", gameName)
|
||||
}
|
||||
notifyItemChanged(viewHolder.adapterPosition)
|
||||
}
|
||||
@ -367,11 +367,11 @@ class DescAdapter(context: Context,
|
||||
if (mIsIntroExpanded) {
|
||||
viewHolder.introContent.maxLines = 100
|
||||
viewHolder.expandIv.setImageResource(R.drawable.ic_arrow_up)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "展开游戏介绍", gameName)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "展开游戏介绍", gameName)
|
||||
} else {
|
||||
viewHolder.introContent.maxLines = 3
|
||||
viewHolder.expandIv.setImageResource(R.drawable.ic_arrow_down)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "收起游戏介绍", gameName)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "收起游戏介绍", gameName)
|
||||
}
|
||||
notifyItemChanged(viewHolder.adapterPosition)
|
||||
}
|
||||
@ -394,7 +394,7 @@ class DescAdapter(context: Context,
|
||||
binding.root.setOnClickListener { _ ->
|
||||
DataCollectionUtils.uploadClick(mContext, "大家都在玩", "游戏详情", gameEntity.name)
|
||||
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "大家都在玩", gameName + "->" + gameEntity.name)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "大家都在玩", gameName + "->" + gameEntity.name)
|
||||
|
||||
GameDetailActivity.startGameDetailActivity(mContext, gameEntity,
|
||||
StringUtils.buildString(mEntrance, "+(", "游戏详情", "[", gameName, "]:大家都在玩[", (position + 1).toString(), "])"))
|
||||
|
||||
@ -64,7 +64,7 @@ class DescCommentsAdapter(context: Context,
|
||||
mContext.ifLogin("游戏详情-介绍-点赞评论") {
|
||||
if (!vote.isChecked) {
|
||||
mViewModel.voteComment(comment.id, callback = {
|
||||
MtaHelper.onEvent("游戏详情", "玩家评论_点赞", mViewModel.game?.name)
|
||||
MtaHelper.onEvent("游戏详情_新", "玩家评论_点赞", mViewModel.game?.name)
|
||||
vote.text = (comment.vote + 1).toString()
|
||||
vote.isChecked = true
|
||||
})
|
||||
@ -74,7 +74,7 @@ class DescCommentsAdapter(context: Context,
|
||||
}
|
||||
}
|
||||
commentItem.setOnClickListener {
|
||||
MtaHelper.onEvent("游戏详情", "玩家评论_点击评论", mViewModel.game?.name)
|
||||
MtaHelper.onEvent("游戏详情_新", "玩家评论_点击评论", mViewModel.game?.name)
|
||||
CommentUtils.showGameCommentOptions(mContext, comment, mViewModel.gameId, "游戏详情-介绍-举报评论")
|
||||
}
|
||||
userIcon.setOnClickListener {
|
||||
@ -84,7 +84,7 @@ class DescCommentsAdapter(context: Context,
|
||||
PersonalHomeActivity.startTargetActivity(mContext, comment.user.id, mEntrance, "(游戏详情:介绍)")
|
||||
}
|
||||
content.setExpandCallback {
|
||||
MtaHelper.onEvent("游戏详情", "玩家评论_点击全文", mViewModel.game?.name)
|
||||
MtaHelper.onEvent("游戏详情_新", "玩家评论_点击全文", mViewModel.game?.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,7 +131,9 @@ class DescViewModel(application: Application,
|
||||
}
|
||||
|
||||
override fun onNext(game: GameEntity) {
|
||||
result.add(game)
|
||||
if (game.getApk().size > 0) {
|
||||
result.add(game)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.gamecenter.gamedetail.desc
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.databinding.DataBindingUtil
|
||||
import android.os.Build
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.text.TextUtils
|
||||
@ -58,7 +59,7 @@ class GameGalleryAdapter(var context: Context,
|
||||
ImageUtils.display(holder.screenshotIv, mGallery[position])
|
||||
holder.itemView.setOnClickListener { _ ->
|
||||
DataCollectionUtils.uploadClick(context, "游戏介绍", "游戏详情")
|
||||
DataUtils.onMtaEvent(context, "游戏详情", "点击游戏截图", mGameName)
|
||||
DataUtils.onMtaEvent(context, "游戏详情_新", "点击游戏截图", mGameName)
|
||||
|
||||
val intent = ViewImageActivity.getViewImageIntent(context,
|
||||
mGallery,
|
||||
@ -84,7 +85,9 @@ class GameGalleryAdapter(var context: Context,
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return if (position == 0 && !TextUtils.isEmpty(mVideo)) {
|
||||
return if (position == 0
|
||||
&& !TextUtils.isEmpty(mVideo)
|
||||
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
VIDEO
|
||||
} else {
|
||||
IMAGE
|
||||
|
||||
@ -2,6 +2,7 @@ package com.gh.gamecenter.gamedetail.fuli
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.preference.PreferenceManager
|
||||
import android.support.v7.widget.GridLayoutManager
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
@ -38,6 +39,8 @@ class FuLiAdapter(context: Context,
|
||||
var itemList: List<FuLiItemData>? = null
|
||||
private var isOpenLiBaoList: Boolean = false
|
||||
private var isOpenToolList: Boolean = false
|
||||
private var mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
private val mAnswerHintKey = "game_detail_answer_hint"
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
if (itemList == null || itemList!!.isEmpty()) {
|
||||
@ -132,17 +135,25 @@ class FuLiAdapter(context: Context,
|
||||
holder.initItemPadding()
|
||||
holder.itemView.setOnClickListener {
|
||||
SuggestionActivity.startSuggestionActivity(mContext, SuggestType.gameQuestion, "game", mFuLiViewModel?.game?.name + ",问题反馈:")
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "此游戏有问题_点击反馈", mFuLiViewModel?.game?.name)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "此游戏有问题_点击反馈", mFuLiViewModel?.game?.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initAnswerViewHolder(holder: GameDetailAnswerViewHolder, position: Int) {
|
||||
holder.binding.run {
|
||||
val isShowAnswerHint = mSharedPreferences.getBoolean(mAnswerHintKey, true)
|
||||
if (isShowAnswerHint) {
|
||||
answerItemHint.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
answerItemList.layoutManager = LinearLayoutManager(mContext)
|
||||
answerItemList.adapter = GameDetailAnswerAdapter(mContext, mFuLiViewModel?.game?.name, itemList?.get(position)?.answer!!, mEntrance)
|
||||
answerItemMore.setOnClickListener {
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "进入问答", mFuLiViewModel?.game?.name)
|
||||
answerItemHint.visibility = View.GONE
|
||||
mSharedPreferences.edit().putBoolean(mAnswerHintKey, false).apply()
|
||||
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "进入问答", mFuLiViewModel?.game?.name)
|
||||
DirectUtils.directToCommunity(mContext, mFuLiViewModel?.gameCommunity)
|
||||
}
|
||||
}
|
||||
@ -161,7 +172,7 @@ class FuLiAdapter(context: Context,
|
||||
NewsDetailActivity.startNewsDetailActivity(mContext, notice[index],
|
||||
StringUtils.buildString(mEntrance, "游戏详情[", mFuLiViewModel?.game?.name, "]:公告"))
|
||||
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "公告", mFuLiViewModel?.game?.name + "->" + mvNotice.notices[index])
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "公告", mFuLiViewModel?.game?.name + "->" + mvNotice.notices[index])
|
||||
}
|
||||
} else {
|
||||
mvNotice.visibility = View.GONE
|
||||
@ -196,7 +207,7 @@ class FuLiAdapter(context: Context,
|
||||
viewHolder.newsMore.setOnClickListener {
|
||||
DataCollectionUtils.uploadClick(mContext, "资讯攻略-全部", "游戏详情", mFuLiViewModel?.game?.name)
|
||||
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "资讯攻略_全部", mFuLiViewModel?.game?.name)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "资讯攻略_全部", mFuLiViewModel?.game?.name)
|
||||
val intent = GameNewsActivity.getIntent(mContext, mFuLiViewModel?.game?.name, mFuLiViewModel?.game?.id,
|
||||
mEntrance + "+(游戏详情[" + mFuLiViewModel?.game?.name + "]:资讯攻略-全部)")
|
||||
mContext.startActivity(intent)
|
||||
@ -241,7 +252,7 @@ class FuLiAdapter(context: Context,
|
||||
|
||||
DataCollectionUtils.uploadClick(mContext, "资讯攻略", "游戏详情", newsEntity.title)
|
||||
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "资讯攻略", mFuLiViewModel?.game?.name + "->" + newsEntity.title)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "资讯攻略", mFuLiViewModel?.game?.name + "->" + newsEntity.title)
|
||||
|
||||
// 统计阅读量
|
||||
NewsUtils.statNewsViews(mContext, newsEntity.id)
|
||||
|
||||
@ -155,7 +155,7 @@ class FuLiFragment : BaseFragment<Any>() {
|
||||
EventBus.getDefault().post(EBReuse("showKaifuHint"))
|
||||
} else if (GameDetailFragment.SCROLL_TO_KAIFU == reuse.type && layoutManager != null) {
|
||||
DataUtils.onMtaEvent(context, "游戏详情开服表按钮", mFuLiViewModel?.game?.name)
|
||||
DataUtils.onMtaEvent(context, "游戏详情", "开服表", mFuLiViewModel?.game?.name)
|
||||
DataUtils.onMtaEvent(context, "游戏详情_新", "开服表", mFuLiViewModel?.game?.name)
|
||||
val position = getServerPosition()
|
||||
if (position > 0) layoutManager?.smoothScrollToPosition(mRecyclerView, null, position)
|
||||
}
|
||||
@ -180,7 +180,7 @@ class FuLiFragment : BaseFragment<Any>() {
|
||||
R.id.gamedetail_libao_item -> {
|
||||
val liBao = data as LibaoEntity
|
||||
val intent = LibaoDetailActivity.getIntent(context, liBao, "$mEntrance[$position]")
|
||||
DataUtils.onMtaEvent(context, "游戏详情", "游戏礼包", mFuLiViewModel?.game?.name + "->" + liBao.name)
|
||||
DataUtils.onMtaEvent(context, "游戏详情_新", "游戏礼包", mFuLiViewModel?.game?.name + "->" + liBao.name)
|
||||
startActivityForResult(intent, GAME_DETAIL_LIBAO_REQUEST)
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,12 +176,13 @@ class FuLiViewModel(application: Application,
|
||||
val itemList = ArrayList<FuLiItemData>()
|
||||
var isExistServer = false
|
||||
var index = 0
|
||||
if (gameDetail.notice != null && gameDetail.notice!!.isNotEmpty()) {
|
||||
val showArticleEntrance = Config.getSettings()?.showArticleEntrance
|
||||
if (showArticleEntrance == "on" && gameDetail.notice != null && gameDetail.notice!!.isNotEmpty()) {
|
||||
val fuLiData = FuLiItemData()
|
||||
fuLiData.notice = gameDetail.notice
|
||||
itemList.add(fuLiData)
|
||||
}
|
||||
if (mArticleList != null) {
|
||||
if (showArticleEntrance == "on" && mArticleList != null) {
|
||||
val fuLiData = FuLiItemData()
|
||||
fuLiData.article = mArticleList
|
||||
itemList.add(fuLiData)
|
||||
|
||||
@ -42,7 +42,7 @@ class GameDetailAnswerAdapter(context: Context,
|
||||
if ("community_article" == entity.type) {
|
||||
ArticleDetailActivity.getIntent(mContext, CommunityEntity(entity.id!!, ""), entity.id!!, mEntrance, path)
|
||||
} else {
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "点击问题", gameName + "->" + entity.questions.title)
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "点击问题", gameName + "->" + entity.questions.title)
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, entity.questions.id, mEntrance, path))
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ class GameDetailAnswerAdapter(context: Context,
|
||||
if ("community_article" == entity.type) {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, CommunityEntity(entity.communityId!!, ""), entity.id!!, mEntrance, path))
|
||||
} else {
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "点击答案", gameName + "->" + StringUtils.shrinkStringWithDot(entity.brief, 10))
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "点击答案", gameName + "->" + StringUtils.shrinkStringWithDot(entity.brief, 10))
|
||||
mContext.startActivity(AnswerDetailActivity.getIntent(mContext, entity.id, mEntrance, path))
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,13 +11,11 @@ import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.OnViewClickListener;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
@ -44,7 +42,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@ -411,7 +408,7 @@ public class GameDetailKaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
mGameEntity.getName(),
|
||||
calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-" + entity.getDay());
|
||||
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "开服详情", mGameEntity.getName() + "->" + viewHolder.calendarKaifu.getText().toString());
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "开服详情", mGameEntity.getName() + "->" + viewHolder.calendarKaifu.getText().toString());
|
||||
initKaifuDetail(entity);
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -55,7 +55,7 @@ public class GameLibaoGalleryAdapter extends BaseRecyclerAdapter<GameLibaoGaller
|
||||
LibaoUtils.setLiBaoBtnStatus(holder.libaoBtn, libaoEntity.getStatus(), mContext);
|
||||
|
||||
holder.libaoBtn.setOnTouchListener((v, event) -> {
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "游戏礼包_领取", mGameName + "->" + libaoEntity.getName());
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "游戏礼包_领取", mGameName + "->" + libaoEntity.getName());
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public class GameDetailToolsAdapter extends BaseRecyclerAdapter {
|
||||
|
||||
viewHolder.itemView.setOnClickListener(v -> {
|
||||
String url = toolBoxEntity.getUrl();
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情", "游戏工具", mGameName + "->" + toolBoxEntity.getName());
|
||||
DataUtils.onMtaEvent(mContext, "游戏详情_新", "游戏工具", mGameName + "->" + toolBoxEntity.getName());
|
||||
|
||||
if (url != null && url.contains(Config.URL_ARTICLE)) {
|
||||
// 写个注释例子, http://www.ghzs666.com/article/${articleId}.html
|
||||
|
||||
@ -11,6 +11,7 @@ import com.gh.common.util.ClickUtils
|
||||
import com.gh.common.util.CommentUtils
|
||||
import com.gh.common.util.MtaHelper
|
||||
import com.gh.common.util.ifLogin
|
||||
import com.gh.common.view.DrawableView
|
||||
import com.gh.gamecenter.PersonalHomeActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
|
||||
@ -80,7 +81,7 @@ class RatingAdapter(context: Context,
|
||||
holder.binding.run {
|
||||
data = ratingData
|
||||
ratingSelector.setOnRatingChangeListener { ratingBar, rating ->
|
||||
MtaHelper.onEvent("游戏详情", "评论Tab_点击星星", mListViewModel.game.name + "- ${rating.toInt()}")
|
||||
MtaHelper.onEvent("游戏详情_新", "评论Tab_点击星星", mListViewModel.game.name + "- ${rating.toInt()}")
|
||||
if (!ClickUtils.isFastDoubleClick(ratingBar.id, 1000)) {
|
||||
skipRatingEdit(rating, "游戏详情-评论-点击星星")
|
||||
// 与传进评论编辑的星星保持一致
|
||||
@ -90,7 +91,7 @@ class RatingAdapter(context: Context,
|
||||
}
|
||||
}
|
||||
ratingEditBtn.setOnClickListener {
|
||||
MtaHelper.onEvent("游戏详情", "评论Tab_点击我来评论", mListViewModel.game.name)
|
||||
MtaHelper.onEvent("游戏详情_新", "评论Tab_点击我来评论", mListViewModel.game.name)
|
||||
skipRatingEdit(0.0F, "游戏详情-评论-[我来评论]")
|
||||
}
|
||||
}
|
||||
@ -102,11 +103,11 @@ class RatingAdapter(context: Context,
|
||||
if (comment?.me?.isCommented != null && comment.me.isCommented) {
|
||||
badge.visibility = View.VISIBLE
|
||||
badge.text = "你的评论"
|
||||
badge.setBackgroundColor(ContextCompat.getColor(mContext, R.color.theme))
|
||||
badge.background = DrawableView.getServerDrawable(ContextCompat.getColor(mContext, R.color.theme))
|
||||
} else if (comment.order > 0) {
|
||||
badge.visibility = View.VISIBLE
|
||||
badge.text = "精彩评论"
|
||||
badge.setBackgroundColor(ContextCompat.getColor(mContext, R.color.tag_orange))
|
||||
badge.background = DrawableView.getServerDrawable(ContextCompat.getColor(mContext, R.color.tag_orange))
|
||||
} else {
|
||||
badge.visibility = View.GONE
|
||||
}
|
||||
@ -137,7 +138,7 @@ class RatingAdapter(context: Context,
|
||||
mListViewModel.voteComment(comment.id, callback = {
|
||||
vote.text = (comment.vote + 1).toString()
|
||||
vote.isChecked = true
|
||||
MtaHelper.onEvent("游戏详情", "评论Tab_点赞", mListViewModel.game.name)
|
||||
MtaHelper.onEvent("游戏详情_新", "评论Tab_点赞", mListViewModel.game.name)
|
||||
})
|
||||
} else {
|
||||
Utils.toast(mContext, "已经点赞了哟~")
|
||||
@ -146,7 +147,7 @@ class RatingAdapter(context: Context,
|
||||
}
|
||||
commentItem.setOnClickListener {
|
||||
CommentUtils.showGameCommentOptions(mContext, comment, mListViewModel.game.id, "游戏详情-评论-举报评论")
|
||||
MtaHelper.onEvent("游戏详情", "评论Tab_点击评论", mListViewModel.game.name)
|
||||
MtaHelper.onEvent("游戏详情_新", "评论Tab_点击评论", mListViewModel.game.name)
|
||||
}
|
||||
userIcon.setOnClickListener {
|
||||
PersonalHomeActivity.startTargetActivity(mContext, comment.user.id, mEntrance, "游戏详情:评分")
|
||||
@ -155,7 +156,7 @@ class RatingAdapter(context: Context,
|
||||
PersonalHomeActivity.startTargetActivity(mContext, comment.user.id, mEntrance, "游戏详情:评分")
|
||||
}
|
||||
content.setExpandCallback {
|
||||
MtaHelper.onEvent("游戏详情", "评论Tab_点击全文", mListViewModel.game.name)
|
||||
MtaHelper.onEvent("游戏详情_新", "评论Tab_点击全文", mListViewModel.game.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,10 @@ public class KaiFuFragment extends BaseFragment {
|
||||
|
||||
private List<Fragment> mFragments;
|
||||
|
||||
public static final String DAY_TODAY = "today";
|
||||
public static final String DAY_TOMORROW = "tomorrow";
|
||||
public static final String DAY_AFTER = "after";
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_kaifu;
|
||||
@ -58,13 +62,13 @@ public class KaiFuFragment extends BaseFragment {
|
||||
String day;
|
||||
switch (i) {
|
||||
case 0:
|
||||
day = "today";
|
||||
day = DAY_TODAY;
|
||||
break;
|
||||
case 1:
|
||||
day = "tomorrow";
|
||||
day = DAY_TOMORROW;
|
||||
break;
|
||||
default:
|
||||
day = "after";
|
||||
day = DAY_AFTER;
|
||||
break;
|
||||
}
|
||||
arguments.putString("day", day);
|
||||
|
||||
@ -7,6 +7,7 @@ import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.util.ArrayMap;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
@ -14,6 +15,10 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.OnRequestCallBackListener;
|
||||
import com.gh.common.exposure.ExposureEvent;
|
||||
import com.gh.common.exposure.ExposureSource;
|
||||
import com.gh.common.exposure.ExposureType;
|
||||
import com.gh.common.exposure.IExposable;
|
||||
import com.gh.common.util.ApkActiveUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
@ -36,6 +41,7 @@ import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@ -49,7 +55,7 @@ import retrofit2.HttpException;
|
||||
/**
|
||||
* Created by khy on 18/08/17.
|
||||
*/
|
||||
public class KaiFuVpAdapter extends BaseRecyclerAdapter {
|
||||
public class KaiFuVpAdapter extends BaseRecyclerAdapter implements IExposable {
|
||||
|
||||
private OnRequestCallBackListener mOnCallBackListener;
|
||||
|
||||
@ -71,6 +77,8 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
|
||||
private static final int VIEW_TYPE_ITEM = 1;
|
||||
private static final int VIEW_TYPE_FOOTER = 2;
|
||||
|
||||
private SparseArray<ExposureEvent> mExposureEventArray = new SparseArray<>();
|
||||
|
||||
public KaiFuVpAdapter(Context context,
|
||||
OnRequestCallBackListener onCallBackListener,
|
||||
String gameId,
|
||||
@ -260,6 +268,31 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
|
||||
if (holder instanceof GameTestViewHolder) {
|
||||
GameEntity gameEntity = mEntityList.get(position);
|
||||
GameTestViewHolder viewHolder = (GameTestViewHolder) holder;
|
||||
|
||||
String day;
|
||||
String fixedTop = "";
|
||||
if (KaiFuFragment.DAY_TODAY.equals(mDay)) {
|
||||
day = "今日开服";
|
||||
} else if (KaiFuFragment.DAY_TOMORROW.equals(mDay)) {
|
||||
day = "明日开服";
|
||||
} else {
|
||||
day = "后续开服";
|
||||
}
|
||||
|
||||
if (gameEntity.getServerEntity() != null &&
|
||||
gameEntity.getServerEntity().getTime() == 0) {
|
||||
fixedTop = "热门开服";
|
||||
}
|
||||
|
||||
ArrayList<ExposureSource> exposureSources = new ArrayList<>();
|
||||
exposureSources.add(new ExposureSource("开服表", ""));
|
||||
exposureSources.add(new ExposureSource(day, fixedTop));
|
||||
ExposureEvent exposureEvent = ExposureEvent.Companion.createEvent(gameEntity,
|
||||
exposureSources,
|
||||
null,
|
||||
ExposureType.EXPOSURE);
|
||||
mExposureEventArray.put(position, exposureEvent);
|
||||
|
||||
initGameTestViewHolder(gameEntity, viewHolder);
|
||||
} else if (holder instanceof KaiFuTimeViewHolder) {
|
||||
GameEntity gameEntity = mEntityList.get(position);
|
||||
@ -332,17 +365,20 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
|
||||
|
||||
DownloadItemUtils.setOnClickListener(mContext,
|
||||
viewHolder.gameDownloadBtn, gameEntity, viewHolder.getAdapterPosition(), KaiFuVpAdapter.this,
|
||||
StringUtils.buildString(entrance, "+(开服表[", String.valueOf(viewHolder.getAdapterPosition() + 1), "])"),
|
||||
StringUtils.buildString("开服表:", gameEntity.getName()));
|
||||
StringUtils.buildString(entrance, "+(开服表[", String.valueOf(viewHolder.getAdapterPosition()), "])"),
|
||||
StringUtils.buildString("开服表:", gameEntity.getName()),
|
||||
mExposureEventArray.get(viewHolder.getAdapterPosition()));
|
||||
|
||||
DownloadItemUtils.updateItem(mContext, gameEntity, viewHolder, true);
|
||||
|
||||
if (gameEntity.getFixedTop()) {
|
||||
viewHolder.itemView.setOnClickListener(v ->
|
||||
GameDetailActivity.startGameDetailActivity(mContext, gameEntity,
|
||||
StringUtils.buildString(entrance, "+(开服表[", String.valueOf(viewHolder.getAdapterPosition() + 1), "])")));
|
||||
GameDetailActivity.startGameDetailActivity(mContext,
|
||||
gameEntity,
|
||||
StringUtils.buildString(entrance, "+(开服表[", String.valueOf(viewHolder.getAdapterPosition()), "])"),
|
||||
mExposureEventArray.get(viewHolder.getAdapterPosition())));
|
||||
} else {
|
||||
viewHolder.itemView.setOnClickListener(v -> showSkipDialog(gameEntity, viewHolder.getAdapterPosition() + 1));
|
||||
viewHolder.itemView.setOnClickListener(v -> showSkipDialog(gameEntity, viewHolder.getAdapterPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,7 +423,7 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
|
||||
case "进入游戏详情":
|
||||
MtaHelper.onEvent("开服表", "点击游戏", "进入游戏详情");
|
||||
GameDetailActivity.startGameDetailActivity(mContext, gameEntity,
|
||||
StringUtils.buildString(entrance, "+(开服表[", String.valueOf(position), "])"));
|
||||
StringUtils.buildString(entrance, "+(开服表[", String.valueOf(position), "])"), mExposureEventArray.get(position));
|
||||
break;
|
||||
case "返回所有游戏":
|
||||
EventBus.getDefault().post(new EBKaiFuReset(KaiFuWrapperFragment.ALL_GAME_KAIFU, gameEntity.getId()));
|
||||
@ -430,6 +466,18 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
|
||||
return mLocationMap;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ExposureEvent getEventByPosition(int pos) {
|
||||
return mExposureEventArray.get(pos);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<ExposureEvent> getEventListByPosition(int pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
interface FooterCallback {
|
||||
void onClick();
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.gc.materialdesign.views.ProgressBarCircularIndeterminate;
|
||||
import com.gh.base.fragment.BaseFragment;
|
||||
import com.gh.common.exposure.ExposureListener;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
@ -114,6 +115,7 @@ public class KaiFuVpFragment extends BaseFragment {
|
||||
mLayoutManager = new LinearLayoutManager(getContext());
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mAdapter = new KaiFuVpAdapter(getContext(), this, mGameId, mDay, mEntrance, this::scrollToTop);
|
||||
mRecyclerView.addOnScrollListener(new ExposureListener(this, mAdapter));
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@ -253,6 +255,7 @@ public class KaiFuVpFragment extends BaseFragment {
|
||||
mNoneData.setVisibility(View.GONE);
|
||||
mAdapter = new KaiFuVpAdapter(getContext(), this, mGameId, mDay, mEntrance, this::scrollToTop);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.addOnScrollListener(new ExposureListener(this, mAdapter));
|
||||
}
|
||||
|
||||
// 下载被删除事件
|
||||
|
||||
@ -15,9 +15,11 @@ import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.fragment.BaseFragment;
|
||||
import com.gh.common.util.TextHelper;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.lightgame.utils.Util_System_Keyboard;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
@ -89,6 +91,10 @@ public class Libao1Fragment extends BaseFragment implements SwipeRefreshLayout.O
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
TextHelper.limitTheLengthOfEditText(mLibaoEtSearch, 50, () -> {
|
||||
Utils.toast(mLibaoEtSearch.getContext(), "最多输入50个字");
|
||||
});
|
||||
}
|
||||
|
||||
private void changeFragment() {
|
||||
|
||||
@ -1,26 +1,15 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.common.im.ImManager;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.MtaHelper;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.baselist.ListFragment;
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity;
|
||||
import com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity;
|
||||
import com.gh.gamecenter.subject.SubjectActivity;
|
||||
import com.halo.assistant.HaloApp;
|
||||
|
||||
/**
|
||||
@ -52,72 +41,15 @@ public class KeFuFragment extends ListFragment<MessageKeFuEntity, KeFuViewModel>
|
||||
|
||||
@Override
|
||||
protected ListAdapter provideListAdapter() {
|
||||
return mAdapter == null ? mAdapter = new KeFuFragmentAdapter(getContext(), this, mEntrance) : mAdapter;
|
||||
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_kefu_skip) {
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击链接");
|
||||
MessageKeFuEntity keFuEntity = (MessageKeFuEntity) data;
|
||||
if (keFuEntity.getLink() == null || keFuEntity.getLink().getType() == null) {
|
||||
toast("数据请求失败");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!keFuEntity.isRead()) {
|
||||
mListViewModel.postMessageRead(keFuEntity.getId());
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
switch (keFuEntity.getLink().getType()) {
|
||||
case "游戏":
|
||||
if (!TextUtils.isEmpty(keFuEntity.getLink().getId())) {
|
||||
GameDetailActivity.startGameDetailActivity(getContext(), keFuEntity.getLink().getId(), "");
|
||||
}
|
||||
break;
|
||||
case "QQ号":
|
||||
if (!TextUtils.isEmpty(keFuEntity.getLink().getQq())) {
|
||||
DirectUtils.directToQqConversation(getContext(), keFuEntity.getLink().getQq());
|
||||
}
|
||||
break;
|
||||
case "web":
|
||||
if (!TextUtils.isEmpty(keFuEntity.getLink().getUrl())) {
|
||||
startActivity(WebActivity.getIntentByUrl(getContext(), keFuEntity.getLink().getUrl()));
|
||||
}
|
||||
break;
|
||||
case "QQ群":
|
||||
if (!TextUtils.isEmpty(keFuEntity.getLink().getKey())) {
|
||||
DirectUtils.directToQqGroup(getContext(), keFuEntity.getLink().getKey());
|
||||
}
|
||||
break;
|
||||
case "新闻":
|
||||
if (!TextUtils.isEmpty(keFuEntity.getLink().getId())) {
|
||||
Intent intent2 = new Intent(getContext(), NewsDetailActivity.class);
|
||||
intent2.putExtra(EntranceUtils.KEY_ENTRANCE, "(消息-公告)");
|
||||
intent2.putExtra(EntranceUtils.KEY_NEWSID, keFuEntity.getLink().getId());
|
||||
startActivity(intent2);
|
||||
}
|
||||
break;
|
||||
case "专题":
|
||||
if (!TextUtils.isEmpty(keFuEntity.getLink().getId())) {
|
||||
SubjectActivity.startSubjectActivity(getContext(), keFuEntity.getLink().getId()
|
||||
, null, false, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "7moor":
|
||||
ImManager.startChatActivity(getActivity());
|
||||
break;
|
||||
case "问题":
|
||||
String questionId = keFuEntity.getLink().getId();
|
||||
if (!TextUtils.isEmpty(questionId)) {
|
||||
startActivity(QuestionsDetailActivity.getIntent(getContext(), questionId, mEntrance, "(消息-客服)"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DialogUtils.showLowVersionDialog(getActivity());
|
||||
break;
|
||||
}
|
||||
} else if (view.getId() == R.id.message_kaifu_item) {
|
||||
if (view.getId() == R.id.message_kaifu_item) {
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击卡片");
|
||||
MessageKeFuEntity keFuEntity = (MessageKeFuEntity) data;
|
||||
if (!keFuEntity.isRead()) {
|
||||
|
||||
@ -1,22 +1,41 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.OnListClickListener;
|
||||
import com.gh.common.constant.ItemViewType;
|
||||
import com.gh.common.im.ImManager;
|
||||
import com.gh.common.util.CommentUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.MtaHelper;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.PersonalHomeActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity;
|
||||
import com.gh.gamecenter.entity.MessageLinkEntity;
|
||||
import com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity;
|
||||
import com.gh.gamecenter.subject.SubjectActivity;
|
||||
import com.lightgame.utils.Util_System_ClipboardManager;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/4/10.
|
||||
@ -26,10 +45,13 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
|
||||
private OnListClickListener mClickListener;
|
||||
|
||||
private KeFuViewModel mListViewModel;
|
||||
|
||||
private String mEntrance;
|
||||
|
||||
public KeFuFragmentAdapter(Context context, OnListClickListener listener, String entrance) {
|
||||
public KeFuFragmentAdapter(Context context, OnListClickListener listener, KeFuViewModel listViewModel, String entrance) {
|
||||
super(context);
|
||||
mListViewModel = listViewModel;
|
||||
mClickListener = listener;
|
||||
mEntrance = entrance;
|
||||
}
|
||||
@ -75,6 +97,12 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
private void initKeFuViewHolder(KeFuViewHolder viewHolder, final MessageKeFuEntity keFuEntity) {
|
||||
|
||||
viewHolder.content.setText(Html.fromHtml(keFuEntity.getMessage()));
|
||||
|
||||
viewHolder.content.setOnSpannableClickListener(spannableText -> {
|
||||
Util_System_ClipboardManager.setText(mContext, spannableText);
|
||||
Utils.toast(mContext, "已复制:" + spannableText);
|
||||
});
|
||||
|
||||
viewHolder.setClickData(keFuEntity);
|
||||
if (!TextUtils.isEmpty(keFuEntity.getSuggestion())) {
|
||||
viewHolder.suggestion.setVisibility(View.VISIBLE);
|
||||
@ -83,11 +111,34 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
viewHolder.suggestion.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (keFuEntity.getLink() != null && !TextUtils.isEmpty(keFuEntity.getLink().getDocument())) {
|
||||
viewHolder.skip.setText(keFuEntity.getLink().getDocument());
|
||||
viewHolder.skip.setVisibility(View.VISIBLE);
|
||||
List<MessageLinkEntity> links = keFuEntity.getLinks();
|
||||
if (links != null && !links.isEmpty()) {
|
||||
viewHolder.skipList.setVisibility(View.VISIBLE);
|
||||
viewHolder.skipList.removeAllViews();
|
||||
for (MessageLinkEntity link : links) {
|
||||
if (TextUtils.isEmpty(link.getQq()) &&
|
||||
TextUtils.isEmpty(link.getId()) &&
|
||||
TextUtils.isEmpty(link.getUrl()) &&
|
||||
!"7moor".equals(link.getType())) continue;
|
||||
TextView textView = new TextView(mContext);
|
||||
textView.setTextColor(mContext.getResources().getColor(R.color.theme));
|
||||
textView.setTextSize(14F);
|
||||
textView.setText(link.getDocument());
|
||||
textView.setOnClickListener(v -> {
|
||||
if (!keFuEntity.isRead()) {
|
||||
mListViewModel.postMessageRead(keFuEntity.getId());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
linkSkip(link);
|
||||
});
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, DisplayUtils.dip2px(8F), 0, 0);
|
||||
viewHolder.skipList.addView(textView, params);
|
||||
}
|
||||
|
||||
} else {
|
||||
viewHolder.skip.setVisibility(View.GONE);
|
||||
viewHolder.skipList.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
MessageKeFuEntity.ServiceEntity serviceEntity = keFuEntity.getServiceEntity();
|
||||
@ -140,4 +191,64 @@ public class KeFuFragmentAdapter extends ListAdapter<MessageKeFuEntity> {
|
||||
});
|
||||
}
|
||||
|
||||
private void linkSkip(MessageLinkEntity data) {
|
||||
String type = data.getType();
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
Utils.toast(mContext, "数据请求失败");
|
||||
return;
|
||||
}
|
||||
MtaHelper.onEvent("消息中心", "系统_二级列表", "点击链接");
|
||||
|
||||
|
||||
switch (type) {
|
||||
case "游戏":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
GameDetailActivity.startGameDetailActivity(mContext, data.getId(), "");
|
||||
}
|
||||
break;
|
||||
case "QQ号":
|
||||
if (!TextUtils.isEmpty(data.getQq())) {
|
||||
DirectUtils.directToQqConversation(mContext, data.getQq());
|
||||
}
|
||||
break;
|
||||
case "web":
|
||||
if (!TextUtils.isEmpty(data.getUrl())) {
|
||||
mContext.startActivity(WebActivity.getIntentByUrl(mContext, data.getUrl()));
|
||||
}
|
||||
break;
|
||||
case "QQ群":
|
||||
if (!TextUtils.isEmpty(data.getKey())) {
|
||||
DirectUtils.directToQqGroup(mContext, data.getKey());
|
||||
}
|
||||
break;
|
||||
case "新闻":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
Intent intent2 = new Intent(mContext, NewsDetailActivity.class);
|
||||
intent2.putExtra(EntranceUtils.KEY_ENTRANCE, "(消息-公告)");
|
||||
intent2.putExtra(EntranceUtils.KEY_NEWSID, data.getId());
|
||||
mContext.startActivity(intent2);
|
||||
}
|
||||
break;
|
||||
case "专题":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
SubjectActivity.startSubjectActivity(mContext, data.getId()
|
||||
, null, false, "(消息-客服)");
|
||||
}
|
||||
break;
|
||||
case "7moor":
|
||||
if (mContext instanceof Activity) {
|
||||
ImManager.startChatActivity((Activity) mContext);
|
||||
}
|
||||
break;
|
||||
case "问题":
|
||||
if (!TextUtils.isEmpty(data.getId())) {
|
||||
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, data.getId(), mEntrance, "(消息-客服)"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DialogUtils.showLowVersionDialog(mContext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.gh.gamecenter.message;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.base.BaseRecyclerViewHolder;
|
||||
import com.gh.base.OnListClickListener;
|
||||
import com.gh.common.view.MessageSpannableTextView;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.MessageKeFuEntity;
|
||||
|
||||
@ -21,11 +23,11 @@ public class KeFuViewHolder extends BaseRecyclerViewHolder<MessageKeFuEntity> {
|
||||
@BindView(R.id.message_kefu_hint)
|
||||
public View readHint;
|
||||
@BindView(R.id.message_kefu_content)
|
||||
public TextView content;
|
||||
public MessageSpannableTextView content;
|
||||
@BindView(R.id.message_kefu_suggestion)
|
||||
public TextView suggestion;
|
||||
@BindView(R.id.message_kefu_skip)
|
||||
public TextView skip;
|
||||
@BindView(R.id.message_skip_list)
|
||||
public LinearLayout skipList;
|
||||
@BindView(R.id.message_kefu_icon)
|
||||
public SimpleDraweeView kefuIcon;
|
||||
@BindView(R.id.message_user_badge)
|
||||
@ -38,6 +40,5 @@ public class KeFuViewHolder extends BaseRecyclerViewHolder<MessageKeFuEntity> {
|
||||
public KeFuViewHolder(View itemView, OnListClickListener listClickListener) {
|
||||
super(itemView, listClickListener);
|
||||
itemView.setOnClickListener(this);
|
||||
skip.setOnClickListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class MessageAdapter extends ListAdapter<MessageEntity> {
|
||||
case ItemViewType.ITEM_BODY:
|
||||
MessageItemViewHolder viewHolder = (MessageItemViewHolder) holder;
|
||||
MessageEntity entity = mEntityList.get(position - TOP_ITEM_COUNT);
|
||||
viewHolder.setMessageItem(entity, mEntrance);
|
||||
viewHolder.setMessageItem(entity, mContext, mEntrance);
|
||||
break;
|
||||
case ItemViewType.ITEM_FOOTER:
|
||||
FooterViewHolder footerViewHolder = (FooterViewHolder) holder;
|
||||
|
||||
@ -2,6 +2,8 @@ package com.gh.gamecenter.message;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.base.BaseActivity;
|
||||
@ -20,13 +22,25 @@ import com.gh.gamecenter.databinding.MessageItemBinding;
|
||||
import com.gh.gamecenter.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.entity.LinkEntity;
|
||||
import com.gh.gamecenter.entity.MessageEntity;
|
||||
import com.gh.gamecenter.entity.MessageFold;
|
||||
import com.gh.gamecenter.entity.UserEntity;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity;
|
||||
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity;
|
||||
import com.gh.gamecenter.qa.entity.Questions;
|
||||
import com.gh.gamecenter.qa.follow.AskFollowMoreDialog;
|
||||
import com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.HttpException;
|
||||
|
||||
/**
|
||||
* Created by khy on 23/03/18.
|
||||
*/
|
||||
@ -47,7 +61,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
mBinding.messageItem.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void setMessageItem(MessageEntity messageEntity, String entrance) {
|
||||
public void setMessageItem(MessageEntity messageEntity, Context context, String entrance) {
|
||||
setClickData(messageEntity);
|
||||
mBinding.setMessageEntity(messageEntity);
|
||||
mBinding.messageTime.setText(NewsUtils.getFormattedTime(messageEntity.getTime()));
|
||||
@ -67,6 +81,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "reply":
|
||||
mBinding.messageCommand.setText("回复了你");
|
||||
@ -77,6 +92,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.display(mBinding.messageArticleIcon, messageEntity.getArticle().getThumb());
|
||||
mBinding.messageArticleIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageAskIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "follow_question":
|
||||
mBinding.messageCommand.setText("回答了你关注的问题");
|
||||
@ -91,6 +107,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "reply_answer_comment":
|
||||
mBinding.messageCommand.setText("回复了你");
|
||||
@ -104,6 +121,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
}
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "answer_comment":
|
||||
mBinding.messageCommand.setText("评论了你");
|
||||
@ -118,6 +136,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "answer_vote":
|
||||
mBinding.messageCommand.setText("赞同你的回答");
|
||||
@ -130,6 +149,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "comment_vote":
|
||||
mBinding.messageCommand.setText("赞了你的评论");
|
||||
@ -138,6 +158,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.display(mBinding.messageArticleIcon, messageEntity.getArticle().getThumb());
|
||||
mBinding.messageArticleIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageAskIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "answer_comment_vote":
|
||||
mBinding.messageCommand.setText("赞了你的评论");
|
||||
@ -150,6 +171,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "invited":
|
||||
mBinding.messageCommand.setText("邀请你回答");
|
||||
@ -162,6 +184,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "system_invited":
|
||||
mBinding.messageCommand.setText("有新问题等你回答");
|
||||
@ -174,6 +197,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "community_article_vote":
|
||||
mBinding.messageCommand.setText("赞同你的文章");
|
||||
@ -186,6 +210,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
targetUrl = images.get(0);
|
||||
}
|
||||
ImageUtils.display(mBinding.messageAskIcon, targetUrl);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "community_article_comment":
|
||||
mBinding.messageCommand.setText("评论了你");
|
||||
@ -200,6 +225,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "community_article_comment_vote":
|
||||
mBinding.messageCommand.setText("赞了你的评论");
|
||||
@ -212,6 +238,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "reply_community_article_comment":
|
||||
mBinding.messageCommand.setText("回复了你");
|
||||
@ -225,6 +252,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
}
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "game_comment_vote":
|
||||
mBinding.messageCommand.setText("赞了你的评论");
|
||||
@ -233,6 +261,7 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, messageEntity.getGame().getIcon());
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
case "update-answer":
|
||||
mBinding.messageCommand.setText("更新了回答");
|
||||
@ -247,9 +276,14 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
ImageUtils.displayIcon(mBinding.messageAskIcon, targetUrl);
|
||||
mBinding.messageAskIcon.setVisibility(View.VISIBLE);
|
||||
mBinding.messageArticleIcon.setVisibility(View.GONE);
|
||||
voteMoreUser(messageEntity);
|
||||
break;
|
||||
}
|
||||
|
||||
mBinding.messageUserMore.setOnClickListener(v -> {
|
||||
MessageEntity.Fold fold = messageEntity.getFold();
|
||||
if (fold != null) getFoldList(context, messageEntity.getFold().getResourceId());
|
||||
});
|
||||
mBinding.messageUserIcon.setOnClickListener(v -> {
|
||||
MtaHelper.onEvent("消息中心", mOuterInfo, "点击头像");
|
||||
PersonalHomeActivity.startTargetActivity(itemView.getContext(), messageEntity.getUserEntity().getId(), entrance, "消息中心-赞同及邀请");
|
||||
@ -260,6 +294,49 @@ public class MessageItemViewHolder extends BaseRecyclerViewHolder<MessageEntity>
|
||||
});
|
||||
}
|
||||
|
||||
private void voteMoreUser(MessageEntity messageEntity) {
|
||||
MessageEntity.Fold fold = messageEntity.getFold();
|
||||
if (fold != null && fold.getNumber() > 1) {
|
||||
mBinding.messageUserMore.setVisibility(View.VISIBLE);
|
||||
mBinding.messageUserMore.setText((" 等" + fold.getNumber() + "人"));
|
||||
} else {
|
||||
mBinding.messageUserMore.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void getFoldList(Context context, String resourceId) {
|
||||
RetrofitManager
|
||||
.getInstance(context)
|
||||
.getApi()
|
||||
.getMessageFoldList(UserManager.getInstance().getUserId(), resourceId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<MessageFold>>() {
|
||||
@Override
|
||||
public void onResponse(@Nullable List<MessageFold> response) {
|
||||
|
||||
List<UserEntity> list = new ArrayList<>();
|
||||
for (MessageFold messageFold : response) {
|
||||
UserEntity user = messageFold.getUser();
|
||||
user.setTime(messageFold.getTime());
|
||||
list.add(user);
|
||||
}
|
||||
|
||||
if (context instanceof FragmentActivity) {
|
||||
AskFollowMoreDialog dialog = new AskFollowMoreDialog();
|
||||
dialog.setType("赞同了你");
|
||||
dialog.setUserList((ArrayList<UserEntity>) list);
|
||||
dialog.show(((FragmentActivity) context).getSupportFragmentManager(), "more");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@Nullable HttpException e) {
|
||||
Utils.toast(context, R.string.request_failure_normal_hint);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void messageItemClickSkip(View view, MessageEntity entity, String entrance, String outerInfo, String path) {
|
||||
if (view == null || entity == null) return;
|
||||
Context context = view.getContext();
|
||||
|
||||
@ -57,7 +57,7 @@ public class MessageNormalAdapter extends ListAdapter<MessageEntity> {
|
||||
MessageItemViewHolder viewHolder = (MessageItemViewHolder) holder;
|
||||
MessageEntity entity = mEntityList.get(position);
|
||||
entity.setRead(true);
|
||||
viewHolder.setMessageItem(entity, mEntrance);
|
||||
viewHolder.setMessageItem(entity, mContext, mEntrance);
|
||||
break;
|
||||
case ItemViewType.ITEM_FOOTER:
|
||||
((FooterViewHolder) holder).initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver, R.string.ask_loadover_hint);
|
||||
|
||||
@ -413,7 +413,7 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
Utils.toast(mContext, R.string.concern_failure);
|
||||
viewHolder.gameConcern.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
} else {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("状态", mContext.getString(R.string.cancel_concern));
|
||||
|
||||
@ -3,7 +3,6 @@ package com.gh.gamecenter.packagehelper
|
||||
import android.arch.lifecycle.MutableLiveData
|
||||
import android.preference.PreferenceManager
|
||||
import android.text.TextUtils
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.entity.AppEntity
|
||||
@ -124,9 +123,6 @@ object PackageRepository {
|
||||
list.addAll(localList)
|
||||
}
|
||||
}
|
||||
|
||||
// 忽略特定的包
|
||||
list.remove(Constants.XPOSED_INSTALLER_PACKAGE_NAME)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,12 +147,15 @@ object PackageRepository {
|
||||
.subscribe(object : Response<List<GameEntity>>() {
|
||||
override fun onResponse(response: List<GameEntity>?) {
|
||||
if (response != null) {
|
||||
val gh_id = PackageUtils.getMetaData(HaloApp.getInstance().application, pkgName, "gh_id")
|
||||
for (game in response) {
|
||||
gameInstalled.add(GameInstall.transformGameInstall(game, pkgName))
|
||||
val isCanPluggable = checkGamePlugin(game, pkgName)
|
||||
val isCanUpdate = checkGameUpdate(game)
|
||||
if (!isNotifyUpdate && isCanUpdate || isCanPluggable) {
|
||||
isNotifyUpdate = true
|
||||
if (gh_id == null || gh_id == game.id) {
|
||||
gameInstalled.add(GameInstall.transformGameInstall(game, pkgName))
|
||||
val isCanPluggable = checkGamePlugin(game, pkgName)
|
||||
val isCanUpdate = checkGameUpdate(game)
|
||||
if (!isNotifyUpdate && isCanUpdate || isCanPluggable) {
|
||||
isNotifyUpdate = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,11 +237,14 @@ object PackageRepository {
|
||||
*/
|
||||
fun uninstalledGame(pkgName: String) {
|
||||
// 删除更新列表
|
||||
for (game in gameUpdate) {
|
||||
var j = 0
|
||||
while (j < gameUpdate.size) {
|
||||
val game = gameUpdate[j]
|
||||
if (game.packageName == pkgName) {
|
||||
gameUpdate.remove(game)
|
||||
notifyGameUpdateData()
|
||||
break
|
||||
} else {
|
||||
j++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -297,7 +297,7 @@ public class AnswerEditFragment extends NormalFragment {
|
||||
if (postDialog != null) postDialog.dismissAllowingStateLoss();
|
||||
DialogUtils.showAlertDialog(getContext(),
|
||||
getString(R.string.answer_post_failed),
|
||||
String.format(getString(R.string.answer_exceed_length_limit), Integer.toString(answerLength - MIN_ANSWER_TEXT_LENGTH)),
|
||||
getString(R.string.answer_exceed_length_limit, MAX_ANSWER_TEXT_LENGTH, (answerLength - MAX_ANSWER_TEXT_LENGTH)),
|
||||
getString(R.string.answer_resume_edit), "", () -> {
|
||||
// do nothing
|
||||
}, null);
|
||||
|
||||
@ -52,7 +52,7 @@ class MyArticleFragment : ListFragment<ArticleEntity, NormalListViewModel<Articl
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
mTargetUserId = arguments?.getString(EntranceUtils.KEY_USER_ID)!!
|
||||
mTargetUserId = arguments?.getString(EntranceUtils.KEY_USER_ID) ?: ""
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (activity is MyArticleActivity) {
|
||||
|
||||
@ -247,7 +247,7 @@ class ArticleDetailActivity : BaseActivity() {
|
||||
when (item?.itemId) {
|
||||
R.id.menu_more -> showMoreItemDialog()
|
||||
R.id.menu_collect -> {
|
||||
CheckLoginUtils.checkLogin(this, "社区文章详情-收藏") {
|
||||
ifLogin(entrance = "社区文章详情-收藏") {
|
||||
mViewModel.collectionCommand(!mViewModel.detailEntity?.me?.isCommunityArticleFavorite!!, callback = {
|
||||
mViewModel.detailEntity?.me?.isCommunityArticleFavorite = it
|
||||
if (it) {
|
||||
|
||||
@ -2,6 +2,7 @@ package com.gh.gamecenter.qa.article.draft
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.gh.common.constant.ItemViewType
|
||||
@ -16,6 +17,14 @@ class ArticleDraftAdapter(context: Context
|
||||
, private val deleteCallback: (ArticleDraftEntity) -> Unit
|
||||
, private val selectCallback: (ArticleDraftEntity) -> Unit) : ListAdapter<ArticleDraftEntity>(context) {
|
||||
|
||||
override fun areItemsTheSame(oldItem: ArticleDraftEntity, newItem: ArticleDraftEntity): Boolean {
|
||||
return !TextUtils.isEmpty(oldItem.id) && oldItem.id == newItem.id
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: ArticleDraftEntity, newItem: ArticleDraftEntity): Boolean {
|
||||
return oldItem == newItem
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val view: View
|
||||
return when (viewType) {
|
||||
|
||||
@ -28,7 +28,7 @@ class ArticleDraftFragment : ListFragment<ArticleDraftEntity, NormalListViewMode
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == ARTICLE_DRAFT_REQUEST /*&& resultCode == Activity.RESULT_OK*/) {
|
||||
mListViewModel?.load(LoadType.REFRESH)
|
||||
mBaseHandler.postDelayed({ mListViewModel.load(LoadType.REFRESH) }, 100)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ class ArticleEditActivity : BaseActivity() {
|
||||
|
||||
mViewModel?.processDialog?.observe(this, Observer { it ->
|
||||
if (it?.isShow!!) {
|
||||
if (mProcessingDialog != null && mProcessingDialog?.isVisible!!) {
|
||||
if (mProcessingDialog?.dialog?.isShowing == true) {
|
||||
mProcessingDialog?.uploadWaitingHint(it.msg)
|
||||
} else {
|
||||
mProcessingDialog = WaitingDialogFragment.newInstance(it.msg, false)
|
||||
|
||||
@ -162,7 +162,7 @@ class ArticleEditViewModel(application: Application) : AndroidViewModel(applicat
|
||||
return
|
||||
}
|
||||
|
||||
processDialog.postValue(WaitingDialogFragment.WaitingDialogData("上传中...", true))
|
||||
processDialog.postValue(WaitingDialogFragment.WaitingDialogData("上传中...6566", true))
|
||||
uploadImageSubscription = UploadImageUtils.compressAndUploadImage(UploadImageUtils.UploadType.answer
|
||||
, picPath, false, object : UploadImageUtils.OnUploadImageListener {
|
||||
override fun onProgress(total: Long, progress: Long) {
|
||||
|
||||
@ -60,6 +60,8 @@ class AnswerEntity() : Parcelable {
|
||||
|
||||
var type: String = ""
|
||||
|
||||
var time: Long? = 0
|
||||
|
||||
constructor(parcel: Parcel) : this() {
|
||||
primaryKey = parcel.readString()
|
||||
communityId = parcel.readString()
|
||||
@ -75,6 +77,7 @@ class AnswerEntity() : Parcelable {
|
||||
communityName = parcel.readString()
|
||||
active = parcel.readByte() != 0.toByte()
|
||||
type = parcel.readString()
|
||||
time = parcel.readLong()
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
@ -92,6 +95,7 @@ class AnswerEntity() : Parcelable {
|
||||
parcel.writeString(communityName)
|
||||
parcel.writeByte(if (active) 1 else 0)
|
||||
parcel.writeString(type)
|
||||
parcel.writeLong(time ?: 0)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
|
||||
@ -22,7 +22,7 @@ import com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity
|
||||
class AskFollowAdapter(val context: Context, val viewModel: AskFollowViewModel)
|
||||
: ListAdapter<PersonalHistoryEntity>(context) {
|
||||
|
||||
private val mEntrance = "(问答关注)"
|
||||
private val mEntrance = ""
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return when (position) {
|
||||
@ -98,7 +98,7 @@ class AskFollowAdapter(val context: Context, val viewModel: AskFollowViewModel)
|
||||
}
|
||||
|
||||
userIcon.setOnClickListener {
|
||||
PersonalHomeActivity.startTargetActivity(mContext, historyEntity.user?.id, mEntrance, "(问答:关注)")
|
||||
PersonalHomeActivity.startTargetActivity(mContext, historyEntity.user?.id, mEntrance, path)
|
||||
}
|
||||
// 禁止click事件穿透
|
||||
userCommand.setTextColor(mContext.resources.getColor(R.color.title))
|
||||
|
||||
@ -59,6 +59,11 @@ class MyDraftAdapter extends ListAdapter<AnswerEntity> {
|
||||
return !TextUtils.isEmpty(oldItem.getId()) && oldItem.getId().equals(newItem.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean areContentsTheSame(AnswerEntity oldItem, AnswerEntity newItem) {
|
||||
return oldItem == newItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == getItemCount() - 1) return ItemViewType.ITEM_FOOTER;
|
||||
|
||||
@ -41,7 +41,7 @@ public class MyDraftFragment extends ListFragment<AnswerEntity, NormalListViewMo
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == ANSWER_DRAFT_REQUEST &&
|
||||
(resultCode == Activity.RESULT_OK || resultCode == AnswerEditFragment.SAVE_DRAFTS && data != null)) {
|
||||
mListViewModel.load(LoadType.REFRESH);
|
||||
mBaseHandler.postDelayed(() -> mListViewModel.load(LoadType.REFRESH), 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.base.BaseRecyclerViewHolder;
|
||||
import com.gh.base.OnListClickListener;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.NumberUtils;
|
||||
import com.gh.gamecenter.PersonalHomeActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -46,6 +47,8 @@ public class AnswerViewHolder extends BaseRecyclerViewHolder<AnswerEntity> {
|
||||
TextView mCommunityName;
|
||||
@BindView(R.id.ask_answer_item_usericon_container)
|
||||
View mUserIconContainer;
|
||||
@BindView(R.id.ask_answer_item_end_desc)
|
||||
TextView mEndDescTv;
|
||||
|
||||
public AnswerViewHolder(View itemView, OnListClickListener listClickListener) {
|
||||
super(itemView, listClickListener);
|
||||
@ -86,6 +89,10 @@ public class AnswerViewHolder extends BaseRecyclerViewHolder<AnswerEntity> {
|
||||
} else {
|
||||
mImg.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (entity.getTime() != null && entity.getTime() != 0) {
|
||||
mEndDescTv.setText(NewsUtils.getFormattedTime(entity.getTime()));
|
||||
}
|
||||
skipPersonalHome(entity, entrance, path);
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ class QuestionEditActivity : BaseActivity() {
|
||||
// Process dialog
|
||||
mViewModel.processDialog.observe(this, Observer { it ->
|
||||
if (it?.isShow!!) {
|
||||
if (mProcessingDialog != null && mProcessingDialog?.isVisible!!) {
|
||||
if (mProcessingDialog?.dialog?.isShowing == true) {
|
||||
mProcessingDialog?.uploadWaitingHint(it.msg)
|
||||
} else {
|
||||
mProcessingDialog = WaitingDialogFragment.newInstance(it.msg, false)
|
||||
|
||||
@ -90,7 +90,7 @@ public class AskQuestionsRecommendsAdapter extends ListAdapter<RecommendItemData
|
||||
questions.setTitle(entity.getArticleTitle());
|
||||
entity.setQuestions(questions);
|
||||
}
|
||||
((AskQuestionsRecommendsViewHolder) holder).initQuestionsHotViewHolder(mContext, entity, "", "问答-精选");
|
||||
((AskQuestionsRecommendsViewHolder) holder).initQuestionsHotViewHolder(mContext, entity, "", AskQuestionsRecommendsFragment.QUESTION_RECOMMEND_PATH);
|
||||
break;
|
||||
case ItemViewType.ITEM_FOOTER:
|
||||
FooterViewHolder footerViewHolder = (FooterViewHolder) holder;
|
||||
|
||||
@ -54,6 +54,8 @@ public class AskQuestionsRecommendsFragment extends ListFragment<RecommendItemDa
|
||||
|
||||
private final static int RECOMMENDS_REQUEST_CODE = 199;
|
||||
|
||||
public final static String QUESTION_RECOMMEND_PATH = "问答-推荐-按精选";
|
||||
|
||||
private AskQuestionsRecommendsAdapter mAdapter;
|
||||
private CheckLoginUtils.OnLoginListener mOnLoginListener;
|
||||
|
||||
@ -156,7 +158,6 @@ public class AskQuestionsRecommendsFragment extends ListFragment<RecommendItemDa
|
||||
@Override
|
||||
public void onListClick(View view, int position, Object data) {
|
||||
AnswerEntity answerEntity;
|
||||
String path = "问答-精选";
|
||||
switch (view.getId()) {
|
||||
case R.id.footerview_item:
|
||||
if (mAdapter.isNetworkError()) {
|
||||
@ -169,18 +170,18 @@ public class AskQuestionsRecommendsFragment extends ListFragment<RecommendItemDa
|
||||
case R.id.ask_item_title:
|
||||
answerEntity = (AnswerEntity) data;
|
||||
if ("community_article".equals(answerEntity.getType())) {
|
||||
startActivityForResult(ArticleDetailActivity.getRecommendsIntent(getContext(), UserManager.getInstance().getCommunity(), answerEntity.getId(), "", path), RECOMMENDS_REQUEST_CODE);
|
||||
startActivityForResult(ArticleDetailActivity.getRecommendsIntent(getContext(), UserManager.getInstance().getCommunity(), answerEntity.getId(), "", QUESTION_RECOMMEND_PATH), RECOMMENDS_REQUEST_CODE);
|
||||
} else {
|
||||
Questions questions = answerEntity.getQuestions();
|
||||
startActivity(QuestionsDetailActivity.getIntent(getContext(), questions.getId(), "", path));
|
||||
startActivity(QuestionsDetailActivity.getIntent(getContext(), questions.getId(), "", QUESTION_RECOMMEND_PATH));
|
||||
}
|
||||
break;
|
||||
case R.id.ask_item_constraintlayout:
|
||||
answerEntity = (AnswerEntity) data;
|
||||
if ("community_article".equals(answerEntity.getType())) {
|
||||
startActivityForResult(ArticleDetailActivity.getRecommendsIntent(getContext(), UserManager.getInstance().getCommunity(), answerEntity.getId(), "", path), RECOMMENDS_REQUEST_CODE);
|
||||
startActivityForResult(ArticleDetailActivity.getRecommendsIntent(getContext(), UserManager.getInstance().getCommunity(), answerEntity.getId(), "", QUESTION_RECOMMEND_PATH), RECOMMENDS_REQUEST_CODE);
|
||||
} else {
|
||||
startActivityForResult(AnswerDetailActivity.getRecommendsIntent(getContext(), answerEntity.getId(), "", path), RECOMMENDS_REQUEST_CODE);
|
||||
startActivityForResult(AnswerDetailActivity.getRecommendsIntent(getContext(), answerEntity.getId(), "", QUESTION_RECOMMEND_PATH), RECOMMENDS_REQUEST_CODE);
|
||||
}
|
||||
break;
|
||||
case R.id.ask_recommends_item_refresh:
|
||||
|
||||
@ -8,6 +8,7 @@ import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.base.BaseRecyclerViewHolder;
|
||||
import com.gh.base.OnListClickListener;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.NumberUtils;
|
||||
import com.gh.gamecenter.PersonalHomeActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -40,6 +41,8 @@ public class AskQuestionsRecommendsViewHolder extends BaseRecyclerViewHolder<Ans
|
||||
TextView mAskVotecount;
|
||||
@BindView(R.id.ask_item_answercount)
|
||||
TextView mAskAnswerCount;
|
||||
@BindView(R.id.ask_item_end_desc)
|
||||
TextView mAskEndDesc;
|
||||
@BindView(R.id.ask_item_line)
|
||||
public View mLine;
|
||||
|
||||
@ -81,6 +84,10 @@ public class AskQuestionsRecommendsViewHolder extends BaseRecyclerViewHolder<Ans
|
||||
|
||||
mAskUsericon.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(context, entity.getUser().getId(), entrance, path));
|
||||
mAskUsername.setOnClickListener(v -> PersonalHomeActivity.startTargetActivity(context, entity.getUser().getId(), entrance, path));
|
||||
|
||||
if (entity.getTime() != null && entity.getTime() != 0) {
|
||||
mAskEndDesc.setText(NewsUtils.getFormattedTime(entity.getTime()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -62,7 +62,8 @@ class RecommendConcernAdapter(context: Context,
|
||||
}
|
||||
|
||||
private fun skipPersonalHome(entity: SuggestedFollowEntity) {
|
||||
PersonalHomeActivity.startTargetActivity(mContext, entity.id, "", "问答-精选-推荐关注")
|
||||
PersonalHomeActivity.startTargetActivity(mContext, entity.id, "",
|
||||
AskQuestionsRecommendsFragment.QUESTION_RECOMMEND_PATH + "-推荐关注")
|
||||
}
|
||||
|
||||
fun updateData(list: List<SuggestedFollowEntity>) {
|
||||
|
||||
@ -55,7 +55,7 @@ class RecommendNewestAdapter(context: Context) : ListAdapter<AnswerEntity>(conte
|
||||
questions.title = answerEntity.articleTitle
|
||||
answerEntity.questions = questions
|
||||
}
|
||||
val path = "问答-精选(时间)"
|
||||
val path = "问答-推荐-按时间"
|
||||
viewHolder.initQuestionsHotViewHolder(mContext, answerEntity, "", path)
|
||||
viewHolder.mAskTitle.setOnClickListener {
|
||||
if ("community_article" == answerEntity.type) {
|
||||
|
||||
@ -20,12 +20,14 @@ import com.gh.base.BaseActivity;
|
||||
import com.gh.common.util.CheckLoginUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.LogUtils;
|
||||
import com.gh.common.util.TextHelper;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.db.AskSearchHistoryDao;
|
||||
import com.gh.gamecenter.eventbus.EBSearch;
|
||||
import com.gh.gamecenter.qa.questions.edit.QuestionEditActivity;
|
||||
import com.gh.gamecenter.qa.search.history.HistoryFragment;
|
||||
import com.lightgame.utils.Util_System_Keyboard;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
@ -158,6 +160,9 @@ public class AskSearchActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
});
|
||||
TextHelper.limitTheLengthOfEditText(mSearchEt, 50, ()-> {
|
||||
Utils.toast(mSearchEt.getContext(), "最多输入50个字");
|
||||
});
|
||||
}
|
||||
|
||||
@OnClick({R.id.bar_search_delete, R.id.bar_question_btn, R.id.search_questions_skip, R.id.bar_back})
|
||||
|
||||
@ -19,11 +19,11 @@ class HottestFragment : BaseAskSearchFragment<AskSearchEntity, NormalListViewMod
|
||||
override fun setBaseAskListAdapter(): HottestAdapter {
|
||||
if (mAdapter == null) {
|
||||
val path = if (!questionTag.isNullOrEmpty()) {
|
||||
"标签专栏搜索-最热答案"
|
||||
"标签专栏搜索-最热回答"
|
||||
} else if (!columnId.isNullOrEmpty()) {
|
||||
"专栏搜索-最热答案"
|
||||
"专栏搜索-最热回答"
|
||||
} else {
|
||||
"搜索-最热答案"
|
||||
"问答-搜索-最热回答"
|
||||
}
|
||||
mAdapter = HottestAdapter(context!!, mEntrance, path)
|
||||
}
|
||||
|
||||
@ -19,11 +19,11 @@ class NewestFragment : BaseAskSearchFragment<AskSearchEntity, NormalListViewMode
|
||||
override fun setBaseAskListAdapter(): NewestAdapter {
|
||||
if (mAdapter == null) {
|
||||
val path = if (!questionTag.isNullOrEmpty()) {
|
||||
"标签专栏搜索-最新答案"
|
||||
"标签专栏搜索-最新回答"
|
||||
} else if (!columnId.isNullOrEmpty()) {
|
||||
"专栏搜索-最新答案"
|
||||
"专栏搜索-最新回答"
|
||||
} else {
|
||||
"搜索-最新答案"
|
||||
"问答-搜索-最新回答"
|
||||
}
|
||||
mAdapter = NewestAdapter(context!!, mEntrance, path)
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ class QuestionFragment : BaseAskSearchFragment<AskSearchEntity, NormalListViewMo
|
||||
} else if (!columnId.isNullOrEmpty()) {
|
||||
"专栏搜索-只看问题"
|
||||
} else {
|
||||
"搜索-只看问题"
|
||||
"问答-搜索-只看问题"
|
||||
}
|
||||
mAdapter = QuestionAdapter(context!!, mEntrance, path)
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -43,13 +44,15 @@ import retrofit2.HttpException;
|
||||
|
||||
public class SelectGameDialogAdapter extends BaseRecyclerAdapter<VotingSelectGameViewHolder> {
|
||||
private ProgressBar pb;
|
||||
private RecyclerView mRecyclerView;
|
||||
private List<GameInstall> gameList;
|
||||
private List<InstallGameEntity> appList;
|
||||
private Map<Integer, Boolean> mSelectMap;
|
||||
|
||||
public SelectGameDialogAdapter(Context context, ProgressBar pb) {
|
||||
public SelectGameDialogAdapter(Context context, ProgressBar pb, RecyclerView recyclerView) {
|
||||
super(context);
|
||||
this.pb = pb;
|
||||
this.mRecyclerView = recyclerView;
|
||||
mSelectMap = new HashMap<>();
|
||||
gameList = new ArrayList<>();
|
||||
appList = new ArrayList<>();
|
||||
@ -152,6 +155,7 @@ public class SelectGameDialogAdapter extends BaseRecyclerAdapter<VotingSelectGam
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
pb.setVisibility(View.GONE);
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -92,8 +92,9 @@ public class VotingFragment extends ListFragment<AskGameSelectEntity, VotingView
|
||||
TextView negative = view.findViewById(R.id.dialog_suggest_negative);
|
||||
TextView positive = view.findViewById(R.id.dialog_suggest_positive);
|
||||
ProgressBar pb = view.findViewById(R.id.dialog_suggest_game_load);
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 4));
|
||||
SelectGameDialogAdapter dialogAdapter = new SelectGameDialogAdapter(getContext(), pb);
|
||||
SelectGameDialogAdapter dialogAdapter = new SelectGameDialogAdapter(getContext(), pb, recyclerView);
|
||||
recyclerView.setAdapter(dialogAdapter);
|
||||
|
||||
mSelectGameDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
@ -114,7 +115,7 @@ public class VotingFragment extends ListFragment<AskGameSelectEntity, VotingView
|
||||
mListViewModel.sendSuggestion(entity);
|
||||
}
|
||||
|
||||
mLoadingDialog = WaitingDialogFragment.newInstance(getString(R.string.post_img));
|
||||
mLoadingDialog = WaitingDialogFragment.newInstance(getString(R.string.vote_post));
|
||||
mLoadingDialog.show(getChildFragmentManager(), null);
|
||||
mListViewModel.postCommunities(selectGameList);
|
||||
});
|
||||
|
||||
@ -8,6 +8,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.gh.base.OnListClickListener;
|
||||
import com.gh.common.constant.ItemViewType;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.gamecenter.PersonalHomeActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
@ -121,6 +122,11 @@ public class AskSubjectAdapter extends ListAdapter<AnswerEntity> {
|
||||
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, new CommunityEntity(entity.getCommunityId(), ""), entity.getId(), mEntrance, path));
|
||||
}
|
||||
});
|
||||
|
||||
if (entity.getTime() != null && entity.getTime() != 0) {
|
||||
binding.endDesc.setText(NewsUtils.getFormattedTime(entity.getTime()));
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
if ("answer".equals(entity.getType())) {
|
||||
mContext.startActivity(AnswerDetailActivity.getIntent(mContext, entity.getId(), mEntrance, path));
|
||||
|
||||
@ -41,7 +41,7 @@ public class DownloadReceiver extends BroadcastReceiver {
|
||||
ContextCompat.startActivities(context, new Intent[]{main, download});
|
||||
}
|
||||
// 切换到游戏下载fragment
|
||||
EventBus.getDefault().post(new EBSkip(DownloadManagerActivity.TAG, DownloadManagerActivity.INDEX_UPDATE));
|
||||
EventBus.getDefault().post(new EBSkip(DownloadManagerActivity.TAG, DownloadManagerActivity.INDEX_DOWNLOAD));
|
||||
} else {
|
||||
Intent downloadIntent = DownloadManagerActivity.getDownloadMangerIntent(context, null, ENTRANCE_DOWNLOAD);
|
||||
downloadIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
@ -66,6 +66,8 @@ class OkHttpCacheInterceptor implements Interceptor {
|
||||
.addHeader("IMEI", Util_System_Phone_State.getImei(HaloApp.getInstance().getApplication()))
|
||||
.addHeader("CHANNEL", HaloApp.getInstance().getChannel())
|
||||
.addHeader("VERSION", PackageUtils.getVersionName())
|
||||
.removeHeader("User-Agent")
|
||||
.addHeader("User-Agent", HaloApp.getInstance().ua)
|
||||
.build();
|
||||
|
||||
Response response = chain.proceed(request);
|
||||
|
||||
@ -17,6 +17,7 @@ import com.gh.gamecenter.entity.LibaoStatusEntity;
|
||||
import com.gh.gamecenter.entity.LinkEntity;
|
||||
import com.gh.gamecenter.entity.LoginTokenEntity;
|
||||
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.entity.NewsDetailEntity;
|
||||
@ -414,7 +415,7 @@ public interface ApiService {
|
||||
*/
|
||||
@Headers({"Content-Type: application/json", "Accept: application/json"})
|
||||
@POST("users/{user_id}/follows/games/{game_id}")
|
||||
Observable<ResponseBody> postConcern(@Path("user_id") String user_id, @Path("game_id") String game_id);
|
||||
Observable<ResponseBody> postConcern(@Path("user_id") String user_id, @Path("game_id") String game_id, @Query("mode") String mode);
|
||||
|
||||
/**
|
||||
* 删除关注
|
||||
@ -1488,4 +1489,11 @@ public interface ApiService {
|
||||
*/
|
||||
@GET("communities/{community_id}/suggested_follows")
|
||||
Observable<List<SuggestedFollowEntity>> getSuggestedFollows(@Path("community_id") String communityId);
|
||||
|
||||
@POST("baidu/ocpc:activate")
|
||||
Observable<ResponseBody> postBaiduActivationInfo();
|
||||
|
||||
@GET("users/{user_id}/messages/{resource_id}/fold-list")
|
||||
Observable<List<MessageFold>> getMessageFoldList(@Path("user_id") String userId,
|
||||
@Path("resource_id") String resourceId);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user