From d2535e05236ef7c80162e627e31ae285869a00c0 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Sat, 18 Jun 2022 19:12:02 -0400 Subject: [PATCH] WIP --- .../java/io/heckel/ntfy/ui/DetailAdapter.kt | 4 +- .../main/res/layout/fragment_detail_item.xml | 52 ++++++++++++------- 2 files changed, 37 insertions(+), 19 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 fbc0b82..626b2fa 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailAdapter.kt @@ -10,6 +10,7 @@ import android.net.Uri import android.os.Build import android.os.Environment import android.provider.MediaStore +import android.util.TypedValue import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -22,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.widget.TextViewCompat import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView @@ -189,7 +191,7 @@ class DetailAdapter(private val activity: Activity, private val lifecycleScope: private fun maybeRenderActions(context: Context, notification: Notification) { if (notification.actions != null && notification.actions.isNotEmpty()) { actionsWrapperView.visibility = View.VISIBLE - val actionsCount = min(notification.actions.size, 3) // per documentation, only 3 actions are available + val actionsCount = Math.min(notification.actions.size, 3) // per documentation, only 3 actions are available for (i in 0 until actionsCount) { val action = notification.actions[i] val label = formatActionLabel(action) diff --git a/app/src/main/res/layout/fragment_detail_item.xml b/app/src/main/res/layout/fragment_detail_item.xml index 33a34bc..dc875f9 100644 --- a/app/src/main/res/layout/fragment_detail_item.xml +++ b/app/src/main/res/layout/fragment_detail_item.xml @@ -1,7 +1,7 @@ + android:layout_width="match_parent" + android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/detail_item_padding_bottom" + android:id="@+id/detail_item_actions_wrapper" app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" android:layout_marginStart="8dp" android:layout_marginEnd="10dp" + app:layout_constraintBottom_toBottomOf="parent" + android:visibility="visible" android:layout_marginTop="2dp" + android:padding="0dp"> + + + + android:layout_width="0dp" + android:layout_height="wrap_content" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:flow_wrapMode="chain2" + app:flow_horizontalStyle="packed" + android:id="@+id/detail_item_actions_flow" + app:layout_constraintStart_toStartOf="parent" + app:flow_horizontalBias="0" + app:flow_verticalGap="0dp" app:flow_horizontalGap="0dp" + app:constraint_referenced_ids="button1,button2,button3"/>