diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/day/DayDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/day/DayDialog.kt
index c42cccc2..2d8885a5 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/day/DayDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/day/DayDialog.kt
@@ -5,7 +5,6 @@
package pl.szczodrzynski.edziennik.ui.dialogs.day
import android.view.View
-import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
@@ -88,7 +87,6 @@ class DayDialog(
adapter = EventListAdapter(
activity,
onItemClick = {
- Toast.makeText(activity, "Event clicked ${it.topic}", Toast.LENGTH_SHORT).show()
EventDetailsDialog(
activity,
it,
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventDetailsDialog.kt
index d49a3a84..baf65e8f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventDetailsDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventDetailsDialog.kt
@@ -11,7 +11,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.*
import pl.szczodrzynski.edziennik.*
import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
-import pl.szczodrzynski.edziennik.data.api.task.SzkolnyTask
import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull
import pl.szczodrzynski.edziennik.databinding.DialogEventDetailsBinding
import pl.szczodrzynski.edziennik.utils.models.Date
@@ -38,8 +37,6 @@ class EventDetailsDialog(
override val coroutineContext: CoroutineContext
get() = job + Dispatchers.Main
- private lateinit var adapter: EventListAdapter
-
private val api by lazy {
SzkolnyApi(app)
}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventListDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventListDialog.kt
deleted file mode 100644
index e5690648..00000000
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventListDialog.kt
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) Kacper Ziubryniewicz 2019-11-30
- */
-
-package pl.szczodrzynski.edziennik.ui.dialogs.event
-
-import android.graphics.Typeface
-import android.view.View
-import android.widget.Toast
-import androidx.appcompat.app.AlertDialog
-import androidx.appcompat.app.AppCompatActivity
-import androidx.lifecycle.Observer
-import androidx.recyclerview.widget.LinearLayoutManager
-import com.google.android.material.dialog.MaterialAlertDialogBuilder
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.Job
-import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.R
-import pl.szczodrzynski.edziennik.data.db.modules.timetable.Lesson
-import pl.szczodrzynski.edziennik.data.db.modules.timetable.LessonFull
-import pl.szczodrzynski.edziennik.databinding.DialogEventListBinding
-import pl.szczodrzynski.edziennik.utils.models.Date
-import pl.szczodrzynski.edziennik.utils.models.Time
-import kotlin.coroutines.CoroutineContext
-
-class EventListDialog(
- val activity: AppCompatActivity,
- val profileId: Int,
- val date: Date,
- val time: Time? = null,
- val onShowListener: ((tag: String) -> Unit)? = null,
- val onDismissListener: ((tag: String) -> Unit)? = null
-) : CoroutineScope {
-
- companion object {
- const val TAG = "EventListDialog"
- }
-
- private lateinit var job: Job
- override val coroutineContext: CoroutineContext
- get() = job + Dispatchers.Main
-
- private val app by lazy { activity.application as App }
- private lateinit var b: DialogEventListBinding
- private lateinit var dialog: AlertDialog
- private lateinit var adapter: EventListAdapter
-
- private var lesson: LessonFull? = null
-
- init {
- run {
- if (activity.isFinishing)
- return@run
- job = Job()
- onShowListener?.invoke(TAG)
- b = DialogEventListBinding.inflate(activity.layoutInflater)
-
- dialog = MaterialAlertDialogBuilder(activity)
- .setTitle(date.formattedString + (time?.let { ", " + it.stringHM } ?: ""))
- .setView(b.root)
- .setPositiveButton(R.string.close) { dialog, _ -> dialog.dismiss() }
- .setNeutralButton(R.string.add) { _, _ ->
- EventManualDialog(
- activity,
- lesson?.profileId ?: profileId,
- lesson,
- date,
- time,
- onShowListener = onShowListener,
- onDismissListener = onDismissListener
- )
- }
- .setOnDismissListener {
- onDismissListener?.invoke(TAG)
- }
- .show()
-
- app.db.timetableDao().getForDate(profileId, date).observe(activity, Observer { lessons ->
- lesson = lessons.firstOrNull { it.displayStartTime == time }
- update()
- })
- }
- }
-
- fun dismiss() = dialog.dismiss()
-
- private fun update() {
- b.eventListLessonDetails.visibility = if (lesson == null) View.GONE else View.VISIBLE
-
- if (lesson != null) {
- dialog.setTitle(if (time == null) date.formattedString else (lesson?.displaySubjectName
- ?: date.formattedString) + ", " + time.stringHM)
-
- b.eventListLessonDate.text = app.getString(R.string.date_time_format, date.formattedString, "")
-
- if (lesson?.type == Lesson.TYPE_CANCELLED) {
- b.eventListLessonChange.text = app.getString(R.string.lesson_cancelled)
- b.eventListLessonChange.setTypeface(null, Typeface.BOLD_ITALIC)
- b.eventListTeacher.visibility = View.GONE
- b.eventListClassroom.visibility = View.GONE
- } else {
- b.eventListLessonChange.text = lesson?.changeSubjectName
- b.eventListLessonChange.setTypeface(null, Typeface.ITALIC)
- b.eventListLessonChange.visibility = if (lesson?.isSubjectNameChanged == true) View.VISIBLE else View.GONE
-
- b.eventListTeacher.text = lesson?.changeTeacherName
- b.eventListTeacher.setTypeface(null, if (lesson?.isTeacherNameChanged == true) Typeface.ITALIC else Typeface.NORMAL)
-
- b.eventListClassroom.text = lesson?.changeClassroom
- b.eventListClassroom.setTypeface(null, if (lesson?.isClassroomChanged == true) Typeface.ITALIC else Typeface.NORMAL)
- }
- }
-
- b.eventListView.apply {
- setHasFixedSize(false)
- isNestedScrollingEnabled = true
- layoutManager = LinearLayoutManager(activity)
- }
-
- adapter = EventListAdapter(activity) {
- Toast.makeText(activity, "Event clicked ${it.topic}", Toast.LENGTH_SHORT).show()
- }
- b.eventListView.adapter = adapter
-
- app.db.eventDao().getAllByDateTime(profileId, date, time).observe(activity, Observer { events ->
- if (events.isNullOrEmpty()) {
- b.eventListView.visibility = View.GONE
- b.textNoEvents.visibility = View.VISIBLE
- } else {
- adapter.run {
- /*items.apply {
- clear()
- addAll(events)
- }*/
- notifyDataSetChanged()
- }
- }
- })
- }
-}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualDialog.kt
index 3f2d224b..c0cab3f3 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualDialog.kt
@@ -611,15 +611,15 @@ class EventManualDialog(
val profile = app.db.profileDao().getByIdNow(profileId)
if (!share && !editingShared) {
- Toast.makeText(activity, "Save without sharing", Toast.LENGTH_SHORT).show()
+ Toast.makeText(activity, R.string.event_manual_saving, Toast.LENGTH_SHORT).show()
finishAdding(eventObject, metadataObject)
}
else if (editingShared && !editingOwn) {
- Toast.makeText(activity, "Request editing somebody's event", Toast.LENGTH_SHORT).show()
+ Toast.makeText(activity, "Opcja edycji wydarzeń innych uczniów nie została jeszcze zaimplementowana.", Toast.LENGTH_LONG).show()
// TODO
}
else if (!share && editingShared) {
- Toast.makeText(activity, "Unshare own event", Toast.LENGTH_SHORT).show()
+ Toast.makeText(activity, R.string.event_manual_unshare, Toast.LENGTH_SHORT).show()
eventObject.apply {
sharedBy = null
@@ -639,7 +639,7 @@ class EventManualDialog(
finishAdding(eventObject, metadataObject)
}
else if (share) {
- Toast.makeText(activity, "Share/update own event", Toast.LENGTH_SHORT).show()
+ Toast.makeText(activity, R.string.event_manual_share, Toast.LENGTH_SHORT).show()
eventObject.apply {
sharedBy = profile?.userCode
@@ -669,7 +669,7 @@ class EventManualDialog(
private fun removeEvent() {
launch {
if (editingShared && editingOwn) {
- Toast.makeText(activity, "Unshare + remove own event", Toast.LENGTH_SHORT).show()
+ Toast.makeText(activity, R.string.event_manual_unshare_remove, Toast.LENGTH_SHORT).show()
val response = withContext(Dispatchers.Default) {
api.unshareEvent(editingEvent!!)
@@ -682,10 +682,10 @@ class EventManualDialog(
finishRemoving()
} else if (editingShared && !editingOwn) {
- Toast.makeText(activity, "Remove + blacklist somebody's event", Toast.LENGTH_SHORT).show()
+ Toast.makeText(activity, "Nie zaimplementowana opcja :(", Toast.LENGTH_SHORT).show()
// TODO
} else {
- Toast.makeText(activity, "Remove event", Toast.LENGTH_SHORT).show()
+ Toast.makeText(activity, R.string.event_manual_remove, Toast.LENGTH_SHORT).show()
finishRemoving()
}
}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt
index 5054fb05..013c27d6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt
@@ -6,7 +6,6 @@ package pl.szczodrzynski.edziennik.ui.dialogs.timetable
import android.content.Intent
import android.view.View
-import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
@@ -166,7 +165,6 @@ class LessonDetailsDialog(
adapter = EventListAdapter(
activity,
onItemClick = {
- Toast.makeText(activity, "Event clicked ${it.topic}", Toast.LENGTH_SHORT).show()
EventDetailsDialog(
activity,
it,
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ec116bb9..8586936d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1152,4 +1152,9 @@
Do wydruku (czarno-białe)
Na wybrany tydzień
Pobieranie listy lekcji…
+ Zapisuję wydarzenie...
+ Usuwam wydarzenie u reszty klasy...
+ Udostępniam wydarzenie...
+ Usuwam udostępnione wydarzenie...
+ Usuwam wydarzenie...