Compare commits

...

46 Commits

Author SHA1 Message Date
252566837a chore: 版本更新至 5.14.6 2022-11-24 10:06:24 +08:00
94d249312b Merge branch 'hotfix-v5.13.7-617-try_catch_subtitle_crash' into 'release'
fix:捕获游戏详情副标题的异常

See merge request halo/android/assistant-android!466
2022-11-23 17:03:28 +08:00
4855dda839 fix:捕获游戏详情副标题的异常 2022-11-23 17:03:28 +08:00
c5519fb160 Merge branch 'hotfix-v5.14.5-635-subtitle' into 'release'
fix: 修复模拟器上部分副标题不显示的问题,为分类页面和开服表页面添加副标题支持 https://jira.shanqu.cc/browse/GHZS-319

See merge request halo/android/assistant-android!463
2022-11-23 16:26:09 +08:00
5cd9197d0f fix: 修复模拟器上部分副标题不显示的问题,为分类页面和开服表页面添加副标题支持 https://jira.shanqu.cc/browse/GHZS-319 2022-11-23 16:26:09 +08:00
3b178c0bbe chore: 版本更新至 5.14.5 2022-11-23 10:20:30 +08:00
6270f9fb98 Merge branch 'hotfix-v5.14.4-634-vgame_feedback' into 'release'
fix: 修复畅玩游戏反馈无法正常跳转的问题 https://jira.shanqu.cc/browse/GHZS-309

See merge request halo/android/assistant-android!460
2022-11-23 10:19:40 +08:00
0306caadb5 fix: 修复畅玩游戏反馈无法正常跳转的问题 https://jira.shanqu.cc/browse/GHZS-309 2022-11-23 10:19:40 +08:00
30268a5cda chore: 版本更新至 5.14.4 2022-11-15 11:13:52 +08:00
5d4f489ddd Merge branch 'release-merge-legacy_release' into 'release'
合并 legacy-release 变更

See merge request halo/android/assistant-android!434
2022-11-15 11:13:03 +08:00
102d285c09 Merge remote-tracking branch 'origin/legacy-release' into release-merge-legacy_release
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt
#	dependencies.gradle
2022-11-15 10:57:41 +08:00
6b0611e05f chore: 版本更新至 5.13.7 2022-11-14 15:29:23 +08:00
384469bcae Merge branch 'feature-GHZS-209' into 'legacy-release'
feat: 还原首次启动时的权限提示弹窗和权限获取 https://jira.shanqu.cc/browse/GHZS-209

See merge request halo/android/assistant-android!431
2022-11-14 15:22:06 +08:00
0aeb37a5eb feat: 还原首次启动时的权限提示弹窗和权限获取 https://jira.shanqu.cc/browse/GHZS-209 2022-11-14 14:27:10 +08:00
900ee8e641 chore:版本更新至 5.13.6 2022-11-10 15:14:16 +08:00
bad1e32fda Merge branch 'feature-GHZS-163' into 'legacy-release'
feat:【光环助手】存储权限授权弹窗埋点补充 https://jira.shanqu.cc/browse/GHZS-163

See merge request halo/android/assistant-android!426
2022-11-10 15:11:40 +08:00
b602960882 feat:【光环助手】存储权限授权弹窗埋点补充 https://jira.shanqu.cc/browse/GHZS-163 2022-11-10 15:05:05 +08:00
fadd165e68 Merge branch 'hotfix-v5.14.3-633-setting_datas_error' into 'release'
fix: 修改设置接口数据保存错误问题

See merge request halo/android/assistant-android!421
2022-11-09 14:34:50 +08:00
255b6ea141 fix: 修改设置接口数据保存错误问题 2022-11-09 13:46:20 +08:00
7712039804 chore: 版本更新至 5.14.3 2022-11-08 15:15:57 +08:00
fee65172d1 Merge branch 'hotfix-v5.14.2-632-delete_apk_crash' into 'release'
fix: 捕抓清理安装包时的 concurrent 异常

See merge request halo/android/assistant-android!419
2022-11-08 15:13:36 +08:00
b09f0cde18 fix: 捕抓清理安装包时的 concurrent 异常 2022-11-08 15:04:12 +08:00
cb355b2490 Merge branch 'hotfix-v5.14.2-632-wrong_dark_mode_setting' into 'release'
fix: 修复错误的深色模式切换开关配置

See merge request halo/android/assistant-android!418
2022-11-08 12:01:27 +08:00
806ceee7e7 Merge branch 'hotfix-v5.14.2-632-super_did_not_called_crash' into 'release'
fix: 修复因为混淆问题导致 onConfigurationChanged 没有调用 super.onConfigurationChanged 而造成的闪退

See merge request halo/android/assistant-android!417
2022-11-08 11:55:35 +08:00
0cc8904852 fix: 修复错误的深色模式切换开关配置 2022-11-08 11:33:33 +08:00
1ffb58feea fix: 修复因为混淆问题导致 onConfigurationChanged 没有调用 super.onConfigurationChanged 而造成的闪退 2022-11-08 11:09:32 +08:00
3ae27ebdb6 chore: 版本更新至 5.14.2 2022-11-01 17:20:30 +08:00
aab422662a Merge branch 'hotfix-v5.14.1-631-onConfigurationChanged' into 'release'
fix: 添加 onConfigurationChanged 日志辅助闪退确定问题

See merge request halo/android/assistant-android!407
2022-11-01 17:19:23 +08:00
8193b9ec9f fix: 添加 onConfigurationChanged 日志辅助闪退确定问题 2022-11-01 16:23:54 +08:00
13929f4dc5 Merge branch 'hotfix-v5.14.1-631-webview_dark_error' into 'release'
fix: 修复web页面开启夜间模式闪退问题

See merge request halo/android/assistant-android!404
2022-11-01 16:18:12 +08:00
0ea0834140 fix: 修复web页面开启夜间模式闪退问题 2022-11-01 16:09:05 +08:00
7efdb5e432 Merge branch 'hotfix-v5.14.1-631-simulator_sync_error' into 'release'
fix: 修复模拟器游戏列表可能出现的服务端为空,本地不为空的问题

See merge request halo/android/assistant-android!393
2022-10-31 18:51:40 +08:00
681ba37c4e Merge branch 'hotfix-v5.14.1-631-simulator_sync_error' into 'release'
fix: 修复模拟器游戏列表可能出现的服务端为空,本地不为空的问题

See merge request halo/android/assistant-android!393
2022-10-31 14:23:57 +08:00
d4d71d27ce fix: 修复模拟器游戏列表可能出现的服务端为空,本地不为空的问题 2022-10-31 13:47:10 +08:00
987ab1ccc9 Merge branch 'hotfix-v5.14.1-631-clean_apk_crash' into 'release'
修复清理 APK 时因为原图标过大导致的闪退

See merge request halo/android/assistant-android!392
2022-10-31 12:41:56 +08:00
8863b02c7a fix: 修复安装包清理遇到原始图标过大而造成的闪退问题 2022-10-31 11:41:02 +08:00
a94bb4dcb5 fix: 修复模拟器运行即闪退的问题 2022-10-28 16:22:29 +08:00
195d9343eb chore: 版本更新至 5.14.1 2022-10-28 15:45:09 +08:00
997bfdf93d Merge branch 'hotfix-v5.14.0-630-vector_crash' into 'release'
fix:修复5.0以下系统部分矢量图加载出错导致无法显示的问题

See merge request halo/android/assistant-android!373
2022-10-27 15:34:53 +08:00
de712065f5 Merge branch 'hotfix-v5.14.0-630-soft_keyboard' into 'release'
fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题

See merge request halo/android/assistant-android!372
2022-10-27 14:56:33 +08:00
511449c709 fix:修复5.0以下系统部分矢量图加载出错导致无法显示的问题 2022-10-27 14:50:24 +08:00
03095b682b fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题 2022-10-27 14:32:48 +08:00
8437bfe1e3 Merge branch 'hotfix-v5.14.0-630-soft_keyboard' into 'release'
fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题

See merge request halo/android/assistant-android!369
2022-10-27 11:34:54 +08:00
a169ce1989 fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题 2022-10-27 10:48:14 +08:00
9690429e95 Merge branch 'hotfix-v5.14.0-630-banned_vote_error' into 'release'
【光环助手V5.15.0】违规整合-正式环境运营验收问题(19) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2129

See merge request halo/android/assistant-android!367
2022-10-25 16:58:08 +08:00
b1dff15234 fix: 【光环助手V5.15.0】违规整合-正式环境运营验收问题(19) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2129 2022-10-25 15:45:48 +08:00
38 changed files with 554 additions and 226 deletions

View File

@ -8,23 +8,24 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.EnvHelper;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.common.util.PackageHelper;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.SuggestionActivity;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.EnvHelper;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.entity.GameGuidePopupEntity;
import com.gh.gamecenter.entity.NewApiSettingsEntity;
import com.gh.gamecenter.entity.NewSettingsEntity;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.SettingsEntity;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.entity.VSetting;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.vspace.VHelper;
import com.halo.assistant.HaloApp;
@ -63,8 +64,9 @@ public class Config {
private static SettingsEntity mSettingsEntity;
private static NewSettingsEntity mNewSettingsEntity;
private static NewApiSettingsEntity mNewApiSettingsEntity;
private static NewSettingsEntity.NightMode mNightModeSetting;
private static NewApiSettingsEntity.NightMode mNightModeSetting;
private static VSetting mVSetting;
private static GameGuidePopupEntity mGameGuidePopupEntity;
private static SharedPreferences mDefaultSharedPreferences;
@ -221,11 +223,11 @@ public class Config {
}
@Nullable
public static NewSettingsEntity.NightMode getNightModeSetting() {
public static NewApiSettingsEntity.NightMode getNightModeSetting() {
if (mNightModeSetting != null) {
return mNightModeSetting;
} else if (mNewSettingsEntity != null && mNewSettingsEntity.getNightMode() != null) {
return mNewSettingsEntity.getNightMode();
} else if (mNewApiSettingsEntity != null && mNewApiSettingsEntity.getNightMode() != null) {
return mNewApiSettingsEntity.getNightMode();
} else {
return null;
}
@ -350,9 +352,6 @@ public class Config {
@Override
public void onSuccess(NewSettingsEntity data) {
mNewSettingsEntity = data;
if (mNightModeSetting != null) {
mNewSettingsEntity.setNightMode(mNightModeSetting);
}
SPUtils.setString(Constants.SP_NEW_SETTINGS, GsonUtils.toJson(data));
}
});
@ -370,25 +369,21 @@ public class Config {
});
}
if (mNightModeSetting == null) {
if (mNewApiSettingsEntity == null) {
RetrofitManager.getInstance()
.getNewApi().getNewSettings(PackageUtils.getGhVersionName(), channel)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BiResponse<NewSettingsEntity>() {
.subscribe(new BiResponse<NewApiSettingsEntity>() {
@Override
public void onSuccess(NewSettingsEntity data) {
public void onSuccess(NewApiSettingsEntity data) {
mNewApiSettingsEntity = data;
mNightModeSetting = data.getNightMode();
if (HaloApp.getInstance().isNewForThisVersion && mNightModeSetting != null && mNightModeSetting.getInstall()) {
DarkModeUtils.INSTANCE.updateFollowSystemDarkModeToSp(true);
DarkModeUtils.INSTANCE.updateAppDarkModeStatusToSp(true);
DarkModeUtils.INSTANCE.initDarkMode();
}
if (mNewSettingsEntity != null) {
mNewSettingsEntity.setNightMode(mNightModeSetting);
SPUtils.setString(Constants.SP_NEW_SETTINGS, GsonUtils.toJson(data));
}
SPUtils.setString(Constants.SP_NEW_API_SETTINGS, GsonUtils.toJson(data));
}
});
}

View File

@ -681,6 +681,36 @@ object DirectUtils {
jumpActivity(context, bundle)
}
@JvmStatic
fun directToFeedbackCompat(
context: Context,
content: String? = null,
hintType: String? = null,
isQaFeedback: Boolean = false,
qaContentId: String? = "",
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, SuggestionActivity::class.java.simpleName)
if (isQaFeedback) {
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
} else {
bundle.putString(KEY_CONTENT, content)
if (TextUtils.isEmpty(hintType)) {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.gameQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN)
} else {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
bundle.putString(KEY_SUGGEST_HINT_TYPE, hintType)
}
}
jumpActivityCompat(context, bundle)
}
@JvmStatic
fun directToDownloadManager(context: Context, entrance: String? = null) {
val bundle = Bundle()

View File

@ -37,6 +37,32 @@ import java.util.Set;
public class EntranceUtils {
public static void jumpActivityCompat(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
if (HaloApp.getInstance().isRunningForeground || HaloApp.getInstance().isAlreadyUpAndRunning) {
// 应用正在运行,前台或后台
String to = bundle.getString(KEY_TO);
Class<?> clazz = ClassUtils.forName(to);
if (clazz == null) clazz = MainActivity.class;
if (ToolbarFragment.class.isAssignableFrom(clazz)) { // 兼容ToolbarFragment
ToolBarActivity.startFragmentNewTask(context, (Class<? extends ToolbarFragment>) clazz, bundle);
} else {
Intent intent1 = new Intent(context, clazz);
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 如果 activity 名称有 singleton 的就添加 reorder_to_front 标签 (有点粗暴有点蠢,但暂时就先这样吧 :C )
if (clazz.getSimpleName().toLowerCase().contains("singleton")) {
intent1.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
}
intent1.putExtras(bundle);
context.startActivity(intent1);
}
} else {
// 应用未在运行
context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
}
}
public static void jumpActivity(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);

View File

@ -36,6 +36,7 @@ import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.core.utils.SentryHelper;
import com.gh.gamecenter.download.DownloadedGameIdAndPackageNameDao;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
@ -389,12 +390,16 @@ public class DownloadManager implements DownloadStatusListener {
* 清理不存在本地 APK 文件的任务
*/
public void clearTasksThatFileBeenDeleted() {
for (DownloadEntity entity : getAllDownloadEntity()) {
if (entity.getStatus() == DownloadStatus.done) {
if (FileUtils.isEmptyFile(entity.getPath())) {
cancel(entity.getUrl());
try {
for (DownloadEntity entity : getAllDownloadEntity()) {
if (entity.getStatus() == DownloadStatus.done) {
if (FileUtils.isEmptyFile(entity.getPath())) {
cancel(entity.getUrl());
}
}
}
} catch (Exception e) {
SentryHelper.INSTANCE.onEvent("CLEAR_DELETED_TASK_ERROR", "exception_digest", e.getLocalizedMessage());
}
}

View File

@ -180,6 +180,7 @@ public class MainActivity extends BaseActivity {
showAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null;
HaloApp.getInstance().initFresco();
HaloApp.getInstance().isAlreadyUpAndRunning = true;
super.onCreate(savedInstanceState);
setStatusBarColor(Color.TRANSPARENT);

View File

@ -137,7 +137,7 @@ public class SkipActivity extends BaseActivity {
if (!TextUtils.isEmpty(qaId)) {
DirectUtils.directToQa(this, qaTitle, qaId);
} else if ("vgame".equals(suggestionType)) {
DirectUtils.directToFeedback(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
DirectUtils.directToFeedbackCompat(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
} else {
DirectUtils.directToFeedback(this, content, null, isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
}

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter
import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
@ -25,6 +26,7 @@ import com.gh.common.util.GameSubstituteRepositoryHelper.updateGameSubstituteRep
import com.gh.common.util.UsageStatsHelper.checkAndPostUsageStats
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.callback.SimpleCallback
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.tracker.TrackerLogger
@ -60,6 +62,8 @@ class SplashScreenActivity : BaseActivity() {
private var mShouldPrefetchData = true
private val mPermissions = arrayOf(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
PermissionHelper.PERMISSION_GET_INSTALLED_LIST
)
@ -149,42 +153,41 @@ class SplashScreenActivity : BaseActivity() {
private fun showPrivacyDialog(guideLayout: ViewPager) {
NewPrivacyPolicyDialogFragment.show(this, null) { isSuccess: Boolean ->
if (isSuccess) {
guideLayout.visibility = View.VISIBLE
SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
//
// // 恢复畅玩数据
// VHelper.recoverVDataIfPossible()
//
// requestPermission()
//
// // 检查是否有旧版本光环,有就删掉
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
// if (mStartMainActivityDirectly) {
// launchMainActivity()
// }
// 恢复畅玩数据
VHelper.recoverVDataIfPossible()
mShouldPrefetchData = false
prefetchData()
requestPermission()
// 检查是否有旧版本光环,有就删掉
AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
launchMainActivity()
} else {
mShouldPrefetchData = false
prefetchData()
val callback = object : SimpleCallback<Boolean> {
override fun onCallback(arg: Boolean) {
// Dialog dismiss 后的回调
guideLayout.visibility = View.VISIBLE
SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
if (arg) {
requestPermission()
} else {
mStartMainActivityDirectly = false
}
}
}
// val callback = object : SimpleCallback<Boolean> {
// override fun onCallback(arg: Boolean) {
// // Dialog dismiss 后的回调
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
// if (arg) {
// requestPermission()
// } else {
// mStartMainActivityDirectly = false
// }
// }
// }
//
// mViewModel?.showPrivacyPolicy({
// DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, it, callback)
// }, {
// DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, PrivacyPolicyEntity.createDefaultData(), callback)
// })
mViewModel?.showPrivacyPolicy({
DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, it, callback)
}, {
DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, PrivacyPolicyEntity.createDefaultData(), callback)
})
} else {
DialogUtils.showPrivacyPolicyDisallowDialog(this, PrivacyPolicyEntity.createDefaultData(), object : EmptyCallback {
override fun onCallback() {
@ -381,10 +384,10 @@ class SplashScreenActivity : BaseActivity() {
private fun checkAndRequestPermission() {
if (EasyPermissions.hasPermissions(this, *mPermissions)) {
// 恢复畅玩数据
// VHelper.recoverVDataIfPossible()
VHelper.recoverVDataIfPossible()
// 检查是否有旧版本光环,有就删掉
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) {
showGitLogDialogIfNeeded()

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.view.View;
@ -117,7 +118,8 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
appInfo.sourceDir = apk_path;
appInfo.publicSourceDir = apk_path;
Drawable apk_icon = appInfo.loadIcon(pm);
apkEntity.setGameBm(BitmapUtils.drawableToBitmap(apk_icon, true));
Bitmap originalBitmap = BitmapUtils.drawableToBitmap(apk_icon, true);
apkEntity.setGameBm(BitmapUtils.compressBitmap(originalBitmap, 100));
/** apk的绝对路劲 */
apkEntity.setGamePath(apk_path);
/** apk的版本名称 String */

View File

@ -27,6 +27,7 @@ import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.CategoryGameItemBinding
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.game.GameItemViewHolder
import com.lightgame.download.DownloadEntity
class CategoryV2ListAdapter(
@ -204,6 +205,8 @@ class CategoryV2ListAdapter(
gameRating.setPadding(0,0,if (gameEntity.commentCount > 3) 8F.dip2px() else 0,0)
gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor(mContext) else R.color.theme.toColor(mContext))
gameDes.text = gameEntity.decoratedDes
GameItemViewHolder.initGameSubtitle(gameEntity, gameSubtitleTv, gameDesSpace, root)
}
}

View File

@ -0,0 +1,20 @@
package com.gh.gamecenter.entity
import com.google.gson.annotations.SerializedName
data class NewApiSettingsEntity(
@SerializedName("night_mode")
var nightMode: NightMode? = null,
) {
/**
*
* "icon": false, // 是否显示切换true显示
* "setting": false, // 设置页面是否显示true显示
* "install": false, // 安装时的默认值true开启
*/
data class NightMode(
val icon: Boolean,
val setting: Boolean,
val install: Boolean
)
}

View File

@ -5,8 +5,6 @@ import com.google.gson.annotations.SerializedName
data class NewSettingsEntity(
@SerializedName("install_model")
var installModel: InstallModel? = null,
@SerializedName("night_mode")
var nightMode: NightMode? = null,
) {
data class InstallModel(
var status: String = "",
@ -14,16 +12,4 @@ data class NewSettingsEntity(
@SerializedName("white_list")
var whiteList: ArrayList<String>? = arrayListOf()
)
/**
*
* "icon": false, // 是否显示切换true显示
* "setting": false, // 设置页面是否显示true显示
* "install": false, // 安装时的默认值true开启
*/
data class NightMode(
val icon: Boolean,
val setting: Boolean,
val install: Boolean
)
}

View File

@ -23,10 +23,10 @@ data class PrivacyPolicyEntity(
icon = "res:///" + R.drawable.permission_storage,
name = "存储权限",
intro = "用于下载游戏,以及实现内容缓存提升浏览体验"))
permissions.add(PermissionsEntity(
icon = "res:///" + R.drawable.permission_phone_state,
name = "设备信息",
intro = "为保障您的账号安全及使用软件与服务可安全运行"))
// permissions.add(PermissionsEntity(
// icon = "res:///" + R.drawable.permission_phone_state,
// name = "设备信息",
// intro = "为保障您的账号安全及使用软件与服务可安全运行"))
// permissions.add(PermissionsEntity(
// icon = "res:///" + R.drawable.permission_sdk,
// name = "第三方SDK使用信息提醒",

View File

@ -11,6 +11,7 @@ import com.gh.common.databind.BindingAdapters
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.maxWidthExcludeZero
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.DrawableView
@ -77,7 +78,11 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
}
@JvmStatic
fun initGameSubtitle(entity: GameEntity, gameSubtitleTv: TextView, gameDesSpace: Space, rootContainer: ConstraintLayout, forceShowSubtitle: Boolean = false) {
fun initGameSubtitle(entity: GameEntity,
gameSubtitleTv: TextView,
gameDesSpace: Space? = null,
rootContainer: ConstraintLayout? = null,
forceShowSubtitle: Boolean = false) {
gameSubtitleTv.visibility = View.GONE
if ((entity.serverLabel == null && entity.subtitle.isNotEmpty() && !entity.advanceDownload) || (forceShowSubtitle && entity.subtitle.isNotEmpty())) {
gameSubtitleTv.run {
@ -97,8 +102,9 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
}
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameDesSpace?.post {
// 模拟器上可能出现未提前 bindView 导致 gameDesSpace.width 为 0 的情况
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (entity.advanceDownload) {
@ -109,10 +115,12 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
background = R.drawable.bg_advance_download_game_subtitle.toDrawable(context)
}
}
ConstraintSet().apply {
clone(rootContainer)
connect(R.id.game_name, ConstraintSet.END, if (entity.serverLabel != null && !entity.advanceDownload && !forceShowSubtitle) R.id.recent_played_tag else R.id.gameSubtitleTv, ConstraintSet.START)
}.applyTo(rootContainer)
rootContainer?.let {
ConstraintSet().apply {
clone(rootContainer)
connect(R.id.game_name, ConstraintSet.END, if (entity.serverLabel != null && !entity.advanceDownload && !forceShowSubtitle) R.id.recent_played_tag else R.id.gameSubtitleTv, ConstraintSet.START)
}.applyTo(rootContainer)
}
}
}

View File

@ -13,6 +13,7 @@ import com.gh.common.util.DownloadItemUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.maxWidthExcludeZero
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.AsyncUi
@ -108,7 +109,7 @@ class GameVerticalAdapter(
}
}
mGameDesSpace.post {
gameSubtitleTv.maxWidth = mGameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(mGameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -615,7 +615,7 @@ open class GameCollectionDetailAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -559,32 +559,36 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
}
private fun subtractGameNameIfNeeded(textView: TextView, name: CharSequence, tagLayout: FrameLayout) {
if (!isAdded) return
textView.run {
if (lineCount > 2 || (layout != null && layout.getEllipsisCount(1) > 0)) {
val displayName = name.substring(0, name.length - 2) + ""
text = displayName
if (tagLayout.getChildAt(0) != null) {
val tagView = tagLayout.getChildAt(0)
tagView.layoutParams = (tagView.layoutParams as FrameLayout.LayoutParams).apply {
setMargins(if (lineCount == 1) 0 else 4F.dip2px(), 0, 0, 0)
try {
if (!isAdded) return
textView.run {
if (lineCount > 2 || (layout != null && layout.getEllipsisCount(1) > 0)) {
val displayName = name.substring(0, name.length - 2) + ""
text = displayName
if (tagLayout.getChildAt(0) != null) {
val tagView = tagLayout.getChildAt(0)
tagView.layoutParams = (tagView.layoutParams as FrameLayout.LayoutParams).apply {
setMargins(if (lineCount == 1) 0 else 4F.dip2px(), 0, 0, 0)
}
}
}
val tagBitmap = tagLayout.convertViewToBitmap()
text = SpannableStringBuilder("$displayName ").apply {
tagBitmap?.let {
setSpan(
CenterImageSpan(
context,
it
), displayName.length, displayName.length + 1, Spanned.SPAN_EXCLUSIVE_INCLUSIVE
)
val tagBitmap = tagLayout.convertViewToBitmap()
text = SpannableStringBuilder("$displayName ").apply {
tagBitmap?.let {
setSpan(
CenterImageSpan(
context,
it
), displayName.length, displayName.length + 1, Spanned.SPAN_EXCLUSIVE_INCLUSIVE
)
}
}
post {
subtractGameNameIfNeeded(this, displayName, tagLayout)
}
}
post {
subtractGameNameIfNeeded(this, displayName, tagLayout)
}
}
} catch (e: Exception) {
SentryHelper.onEvent("GAME_DETAIL_SUBTRACT_GAME_NAME_ERROR", "exception_digest", e.localizedMessage)
}
}

View File

@ -104,7 +104,7 @@ class MyFollowedGameAdapter(context: Context, var mViewModel: MyFollowedGameView
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -108,7 +108,7 @@ class MyReservationAdapter(context: Context, var mViewModel: MyReservationViewMo
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -157,7 +157,7 @@ open class PlayedGameAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -152,8 +152,18 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
NewLogUtils.logRecommendFeedForumClick(contentType, entity.id, entity.bbs.id, bbsType)
}
MtaHelper.onEvent(getEventId(entrance), getKey(entrance), if (entity.bbs.name.isEmpty()) entity.community.name else entity.bbs.name)
itemView.context.startActivity(ForumDetailActivity.getIntent(itemView.context, entity.community.id, entrance))
MtaHelper.onEvent(
getEventId(entrance),
getKey(entrance),
if (entity.bbs.name.isEmpty()) entity.community.name else entity.bbs.name
)
itemView.context.startActivity(
ForumDetailActivity.getIntent(
itemView.context,
entity.community.id,
entrance
)
)
LogUtils.uploadAccessToBbs(entity.community.id, "文章外所属论坛")
}
@ -208,11 +218,24 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
itemView.context.startActivity(intent)
}
"answer" -> {
val intent = NewQuestionDetailActivity.getCommentIntent(it.context, entity.questions.id, entity.id, entrance, "")
val intent = NewQuestionDetailActivity.getCommentIntent(
it.context,
entity.questions.id,
entity.id,
entrance,
""
)
itemView.context.startActivity(intent)
}
"video" -> {
itemView.context.startActivity(ForumVideoDetailActivity.getIntent(itemView.context, entity.id, entity.community.id, true))
itemView.context.startActivity(
ForumVideoDetailActivity.getIntent(
itemView.context,
entity.id,
entity.community.id,
true
)
)
}
else -> {
val communityId = entity.community.id
@ -300,7 +323,8 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
commentCount.setCompoundDrawables(commentIcon, null, null, null)
commentCount.setTextColor(R.color.text_subtitleDesc.toColor(commentCount.context))
} else {
val commentCloseIcon = itemView.context.resources.getDrawable(R.drawable.community_comment_count_unavailable)
val commentCloseIcon =
itemView.context.resources.getDrawable(R.drawable.community_comment_count_unavailable)
commentCloseIcon.setBounds(0, 0, commentCloseIcon.minimumWidth, commentCloseIcon.minimumHeight)
commentCount.setCompoundDrawables(commentCloseIcon, null, null, null)
commentCount.setTextColor(R.color.text_body.toColor(commentCount.context))
@ -317,17 +341,24 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
RetrofitManager.getInstance()
.api.voteVideo(entity.id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
//Utils.toast(getApplication(), "已点赞")
entity.count.vote = entity.count.vote + 1
entity.me.isVoted = true
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
EnergyTaskHelper.postEnergyTask("vote_video", entity.id)
setVoteAndCommentStyle(entity)
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
entity.count.vote = entity.count.vote - 1
entity.me.isVoted = false
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
if (exception is HttpException) {
ErrorHelper.handleError(
itemView.context,
exception.response()?.errorBody()?.string()
)
}
setVoteAndCommentStyle(entity)
}
})
@ -352,73 +383,75 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
EnergyTaskHelper.postEnergyTask("vote_answer", entity.id)
}
ToastUtils.showToast("已赞同")
entity.count.vote = entity.count.vote + 1
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
}
override fun onFailure(e: HttpException?) {
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
if (403008 == it) {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
} else if (403036 == it) {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
} else if (404001 == it) {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
} else {
entity.count.vote = entity.count.vote - 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = true
} else {
entity.me.isAnswerVoted = true
ErrorHelper.handleErrorWithCustomizedHandler(
itemView.context,
e?.response()?.errorBody()?.string(),
false
) {
when (it) {
403008 -> {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
}
403036 -> {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
}
404001 -> {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
}
else -> {
setVoteAndCommentStyle(entity)
false
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
false
}
}
}
})
}
entity.count.vote = entity.count.vote + 1
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
playVoteAnimation()
}
@SuppressLint("CheckResult")
fun cancelAnswerVote(entity: AnswerEntity) {
entity.count.vote = entity.count.vote - 1
voteIcon.isChecked = false
voteCount.setTextColor(R.color.text_subtitleDesc.toColor(voteCount.context))
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
if (entity.type == "video") {
RetrofitManager.getInstance()
.api.undoVoteVideo(entity.id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
entity.count.vote = entity.count.vote - 1
entity.me.isVoted = false
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
Utils.toast(itemView.context, "取消点赞")
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
entity.count.vote = entity.count.vote + 1
entity.me.isVoted = true
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
if (exception is HttpException) {
ErrorHelper.handleError(
itemView.context,
exception.response()?.errorBody()?.string()
)
}
setVoteAndCommentStyle(entity)
}
})
} else {
val unVoteObservable = if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = false
RetrofitManager.getInstance().api.postCommunityArticleUnVote(entity.id)
} else {
entity.me.isAnswerVoted = false
RetrofitManager.getInstance().api
.postAnswerUnvote(entity.id)
}
@ -427,32 +460,42 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<VoteEntity>() {
override fun onResponse(response: VoteEntity?) {
entity.count.vote = entity.count.vote - 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = false
} else {
entity.me.isAnswerVoted = false
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
Utils.toast(itemView.context, "取消赞同")
}
override fun onFailure(e: HttpException?) {
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
if (403008 == it) {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
} else if (403036 == it) {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
} else if (404001 == it) {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
} else {
entity.count.vote = entity.count.vote + 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = true
} else {
entity.me.isAnswerVoted = true
ErrorHelper.handleErrorWithCustomizedHandler(
itemView.context,
e?.response()?.errorBody()?.string(),
false
) {
when (it) {
403008 -> {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
}
403036 -> {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
}
404001 -> {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
}
else -> {
setVoteAndCommentStyle(entity)
false
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
false
}
}
}
@ -477,7 +520,11 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
}
override fun onFailure(e: HttpException?) {
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
ErrorHelper.handleErrorWithCustomizedHandler(
itemView.context,
e?.response()?.errorBody()?.string(),
false
) {
if (403008 == it) {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
@ -518,7 +565,11 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
}
override fun onFailure(e: HttpException?) {
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
ErrorHelper.handleErrorWithCustomizedHandler(
itemView.context,
e?.response()?.errorBody()?.string(),
false
) {
if (403008 == it) {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true

View File

@ -311,6 +311,13 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
super.onResume()
mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
EventBus.getDefault().post(EBReuse(COMMENT_RESUME))
if (::commentEt.isInitialized && commentEt.text.isNotEmpty()) {
// 若不延迟,可能回来的时候不能获取焦点导致弹不起来
mBaseHandler.postDelayed({
Util_System_Keyboard.showSoftKeyboard(context, commentEt)
}, 200)
}
}
override fun onPause() {

View File

@ -948,7 +948,7 @@ public interface ApiService {
* 新的设置接口
*/
@GET("settings")
Single<NewSettingsEntity> getNewSettings(@Query("version") String version, @Query("channel") String channel);
Single<NewApiSettingsEntity> getNewSettings(@Query("version") String version, @Query("channel") String channel);
/**
* 获取新的配置信息,因为旧的已经太大了避免冲突

View File

@ -158,7 +158,7 @@ class SearchGameIndexAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -223,7 +223,7 @@ class SearchGameResultAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -25,6 +25,7 @@ import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.game.GameItemViewHolder
import com.lightgame.adapter.BaseRecyclerAdapter
import java.text.SimpleDateFormat
import java.util.*
@ -294,6 +295,8 @@ class GameServersContentAdapter(
viewHolder.binding.home2TestType.background = getServerDrawableBySource(R.color.tag_orange)
}
GameItemViewHolder.initGameSubtitle(gameEntity, viewHolder.binding.gameSubtitleTv, forceShowSubtitle = true)
if (gameEntity.fixedTop!!) {
val tag = "今日开服"
viewHolder.binding.home2TestType.visibility = View.VISIBLE

View File

@ -45,7 +45,7 @@ class SimulatorGameViewModel(application: Application) : AndroidViewModel(applic
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe({
val localSimulatorList: List<SimulatorEntity> = AppDatabase.getInstance().simulatorGameDao().getSimulatorList()
val localSimulatorList: List<SimulatorEntity> = mSimulatorGameDao.getSimulatorList()
if (it.isNotEmpty()) {
when (it[0]) {
@ -59,6 +59,11 @@ class SimulatorGameViewModel(application: Application) : AndroidViewModel(applic
}
}
}
} else {
// 若网络数据为空,本地数据不为空时同步本地数据到服务端 (避免本地数据与网络数据不一致的问题)
if (localSimulatorList.isNotEmpty()) {
SimulatorGameManager.recordDownloadSimulatorGames()
}
}
}, {
simulators.postValue(mResultSimulatorsList)

View File

@ -71,12 +71,9 @@ import com.lightgame.utils.Utils;
import com.llew.huawei.verifier.LoadedApkHuaWei;
import com.shuyu.gsyvideoplayer.cache.CacheFactory;
import com.shuyu.gsyvideoplayer.player.PlayerFactory;
import com.walkud.rom.checker.Rom;
import com.walkud.rom.checker.RomIdentifier;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Locale;
import java.util.ServiceLoader;
import io.reactivex.plugins.RxJavaPlugins;
@ -102,6 +99,8 @@ public class HaloApp extends MultiDexApplication {
public boolean isBrandNewInstall = false; // 当前用户是否是安装光环后第一次打开
public boolean isNewForThisVersion = false; // 当前用户是否是安装当前版本后第一次打开 (包括全新和更新)
public boolean isRunningForeground = false; // 标记当前 APP 是否处于前台运行中
public boolean isAlreadyUpAndRunning = false; // 应用是否处于运行中状态 (进入到 MainActivity 就当运行中)
private List<String> webViewAbiList;
private ChannelProvider mChannelProvider = new ChannelProviderImp();
private final ServiceLoader<IApplication> mApplicationList = ServiceLoader.load(IApplication.class, this.getClass().getClassLoader());

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

View File

@ -60,14 +60,45 @@
android:textStyle="bold"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/gameDescContainer"
app:layout_constraintEnd_toStartOf="@+id/recent_played_tag"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="@+id/gameDescContainer"
app:layout_constraintRight_toLeftOf="@+id/recent_played_tag"
app:layout_constraintStart_toStartOf="@+id/gameDescContainer"
app:layout_constraintTop_toTopOf="@+id/gameIconView"
app:layout_constraintVertical_chainStyle="packed"
tools:text="地海争霸:巫妖王再怒" />
<TextView
android:id="@+id/gameSubtitleTv"
android:layout_width="wrap_content"
android:layout_height="14dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:background="@drawable/bg_advance_download_game_subtitle"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:singleLine="true"
android:textColor="@color/text_subtitle"
android:textSize="@dimen/tag_text_size"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/game_name"
app:layout_constraintEnd_toEndOf="@+id/gameDesSpace"
app:layout_constraintStart_toEndOf="@+id/game_name"
app:layout_constraintTop_toTopOf="@+id/game_name"
app:layout_goneMarginStart="0dp"
tools:text="副标题"
tools:visibility="visible" />
<Space
android:id="@+id/gameDesSpace"
android:layout_width="0dp"
android:layout_height="28dp"
android:background="@color/black"
app:layout_constraintBottom_toTopOf="@+id/label_list"
app:layout_constraintEnd_toStartOf="@+id/download_btn"
app:layout_constraintStart_toEndOf="@+id/gameIconView"
app:layout_constraintTop_toBottomOf="@+id/game_name" />
<TextView
android:id="@+id/recent_played_tag"
android:layout_width="44dp"
@ -80,9 +111,10 @@
android:textSize="9sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/game_name"
app:layout_constraintLeft_toRightOf="@+id/game_name"
app:layout_constraintRight_toLeftOf="@+id/game_kaifu_type"
app:layout_constraintTop_toTopOf="@+id/game_name" />
app:layout_constraintEnd_toStartOf="@+id/game_kaifu_type"
app:layout_constraintStart_toEndOf="@+id/game_name"
app:layout_constraintTop_toTopOf="@+id/game_name"
tools:visibility="visible" />
<TextView
android:id="@+id/game_kaifu_type"
@ -99,9 +131,11 @@
android:textSize="9sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/game_name"
app:layout_constraintLeft_toRightOf="@+id/recent_played_tag"
app:layout_constraintRight_toRightOf="@+id/gameDescContainer"
app:layout_constraintTop_toTopOf="@+id/game_name" />
app:layout_constraintEnd_toEndOf="@+id/gameDescContainer"
app:layout_constraintStart_toEndOf="@+id/recent_played_tag"
app:layout_constraintTop_toTopOf="@+id/game_name"
tools:text="九游版"
tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/gameDescContainer"

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -30,7 +31,7 @@
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -45,7 +46,32 @@
android:singleLine="true"
android:textColor="@color/text_title"
android:textSize="14sp"
android:textStyle="bold" />
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="who let dog out" />
<TextView
android:id="@+id/gameSubtitleTv"
android:layout_width="wrap_content"
android:layout_height="14dp"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_toRightOf="@id/home2_game_nameAndsize"
android:background="@drawable/bg_advance_download_game_subtitle"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:singleLine="true"
android:textColor="@color/text_subtitle"
android:textSize="@dimen/tag_text_size"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/home2_game_nameAndsize"
app:layout_constraintStart_toEndOf="@id/home2_game_nameAndsize"
app:layout_constraintTop_toTopOf="@id/home2_game_nameAndsize"
app:layout_goneMarginStart="0dp"
tools:text="副标题"
tools:visibility="visible" />
<TextView
android:id="@+id/home2_game_server_type"
@ -57,10 +83,15 @@
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingBottom="0.5dp"
android:text="九游版"
android:textColor="@color/white"
android:textSize="9sp"
android:visibility="gone" />
</RelativeLayout>
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/home2_game_nameAndsize"
app:layout_constraintStart_toEndOf="@id/gameSubtitleTv"
app:layout_constraintTop_toTopOf="@id/home2_game_nameAndsize"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="match_parent"
@ -167,8 +198,8 @@
android:id="@+id/home2_download_btn"
android:layout_width="60dp"
android:layout_height="28.5dp"
fresco:download_button_show_progress="false"
fresco:download_button_text_size="12sp" />
app:download_button_show_progress="false"
app:download_button_text_size="12sp" />
</LinearLayout>
<FrameLayout

View File

@ -7,8 +7,8 @@ ext {
targetSdkVersion = 28
// application info (每个大版本之间的 versionCode 增加 20)
versionCode = 630
versionName = "5.14.0"
versionCode = 636
versionName = "5.14.6"
applicationId = "com.gh.gamecenter"
// AndroidX

View File

@ -24,13 +24,17 @@ class CustomLayoutInflaterFactory(
mAppCompatActivity.delegate.createView(parent, name, context, attrs)
?: mAppCompatActivity.onCreateView(parent, name, context, attrs)
?: mAppCompatActivity.layoutInflater.createView(name, null, attrs)
} catch (e: ClassNotFoundException) {
} catch (e: Exception) {
try {
mAppCompatActivity.layoutInflater.createView(name, "android.widget.", attrs)
if (e is ClassNotFoundException) {
mAppCompatActivity.layoutInflater.createView(name, "android.widget.", attrs)
}
} catch (e2: Exception) {
e2.printStackTrace()
return null
}
e.printStackTrace()
return null
}
val n = attrs.attributeCount

View File

@ -80,6 +80,9 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import io.sentry.Breadcrumb;
import io.sentry.Sentry;
import io.sentry.SentryLevel;
import kotlin.Pair;
import pub.devrel.easypermissions.EasyPermissions;
@ -564,12 +567,19 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
// 这里根据调用栈是否存在 DarkModeUtils 来确定是否为系统回调
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
for (StackTraceElement element : trace) {
if (element.getClassName().contains(DarkModeUtils.class.getSimpleName())) {
if (element.getClassName().equals(DarkModeUtils.class.getName())) {
isCalledBySystem = false;
break;
}
}
Breadcrumb breadcrumb = new Breadcrumb();
breadcrumb.setCategory("onConfigurationChanged");
breadcrumb.setMessage("IsCalledBySystem " + isCalledBySystem + ","
+ this.getClass().getSimpleName() + " lifecycle is " + getLifecycle().getCurrentState());
breadcrumb.setLevel(SentryLevel.INFO);
Sentry.addBreadcrumb(breadcrumb);
if (BuildConfig.IS_DARK_MODE_ON && mIsDarkModeOn != DarkModeUtils.INSTANCE.isDarkModeOn(this)) {
// 当且仅当页面处于可见状态时响应新的 UiMode并将它传递下去
// (在不可见的 activity 调用 onConfigurationChanged 方法有一定概率触发 ANR

View File

@ -207,6 +207,9 @@ public class Constants {
// 补充配置项
public static final String SP_NEW_SETTINGS = "new_settings";
// 新接口配置项
public static final String SP_NEW_API_SETTINGS = "new_api_settings";
// 畅玩组件的配置
public static final String SP_V_SETTINGS = "v_settings";

View File

@ -1,6 +1,7 @@
package com.gh.gamecenter.common.utils
import android.animation.Animator
import android.annotation.SuppressLint
import android.app.Activity
import android.content.ClipData
import android.content.ClipboardManager
@ -331,7 +332,8 @@ fun Fragment.ifLogin(entrance: String, action: (() -> Unit)? = null) {
}
fun Context.ifLogin(entrance: String, action: (() -> Unit)? = null) {
val checkLoginConfig = ARouter.getInstance().build(RouteConsts.provider.checkLogin).navigation() as? ICheckLoginProvider
val checkLoginConfig =
ARouter.getInstance().build(RouteConsts.provider.checkLogin).navigation() as? ICheckLoginProvider
checkLoginConfig?.checkLogin(this, entrance, action)
}
@ -379,8 +381,10 @@ fun String.containHtmlTag(): Boolean {
*/
fun Fragment.showRegulationTestDialogIfNeeded(action: (() -> Unit)) {
val provider = ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
val userManagerProvider = ARouter.getInstance().build(RouteConsts.provider.userManager).navigation() as? IUserManagerProvider
val dialogUtils = ARouter.getInstance().build(RouteConsts.provider.dialogUtils).navigation() as? IDialogUtilsProvider
val userManagerProvider =
ARouter.getInstance().build(RouteConsts.provider.userManager).navigation() as? IUserManagerProvider
val dialogUtils =
ARouter.getInstance().build(RouteConsts.provider.dialogUtils).navigation() as? IDialogUtilsProvider
if (userManagerProvider?.userShouldTakeRegulationBaseOnLastRemind() == true) {
dialogUtils?.showRegulationTestDialog(requireContext(),
{ provider?.directToRegulationTestPage(requireContext()) },
@ -392,8 +396,10 @@ fun Fragment.showRegulationTestDialogIfNeeded(action: (() -> Unit)) {
fun Context.showRegulationTestDialogIfNeeded(action: (() -> Unit)) {
val provider = ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
val userManagerProvider = ARouter.getInstance().build(RouteConsts.provider.userManager).navigation() as? IUserManagerProvider
val dialogUtils = ARouter.getInstance().build(RouteConsts.provider.dialogUtils).navigation() as? IDialogUtilsProvider
val userManagerProvider =
ARouter.getInstance().build(RouteConsts.provider.userManager).navigation() as? IUserManagerProvider
val dialogUtils =
ARouter.getInstance().build(RouteConsts.provider.dialogUtils).navigation() as? IDialogUtilsProvider
if (userManagerProvider?.userShouldTakeRegulationBaseOnLastRemind() == true) {
dialogUtils?.showRegulationTestDialog(this,
{ provider?.directToRegulationTestPage(this) },
@ -848,6 +854,15 @@ fun TextView.setTextWithInterceptingInternalUrl(text: CharSequence) {
setText(ssb)
}
/**
* 为 TextView 设置最大宽度,忽略入参为 0 的场景
*/
fun TextView.maxWidthExcludeZero(width: Int) {
if (width != 0) {
maxWidth = width
}
}
fun CharSequence.interceptUrlSpanAndRoundImageSpan(clickedCallback: ((url: String) -> Unit)? = null): SpannableStringBuilder {
return SpannableStringBuilder.valueOf(this).apply {
getSpans(0, length, URLSpan::class.java).forEach {
@ -864,8 +879,10 @@ fun CharSequence.interceptUrlSpanAndRoundImageSpan(clickedCallback: ((url: Strin
override fun onClick(widget: View) {
clickedCallback?.invoke(it.url)
val webActivityProvider = ARouter.getInstance().build(RouteConsts.provider.webActivity).navigation() as? IWebProvider
val provider = ARouter.getInstance().build(RouteConsts.provider.defaultUrlHandler).navigation() as IDefaultUrlHandlerProvider
val webActivityProvider =
ARouter.getInstance().build(RouteConsts.provider.webActivity).navigation() as? IWebProvider
val provider = ARouter.getInstance().build(RouteConsts.provider.defaultUrlHandler)
.navigation() as IDefaultUrlHandlerProvider
if (!provider.interceptUrl(widget.context, it.url, "")) {
webActivityProvider?.getIntent(widget.context, it.url, true)?.run {
widget.context.startActivity(this)
@ -992,8 +1009,10 @@ fun Context.doOnMainProcessOnly(callback: EmptyCallback) {
* 虽然现在我们没有了友盟以后只是单进程APP但在 debug 模式下还有 whatTheStack 这个进程如果不限定主进程会出现奇奇怪怪的问题 (BroadcastReceiver相关)
*/
inline fun Context.doOnMainProcessOnly(f: () -> Unit) {
val buildConfig = ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
val packageUtilsConfig = ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
val buildConfig =
ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
val packageUtilsConfig =
ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
val processName = packageUtilsConfig?.obtainProcessName(this)
if (processName == null || buildConfig?.getApplicationId() == processName) {
f.invoke()
@ -1005,8 +1024,10 @@ inline fun Context.doOnMainProcessOnly(f: () -> Unit) {
}
inline fun doOnMainProcessOnly(f: () -> Unit) {
val buildConfig = ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
val packageUtilsConfig = ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
val buildConfig =
ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
val packageUtilsConfig =
ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
val processName = packageUtilsConfig?.obtainProcessName(HaloApp.getInstance())
if (processName == null || buildConfig?.getApplicationId() == processName) {
f.invoke()
@ -1251,9 +1272,19 @@ fun String.emojiCount(): Int {
/**
* WebView启用强制深色模式
*/
@SuppressLint("RequiresFeature")
fun WebView.enableForceDark(isDarkModeOn: Boolean) {
if (BuildConfig.IS_DARK_MODE_ON && WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
WebSettingsCompat.setForceDark(settings, if (isDarkModeOn) WebSettingsCompat.FORCE_DARK_ON else WebSettingsCompat.FORCE_DARK_OFF)
val isFeatureSupported = try {
WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)
} catch (throwable: Throwable) {
throwable.printStackTrace()
false
}
if (BuildConfig.IS_DARK_MODE_ON && isFeatureSupported) {
WebSettingsCompat.setForceDark(
settings,
if (isDarkModeOn) WebSettingsCompat.FORCE_DARK_ON else WebSettingsCompat.FORCE_DARK_OFF
)
}
}

View File

@ -0,0 +1,49 @@
package com.gh.gamecenter.common.utils
import com.gh.gamecenter.common.json.JsonObjectBuilder
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.lightgame.utils.Utils
import org.json.JSONObject
object NewFlagLogUtils {
private fun log(jsonObject: JSONObject, logStore: String, uploadImmediately: Boolean) {
Utils.log("NewFlatLogUtils", jsonObject.toString(4))
LoghubUtils.log(jsonObject, logStore, uploadImmediately, true)
}
private fun parseAndPutMeta(): JsonObjectBuilder.() -> Unit = {
val meta = LogUtils.getMetaObject()
val metaKeys = meta.keys()
while (metaKeys.hasNext()) {
val key: String = metaKeys.next().toString()
val value = meta.getString(key)
key to value
}
}
/**
* 记录外部存储权限提示弹窗出现
*/
fun logExternalStoragePermissionDialogAppearance() {
val json = json {
"event" to "storage_permission_pop_show"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
/**
* 记录外部存储权限弹窗行为
*/
fun logExternalStoragePermissionDialogAction(action: String) {
val json = json {
"event" to "storage_permission_pop_click"
"button" to action
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
}

View File

@ -244,24 +244,41 @@ object PermissionHelper {
}
private fun showDialogBeforeRequestingStorageDialog(context: FragmentActivity, emptyCallback: EmptyCallback) {
// 是否点击外部区域触发弹窗消失
var isCanceledByClickingOutside = true
NewFlagLogUtils.logExternalStoragePermissionDialogAppearance()
DialogHelper.showDialog(
context,
title = "权限申请",
content = "光环助手将向您申请开启设备的存储权限,以保证能正常使用相关功能。拒绝授权将无法正常使用部分功能。",
cancelText = "放弃",
confirmText = "去授权",
cancelClickCallback = null,
confirmClickCallback = { checkStoragePermissionBeforeAction(context, emptyCallback) },
cancelClickCallback = {
isCanceledByClickingOutside = false
NewFlagLogUtils.logExternalStoragePermissionDialogAction("放弃")
},
confirmClickCallback = {
isCanceledByClickingOutside = false
checkStoragePermissionBeforeAction(context, emptyCallback)
NewFlagLogUtils.logExternalStoragePermissionDialogAction("去授权")
},
extraConfig = DialogHelper.Config(hint = "查看权限应用场景"),
uiModificationCallback = {
it.hintTv.setTextColor(ContextCompat.getColor(context, R.color.theme_font))
it.hintTv.setOnClickListener {
val provider = ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
val provider =
ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
provider?.directToWebView(context, Constants.PERMISSION_SCENARIO_ADDRESS, "(权限弹窗)")
NewFlagLogUtils.logExternalStoragePermissionDialogAction("查看权限应用场景")
}
it.contentTv.setTextColor(ContextCompat.getColor(context, R.color.text_title))
}
)
)?.setOnDismissListener {
if (isCanceledByClickingOutside) {
NewFlagLogUtils.logExternalStoragePermissionDialogAction("点击弹窗以外空白区域")
}
}
}
private fun showDialogBeforeRequestingGetInstalledListDialog(context: FragmentActivity, emptyCallback: EmptyCallback) {