Compare commits
10 Commits
v4.9.6-336
...
v4.9.6-338
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d011ae7ef | |||
| 36b58383f7 | |||
| 70b7689ac5 | |||
| 47b0a8d1ac | |||
| 1ae63d3010 | |||
| 9b9777ae19 | |||
| 814cef6218 | |||
| fd6c4836d4 | |||
| 9df138ed7c | |||
| 1f34f95e7c |
@ -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)
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -24,6 +24,10 @@ class HomeSearchToolWrapperViewModel(application: Application) : AndroidViewMode
|
||||
|
||||
var appBarOffset = 0
|
||||
|
||||
init {
|
||||
getTabs()
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun getTabs() {
|
||||
RetrofitManager.getInstance(getApplication()).api
|
||||
|
||||
@ -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))
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ ext {
|
||||
targetSdkVersion = 26
|
||||
|
||||
// application info (每个大版本之间的 versionCode 增加 20)
|
||||
versionCode = 336
|
||||
versionCode = 338
|
||||
versionName = "4.9.6"
|
||||
applicationId = "com.gh.gamecenter"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user