mirror of
https://github.com/Matte23/circolapp.git
synced 2025-12-06 07:29:10 +00:00
Make circular details collapsible
This commit is contained in:
@@ -43,6 +43,7 @@ class CircularLetterAdapter(private val circulars: List<Circular>) :
|
|||||||
var title: TextView = view.circular_title_textview
|
var title: TextView = view.circular_title_textview
|
||||||
var number: TextView = view.circular_number_textview
|
var number: TextView = view.circular_number_textview
|
||||||
var date: TextView = view.circular_date_textview
|
var date: TextView = view.circular_date_textview
|
||||||
|
var collapseButton: ImageButton = view.circular_collapse_button
|
||||||
var viewButton: ImageButton = view.circular_view_button
|
var viewButton: ImageButton = view.circular_view_button
|
||||||
var downloadButton: ImageButton = view.circular_download_button
|
var downloadButton: ImageButton = view.circular_download_button
|
||||||
var favouriteButton: ImageButton = view.circular_favourite_button
|
var favouriteButton: ImageButton = view.circular_favourite_button
|
||||||
@@ -84,15 +85,29 @@ class CircularLetterAdapter(private val circulars: List<Circular>) :
|
|||||||
(context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager).enqueue(request)
|
(context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager).enqueue(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (circulars[position].attachmentsNames.isNotEmpty()) {
|
holder.collapseButton.setOnClickListener {
|
||||||
holder.attachmentsList.visibility = View.VISIBLE
|
if (holder.viewButton.visibility == View.VISIBLE) {
|
||||||
holder.attachmentsList.adapter = AttachmentAdapter(
|
holder.viewButton.visibility = View.GONE
|
||||||
circulars[position].attachmentsNames,
|
holder.downloadButton.visibility = View.GONE
|
||||||
circulars[position].attachmentsUrls
|
holder.favouriteButton.visibility = View.GONE
|
||||||
)
|
holder.reminderButton.visibility = View.GONE
|
||||||
} else {
|
|
||||||
holder.attachmentsList.visibility = View.GONE
|
holder.attachmentsList.visibility = View.GONE
|
||||||
holder.attachmentsList.adapter = null
|
holder.attachmentsList.adapter = null
|
||||||
|
} else {
|
||||||
|
holder.viewButton.visibility = View.VISIBLE
|
||||||
|
holder.downloadButton.visibility = View.VISIBLE
|
||||||
|
holder.favouriteButton.visibility = View.VISIBLE
|
||||||
|
holder.reminderButton.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
if (circulars[position].attachmentsNames.isNotEmpty()) {
|
||||||
|
holder.attachmentsList.visibility = View.VISIBLE
|
||||||
|
holder.attachmentsList.adapter = AttachmentAdapter(
|
||||||
|
circulars[position].attachmentsNames,
|
||||||
|
circulars[position].attachmentsUrls
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
app/src/main/res/drawable/baseline_keyboard_arrow_down_24.xml
Executable file
10
app/src/main/res/drawable/baseline_keyboard_arrow_down_24.xml
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M7.41,8.59L12,13.17l4.59,-4.58L18,10l-6,6 -6,-6 1.41,-1.41z"/>
|
||||||
|
</vector>
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
android:id="@+id/attachment_divider"
|
android:id="@+id/attachment_divider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
android:background="@color/colorDivider"
|
android:background="@color/colorDivider"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -31,7 +32,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:scaleType="centerInside"
|
|
||||||
android:src="@drawable/baseline_visibility_24"
|
android:src="@drawable/baseline_visibility_24"
|
||||||
android:tint="@color/colorAccent"
|
android:tint="@color/colorAccent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/attachment_download_button"
|
app:layout_constraintEnd_toStartOf="@+id/attachment_download_button"
|
||||||
|
|||||||
@@ -24,13 +24,13 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/circular_title_textview"
|
android:id="@+id/circular_title_textview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/circular_view_button"
|
app:layout_constraintBottom_toTopOf="@+id/circular_view_button"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@+id/circular_collapse_button"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/circular_number_textview" />
|
app:layout_constraintTop_toBottomOf="@+id/circular_number_textview" />
|
||||||
|
|
||||||
@@ -44,6 +44,18 @@
|
|||||||
app:layout_constraintStart_toEndOf="@+id/circular_number_textview"
|
app:layout_constraintStart_toEndOf="@+id/circular_number_textview"
|
||||||
app:layout_constraintTop_toTopOf="@+id/circular_number_textview" />
|
app:layout_constraintTop_toTopOf="@+id/circular_number_textview" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/circular_collapse_button"
|
||||||
|
style="?android:attr/borderlessButtonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:src="@drawable/baseline_keyboard_arrow_down_24"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/circular_reminder_button"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/circular_view_button"
|
android:id="@+id/circular_view_button"
|
||||||
style="?android:attr/borderlessButtonStyle"
|
style="?android:attr/borderlessButtonStyle"
|
||||||
@@ -52,6 +64,7 @@
|
|||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:src="@drawable/baseline_visibility_24"
|
android:src="@drawable/baseline_visibility_24"
|
||||||
android:tint="@color/colorAccent"
|
android:tint="@color/colorAccent"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/circulars_attachments_list"
|
app:layout_constraintBottom_toTopOf="@+id/circulars_attachments_list"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
@@ -63,6 +76,7 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:src="@drawable/baseline_get_app_24"
|
android:src="@drawable/baseline_get_app_24"
|
||||||
android:tint="@color/colorAccent"
|
android:tint="@color/colorAccent"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/circulars_attachments_list"
|
app:layout_constraintBottom_toTopOf="@+id/circulars_attachments_list"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/circular_guideline"
|
app:layout_constraintEnd_toStartOf="@+id/circular_guideline"
|
||||||
app:layout_constraintStart_toEndOf="@+id/circular_view_button" />
|
app:layout_constraintStart_toEndOf="@+id/circular_view_button" />
|
||||||
@@ -74,6 +88,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/baseline_star_24"
|
android:src="@drawable/baseline_star_24"
|
||||||
android:tint="@color/colorAccent"
|
android:tint="@color/colorAccent"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/circulars_attachments_list"
|
app:layout_constraintBottom_toTopOf="@+id/circulars_attachments_list"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/circular_reminder_button"
|
app:layout_constraintEnd_toStartOf="@+id/circular_reminder_button"
|
||||||
app:layout_constraintStart_toStartOf="@+id/circular_guideline" />
|
app:layout_constraintStart_toStartOf="@+id/circular_guideline" />
|
||||||
@@ -86,6 +101,7 @@
|
|||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:src="@drawable/baseline_notifications_24"
|
android:src="@drawable/baseline_notifications_24"
|
||||||
android:tint="@color/colorAccent"
|
android:tint="@color/colorAccent"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/circulars_attachments_list"
|
app:layout_constraintBottom_toTopOf="@+id/circulars_attachments_list"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
@@ -97,6 +113,7 @@
|
|||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|||||||
Reference in New Issue
Block a user