forked from github/szkolny
[Events] Add showing green check when event is done. Hide done events from homework current list.
This commit is contained in:
parent
fcc3c55110
commit
0db6393bb0
@ -6,7 +6,6 @@ package pl.szczodrzynski.edziennik.ui.dialogs.event
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isVisible
|
||||
@ -52,6 +51,7 @@ class EventListAdapter(
|
||||
b.simpleMode = simpleMode
|
||||
|
||||
b.topic.text = event.topic
|
||||
b.topic.maxLines = if (simpleMode) 2 else 3
|
||||
|
||||
b.details.text = mutableListOf<CharSequence?>(
|
||||
if (showWeekDay) Week.getFullDayName(event.date.weekDay) else null,
|
||||
@ -79,11 +79,13 @@ class EventListAdapter(
|
||||
b.typeColor.background?.setTintColor(event.eventColor)
|
||||
b.typeColor.isVisible = showType
|
||||
|
||||
b.editButton.visibility = if (event.addedManually && !simpleMode) View.VISIBLE else View.GONE
|
||||
b.editButton.isVisible = !simpleMode && event.addedManually && !event.isDone
|
||||
b.editButton.onClick {
|
||||
onEventEditClick?.invoke(event)
|
||||
}
|
||||
|
||||
b.isDone.isVisible = event.isDone
|
||||
|
||||
b.editButton.setOnLongClickListener {
|
||||
Toast.makeText(context, R.string.hint_edit_event, Toast.LENGTH_SHORT).show()
|
||||
true
|
||||
|
@ -49,8 +49,8 @@ class HomeworkListFragment : LazyFragment(), CoroutineScope {
|
||||
|
||||
val today = Date.getToday()
|
||||
val filter = when(homeworkDate) {
|
||||
HomeworkDate.CURRENT -> "eventDate >= '${today.stringY_m_d}'"
|
||||
else -> "eventDate < '${today.stringY_m_d}'"
|
||||
HomeworkDate.CURRENT -> "eventDate >= '${today.stringY_m_d}' AND eventIsDone = 0"
|
||||
else -> "eventDate < '${today.stringY_m_d}' OR eventIsDone = 1"
|
||||
}
|
||||
|
||||
val adapter = EventListAdapter(
|
||||
|
@ -4,7 +4,8 @@
|
||||
-->
|
||||
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View"/>
|
||||
@ -54,22 +55,35 @@
|
||||
android:id="@+id/topic"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_weight="1"
|
||||
android:textAppearance="@style/NavView.TextView.Medium"
|
||||
android:maxLines="@{simpleMode ? 2 : 3}"
|
||||
android:ellipsize="end"
|
||||
tools:maxLines="3"
|
||||
android:maxLines="3"
|
||||
android:textAppearance="@style/NavView.TextView.Medium"
|
||||
tools:text="Rozdział II: Panowanie Piastów i Jagiellonów.Przeniesiony z 11 grudnia. Nie wiem co się dzieje w tym roku nie będzie już religii w szkołach podstawowych w Polsce i Europie zachodniej Afryki" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/editButton"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/community_material_font_v3_5_95_1"
|
||||
android:minWidth="0dp"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:text="\uFC92"
|
||||
android:textSize="20sp"
|
||||
android:fontFamily="@font/community_material_font_v3_5_95_1"/>
|
||||
tools:visibility="gone" />
|
||||
|
||||
<com.mikepenz.iconics.view.IconicsImageView
|
||||
android:id="@+id/isDone"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
app:iiv_color="@color/md_green_500"
|
||||
app:iiv_icon="cmd-check"
|
||||
tools:background="@sample/check" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user