Compare commits

...

10 Commits

Author SHA1 Message Date
8d011ae7ef Merge branch 'hotfix-v4.9.6-337-generic_bugs' into 'release'
修复下载模拟器时会暂停其它下载任务的问题

See merge request halo/android/assistant-android!117
2021-06-17 18:38:04 +08:00
36b58383f7 版本更新至 4.9.6-338 2021-06-17 18:37:32 +08:00
70b7689ac5 修复下载模拟器时会暂停其它下载任务的问题 2021-06-17 15:18:41 +08:00
47b0a8d1ac 版本更新至 4.9.6-337 2021-06-17 10:43:33 +08:00
1ae63d3010 Merge branch 'hotfix-v4.9.6-336-recreate' into 'release'
修复首页和游戏详情页页面重建时的 tab 显示问题

See merge request halo/android/assistant-android!116
2021-06-17 10:39:51 +08:00
9b9777ae19 修复首页和游戏详情页页面重建时的 tab 显示问题 2021-06-16 16:18:55 +08:00
814cef6218 Merge branch 'hotfix-v4.9.6-336-crash' into 'release'
1.修复Xapk解压过程中获取解压文件大小时的闪退问题

See merge request halo/android/assistant-android!115
2021-06-15 11:55:02 +08:00
lyr
fd6c4836d4 1.修复Xapk解压过程中获取解压文件大小时的闪退问题
2.修复新分类2.0游戏列表时的空指针问题
3.修复新分类2.0已选分类列表的数组越界问题
2021-06-15 11:51:22 +08:00
9df138ed7c Merge branch 'hotfix-v4.9.6-336-install' into 'release'
特殊处理山寨机在后台开启使用浏览器安装时的安装 intent

See merge request halo/android/assistant-android!114
2021-06-15 11:02:37 +08:00
1f34f95e7c 特殊处理山寨机在后台开启使用浏览器安装时的安装 intent 2021-06-10 09:53:54 +08:00
10 changed files with 63 additions and 18 deletions

View File

@ -191,7 +191,6 @@ class SimulatorDownloadManager private constructor() {
private fun download(context: Context, simulator: SimulatorEntity?) {
val apkEntity = simulator?.apk ?: return
DownloadManager.getInstance(context).pauseAll()
val entity = DownloadManager.getInstance(context).getDownloadEntityByUrl(apkEntity.url)
HaloApp.put(simulator.name, simulator)

View File

@ -108,7 +108,11 @@ object PackageInstaller {
@JvmStatic
fun getInstallIntent(context: Context, path: String): Intent {
var uri = Uri.fromFile(File(path))
val installIntent = Intent(Intent.ACTION_VIEW)
val installIntent = if (BrowserInstallHelper.isUseBrowserToInstallEnabledWithPackageMatched()) {
Intent(Intent.ACTION_INSTALL_PACKAGE)
} else {
Intent(Intent.ACTION_VIEW)
}
if ("smartisan" == Build.MANUFACTURER) {
installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}

View File

@ -1,5 +1,6 @@
package com.gh.common.xapk
import android.os.Build
import android.os.Environment
import com.gh.common.util.debounceActionWithInterval
import com.gh.common.util.getExtension
@ -207,8 +208,15 @@ class XapkUnzipThread(private var mDownloadEntity: DownloadEntity,
private fun getUnzipSize(path: String): Long {
var totalSize = 0L
ZipFile(File(path)).use {
for (entry in it.entries()) {
// 这里安卓5.0以下使用use会报错闪退
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ZipFile(File(path)).use {
for (entry in it.entries()) {
totalSize += entry.size
}
}
} else {
for (entry in ZipFile(File(path)).entries()) {
totalSize += entry.size
}
}

View File

@ -166,6 +166,28 @@ object BrowserInstallHelper {
}
}
/**
* 浏览器安装的后台开关 (返回仅包名匹配时的状态)
*/
@JvmStatic
fun isUseBrowserToInstallEnabledWithPackageMatched(): Boolean {
val settingsEntity = Config.getNewSettingsEntity()
if (settingsEntity == null) {
return false
} else {
settingsEntity.installModel.packages?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return true
}
}
}
return false
}
}
fun onApkInstalled(path: String?) {
path?.let {
val fileName = path.substringAfterLast(File.separator).removeSuffix(DownloadServer.APK_SUFFIX)

View File

@ -58,7 +58,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
override fun provideListAdapter() = mAdapter
?: CategoryV2ListAdapter(
requireContext(),
mListViewModel,
mListViewModel ?: provideListViewModel(),
mCategoryViewModel ?: viewModelProviderFromParent(CategoryV2ViewModel.Factory(mCategoryId, mCategoryTitle), mCategoryId),
mEntrance).apply { mAdapter = this }
@ -80,7 +80,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
initFilterView()
mListViewModel.refresh.observeNonNull(viewLifecycleOwner) { onRefresh() }
mListViewModel?.refresh?.observeNonNull(viewLifecycleOwner) { onRefresh() }
mCategoryViewModel?.run {
categoryPositionLiveData.observeNonNull(viewLifecycleOwner) {
directories[it.first].data?.get(it.second)?.run {
@ -114,11 +114,11 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
visibility = View.VISIBLE
setOnConfigSetupListener(object : CategoryFilterView.OnCategoryFilterSetupListener {
override fun onSetupSortSize(sortSize: SubjectSettingEntity.Size) {
mListViewModel.updateSortConfig(sortSize = sortSize)
mListViewModel?.updateSortConfig(sortSize = sortSize)
}
override fun onSetupSortType(sortType: CategoryFilterView.SortType) {
mListViewModel.updateSortConfig(sortType = sortType)
mListViewModel?.updateSortConfig(sortType = sortType)
}
override fun onSetupSortCategory() {
@ -139,7 +139,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
visibility = View.GONE
}
if (categoryId != null) mSubCategoryId = categoryId
mListViewModel.updateSortConfig(categoryIds = mSubCategoryId)
mListViewModel?.updateSortConfig(categoryIds = mSubCategoryId)
}
private fun addCategory(entity: CategoryEntity) {
@ -156,7 +156,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
remove(entity)
if (size == 0) {
mBinding?.selectedCategoryContainer?.visibility = View.GONE
mListViewModel.updateSortConfig(categoryIds = mSubCategoryId)
mListViewModel?.updateSortConfig(categoryIds = mSubCategoryId)
} else {
updateCategoryGame()
}
@ -188,8 +188,11 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
i = index
}
}
mBinding?.selectedCategoryContainer?.removeView(mSelectedViewList[i])
mSelectedViewList.removeAt(i)
if (i < mSelectedViewList.size) {
mBinding?.selectedCategoryContainer?.removeView(mSelectedViewList[i])
mSelectedViewList.removeAt(i)
}
}
}
@ -215,7 +218,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
categoryIds.append("-")
}
}
mListViewModel.updateSortConfig(categoryIds = categoryIds.toString())
mListViewModel?.updateSortConfig(categoryIds = categoryIds.toString())
}
}

View File

@ -63,11 +63,12 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mViewModel = viewModelProviderFromParent()
savedInstanceState?.let { mDefaultSelectedTab = it.getInt(LAST_SELECTED_POSITION) }
}
override fun onFragmentFirstVisible() {
mViewModel = viewModelProviderFromParent()
mSearchToolbarFragment = childFragmentManager.findFragmentById(R.id.wrapper_toolbar) as SearchToolbarFragment?
?: SearchToolbarFragment()
setSearchHints()
@ -84,7 +85,6 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
updateAppBarStyle(Color.WHITE, false)
mViewModel?.getTabs()
mViewModel?.tabs?.observe(viewLifecycleOwner, Observer {
if (mDefaultSelectedTab == -1) {
mDefaultSelectedTab = mViewModel?.defaultTabPosition ?: 0

View File

@ -24,6 +24,10 @@ class HomeSearchToolWrapperViewModel(application: Application) : AndroidViewMode
var appBarOffset = 0
init {
getTabs()
}
@SuppressLint("CheckResult")
fun getTabs() {
RetrofitManager.getInstance(getApplication()).api

View File

@ -369,7 +369,6 @@ class GameDetailFragment : NormalFragment() {
args.getString(EntranceUtils.KEY_GAMEID),
args.getParcelable(GameEntity.TAG))
mViewModel = viewModelProviderFromParent(factory)
mViewModel.loadData()
mPackageViewModel = viewModelProvider(PackageViewModel.Factory())
mUserViewModel = viewModelProvider(UserViewModel.Factory(HaloApp.getInstance().application))

View File

@ -12,6 +12,7 @@ import androidx.lifecycle.ViewModelProvider
import com.gh.common.constant.Constants
import com.gh.common.filter.RegionSettingHelper
import com.gh.common.history.HistoryHelper
import com.gh.common.runOnUiThread
import com.gh.common.util.*
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.gamedetail.entity.BigEvent
@ -30,12 +31,17 @@ import io.reactivex.schedulers.Schedulers
import retrofit2.HttpException
import tv.danmaku.ijk.media.exo2.ExoSourceManager
import java.util.*
import kotlin.collections.ArrayList
class GameDetailViewModel(application: Application,
var gameId: String?,
var game: GameEntity?) : AndroidViewModel(application) {
init {
runOnUiThread {
loadData()
}
}
private val mApi = RetrofitManager.getInstance(getApplication()).api
private val mSensitiveApi = RetrofitManager.getInstance(application).sensitiveApi

View File

@ -7,7 +7,7 @@ ext {
targetSdkVersion = 26
// application info (每个大版本之间的 versionCode 增加 20)
versionCode = 336
versionCode = 338
versionName = "4.9.6"
applicationId = "com.gh.gamecenter"