diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/hidden/HiddenViewHolder.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/hidden/HiddenViewHolder.kt index db5c150d..27c9de9e 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/hidden/HiddenViewHolder.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/hidden/HiddenViewHolder.kt @@ -19,20 +19,18 @@ class HiddenViewHolder( RecyclerView.ViewHolder(binding.root) { fun bind(appInfo: AppInfo) { binding.apply { - // Get the current LayoutParams of appFavoriteName - val layoutParams = LinearLayoutCompat.LayoutParams( - LinearLayoutCompat.LayoutParams.WRAP_CONTENT, - LinearLayoutCompat.LayoutParams.WRAP_CONTENT - ).apply { - gravity = Gravity.START - topMargin = preferenceHelper.homeAppPadding.toInt() - bottomMargin = preferenceHelper.homeAppPadding.toInt() - } + // Get the current LayoutParams of appHiddenName + 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 + appHiddenName.gravity = Gravity.START Log.d("Tag", "Draw Adapter: ${appInfo.appName}") if (preferenceHelper.showAppIcon) { diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/home/HomeViewHolder.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/home/HomeViewHolder.kt index 544507e4..02c79018 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/home/HomeViewHolder.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/home/HomeViewHolder.kt @@ -6,6 +6,7 @@ import android.util.Log import android.view.Gravity import android.view.View import androidx.appcompat.widget.LinearLayoutCompat +import androidx.core.view.marginTop import androidx.recyclerview.widget.RecyclerView import com.github.droidworksstudio.launcher.data.entities.AppInfo import com.github.droidworksstudio.launcher.databinding.ItemHomeBinding @@ -22,19 +23,18 @@ class HomeViewHolder @Inject constructor( @SuppressLint("ClickableViewAccessibility") fun bind(appInfo: AppInfo) { binding.apply { - val layoutParams = LinearLayoutCompat.LayoutParams( - LinearLayoutCompat.LayoutParams.WRAP_CONTENT, - LinearLayoutCompat.LayoutParams.WRAP_CONTENT - ).apply { - gravity = preferenceHelper.homeAppAlignment - topMargin = preferenceHelper.homeAppPadding.toInt() - bottomMargin = preferenceHelper.homeAppPadding.toInt() - } + // Get the current LayoutParams of appHomeName + val layoutParams = appHomeName.layoutParams as LinearLayoutCompat.LayoutParams + + // Set the margins + layoutParams.topMargin = preferenceHelper.homeAppPadding.toInt() + layoutParams.bottomMargin = preferenceHelper.homeAppPadding.toInt() appHomeName.layoutParams = layoutParams appHomeName.text = appInfo.appName appHomeName.setTextColor(preferenceHelper.appColor) appHomeName.textSize = preferenceHelper.appTextSize + appHomeName.gravity = preferenceHelper.homeAppAlignment Log.d("Tag", "Home Adapter Color: ${preferenceHelper.appColor}") if (preferenceHelper.showAppIcon) {