mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Refactoring and changed loadLabel to getApplicationLabel across the board
This commit is contained in:
parent
382bc4a53d
commit
90f5fecb8f
7 changed files with 11 additions and 14 deletions
|
|
@ -139,7 +139,7 @@ class AppMenuAdapter(
|
||||||
holder.textView.setTextColor(sharedPreferenceManager.getTextColor())
|
holder.textView.setTextColor(sharedPreferenceManager.getTextColor())
|
||||||
|
|
||||||
// Set app name on the menu. If the app has been uninstalled, replace it with "Removing" until the app menu updates.
|
// Set app name on the menu. If the app has been uninstalled, replace it with "Removing" until the app menu updates.
|
||||||
val appLabel: CharSequence = appInfo?.loadLabel(context.packageManager) ?: "Removing..."
|
val appLabel: CharSequence = appInfo?.let { context.packageManager.getApplicationLabel(it) } ?: "Removing..."
|
||||||
|
|
||||||
if (appInfo != null) {
|
if (appInfo != null) {
|
||||||
holder.textView.text = sharedPreferenceManager.getAppName(
|
holder.textView.text = sharedPreferenceManager.getAppName(
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class AppUtils(private val context: Context, private val launcherApps: LauncherA
|
||||||
sharedPreferenceManager.getAppName(
|
sharedPreferenceManager.getAppName(
|
||||||
it.first.applicationInfo.packageName,
|
it.first.applicationInfo.packageName,
|
||||||
it.third,
|
it.third,
|
||||||
it.first.applicationInfo.loadLabel(context.packageManager)
|
context.packageManager.getApplicationLabel(it.first.applicationInfo)
|
||||||
).toString().lowercase()
|
).toString().lowercase()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class GestureAppsAdapter(
|
||||||
holder.textView.text = sharedPreferenceManager.getAppName(
|
holder.textView.text = sharedPreferenceManager.getAppName(
|
||||||
app.first.applicationInfo.packageName,
|
app.first.applicationInfo.packageName,
|
||||||
app.third,
|
app.third,
|
||||||
holder.itemView.context.packageManager.getApplicationLabel(appInfo)
|
context.packageManager.getApplicationLabel(appInfo)
|
||||||
)
|
)
|
||||||
|
|
||||||
holder.textView.visibility = View.VISIBLE
|
holder.textView.visibility = View.VISIBLE
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,10 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.setFragmentResult
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
class GestureAppsFragment(private val direction: String) : Fragment(), GestureAppsAdapter.OnItemClickListener {
|
class GestureAppsFragment(private val direction: String) : Fragment(), GestureAppsAdapter.OnItemClickListener {
|
||||||
|
|
||||||
|
|
@ -88,7 +85,7 @@ class GestureAppsFragment(private val direction: String) : Fragment(), GestureAp
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
override fun afterTextChanged(s: Editable?) {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
filterItems(searchView.text.toString())
|
filterItems(s.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +113,7 @@ class GestureAppsFragment(private val direction: String) : Fragment(), GestureAp
|
||||||
val cleanItemText = stringUtils.cleanString(sharedPreferenceManager.getAppName(
|
val cleanItemText = stringUtils.cleanString(sharedPreferenceManager.getAppName(
|
||||||
it.first.applicationInfo.packageName,
|
it.first.applicationInfo.packageName,
|
||||||
it.third,
|
it.third,
|
||||||
requireActivity().packageManager.getApplicationLabel(it.first.applicationInfo)
|
requireContext().packageManager.getApplicationLabel(it.first.applicationInfo)
|
||||||
).toString())
|
).toString())
|
||||||
if (cleanItemText != null) {
|
if (cleanItemText != null) {
|
||||||
if (cleanItemText.contains(cleanQuery, ignoreCase = true)) {
|
if (cleanItemText.contains(cleanQuery, ignoreCase = true)) {
|
||||||
|
|
@ -134,9 +131,9 @@ class GestureAppsFragment(private val direction: String) : Fragment(), GestureAp
|
||||||
private fun showConfirmationDialog(appInfo: LauncherActivityInfo, appName: String, profile: Int) {
|
private fun showConfirmationDialog(appInfo: LauncherActivityInfo, appName: String, profile: Int) {
|
||||||
AlertDialog.Builder(requireContext()).apply {
|
AlertDialog.Builder(requireContext()).apply {
|
||||||
setTitle("Confirmation")
|
setTitle("Confirmation")
|
||||||
setMessage("Are you sure you want to set $appName? as the gesture app")
|
setMessage("Are you sure you want to choose $appName?")
|
||||||
|
|
||||||
setPositiveButton("Yes") { _, _ ->
|
setPositiveButton("Yes") { _, _ ->
|
||||||
// Perform action on confirmation
|
|
||||||
performConfirmedAction(appInfo, appName, profile)
|
performConfirmedAction(appInfo, appName, profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class HiddenAppsAdapter(
|
||||||
holder.textView.text = sharedPreferenceManager.getAppName(
|
holder.textView.text = sharedPreferenceManager.getAppName(
|
||||||
app.first.applicationInfo.packageName,
|
app.first.applicationInfo.packageName,
|
||||||
app.third,
|
app.third,
|
||||||
holder.itemView.context.packageManager.getApplicationLabel(appInfo)
|
context.packageManager.getApplicationLabel(appInfo)
|
||||||
)
|
)
|
||||||
|
|
||||||
holder.textView.visibility = View.VISIBLE
|
holder.textView.visibility = View.VISIBLE
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
override fun afterTextChanged(s: Editable?) {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
filterItems(searchView.text.toString())
|
filterItems(s.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +114,7 @@ class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
||||||
val cleanItemText = stringUtils.cleanString(sharedPreferenceManager.getAppName(
|
val cleanItemText = stringUtils.cleanString(sharedPreferenceManager.getAppName(
|
||||||
it.first.applicationInfo.packageName,
|
it.first.applicationInfo.packageName,
|
||||||
it.third,
|
it.third,
|
||||||
requireActivity().packageManager.getApplicationLabel(it.first.applicationInfo)
|
requireContext().packageManager.getApplicationLabel(it.first.applicationInfo)
|
||||||
).toString())
|
).toString())
|
||||||
if (cleanItemText != null) {
|
if (cleanItemText != null) {
|
||||||
if (cleanItemText.contains(cleanQuery, ignoreCase = true)) {
|
if (cleanItemText.contains(cleanQuery, ignoreCase = true)) {
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
override fun afterTextChanged(s: Editable?) {
|
||||||
lifecycleScope.launch(Dispatchers.Default) {
|
lifecycleScope.launch(Dispatchers.Default) {
|
||||||
filterItems(searchView.text.toString())
|
filterItems(s.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue