Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamlooker committed Sep 26, 2023
1 parent 8c36c8c commit 997f7c8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -982,9 +982,11 @@ class AppDetailAdapter(private val callbacks: Callbacks) :

var action: Action? = null
set(value) {
if (field != value) {
val index = items.indexOf(Item.InstallButtonItem)
if (index > 0) notifyItemChanged(index)
val index = items.indexOf(Item.InstallButtonItem)
val progressBarIndex = items.indexOf(Item.DownloadStatusItem)
if (index > 0 && progressBarIndex > 0) {
notifyItemChanged(index)
notifyItemChanged(progressBarIndex)
}
field = value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AppDetailViewModel @Inject constructor(
}

val installerState = installer
.getStatus()
.status
.asStateFlow(InstallerQueueState.EMPTY)

val state by lazy {
Expand Down
4 changes: 1 addition & 3 deletions core/common/src/main/java/com/looker/core/common/Text.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ fun ByteArray.hex(): String = joinToString(separator = "") { byte ->
"%02x".format(Locale.US, byte.toInt() and 0xff)
}

fun Any.log(message: Any) {
this::class.java.simpleName
val tag = this::class.java.simpleName + ".DEBUG"
fun Any.log(message: Any, tag: String = this::class.java.simpleName + ".DEBUG") {
Log.d(tag, message.toString())
}
11 changes: 8 additions & 3 deletions installer/src/main/java/com/looker/installer/InstallManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package com.looker.installer

import android.content.Context
import com.looker.core.common.Constants
import com.looker.core.common.PackageName
import com.looker.core.common.extension.filter
import com.looker.core.common.extension.notificationManager
import com.looker.core.common.extension.updateAsMutable
import com.looker.core.datastore.SettingsRepository
import com.looker.core.datastore.model.InstallerType
import com.looker.core.common.PackageName
import com.looker.installer.installers.*
import com.looker.installer.installers.Installer
import com.looker.installer.installers.LegacyInstaller
import com.looker.installer.installers.SessionInstaller
import com.looker.installer.installers.root.RootInstaller
import com.looker.installer.installers.shizuku.ShizukuInstaller
import com.looker.installer.model.*
Expand Down Expand Up @@ -62,7 +64,10 @@ class InstallManager(
uninstallItems.send(packageName)
}

fun getStatus() = combine(installState, installQueue) { current, queue ->
val status = combine(
installState,
installQueue
) { current, queue ->
InstallerQueueState(
currentItem = current,
queued = queue
Expand Down

0 comments on commit 997f7c8

Please sign in to comment.