diff --git a/ui/src/main/java/de/mm20/launcher2/ui/legacy/component/EditFavoritesView.kt b/ui/src/main/java/de/mm20/launcher2/ui/legacy/component/EditFavoritesView.kt index aac088de..88d1a03f 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/legacy/component/EditFavoritesView.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/legacy/component/EditFavoritesView.kt @@ -8,9 +8,11 @@ import android.widget.FrameLayout import android.widget.TextView import androidx.annotation.StringRes import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.widget.AppCompatTextView import androidx.core.content.ContextCompat import androidx.core.view.updateMargins import androidx.core.widget.TextViewCompat +import com.google.android.material.textview.MaterialTextView import de.mm20.launcher2.favorites.FavoritesItem import de.mm20.launcher2.favorites.FavoritesViewModel import de.mm20.launcher2.ktx.dp @@ -18,6 +20,8 @@ import de.mm20.launcher2.ktx.lifecycleScope import de.mm20.launcher2.ktx.setPadding import de.mm20.launcher2.ui.R import de.mm20.launcher2.ui.databinding.DialogEditFavoritesBinding +import de.mm20.launcher2.ui.databinding.EditFavoritesRowBinding +import de.mm20.launcher2.ui.databinding.EditFavoritesTitleBinding import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -125,20 +129,9 @@ class EditFavoritesView @JvmOverloads constructor( } private fun getLabel(@StringRes label: Int): FrameLayout { - return FrameLayout(context).also { - it.addView(TextView(context).also { - TextViewCompat.setTextAppearance(it, R.style.TextAppearance_EditFavorites) - it.setText(label) - it.setPadding((8 * dp).toInt(), (4 * dp).toInt()) - it.layoutParams = MarginLayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).also { - it.updateMargins(top = (2 * dp).toInt()) - } - it.setBackgroundColor(ContextCompat.getColor(context, R.color.color_divider)) - }) - it.addView(View(context).also { - it.visibility = View.GONE - }) - } + return EditFavoritesTitleBinding.inflate(LayoutInflater.from(context)).also { + it.text.setText(label) + }.root } } \ No newline at end of file diff --git a/ui/src/main/res/layout/edit_favorites_title.xml b/ui/src/main/res/layout/edit_favorites_title.xml new file mode 100644 index 00000000..d5d0b1ef --- /dev/null +++ b/ui/src/main/res/layout/edit_favorites_title.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/ui/src/main/res/values/EditFavoritesView.xml b/ui/src/main/res/values/EditFavoritesView.xml deleted file mode 100644 index 1a2b80af..00000000 --- a/ui/src/main/res/values/EditFavoritesView.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - -