Compare commits

...

7 Commits

Author SHA1 Message Date
0d9a4baf32 Merge branch 'hotfix-v4.5.2-252-catalogUI' into 'release'
再次调整新分类-精选UI

See merge request halo/assistant-android!47
2020-12-15 18:07:26 +08:00
lyr
3a9132ff8c 再次调整新分类-精选UI 2020-12-15 18:05:35 +08:00
02a6ec9f7d 版本更新至 4.5.2 2020-12-14 17:15:20 +08:00
c779d775e3 Merge branch 'hotfix-v4.5.1-251-downloadANR' into 'release'
尝试修复安装完成触发的 ANR

See merge request halo/assistant-android!46
2020-12-14 17:12:26 +08:00
3fbcd33f98 尝试修复安装完成触发的 ANR 2020-12-14 17:10:55 +08:00
dbcdd7f3cc Merge branch 'hotfix-v4.5.1-251-catalogUI' into 'release'
微调新分类-精选UI

See merge request halo/assistant-android!45
2020-12-14 14:54:50 +08:00
lyr
69d9854b44 微调新分类-精选UI 2020-12-14 14:32:19 +08:00
6 changed files with 29 additions and 6 deletions

View File

@ -185,6 +185,11 @@ public class PackageUtils {
public static boolean compareSignatureBetweenInstalledAppWithApk(Context context, String packageName, String apkFilePath) {
try {
// 统计签名比较使用的频率 (大文件会触发 ANR)
SentryHelper.INSTANCE.onEvent(
"SIGNATURE_COMPARE",
"packageName", packageName);
Signature sig = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES).signatures[0];
// Fuck HUAWEI, 华为系统调用 getPackageArchiveInfo 获取魔羯 apk 的签名时会耗时超过5秒造成 ANR没有找到解决方法

View File

@ -7,6 +7,7 @@ import android.preference.PreferenceManager
import android.text.TextUtils
import com.gh.common.constant.Constants
import com.gh.common.loghub.LoghubUtils
import com.gh.common.runOnIoThread
import com.gh.common.util.*
import com.gh.gamecenter.entity.GameDigestEntity
import com.gh.gamecenter.eventbus.EBPackage
@ -106,7 +107,8 @@ object PackageObserver {
}
})
}
postNewlyInstalledApp(gameId, packageName)
runOnIoThread { postNewlyInstalledApp(gameId, packageName) }
}
if ("卸载" == busFour.type) {

View File

@ -14,6 +14,7 @@ import com.gh.common.exposure.ExposureEvent
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.IExposable
import com.gh.common.util.DirectUtils
import com.gh.common.util.dip2px
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
import com.gh.gamecenter.baselist.ListAdapter
@ -100,6 +101,11 @@ class SpecialCatalogAdapter(context: Context, private val mCatalogViewModel: Cat
is CatalogImageItemHolder -> {
val imageEntity = mEntityList[position].bigImage!!
holder.binding.run {
image.layoutParams = image.layoutParams.apply {
val imageWidth = mContext.resources.displayMetrics.widthPixels - (80F + 16F + 16F).dip2px()
height = imageWidth * 9 / 16
}
entity = imageEntity.image
var exposureEvent: ExposureEvent? = null

View File

@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.gh.common.AppExecutor;
import com.gh.common.util.DataUtils;
import com.gh.common.util.ExtensionsKt;
import com.gh.common.util.InstallUtils;
@ -38,7 +39,14 @@ public class InstallAndUninstallReceiver extends BroadcastReceiver {
String versionName = PackageUtils.getVersionByPackage(packageName);
EBPackage installEb = new EBPackage("安装", packageName, versionName);
EventBus.getDefault().post(installEb);
PackageObserver.onPackageChanged(installEb);
if (PackageUtils.isAppOnForeground(context)) {
PackageObserver.onPackageChanged(installEb);
} else {
// 处于后台运行的时候尝试延迟 1 秒再触发 onPackageChanged (猜测是引起 ANR 的原因)
AppExecutor.getUiExecutor().executeWithDelay(() -> {
PackageObserver.onPackageChanged(installEb);
}, 1000);
}
}
// 接收卸载广播

View File

@ -28,8 +28,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:maxLines="2"
android:ellipsize="end"
android:marqueeRepeatLimit="marquee_forever"
android:gravity="center"
android:includeFontPadding="false"

View File

@ -7,8 +7,8 @@ ext {
targetSdkVersion = 26
// application info (每个大版本之间的 versionCode 增加 20)
versionCode = 251
versionName = "4.5.1"
versionCode = 252
versionName = "4.5.2"
applicationId = "com.gh.gamecenter"
// AndroidX