Skip to content

Commit

Permalink
Fix: App name Gravity and Layout Params.
Browse files Browse the repository at this point in the history
Signed-off-by: HeCodes2Much <wayne6324@gmail.com>
  • Loading branch information
CreativeCodeCat committed Jul 12, 2024
1 parent 96b221a commit 7622aa6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 7622aa6

Please sign in to comment.