@@ -6,6 +6,7 @@ import android.util.Log
6
6
import android.view.Gravity
7
7
import android.view.View
8
8
import androidx.appcompat.widget.LinearLayoutCompat
9
+ import androidx.core.view.marginTop
9
10
import androidx.recyclerview.widget.RecyclerView
10
11
import com.github.droidworksstudio.launcher.data.entities.AppInfo
11
12
import com.github.droidworksstudio.launcher.databinding.ItemHomeBinding
@@ -22,19 +23,18 @@ class HomeViewHolder @Inject constructor(
22
23
@SuppressLint(" ClickableViewAccessibility" )
23
24
fun bind (appInfo : AppInfo ) {
24
25
binding.apply {
25
- val layoutParams = LinearLayoutCompat .LayoutParams (
26
- LinearLayoutCompat .LayoutParams .WRAP_CONTENT ,
27
- LinearLayoutCompat .LayoutParams .WRAP_CONTENT
28
- ).apply {
29
- gravity = preferenceHelper.homeAppAlignment
30
- topMargin = preferenceHelper.homeAppPadding.toInt()
31
- bottomMargin = preferenceHelper.homeAppPadding.toInt()
32
- }
26
+ // Get the current LayoutParams of appHomeName
27
+ val layoutParams = appHomeName.layoutParams as LinearLayoutCompat .LayoutParams
28
+
29
+ // Set the margins
30
+ layoutParams.topMargin = preferenceHelper.homeAppPadding.toInt()
31
+ layoutParams.bottomMargin = preferenceHelper.homeAppPadding.toInt()
33
32
34
33
appHomeName.layoutParams = layoutParams
35
34
appHomeName.text = appInfo.appName
36
35
appHomeName.setTextColor(preferenceHelper.appColor)
37
36
appHomeName.textSize = preferenceHelper.appTextSize
37
+ appHomeName.gravity = preferenceHelper.homeAppAlignment
38
38
Log .d(" Tag" , " Home Adapter Color: ${preferenceHelper.appColor} " )
39
39
40
40
if (preferenceHelper.showAppIcon) {
0 commit comments