Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion app/src/main/java/app/olauncher/ui/AppDrawerAdapter.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package app.olauncher.ui

import android.accounts.AccountManager
import android.content.Context
import android.os.UserHandle
import android.os.UserManager
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater
Expand All @@ -23,6 +25,7 @@ import app.olauncher.helper.isSystemApp
import app.olauncher.helper.showKeyboard
import java.text.Normalizer


class AppDrawerAdapter(
private var flag: Int,
private val appLabelGravity: Int,
Expand Down Expand Up @@ -160,7 +163,12 @@ class AppDrawerAdapter(
appTitle.visibility = View.VISIBLE
appTitle.text = appModel.appLabel + if (appModel.isNew == true) " ✦" else ""
appTitle.gravity = appLabelGravity
otherProfileIndicator.isVisible = appModel.user != myUserHandle
var otherProfile = appModel.user != myUserHandle
otherProfileIndicator.isVisible = otherProfile
// if app belongs to paused user, lower opacity
if (otherProfile && appPaused(binding.root.context, appModel)) {
appTitle.alpha = 0.5f
}

appTitle.setOnClickListener { clickListener(appModel) }
appTitle.setOnLongClickListener {
Expand Down Expand Up @@ -262,5 +270,11 @@ class AppDrawerAdapter(
packageManager.getApplicationInfo(appPackage, 0)
).toString()
}

private fun appPaused(context: Context, appModel: AppModel): Boolean {
// check if this app is currently paused
val userManager = context.getSystemService(Context.USER_SERVICE) as UserManager
return !userManager.isUserUnlocked(appModel.user)
}
}
}