diff --git a/app/build.gradle b/app/build.gradle index 8b9c72d73..aca97bfbd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,7 +26,7 @@ android { minSdkVersion 21 targetSdkVersion 30 versionCode 49 - versionName "0.1.4.9" + versionName "0.1.4.10" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" kapt { arguments { @@ -94,9 +94,9 @@ dependencies { implementation 'com.akexorcist:localization:1.2.6' // OkHttp - implementation 'com.squareup.okhttp3:okhttp:4.8.1' + implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.okio:okio:2.8.0' - implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.8.1' + implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.9.0' // Firebase implementation 'com.google.firebase:firebase-core:17.5.0' diff --git a/app/src/main/java/net/xzos/upgradeall/ui/viewmodels/adapters/AppItemAdapter.kt b/app/src/main/java/net/xzos/upgradeall/ui/viewmodels/adapters/AppItemAdapter.kt index 5f6c88984..976b5618b 100644 --- a/app/src/main/java/net/xzos/upgradeall/ui/viewmodels/adapters/AppItemAdapter.kt +++ b/app/src/main/java/net/xzos/upgradeall/ui/viewmodels/adapters/AppItemAdapter.kt @@ -36,7 +36,6 @@ open class AppItemAdapter(internal val mItemCardViewList: MutableList @@ -45,7 +44,6 @@ open class AppItemAdapter(internal val mItemCardViewList: MutableList) { val operationSteps = list1ToList2(mItemCardViewList, newList) for (operationStep in operationSteps) { - when (operationStep.operation) { - add -> { - operationStep as ListAddOperationStep<*> - onAddItem(operationStep.index, operationStep.element as ItemCardView) - } - del -> { - operationStep as ListDelOperationStep + when (operationStep) { + is ListDelOperationStep -> { onItemDismiss(operationStep.index) } - swap -> { - operationStep as ListSwapOperationStep + is ListAddOperationStep<*> -> { + onAddItem(operationStep.index, operationStep.element as ItemCardView) + } + is ListSwapOperationStep -> { onItemMove(operationStep.rowIndex, operationStep.newIndex) } } diff --git a/app/src/main/java/net/xzos/upgradeall/ui/viewmodels/adapters/AppListItemAdapter.kt b/app/src/main/java/net/xzos/upgradeall/ui/viewmodels/adapters/AppListItemAdapter.kt index 2c3ce9812..48e812ad4 100644 --- a/app/src/main/java/net/xzos/upgradeall/ui/viewmodels/adapters/AppListItemAdapter.kt +++ b/app/src/main/java/net/xzos/upgradeall/ui/viewmodels/adapters/AppListItemAdapter.kt @@ -25,9 +25,23 @@ import net.xzos.upgradeall.utils.file.FileUtil import net.xzos.upgradeall.utils.getByHolder -class AppListItemAdapter(private val appListPageViewModel: AppListPageViewModel +class AppListItemAdapter( + private val appListPageViewModel: AppListPageViewModel ) : AppItemAdapter(appListPageViewModel.appCardViewList.value ?: mutableListOf(), appListPageViewModel.needUpdateAppsLiveData) { + override fun onBindViewHolder(holder: CardViewRecyclerViewHolder, position: Int) { + val itemCardView = mItemCardViewList[position] + itemCardView.extraData.app?.run { + holder.hubNameTextView.text = itemCardView.hubName.let { + if (it.isNullOrEmpty()) { + "Unknown" + } else { + it + } + } + } + super.onBindViewHolder(holder, position) + } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CardViewRecyclerViewHolder { val holder = super.onCreateViewHolder(parent, viewType) diff --git a/app/src/main/java/net/xzos/upgradeall/utils/ListUtils.kt b/app/src/main/java/net/xzos/upgradeall/utils/ListUtils.kt index b9bf20537..a6d575976 100644 --- a/app/src/main/java/net/xzos/upgradeall/utils/ListUtils.kt +++ b/app/src/main/java/net/xzos/upgradeall/utils/ListUtils.kt @@ -1,19 +1,15 @@ package net.xzos.upgradeall.utils -const val add = "ADD" -const val del = "DEL" -const val swap = "SWAP" - -open class ListOperationStepBase internal constructor(val operation: String) +open class ListOperationStepBase class ListAddOperationStep internal constructor(val index: Int, val element: E) - : ListOperationStepBase(add) + : ListOperationStepBase() class ListDelOperationStep internal constructor(val index: Int) - : ListOperationStepBase(del) + : ListOperationStepBase() class ListSwapOperationStep internal constructor(val rowIndex: Int, val newIndex: Int) - : ListOperationStepBase(swap) + : ListOperationStepBase() fun list1ToList2(list1: List, list2: List): List { if (list1 == list2) return emptyList() diff --git a/build.gradle b/build.gradle index 45c51905c..2dac0fbae 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.4.0' + ext.kotlin_version = '1.4.10' ext.protobuf_version = '0.8.12' ext.protoc_version = '3.13.0' repositories { diff --git a/core/src/main/java/net/xzos/upgradeall/core/network_api/GrpcApi.kt b/core/src/main/java/net/xzos/upgradeall/core/network_api/GrpcApi.kt index cae1ed12c..b3b27b533 100644 --- a/core/src/main/java/net/xzos/upgradeall/core/network_api/GrpcApi.kt +++ b/core/src/main/java/net/xzos/upgradeall/core/network_api/GrpcApi.kt @@ -114,8 +114,10 @@ class GrpcApi { val hubUuid = hubData.hubUuid val auth = hubData.auth val appIdList = hubData.getAppIdList() - for (appIdL in appIdList.chunked(50)) - callGetAppRelease(hubUuid, auth, appIdL.toHashSet()) + for (appIdL in appIdList.chunked(15)) + GlobalScope.launch { + callGetAppRelease(hubUuid, auth, appIdL.toHashSet()) + } } private suspend fun callGetAppRelease(