remove delimiters from treatments tabs

This commit is contained in:
Milos Kozak 2022-04-19 12:20:31 +02:00
parent 786b13ba42
commit 7e15f04592
14 changed files with 91 additions and 160 deletions

View file

@ -269,8 +269,6 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
}
holder.binding.calculation.tag = ml
val nextTimestamp = if (mealLinks.size != position + 1) timestamp(mealLinks[position + 1]) else 0L
holder.binding.delimiter.visibility = dateUtil.isSameDayGroup(timestamp(ml), nextTimestamp).toVisibility()
}
override fun getItemCount() = mealLinks.size

View file

@ -173,8 +173,6 @@ class TreatmentsCareportalFragment : DaggerFragment() {
actionHelper.updateSelection(position, therapyEvent, holder.binding.cbRemove.isChecked)
}
holder.binding.cbRemove.isChecked = actionHelper.isSelected(position)
val nextTimestamp = if (therapyList.size != position + 1) therapyList[position + 1].timestamp else 0L
holder.binding.delimiter.visibility = dateUtil.isSameDayGroup(therapyEvent.timestamp, nextTimestamp).toVisibility()
}
override fun getItemCount() = therapyList.size

View file

@ -163,8 +163,6 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
}
holder.binding.cbRemove.isChecked = actionHelper.isSelected(position)
}
val nextTimestamp = if (extendedBolusList.size != position + 1) extendedBolusList[position + 1].timestamp else 0L
holder.binding.delimiter.visibility = dateUtil.isSameDayGroup(extendedBolus.timestamp, nextTimestamp).toVisibility()
}
override fun getItemCount() = extendedBolusList.size

View file

@ -214,8 +214,6 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
}
holder.binding.clone.visibility = (profileSwitch is ProfileSealed.PS).toVisibility()
holder.binding.spacer.visibility = (profileSwitch is ProfileSealed.PS).toVisibility()
val nextTimestamp = if (profileSwitchList.size != position + 1) profileSwitchList[position + 1].timestamp else 0L
holder.binding.delimiter.visibility = dateUtil.isSameDayGroup(profileSwitch.timestamp, nextTimestamp).toVisibility()
}
override fun getItemCount() = profileSwitchList.size

View file

@ -192,8 +192,6 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
else -> holder.binding.reasonColon.currentTextColor
}
)
val nextTimestamp = if (tempTargetList.size != position + 1) tempTargetList[position + 1].timestamp else 0L
holder.binding.delimiter.visibility = dateUtil.isSameDayGroup(tempTarget.timestamp, nextTimestamp).toVisibility()
}
override fun getItemCount() = tempTargetList.size

View file

@ -204,8 +204,6 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
}
holder.binding.cbRemove.isChecked = actionHelper.isSelected(position)
}
val nextTimestamp = if (tempBasalList.size != position + 1) tempBasalList[position + 1].timestamp else 0L
holder.binding.delimiter.visibility = dateUtil.isSameDayGroup(tempBasal.timestamp, nextTimestamp).toVisibility()
}
override fun getItemCount() = tempBasalList.size

View file

@ -134,8 +134,6 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
holder.binding.iconSource.setImageResource(userEntryPresentationHelper.iconId(current.source))
holder.binding.values.text = userEntryPresentationHelper.listToPresentationString(current.values)
holder.binding.values.visibility = (holder.binding.values.text != "").toVisibility()
val nextTimestamp = if (entries.size != position + 1) entries[position + 1].timestamp else 0L
holder.binding.delimiter.visibility = dateUtil.isSameDayGroup(current.timestamp, nextTimestamp).toVisibility()
}
inner class UserEntryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

View file

@ -8,6 +8,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="4dp"
app:contentPadding="2dp"
android:layout_gravity="center">
@ -266,16 +267,6 @@
</LinearLayout>
<View
android:id="@+id/delimiter"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -8,6 +8,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="4dp"
app:contentPadding="2dp"
android:layout_gravity="center">
@ -124,16 +125,6 @@
</LinearLayout>
<View
android:id="@+id/delimiter"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -8,6 +8,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="4dp"
app:contentPadding="2dp"
android:layout_gravity="center">
@ -169,16 +170,6 @@
</LinearLayout>
<View
android:id="@+id/delimiter"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -8,6 +8,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="4dp"
app:contentPadding="2dp"
android:layout_gravity="center">
@ -137,16 +138,6 @@
</LinearLayout>
<View
android:id="@+id/delimiter"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -8,6 +8,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="4dp"
app:contentPadding="2dp"
android:layout_gravity="center">
@ -187,16 +188,6 @@
</LinearLayout>
<View
android:id="@+id/delimiter"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -8,6 +8,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="4dp"
app:contentPadding="2dp"
android:layout_gravity="center">
@ -159,16 +160,6 @@
</LinearLayout>
<View
android:id="@+id/delimiter"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -1,102 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.card.MaterialCardView 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:id="@+id/info_layout"
style="@style/Widget.MaterialComponents.CardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_gravity="center"
android:layout_marginStart="4dp"
android:layout_marginBottom="4dp"
app:cardCornerRadius="4dp"
app:contentPadding="2dp">
<TextView
android:id="@+id/date"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="RtlSymmetry"
tools:text="1.1.2000" />
android:orientation="vertical">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingTop="3dp"
android:textAppearance="?android:attr/textAppearanceSmall"
app:layout_constraintBottom_toBottomOf="@+id/iconSource"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/iconSource"
tools:ignore="RtlSymmetry"
tools:text="09:00" />
<TextView
android:id="@+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:ignore="RtlSymmetry"
tools:text="1.1.2000" />
<TextView
android:id="@+id/action"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingTop="3dp"
android:textAppearance="?android:attr/textAppearanceSmall"
app:layout_constraintEnd_toStartOf="@+id/iconSource"
app:layout_constraintStart_toEndOf="@id/time"
app:layout_constraintTop_toBottomOf="@id/date"
tools:ignore="RtlSymmetry"
tools:text="USER ENTRY" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/iconSource"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@+id/action"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/action"
app:srcCompat="@drawable/ic_cp_bolus_carbs"
tools:ignore="contentDescription" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingTop="3dp"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="RtlSymmetry"
tools:text="09:00" />
<TextView
android:id="@+id/values"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="20dp"
android:paddingEnd="10dp"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/action"
tools:text="Values with units" />
<TextView
android:id="@+id/action"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="10dp"
android:paddingTop="3dp"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="RtlSymmetry"
tools:text="USER ENTRY" />
<TextView
android:id="@+id/notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="20dp"
android:paddingEnd="10dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/values"
tools:ignore="RtlSymmetry"
tools:text="Notes" />
<ImageView
android:id="@+id/iconSource"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:srcCompat="@drawable/ic_cp_bolus_carbs"
tools:ignore="contentDescription" />
<View
android:id="@+id/delimiter"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="?android:attr/dividerHorizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/notes" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/values"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="20dp"
android:paddingEnd="10dp"
android:textStyle="bold"
tools:text="Values with units" />
<TextView
android:id="@+id/notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="20dp"
android:paddingEnd="10dp"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="RtlSymmetry"
tools:text="Notes" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>