From 523bf092db78ef87283ec06ae8c450baf68af357 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Thu, 28 Apr 2022 22:04:46 -0400 Subject: [PATCH] Dark mode, proper alignment --- .../java/io/heckel/ntfy/ui/MainAdapter.kt | 8 +- app/src/main/res/layout/activity_detail.xml | 1 + app/src/main/res/layout/activity_main.xml | 28 +-- .../main/res/layout/fragment_detail_item.xml | 11 +- .../main/res/layout/fragment_main_item.xml | 169 ++++++++---------- app/src/main/res/values-night/styles.xml | 8 + app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/styles.xml | 17 +- 8 files changed, 116 insertions(+), 127 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt b/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt index 02000d2..d0d41f9 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt @@ -5,7 +5,6 @@ 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 @@ -48,7 +47,6 @@ 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) @@ -99,10 +97,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+" } - cardView.setOnClickListener { onClick(subscription) } - cardView.setOnLongClickListener { onLongClick(subscription); true } + itemView.setOnClickListener { onClick(subscription) } + itemView.setOnLongClickListener { onLongClick(subscription); true } if (selected.contains(subscription.id)) { - cardView.setCardBackgroundColor(Colors.itemSelectedBackgroundColor(context)) + itemView.setBackgroundResource(Colors.itemSelectedBackground(context)) } } } diff --git a/app/src/main/res/layout/activity_detail.xml b/app/src/main/res/layout/activity_detail.xml index 8f02bd6..9a7965c 100644 --- a/app/src/main/res/layout/activity_detail.xml +++ b/app/src/main/res/layout/activity_detail.xml @@ -8,6 +8,7 @@ tools:context=".ui.DetailActivity" > - + + - + app:shapeAppearance="?shapeAppearanceLargeComponent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + android:id="@+id/main_banner_battery" + android:visibility="visible" + > + diff --git a/app/src/main/res/layout/fragment_detail_item.xml b/app/src/main/res/layout/fragment_detail_item.xml index e079d43..990786c 100644 --- a/app/src/main/res/layout/fragment_detail_item.xml +++ b/app/src/main/res/layout/fragment_detail_item.xml @@ -2,6 +2,7 @@ + android:paddingBottom="6dp" android:paddingTop="6dp"> + /> - - - - - - - - - - - - + + + + + + + + + + + diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 2a7f99c..09935eb 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -30,4 +30,12 @@ @color/black_light @color/teal_light + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a03ba0e..d1209b4 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -12,5 +12,6 @@ #eeeeee #282828 + #202020 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 28ff522..71c7f64 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -3,30 +3,31 @@ - - + + + + - -