From e351884abe66fede639390b2ac89cdee1a395a4c Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Fri, 24 Jun 2022 14:24:49 -0400 Subject: [PATCH] DAbble --- .../java/io/heckel/ntfy/ui/DetailAdapter.kt | 13 +++-- .../main/res/layout/fragment_detail_item.xml | 47 ++++++++++--------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt index 626b2fa..4a19d87 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt @@ -23,6 +23,7 @@ import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import androidx.core.content.FileProvider import androidx.core.view.allViews +import androidx.core.view.marginLeft import androidx.core.widget.TextViewCompat import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter @@ -210,16 +211,20 @@ class DetailAdapter(private val activity: Activity, private val lifecycleScope: actionsWrapperView.addView(actionsFlow) } - private fun addButtonToCard(button: MaterialButton) { + private fun addButtonToCard(button: View) { actionsWrapperView.addView(button) actionsFlow.addView(button) } - private fun createCardButton(context: Context, label: String, onClick: () -> Boolean): MaterialButton { - val button = MaterialButton(context, null, R.attr.borderlessButtonStyle) + private fun createCardButton(context: Context, label: String, onClick: () -> Boolean): View { + val layoutParams = ConstraintLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) + layoutParams.setMargins(0, 0, 0, 0) + + val button = MaterialButton(context, null, R.attr.materialButtonOutlinedStyle) button.id = View.generateViewId() - button.layoutParams = ConstraintLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) + button.layoutParams = layoutParams button.text = label + button.setPadding(0, 0,0,0) button.setOnClickListener { onClick() } return button } diff --git a/app/src/main/res/layout/fragment_detail_item.xml b/app/src/main/res/layout/fragment_detail_item.xml index dc875f9..732976d 100644 --- a/app/src/main/res/layout/fragment_detail_item.xml +++ b/app/src/main/res/layout/fragment_detail_item.xml @@ -25,7 +25,7 @@ android:orientation="horizontal" android:background="?android:attr/selectableItemBackground" android:focusable="true" - android:paddingBottom="6dp" android:paddingTop="6dp"> + android:paddingBottom="7dp" android:paddingTop="7dp"> + android:layout_marginStart="12dp"/> + android:visibility="visible" + android:padding="0dp" android:layout_marginStart="12dp"> - @@ -165,18 +165,23 @@ android:text="Open DuckDuckGo" style="?attr/borderlessButtonStyle" android:layout_width="wrap_content" - android:layout_height="wrap_content" android:id="@+id/button1" tools:visibility="visible" tools:layout_editor_absoluteY="4dp" tools:layout_editor_absoluteX="4dp" android:textSize="14sp"/> + android:layout_height="wrap_content" android:id="@+id/button1" tools:visibility="visible" tools:layout_editor_absoluteY="4dp" tools:layout_editor_absoluteX="4dp" android:textSize="14sp" android:padding="0dp" android:layout_margin="0dp"/>