Fix: App name Gravity and Layout Params.

Signed-off-by: HeCodes2Much <wayne6324@gmail.com>
This commit is contained in:
HeCodes2Much
2024-07-12 17:07:06 +01:00
parent 96b221a704
commit 7622aa68ca
2 changed files with 15 additions and 17 deletions

View File

@@ -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) {

View File

@@ -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) {