Skip to content

Commit

Permalink
Removed: Removed the over use of app colors.
Browse files Browse the repository at this point in the history
Signed-off-by: HeCodes2Much <wayne6324@gmail.com>
  • Loading branch information
CreativeCodeCat committed May 30, 2024
1 parent 919c799 commit 5f7ae81
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.os.Bundle
import android.text.Spannable
import android.text.SpannableString
import android.text.style.ForegroundColorSpan
import android.util.Log
import android.view.LayoutInflater
import android.view.View
Expand Down Expand Up @@ -110,16 +107,6 @@ class DrawFragment : Fragment(),
private fun observeDrawerApps() {
viewModel.compareInstalledAppInfo()

val searchAppsHint = getString(R.string.search)
val coloredHint = SpannableString(searchAppsHint)
coloredHint.setSpan(
ForegroundColorSpan(preferenceHelper.appColor),
0,
searchAppsHint.length,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
binding.searchViewText.queryHint = coloredHint

@Suppress("DEPRECATION")
viewLifecycleOwner.lifecycleScope.launchWhenCreated {
viewModel.drawApps.collect {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ class FavoriteFragment : Fragment(),
}
}

@RequiresApi(Build.VERSION_CODES.R)
private fun observeFavorite() {
binding.topTextView.setTextColor(preferenceHelper.appColor)

viewModel.compareInstalledAppInfo()
viewLifecycleOwner.lifecycleScope.launch {
viewModel.favoriteApps.collect {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package com.github.droidworksstudio.launcher.ui.favorite

import android.annotation.SuppressLint
import android.graphics.BlendMode
import android.graphics.BlendModeColorFilter
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.os.Build
import android.util.Log
import android.view.MotionEvent
import android.view.View
Expand Down Expand Up @@ -62,27 +57,6 @@ class FavoriteViewHolder(
preferenceHelper.appTextSize.toInt() * 3
appFavoriteLeftIcon.visibility = View.VISIBLE
}


// Create a BlendModeColorFilter with the specified color and blend mode
val blendModeColorFilter = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
BlendModeColorFilter(
preferenceHelper.appColor,
BlendMode.SRC_IN
)
} else {
PorterDuffColorFilter(
preferenceHelper.appColor,
PorterDuff.Mode.SRC_IN
)
}

// Get the current drawable set as the background
val drawable = appFavoriteDragIcon.background.mutate()
// Apply a color filter to change its color
drawable.colorFilter = blendModeColorFilter
// Set the modified drawable back as the background
appFavoriteDragIcon.background = drawable
}

itemView.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.droidworksstudio.launcher.ui.hidden

import android.util.Log
import android.view.View
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.recyclerview.widget.RecyclerView
import com.github.droidworksstudio.launcher.data.entities.AppInfo
import com.github.droidworksstudio.launcher.databinding.ItemHiddenBinding
Expand All @@ -17,7 +18,17 @@ class HiddenViewHolder(
RecyclerView.ViewHolder(binding.root) {
fun bind(appInfo: AppInfo) {
binding.apply {
// Get the current LayoutParams of appFavoriteName
val layoutParams = appHiddenName.layoutParams as LinearLayoutCompat.LayoutParams

// Set the margins
layoutParams.topMargin = preferenceHelper.homeAppPadding.toInt()
layoutParams.bottomMargin = preferenceHelper.homeAppPadding.toInt()

appHiddenName.layoutParams = layoutParams
appHiddenName.text = appInfo.appName
appHiddenName.setTextColor(preferenceHelper.appColor)
appHiddenName.textSize = preferenceHelper.appTextSize
Log.d("Tag", "Draw Adapter: ${appInfo.appName}")

if (preferenceHelper.showAppIcon) {
Expand Down

0 comments on commit 5f7ae81

Please sign in to comment.