WIP Cards

This commit is contained in:
Philipp Heckel 2022-04-27 20:58:23 -04:00
parent 835ace34cd
commit 0d790a447f
8 changed files with 268 additions and 211 deletions

View file

@ -1,6 +1,7 @@
package io.heckel.ntfy.ui
import android.content.Context
import androidx.core.content.ContextCompat
import io.heckel.ntfy.R
import io.heckel.ntfy.util.isDarkThemeOn
@ -13,6 +14,10 @@ class Colors {
return if (isDarkThemeOn(context)) R.color.gray_dark else R.color.gray_light
}
fun itemSelectedBackgroundColor(context: Context): Int {
return ContextCompat.getColor(context, itemSelectedBackground(context))
}
fun statusBarNormal(context: Context): Int {
return if (isDarkThemeOn(context)) R.color.black_light else R.color.teal
}

View file

@ -14,6 +14,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.cardview.widget.CardView
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.content.FileProvider
@ -64,6 +65,7 @@ class DetailAdapter(private val activity: Activity, private val repository: Repo
class DetailViewHolder(private val activity: Activity, private val repository: Repository, itemView: View, private val selected: Set<String>, val onClick: (Notification) -> Unit, val onLongClick: (Notification) -> Unit) :
RecyclerView.ViewHolder(itemView) {
private var notification: Notification? = null
private val cardView: CardView = itemView.findViewById(R.id.detail_item_card)
private val priorityImageView: ImageView = itemView.findViewById(R.id.detail_item_priority_image)
private val dateView: TextView = itemView.findViewById(R.id.detail_item_date_text)
private val titleView: TextView = itemView.findViewById(R.id.detail_item_title_text)
@ -85,8 +87,8 @@ class DetailAdapter(private val activity: Activity, private val repository: Repo
dateView.text = formatDateShort(notification.timestamp)
messageView.text = maybeAppendActionErrors(formatMessage(notification), notification)
newDotImageView.visibility = if (notification.notificationId == 0) View.GONE else View.VISIBLE
itemView.setOnClickListener { onClick(notification) }
itemView.setOnLongClickListener { onLongClick(notification); true }
cardView.setOnClickListener { onClick(notification) }
cardView.setOnLongClickListener { onLongClick(notification); true }
if (notification.title != "") {
titleView.visibility = View.VISIBLE
titleView.text = formatTitle(notification)
@ -100,7 +102,7 @@ class DetailAdapter(private val activity: Activity, private val repository: Repo
tagsView.visibility = View.GONE
}
if (selected.contains(notification.id)) {
itemView.setBackgroundResource(Colors.itemSelectedBackground(context))
cardView.setCardBackgroundColor(Colors.itemSelectedBackgroundColor(context))
}
val attachment = notification.attachment
val exists = if (attachment?.contentUri != null) fileExists(context, attachment.contentUri) else false

View file

@ -5,6 +5,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
@ -47,6 +48,7 @@ class MainAdapter(private val repository: Repository, private val onClick: (Subs
RecyclerView.ViewHolder(itemView) {
private var subscription: Subscription? = null
private val context: Context = itemView.context
private val cardView: CardView = itemView.findViewById(R.id.main_item_card)
private val nameView: TextView = itemView.findViewById(R.id.main_item_text)
private val statusView: TextView = itemView.findViewById(R.id.main_item_status)
private val dateView: TextView = itemView.findViewById(R.id.main_item_date)
@ -97,10 +99,10 @@ class MainAdapter(private val repository: Repository, private val onClick: (Subs
newItemsView.visibility = View.VISIBLE
newItemsView.text = if (subscription.newCount <= 99) subscription.newCount.toString() else "99+"
}
itemView.setOnClickListener { onClick(subscription) }
itemView.setOnLongClickListener { onLongClick(subscription); true }
cardView.setOnClickListener { onClick(subscription) }
cardView.setOnLongClickListener { onLongClick(subscription); true }
if (selected.contains(subscription.id)) {
itemView.setBackgroundResource(Colors.itemSelectedBackground(context))
cardView.setCardBackgroundColor(Colors.itemSelectedBackgroundColor(context))
}
}
}

View file

@ -5,13 +5,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.DetailActivity">
tools:context=".ui.DetailActivity"
>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/detail_notification_list_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/detail_notification_list"
@ -19,7 +18,9 @@
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:layout_marginTop="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:clipToPadding="false"
android:background="?android:attr/selectableItemBackground"
app:layoutManager="LinearLayoutManager"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View file

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -134,7 +136,6 @@
android:text="@string/main_banner_json_stream_button_dismiss"
tools:layout_editor_absoluteX="260dp" tools:layout_editor_absoluteY="83dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/main_banner_json_stream_learn_mode"
style="@style/Widget.MaterialComponents.Button.TextButton"
@ -149,7 +150,6 @@
android:id="@+id/main_subscriptions_list_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:visibility="visible"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
@ -158,6 +158,9 @@
android:id="@+id/main_subscriptions_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:clipToPadding="false"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"

View file

@ -1,128 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal" android:clickable="true"
android:focusable="true"
>
<TextView
android:text="Sun, October 31, 2021, 10:43:12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/detail_item_date_text"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="10dp" app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="10dp"/>
<TextView
android:layout_width="10dp"
android:layout_height="10dp" android:id="@+id/detail_item_new_dot"
android:layout_gravity="center"
android:background="@drawable/ic_circle"
android:gravity="center"
app:layout_constraintTop_toTopOf="@+id/detail_item_date_text"
app:layout_constraintBottom_toBottomOf="@+id/detail_item_date_text"
android:layout_marginTop="1dp"
app:layout_constraintStart_toEndOf="@id/detail_item_priority_image"
android:layout_marginStart="5dp"/>
<ImageButton
android:layout_width="46dp"
android:layout_height="26dp" app:srcCompat="@drawable/ic_more_horiz_gray_24dp"
android:id="@+id/detail_item_menu_button"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackground" android:paddingTop="-5dp"
android:layout_marginTop="5dp"/>
<TextView
android:text="This is a very very very long message. It could be as long as 1024 charaters, which is a lot more than you'd think. No, really so far this message is barely 180 characters long. I can't believe how long 1024 bytes are. This is outrageous. Oh you know what, I think I won't type the whole thing. This seems a little too long for a sample text. Well, anyway, it was nice chatting. So far this message is about 400 bytes long. So maybe just double what you see and that's that."
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detail_item_message_text"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:autoLink="web"
app:layout_constraintTop_toBottomOf="@id/detail_item_title_text"
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="10dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="10dp"
app:layout_constraintBottom_toTopOf="@id/detail_item_attachment_image"/>
<TextView
android:text="This is an optional title. It can also be a little longer but not too long."
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detail_item_title_text"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:autoLink="web"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="10dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="10dp" android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@+id/detail_item_date_text"/>
<ImageView
android:layout_width="16dp"
android:layout_height="16dp" app:srcCompat="@drawable/ic_priority_5_24dp"
android:id="@+id/detail_item_priority_image"
app:layout_constraintStart_toEndOf="@+id/detail_item_date_text"
app:layout_constraintTop_toTopOf="@+id/detail_item_date_text"
app:layout_constraintBottom_toBottomOf="@+id/detail_item_date_text" android:layout_marginStart="5dp"/>
<com.google.android.material.imageview.ShapeableImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" app:srcCompat="@drawable/ic_cancel_gray_24dp"
android:id="@+id/detail_item_attachment_image" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/detail_item_message_text"
android:layout_marginStart="10dp" android:layout_marginEnd="10dp"
android:scaleType="centerCrop"
android:adjustViewBounds="true" android:maxHeight="150dp" android:layout_marginTop="5dp"
app:shapeAppearanceOverlay="@style/roundedCornersImageView" android:visibility="visible"
android:layout_marginBottom="3dp" app:layout_constraintBottom_toTopOf="@id/detail_item_tags_text"/>
<TextView
android:text="Tags: ssh, zfs"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detail_item_tags_text"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="10dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="10dp"
app:layout_constraintTop_toBottomOf="@id/detail_item_attachment_image"
app:layout_constraintBottom_toTopOf="@id/detail_item_attachment_file_box"
app:layout_constraintHorizontal_bias="0.0" android:layout_marginTop="2dp"
/>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/detail_item_card"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_marginBottom="0dp"
android:padding="3dp"
android:paddingBottom="3dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="3dp"
app:cardElevation="2dp"
app:cardMaxElevation="2dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/detail_item_tags_text"
android:id="@+id/detail_item_attachment_file_box" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginStart="10dp" android:layout_marginEnd="10dp"
app:layout_constraintBottom_toTopOf="@id/detail_item_padding_bottom"
android:visibility="visible" android:layout_marginTop="2dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?android:attr/selectableItemBackground"
android:clickable="true" android:focusable="true" android:padding="4dp" android:paddingStart="0dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content" app:srcCompat="@drawable/ic_cancel_gray_24dp"
android:id="@+id/detail_item_attachment_file_icon" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/detail_item_attachment_file_info" android:layout_marginEnd="5dp"
app:layout_constraintBottom_toBottomOf="parent"
/>
android:focusable="true"
android:paddingBottom="5dp">
<TextView
android:text="attachment.jpg\n58 MB, not downloaded, expires 1/2/2022 10:30 PM"
android:text="Sun, October 31, 2021, 10:43:12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/detail_item_date_text"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="10dp" app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="10dp"/>
<TextView
android:layout_width="10dp"
android:layout_height="10dp" android:id="@+id/detail_item_new_dot"
android:layout_gravity="center"
android:background="@drawable/ic_circle"
android:gravity="center"
app:layout_constraintTop_toTopOf="@+id/detail_item_date_text"
app:layout_constraintBottom_toBottomOf="@+id/detail_item_date_text"
android:layout_marginTop="1dp"
app:layout_constraintStart_toEndOf="@id/detail_item_priority_image"
android:layout_marginStart="5dp"/>
<ImageButton
android:layout_width="46dp"
android:layout_height="26dp" app:srcCompat="@drawable/ic_more_horiz_gray_24dp"
android:id="@+id/detail_item_menu_button"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackground" android:paddingTop="-5dp"
android:layout_marginTop="5dp"/>
<TextView
android:text="This is a very very very long message. It could be as long as 1024 charaters, which is a lot more than you'd think. No, really so far this message is barely 180 characters long. I can't believe how long 1024 bytes are. This is outrageous. Oh you know what, I think I won't type the whole thing. This seems a little too long for a sample text. Well, anyway, it was nice chatting. So far this message is about 400 bytes long. So maybe just double what you see and that's that."
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detail_item_attachment_file_info"
android:id="@+id/detail_item_message_text"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:autoLink="web"
app:layout_constraintTop_toBottomOf="@id/detail_item_title_text"
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="10dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="10dp"
app:layout_constraintBottom_toTopOf="@id/detail_item_attachment_image"/>
<TextView
android:text="This is an optional title. It can also be a little longer but not too long."
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detail_item_title_text"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:autoLink="web"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="10dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="10dp" android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@+id/detail_item_date_text"/>
<ImageView
android:layout_width="16dp"
android:layout_height="16dp" app:srcCompat="@drawable/ic_priority_5_24dp"
android:id="@+id/detail_item_priority_image"
app:layout_constraintStart_toEndOf="@+id/detail_item_date_text"
app:layout_constraintTop_toTopOf="@+id/detail_item_date_text"
app:layout_constraintBottom_toBottomOf="@+id/detail_item_date_text" android:layout_marginStart="5dp"/>
<com.google.android.material.imageview.ShapeableImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" app:srcCompat="@drawable/ic_cancel_gray_24dp"
android:id="@+id/detail_item_attachment_image" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/detail_item_message_text"
android:layout_marginStart="10dp" android:layout_marginEnd="10dp"
android:scaleType="centerCrop"
android:adjustViewBounds="true" android:maxHeight="150dp" android:layout_marginTop="5dp"
app:shapeAppearanceOverlay="@style/roundedCornersImageView" android:visibility="visible"
android:layout_marginBottom="3dp" app:layout_constraintBottom_toTopOf="@id/detail_item_tags_text"/>
<TextView
android:text="Tags: ssh, zfs"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detail_item_tags_text"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toEndOf="@+id/detail_item_attachment_file_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/detail_item_attachment_file_icon"
app:layout_constraintBottom_toBottomOf="@+id/detail_item_attachment_file_icon"/>
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="10dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="10dp"
app:layout_constraintTop_toBottomOf="@id/detail_item_attachment_image"
app:layout_constraintBottom_toTopOf="@id/detail_item_attachment_file_box"
app:layout_constraintHorizontal_bias="0.0" android:layout_marginTop="2dp"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/detail_item_tags_text"
android:id="@+id/detail_item_attachment_file_box" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginStart="10dp" android:layout_marginEnd="10dp"
app:layout_constraintBottom_toTopOf="@id/detail_item_padding_bottom"
android:visibility="visible" android:layout_marginTop="2dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true" android:focusable="true" android:padding="4dp" android:paddingStart="0dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content" app:srcCompat="@drawable/ic_cancel_gray_24dp"
android:id="@+id/detail_item_attachment_file_icon" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/detail_item_attachment_file_info" android:layout_marginEnd="5dp"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:text="attachment.jpg\n58 MB, not downloaded, expires 1/2/2022 10:30 PM"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/detail_item_attachment_file_info"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toEndOf="@+id/detail_item_attachment_file_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/detail_item_attachment_file_icon"
app:layout_constraintBottom_toBottomOf="@+id/detail_item_attachment_file_icon"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="5dp" android:id="@+id/detail_item_padding_bottom"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/detail_item_attachment_file_box"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="5dp" android:id="@+id/detail_item_padding_bottom"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/detail_item_attachment_file_box"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

View file

@ -1,75 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal" android:clickable="true"
android:focusable="true" android:paddingEnd="15dp"
android:paddingStart="15dp">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp" app:srcCompat="@drawable/ic_sms_gray_24dp"
android:id="@+id/main_item_image" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="13dp"/>
<TextView
android:text="ntfy.sh/example"
android:layout_width="0dp"
android:layout_height="wrap_content" android:id="@+id/main_item_text"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/main_item_status"
android:layout_marginStart="10dp" app:layout_constraintStart_toEndOf="@+id/main_item_image"
app:layout_constraintVertical_bias="0.0" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary" android:layout_marginTop="10dp"
app:layout_constraintEnd_toStartOf="@+id/main_item_instant_image"/>
<TextView
android:text="89 notifications, reconnecting ... This may wrap in the case of UnifiedPush"
android:layout_width="0dp"
android:layout_height="wrap_content" android:id="@+id/main_item_status"
app:layout_constraintStart_toStartOf="@+id/main_item_text"
app:layout_constraintTop_toBottomOf="@+id/main_item_text" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="10dp" app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@id/main_item_new" android:layout_marginEnd="10dp"/>
<ImageView
android:layout_width="20dp"
android:layout_height="24dp" app:srcCompat="@drawable/ic_notifications_off_time_gray_outline_24dp"
android:id="@+id/main_item_notification_disabled_until_image"
app:layout_constraintTop_toTopOf="@+id/main_item_text"
app:layout_constraintEnd_toStartOf="@+id/main_item_notification_disabled_forever_image"
android:paddingTop="3dp" android:layout_marginEnd="3dp"/>
<ImageView
android:layout_width="20dp"
android:layout_height="24dp" app:srcCompat="@drawable/ic_notifications_off_gray_outline_24dp"
android:id="@+id/main_item_notification_disabled_forever_image"
app:layout_constraintTop_toTopOf="@+id/main_item_notification_disabled_until_image"
app:layout_constraintEnd_toStartOf="@+id/main_item_instant_image" android:paddingTop="3dp"
android:layout_marginEnd="3dp"/>
<ImageView
android:layout_width="20dp"
android:layout_height="24dp" app:srcCompat="@drawable/ic_bolt_gray_24dp"
android:id="@+id/main_item_instant_image"
app:layout_constraintTop_toTopOf="@+id/main_item_notification_disabled_forever_image"
app:layout_constraintEnd_toStartOf="@+id/main_item_date" android:paddingTop="3dp"/>
<TextView
android:text="10:13"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/main_item_date"
app:layout_constraintTop_toTopOf="@+id/main_item_instant_image"
app:layout_constraintEnd_toEndOf="parent"
android:paddingTop="2dp"/>
<TextView
android:text="99+"
android:layout_width="24dp"
android:layout_height="24dp" android:id="@+id/main_item_new"
android:layout_marginTop="3dp"
android:layout_gravity="center"
android:background="@drawable/ic_circle"
android:gravity="center"
android:textColor="@android:color/white"
app:layout_constraintTop_toBottomOf="@+id/main_item_date"
app:layout_constraintEnd_toEndOf="@+id/main_item_date"
app:layout_constraintStart_toEndOf="@+id/main_item_instant_image"
android:textSize="10sp" android:textStyle="bold"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_item_card"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_marginBottom="0dp"
android:padding="0dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="3dp"
app:cardElevation="2dp"
app:cardMaxElevation="2dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingEnd="15dp"
android:paddingStart="15dp"
android:background="?android:attr/selectableItemBackground"
android:focusable="true"
android:paddingBottom="3dp">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp" app:srcCompat="@drawable/ic_sms_gray_24dp"
android:id="@+id/main_item_image" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="13dp"/>
<TextView
android:text="ntfy.sh/example"
android:layout_width="0dp"
android:layout_height="wrap_content" android:id="@+id/main_item_text"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/main_item_status"
android:layout_marginStart="10dp" app:layout_constraintStart_toEndOf="@+id/main_item_image"
app:layout_constraintVertical_bias="0.0" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary" android:layout_marginTop="10dp"
app:layout_constraintEnd_toStartOf="@+id/main_item_instant_image"/>
<TextView
android:text="89 notifications, reconnecting ... This may wrap in the case of UnifiedPush"
android:layout_width="0dp"
android:layout_height="wrap_content" android:id="@+id/main_item_status"
app:layout_constraintStart_toStartOf="@+id/main_item_text"
app:layout_constraintTop_toBottomOf="@+id/main_item_text" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="10dp" app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@id/main_item_new" android:layout_marginEnd="10dp"/>
<ImageView
android:layout_width="20dp"
android:layout_height="24dp" app:srcCompat="@drawable/ic_notifications_off_time_gray_outline_24dp"
android:id="@+id/main_item_notification_disabled_until_image"
app:layout_constraintTop_toTopOf="@+id/main_item_text"
app:layout_constraintEnd_toStartOf="@+id/main_item_notification_disabled_forever_image"
android:paddingTop="3dp" android:layout_marginEnd="3dp"/>
<ImageView
android:layout_width="20dp"
android:layout_height="24dp" app:srcCompat="@drawable/ic_notifications_off_gray_outline_24dp"
android:id="@+id/main_item_notification_disabled_forever_image"
app:layout_constraintTop_toTopOf="@+id/main_item_notification_disabled_until_image"
app:layout_constraintEnd_toStartOf="@+id/main_item_instant_image" android:paddingTop="3dp"
android:layout_marginEnd="3dp"/>
<ImageView
android:layout_width="20dp"
android:layout_height="24dp" app:srcCompat="@drawable/ic_bolt_gray_24dp"
android:id="@+id/main_item_instant_image"
app:layout_constraintTop_toTopOf="@+id/main_item_notification_disabled_forever_image"
app:layout_constraintEnd_toStartOf="@+id/main_item_date" android:paddingTop="3dp"/>
<TextView
android:text="10:13"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/main_item_date"
app:layout_constraintTop_toTopOf="@+id/main_item_instant_image"
app:layout_constraintEnd_toEndOf="parent"
android:paddingTop="2dp"/>
<TextView
android:text="99+"
android:layout_width="24dp"
android:layout_height="24dp" android:id="@+id/main_item_new"
android:layout_marginTop="3dp"
android:layout_gravity="center"
android:background="@drawable/ic_circle"
android:gravity="center"
android:textColor="@android:color/white"
app:layout_constraintTop_toBottomOf="@+id/main_item_date"
app:layout_constraintEnd_toEndOf="@+id/main_item_date"
app:layout_constraintStart_toEndOf="@+id/main_item_instant_image"
android:textSize="10sp" android:textStyle="bold"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

View file

@ -1,11 +1,12 @@
<resources>
<!-- Main app theme; dark theme styles see values-night/styles.xml -->
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/teal</item>
<item name="colorAccent">@color/teal</item> <!-- checkboxes, text fields -->
<item name="android:colorBackground">@color/white</item> <!-- background -->
<item name="android:colorBackground">@color/gray_light</item> <!-- background -->
<item name="android:statusBarColor">@color/teal</item>
<item name="actionModeBackground">@color/teal_dark</item>
<item name="android:popupMenuStyle">@style/PopupMenu</item>
</style>
<!-- Danger buttons & text -->
@ -24,4 +25,8 @@
<item name="cornerFamily">rounded</item>
<item name="cornerSize">5dp</item>
</style>
<style name="PopupMenu" parent="@style/Widget.Material3.PopupMenu">
<item name="android:popupBackground">@color/white</item>
</style>
</resources>