Commit 27bbad26 authored by SusanneFischer's avatar SusanneFischer
Browse files

layout fixes in rental list

parent 0a488cbc
Pipeline #3596 failed with stages
in 0 seconds
package de.asta.hochschule.trier.verleih.rental.adapter
import android.annotation.SuppressLint
import android.view.*
import androidx.recyclerview.widget.RecyclerView
import com.firebase.ui.database.*
......@@ -37,10 +38,12 @@ class RentalMainListAdapter(
}
}
@SuppressLint("SetTextI18n")
private fun setupDateTimeText(holder: ViewHolder, dateTime: DateTime) {
holder.itemBinding.rentalTime.text = DateHelper.getTimeString(dateTime)
holder.itemBinding.rentalDay.text = dateTime.dayOfMonth().asString
holder.itemBinding.rentalMonth.text = dateTime.monthOfYear().asShortText
holder.itemBinding.rentalMonth.text =
"${dateTime.monthOfYear().asShortText} \'${dateTime.year.toString().drop(2)}"
}
override fun onDataChanged() {
......
......@@ -4,7 +4,6 @@ import android.content.Intent
import android.os.Bundle
import android.view.*
import android.widget.*
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.*
......@@ -125,13 +124,6 @@ class RentalMainFragment : Fragment(R.layout.fragment_rental_main) {
} else {
icon.setImageResource(R.drawable.ic_chevron_down)
}
if (emptyStateTextView.id == binding.noRecentRentalsText.id) {
val params =
binding.pastRentalsHeaderLayout.layoutParams as ConstraintLayout.LayoutParams
params.topToBottom = binding.noRecentRentalsText.id
binding.pastRentalsHeaderLayout.requestLayout()
}
}
private fun toggleExpandCollapseState(
......@@ -157,19 +149,6 @@ class RentalMainFragment : Fragment(R.layout.fragment_rental_main) {
} else {
View.GONE
}
if (recyclerView.id == binding.recentRentalsRecyclerView.id) {
val params =
binding.pastRentalsHeaderLayout.layoutParams as ConstraintLayout.LayoutParams
params.topToBottom = if (isExpanded && showEmptyState) {
binding.noRecentRentalsText.id
} else if (isExpanded && !showEmptyState) {
binding.recentRentalsRecyclerView.id
} else {
binding.recentRentalsHeaderLayout.id
}
binding.pastRentalsHeaderLayout.requestLayout()
}
}
override fun onStart() {
......
......@@ -61,38 +61,51 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/no_recent_rentals_text"
style="@style/Caption"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:text="@string/no_recents_rental"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/recent_rentals_header_layout" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recent_rentals_recycler_view"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/recent_rentals_content_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/recent_rentals_header_layout" />
app:layout_constraintTop_toBottomOf="@id/recent_rentals_header_layout">
<TextView
android:id="@+id/no_recent_rentals_text"
style="@style/Caption"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:text="@string/no_recents_rental"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recent_rentals_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/past_rentals_header_layout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:animateLayoutChanges="true"
android:clickable="true"
android:focusable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/recent_rentals_recycler_view">
app:layout_constraintTop_toBottomOf="@id/recent_rentals_content_layout">
<TextView
style="@style/Headline6"
......
......@@ -33,7 +33,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="März"
android:text="März '21"
android:textColor="@color/colorSecondaryLight"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment