Implemented functionality for adding a new event manually; added floating action buttons for adding an event and refreshing the canteen offers

This commit is contained in:
denizk0461
2023-05-03 14:16:32 +02:00
parent ae8db7ce48
commit df1d127a17
18 changed files with 416 additions and 155 deletions
@@ -25,9 +25,6 @@ class StudIPParser(application: Application) {
*/ */
@Throws(IOException::class) @Throws(IOException::class)
fun parse(html: String): Int { fun parse(html: String): Int {
// Primary key value to uniquely identify entries in the database
var id = 0
// Counts how many elements could not be successfully fetched // Counts how many elements could not be successfully fetched
var elementsNotFetched = 0 var elementsNotFetched = 0
@@ -92,7 +89,6 @@ class StudIPParser(application: Application) {
// Construct the newly scraped Stud.IP event // Construct the newly scraped Stud.IP event
val event = StudIPEvent( val event = StudIPEvent(
eventId = id,
title = parsedTitle, title = parsedTitle,
lecturer = parsedLecturers, lecturer = parsedLecturers,
room = entryInfo.getOrQuestionMark(1), room = entryInfo.getOrQuestionMark(1),
@@ -104,9 +100,6 @@ class StudIPParser(application: Application) {
// Add the new element to the temporary list // Add the new element to the temporary list
newEvents.add(event) newEvents.add(event)
// Raise the primary key value by 1 to avoid not fulfilling the unique constraint
id += 1
} }
} }
@@ -17,7 +17,7 @@ import com.denizk0461.studip.model.*
OfferCategory::class, OfferCategory::class,
OfferItem::class, OfferItem::class,
], ],
version = 18, version = 19,
) )
abstract class AppDatabase : RoomDatabase() { abstract class AppDatabase : RoomDatabase() {
@@ -85,6 +85,15 @@ class AppRepository(app: Application) {
*/ */
fun getOffersByDay(day: Int): LiveData<List<CanteenOffer>> = dao.getOffersByDay(day) fun getOffersByDay(day: Int): LiveData<List<CanteenOffer>> = dao.getOffersByDay(day)
/**
* Inserts a new schedule element.
*
* @param event the event to save
*/
fun insert(event: StudIPEvent) {
dao.insert(event)
}
/** /**
* Updates a schedule element. * Updates a schedule element.
* *
@@ -127,6 +127,15 @@ class CanteenFragment : AppFragment() {
} }
} }
// Set up floating action button for refreshing the canteen offers
binding.fabRefreshOffers.setOnClickListener {
// Display to the user that a refresh is in progress
binding.swipeRefreshLayout.isRefreshing = true
// Refresh the offers
refresh()
}
// Set up the view pager's adapter // Set up the view pager's adapter
viewPagerAdapter = CanteenOfferPageAdapter( viewPagerAdapter = CanteenOfferPageAdapter(
childFragmentManager, childFragmentManager,
@@ -8,6 +8,7 @@ import androidx.fragment.app.viewModels
import com.denizk0461.studip.R import com.denizk0461.studip.R
import com.denizk0461.studip.adapter.StudIPEventPageAdapter import com.denizk0461.studip.adapter.StudIPEventPageAdapter
import com.denizk0461.studip.databinding.FragmentEventBinding import com.denizk0461.studip.databinding.FragmentEventBinding
import com.denizk0461.studip.sheet.ScheduleUpdateSheet
import com.denizk0461.studip.viewmodel.EventViewModel import com.denizk0461.studip.viewmodel.EventViewModel
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import java.util.* import java.util.*
@@ -74,6 +75,16 @@ class EventFragment : AppFragment() {
TabLayoutMediator(binding.dayTabLayout, binding.viewPager) { tab, position -> TabLayoutMediator(binding.dayTabLayout, binding.viewPager) { tab, position ->
tab.text = weekdays[position] tab.text = weekdays[position]
}.attach() }.attach()
binding.fabAddEvent.setOnClickListener {
openBottomSheet(
ScheduleUpdateSheet().also { sheet ->
val bundle = Bundle()
bundle.putBoolean("isEditing", false)
sheet.arguments = bundle
}
)
}
} }
/** /**
@@ -91,6 +91,7 @@ class EventPageFragment : AppFragment(), StudIPEventItemAdapter.OnClickListener
openBottomSheet( openBottomSheet(
ScheduleUpdateSheet().also { sheet -> ScheduleUpdateSheet().also { sheet ->
val bundle = Bundle() val bundle = Bundle()
bundle.putBoolean("isEditing", true)
bundle.putParcelable("event", event) bundle.putParcelable("event", event)
sheet.arguments = bundle sheet.arguments = bundle
} }
@@ -20,7 +20,7 @@ import androidx.room.PrimaryKey
*/ */
@Entity(tableName = "studip_events") @Entity(tableName = "studip_events")
data class StudIPEvent( data class StudIPEvent(
@PrimaryKey val eventId: Int, @PrimaryKey(autoGenerate = true) val eventId: Int = 0,
val title: String, val title: String,
val lecturer: String, val lecturer: String,
val room: String, val room: String,
@@ -3,6 +3,7 @@ package com.denizk0461.studip.sheet
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.appcompat.widget.PopupMenu
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.transition.TransitionManager import androidx.transition.TransitionManager
@@ -27,8 +28,8 @@ import com.denizk0461.studip.viewmodel.ScheduleUpdateViewModel
class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePickerFragment.OnTimeSetListener { class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePickerFragment.OnTimeSetListener {
// Editable fields // Editable fields
private var timeslotStart = "" private var timeslotStart = "12:00"
private var timeslotEnd = "" private var timeslotEnd = "13:00"
private var colour = -1 private var colour = -1
// View binding // View binding
@@ -40,13 +41,35 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker
// Whether the user has once clicked the delete button; used to prevent an accidental click // Whether the user has once clicked the delete button; used to prevent an accidental click
private var hasClickedDelete: Boolean = false private var hasClickedDelete: Boolean = false
// Determines whether the user is editing an existing event or creating a new one
private var isEditing: Boolean = false
// Day the event is scheduled for, default is Monday
private var selectedDay = 0
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
if (arguments?.getBoolean("isEditing") == true) {
try { try {
// Retrieve event from arguments bundle /*
* Retrieve event from arguments bundle; determines whether this sheet is for editing or
* creating an event.
*/
val event: StudIPEvent = arguments.getParcelableCompat("event") val event: StudIPEvent = arguments.getParcelableCompat("event")
// - Set-up for editing an existing event - //
// Set the title to reflect that an event is being edited
binding.sheetTitle.text = getString(R.string.sheet_schedule_update_header_edit)
// User is editing an existing event
isEditing = true
// Set day
selectedDay = event.day
// Set values of the text field to that of the event // Set values of the text field to that of the event
timeslotStart = event.timeslotStart timeslotStart = event.timeslotStart
timeslotEnd = event.timeslotEnd timeslotEnd = event.timeslotEnd
@@ -57,6 +80,140 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker
binding.editTextLecturers.setText(event.lecturer) binding.editTextLecturers.setText(event.lecturer)
binding.editTextRoom.setText(event.room) binding.editTextRoom.setText(event.room)
// Prepare delete button
binding.buttonDelete.setOnClickListener {
/*
* Check if the user has already clicked the button before; this is done to prevent
* accidentally deleting an event.
*/
if (hasClickedDelete) {
viewModel.delete(event)
// Dismiss the sheet upon deletion
dismiss()
} else {
// Update the text to show the user that they clicked the button once
TransitionManager.beginDelayedTransition(binding.buttonContainer as ViewGroup)
binding.buttonDelete.text =
getString(R.string.sheet_schedule_update_delete_confirm)
hasClickedDelete = true
}
}
// Prepare update/save button
binding.buttonSave.setOnClickListener {
// Check if any of the text fields are empty
checkIfTextFieldsEmpty {
// Update the event if all fields are filled
viewModel.update(
// construct new StudIPEvent from the data the user may have edited
StudIPEvent(
eventId = event.eventId,
title = binding.editTextTitle.text.toString().trim(),
lecturer = binding.editTextLecturers.text.toString().trim(),
room = binding.editTextRoom.text.toString().trim(),
day = selectedDay,
timeslotStart = timeslotStart,
timeslotEnd = timeslotEnd,
timeslotId = timeslotStart.parseToMinutes(),
colour = colour,
)
)
// Dismiss the sheet upon update
dismiss()
}
}
} catch (e: ParcelNotFoundException) {
// Tell the user that something went wrong when retrieving Parcelable
showToast(context, getString(R.string.event_update_sheet_error))
// Close the sheet
dismiss()
}
} else {
// - Set-up for creating a new event - //
// Set the title to reflect that an event is being added
binding.sheetTitle.text = getString(R.string.sheet_schedule_update_header_add)
// Hide delete button, since there is nothing to delete
binding.buttonDelete.visibility = View.GONE
// Prepare update/save button
binding.buttonSave.setOnClickListener {
// Check if any of the text fields are empty
checkIfTextFieldsEmpty {
// Insert new event into the database
viewModel.insert(
// construct new StudIPEvent from the data the user may have edited
StudIPEvent(
title = binding.editTextTitle.text.toString().trim(),
lecturer = binding.editTextLecturers.text.toString().trim(),
room = binding.editTextRoom.text.toString().trim(),
day = selectedDay,
timeslotStart = timeslotStart,
timeslotEnd = timeslotEnd,
timeslotId = timeslotStart.parseToMinutes(),
colour = colour,
)
)
// Dismiss the sheet upon update
dismiss()
}
}
}
// - Set-up that is required for both editing and creating a new event - //
/*
* TODO implement option to change the colour for the course - single-selection coloured
* filter buttons with checkmarks when they're selected maybe?
*/
// Set visibility for academic quarter button based on whether the change applies
binding.buttonAcademicQuarter.visibility = getVisibilityForAcademicQuarter(
timeslotsForAcademicQuarter.contains(timeslotStart),
timeslotsForAcademicQuarter.contains(timeslotEnd),
)
// Retrieve new values for the day of the current event
binding.buttonDay.text = getString(when (selectedDay) {
1 -> R.string.tuesday
2 -> R.string.wednesday
3 -> R.string.thursday
4 -> R.string.friday
5 -> R.string.saturday
6 -> R.string.sunday
else -> R.string.monday // assume Monday
})
// Open the menu for the day picker button
binding.buttonDay.setOnClickListener {
PopupMenu(binding.root.context, binding.buttonDay).apply {
setOnMenuItemClickListener { item ->
// Retrieve new values for the day selected by the user
val (newDay, newDayId) = when (item?.itemId) {
R.id.tuesday -> Pair(1, R.string.tuesday)
R.id.wednesday -> Pair(2, R.string.wednesday)
R.id.thursday -> Pair(3, R.string.thursday)
R.id.friday -> Pair(4, R.string.friday)
R.id.saturday -> Pair(5, R.string.saturday)
R.id.sunday -> Pair(6, R.string.sunday)
else -> Pair(0, R.string.monday) // assume Monday
}
selectedDay = newDay
// Set newly selected day to the button
binding.buttonDay.text = getString(newDayId)
true
}
inflate(R.menu.menu_days)
show()
}
}
/* /*
* Show academic quarter suggestion if it is applicable. For this to be the case, both the * Show academic quarter suggestion if it is applicable. For this to be the case, both the
@@ -72,7 +229,7 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker
val newStart = getTimestampAcademicQuarterStart(timeslotStart) val newStart = getTimestampAcademicQuarterStart(timeslotStart)
val newEnd = getTimestampAcademicQuarterEnd(timeslotEnd) val newEnd = getTimestampAcademicQuarterEnd(timeslotEnd)
// Set the buttons to the new timesatmps // Set the buttons to the new time stamps
timeslotStart = newStart timeslotStart = newStart
binding.buttonTimeStart.text = newStart binding.buttonTimeStart.text = newStart
timeslotEnd = newEnd timeslotEnd = newEnd
@@ -94,11 +251,6 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker
} }
} }
binding.buttonAcademicQuarter.visibility = getVisibilityForAcademicQuarter(
timeslotsForAcademicQuarter.contains(timeslotStart),
timeslotsForAcademicQuarter.contains(timeslotEnd),
)
// Prepare timestamp buttons // Prepare timestamp buttons
binding.buttonTimeStart.text = timeslotStart binding.buttonTimeStart.text = timeslotStart
binding.buttonTimeStart.setOnClickListener { binding.buttonTimeStart.setOnClickListener {
@@ -125,61 +277,11 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker
}.show((context as FragmentActivity).supportFragmentManager, "timePicker") }.show((context as FragmentActivity).supportFragmentManager, "timePicker")
} }
/*
* TODO implement option to change the colour for the course - single-selection coloured
* filter buttons with checkmarks when they're selected maybe?
*/
// Prepare cancel button // Prepare cancel button
binding.buttonCancel.setOnClickListener { binding.buttonCancel.setOnClickListener {
// Do nothing and dismiss the sheet // Do nothing and dismiss the sheet
dismiss() dismiss()
} }
// Prepare delete button
binding.buttonDelete.setOnClickListener {
/*
* Check if the user has already clicked the button before; this is done to prevent
* accidentally deleting an event.
*/
if (hasClickedDelete) {
viewModel.delete(event)
// Dismiss the sheet upon deletion
dismiss()
} else {
// Update the text to show the user that they clicked the button once
TransitionManager.beginDelayedTransition(binding.buttonContainer as ViewGroup)
binding.buttonDelete.text = getString(R.string.sheet_schedule_update_delete_confirm)
hasClickedDelete = true
}
}
// Prepare update/save button
binding.buttonSave.setOnClickListener {
viewModel.update(
// construct new StudIPEvent from the data the user may have edited
StudIPEvent(
eventId = event.eventId,
title = binding.editTextTitle.text.toString(),
lecturer = binding.editTextLecturers.text.toString(),
room = binding.editTextRoom.text.toString(),
day = event.day,
timeslotStart = timeslotStart,
timeslotEnd = timeslotEnd,
timeslotId = timeslotStart.parseToMinutes(),
colour = colour,
)
)
// Dismiss the sheet upon update
dismiss()
}
} catch (e: ParcelNotFoundException) {
// Tell the user that something went wrong when retrieving Parcelable
showToast(context, getString(R.string.event_update_sheet_error))
// Close the sheet
dismiss()
}
} }
/** /**
@@ -218,6 +320,53 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update), TimePicker
} }
} }
/**
* Checks whether the text fields in the sheet are blank (meaning, with whitespace trimmed from
* the start and the end of the string). Executes an action if the fields are all filled.
*
* @param actionIfFilled action to execute if all fields are filled
*/
private fun checkIfTextFieldsEmpty(actionIfFilled: () -> Unit) {
// Assume at the start that no fields are empty; this may be changed during the checks
var hasEmptyFields = false
// Check if the title field is blank
if (binding.editTextTitle.text.toString().isBlank()) {
// Set an error on the title field
binding.editTextTitle.error =
getString(R.string.sheet_schedule_update_text_field_empty_error)
// Set that the action must not be executed
hasEmptyFields = true
}
// Check if the lecturer field is blank
if (binding.editTextLecturers.text.toString().isBlank()) {
// Set an error on the lecturer field
binding.editTextLecturers.error =
getString(R.string.sheet_schedule_update_text_field_empty_error)
// Set that the action must not be executed
hasEmptyFields = true
}
// Check if the room field is blank
if (binding.editTextRoom.text.toString().isBlank()) {
// Set an error on the room field
binding.editTextRoom.error =
getString(R.string.sheet_schedule_update_text_field_empty_error)
// Set that the action must not be executed
hasEmptyFields = true
}
// If any fields are empty, don't execute the action
if (!hasEmptyFields) {
actionIfFilled()
}
}
/** /**
* Determines which visibility the academic quarter button should have given the timestamps. * Determines which visibility the academic quarter button should have given the timestamps.
* *
@@ -5,6 +5,13 @@ import com.denizk0461.studip.model.StudIPEvent
class ScheduleUpdateViewModel(application: Application) : AppViewModel(application) { class ScheduleUpdateViewModel(application: Application) : AppViewModel(application) {
/**
* Inserts a new schedule element.
*
* @param event the event to save
*/
fun insert(event: StudIPEvent) { doAsync { repo.insert(event) } }
/** /**
* Updates a schedule element. * Updates a schedule element.
* *
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,22H5c-1.11,0 -2,-0.9 -2,-2L3.01,6c0,-1.1 0.88,-2 1.99,-2h1V2h2v2h8V2h2v2h1c1.1,0 2,0.9 2,2v6h-2v-2H5v10h7V22zM22.13,16.99l0.71,-0.71c0.39,-0.39 0.39,-1.02 0,-1.41l-0.71,-0.71c-0.39,-0.39 -1.02,-0.39 -1.41,0l-0.71,0.71L22.13,16.99zM21.42,17.7l-5.3,5.3H14v-2.12l5.3,-5.3L21.42,17.7z"/>
</vector>
+5
View File
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>
+34 -17
View File
@@ -17,11 +17,6 @@
android:orientation="vertical" android:orientation="vertical"
app:layout_scrollFlags="scroll|exitUntilCollapsed"> app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/button_canteen_picker" android:id="@+id/button_canteen_picker"
style="@style/Widget.Material3.Button.TextButton" style="@style/Widget.Material3.Button.TextButton"
@@ -29,8 +24,26 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="18sp" android:textSize="18sp"
android:layout_gravity="start" android:layout_gravity="start"
android:layout_marginStart="8dp"
android:fontFamily="@font/lato_bolditalic"/> android:fontFamily="@font/lato_bolditalic"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp">
<TextView
android:id="@+id/app_title_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title_food"
android:textSize="32sp"
android:fontFamily="@font/lato_bolditalic"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/button_info"/>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.TextButton" style="@style/Widget.Material3.Button.TextButton"
android:id="@+id/button_info" android:id="@+id/button_info"
@@ -39,19 +52,13 @@
android:minWidth="0dp" android:minWidth="0dp"
app:icon="@drawable/info" app:icon="@drawable/info"
app:iconPadding="0dp" app:iconPadding="0dp"
android:layout_gravity="end" android:layout_gravity="center_vertical|end"
app:iconTint="?attr/colorOnSurfaceVariant"/> app:iconTint="?attr/colorOnSurfaceVariant"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/app_title_bar"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="@string/title_food"
android:textSize="32sp"
android:fontFamily="@font/lato_bolditalic"
android:layout_marginHorizontal="16dp"/>
<HorizontalScrollView <HorizontalScrollView
android:id="@+id/scroll_view_chip" android:id="@+id/scroll_view_chip"
@@ -215,6 +222,16 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_refresh_offers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/refresh"
android:contentDescription="@string/canteen_fab_refresh_content_desc"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="@dimen/fab_margin"/>
<!-- <androidx.coordinatorlayout.widget.CoordinatorLayout--> <!-- <androidx.coordinatorlayout.widget.CoordinatorLayout-->
<!-- android:id="@+id/snackbar_container"--> <!-- android:id="@+id/snackbar_container"-->
<!-- android:layout_width="0dp"--> <!-- android:layout_width="0dp"-->
+14 -4
View File
@@ -14,14 +14,14 @@
<TextView <TextView
android:id="@+id/app_title_bar" android:id="@+id/app_title_bar"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="48dp" android:layout_height="wrap_content"
android:text="@string/title_schedule" android:text="@string/title_schedule"
android:textSize="32sp" android:textSize="32sp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fontFamily="@font/lato_bolditalic" android:fontFamily="@font/lato_bolditalic"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"/> app:layout_scrollFlags="scroll|exitUntilCollapsed"/>
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/day_tab_layout" android:id="@+id/day_tab_layout"
@@ -38,4 +38,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_add_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/plus"
android:contentDescription="@string/sheet_schedule_update_header_add"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="@dimen/fab_margin"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -15,8 +15,8 @@
<TextView <TextView
android:id="@+id/app_title_bar" android:id="@+id/app_title_bar"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="48dp" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:fontFamily="@font/lato_bolditalic" android:fontFamily="@font/lato_bolditalic"
@@ -18,11 +18,11 @@
android:layout_marginBottom="8dp"> android:layout_marginBottom="8dp">
<TextView <TextView
android:id="@+id/sheet_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="22sp" android:textSize="22sp"
android:fontFamily="@font/lato_blackitalic" android:fontFamily="@font/lato_blackitalic"
android:text="@string/sheet_schedule_update_header"
android:layout_gravity="start|center_vertical" android:layout_gravity="start|center_vertical"
android:paddingHorizontal="24dp"/> android:paddingHorizontal="24dp"/>
@@ -125,6 +125,14 @@
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
<com.google.android.material.button.MaterialButton
android:id="@+id/button_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:icon="@drawable/edit_calendar"
android:layout_gravity="end"/>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/button_academic_quarter" android:id="@+id/button_academic_quarter"
android:layout_width="wrap_content" android:layout_width="wrap_content"
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/monday"
android:title="@string/monday"
android:enabled="true"/>
<item
android:id="@+id/tuesday"
android:title="@string/tuesday"
android:enabled="true"/>
<item
android:id="@+id/wednesday"
android:title="@string/wednesday"
android:enabled="true"/>
<item
android:id="@+id/thursday"
android:title="@string/thursday"
android:enabled="true"/>
<item
android:id="@+id/friday"
android:title="@string/friday"
android:enabled="true"/>
<item
android:id="@+id/saturday"
android:title="@string/saturday"
android:enabled="true"/>
<item
android:id="@+id/sunday"
android:title="@string/sunday"
android:enabled="true"/>
</menu>
+4 -1
View File
@@ -43,7 +43,8 @@
<string name="sheet_schedule_update_delete_confirm">Sicher?</string> <string name="sheet_schedule_update_delete_confirm">Sicher?</string>
<string name="cancel">Abbrechen</string> <string name="cancel">Abbrechen</string>
<string name="confirm">Bestätigen</string> <string name="confirm">Bestätigen</string>
<string name="sheet_schedule_update_header">Veranstaltung bearbeiten</string> <string name="sheet_schedule_update_header_edit">Veranstaltung bearbeiten</string>
<string name="sheet_schedule_update_header_add">Veranstaltung hinzufügen</string>
<string name="sheet_schedule_update_title_hint">Veranstaltungstitel</string> <string name="sheet_schedule_update_title_hint">Veranstaltungstitel</string>
<string name="sheet_schedule_update_lecturers_hint">Dozierende(r)</string> <string name="sheet_schedule_update_lecturers_hint">Dozierende(r)</string>
<string name="sheet_schedule_update_room_hint">Raum</string> <string name="sheet_schedule_update_room_hint">Raum</string>
@@ -51,9 +52,11 @@
<string name="sheet_schedule_update_hint_quarter_error">Sorry, ein Fehler ist aufgetreten!</string> <string name="sheet_schedule_update_hint_quarter_error">Sorry, ein Fehler ist aufgetreten!</string>
<string name="sheet_schedule_update_timestamp_error_start">Der Kurs kann nicht anfangen nachdem er aufhört!</string> <string name="sheet_schedule_update_timestamp_error_start">Der Kurs kann nicht anfangen nachdem er aufhört!</string>
<string name="sheet_schedule_update_timestamp_error_end">Der Kurs kann nicht enden bevor er anfängt!</string> <string name="sheet_schedule_update_timestamp_error_end">Der Kurs kann nicht enden bevor er anfängt!</string>
<string name="sheet_schedule_update_text_field_empty_error">Dieses Feld darf nicht leer sein</string>
<string name="canteen_no_offer_header">Kein Angebot</string> <string name="canteen_no_offer_header">Kein Angebot</string>
<string name="canteen_no_offer_desc">Für diesen Tag sind keine Angebote vorhanden</string> <string name="canteen_no_offer_desc">Für diesen Tag sind keine Angebote vorhanden</string>
<string name="canteen_fab_refresh_content_desc">Aktualisiere Angebote</string>
<string name="sheet_licences_header">Lizenzen</string> <string name="sheet_licences_header">Lizenzen</string>
+4 -1
View File
@@ -43,7 +43,8 @@
<string name="sheet_schedule_update_delete_confirm">Sure?</string> <string name="sheet_schedule_update_delete_confirm">Sure?</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="confirm">Confirm</string> <string name="confirm">Confirm</string>
<string name="sheet_schedule_update_header">Edit Event</string> <string name="sheet_schedule_update_header_edit">Edit event</string>
<string name="sheet_schedule_update_header_add">Add event</string>
<string name="sheet_schedule_update_title_hint">Event title</string> <string name="sheet_schedule_update_title_hint">Event title</string>
<string name="sheet_schedule_update_lecturers_hint">Lecturer(s)</string> <string name="sheet_schedule_update_lecturers_hint">Lecturer(s)</string>
<string name="sheet_schedule_update_room_hint">Room</string> <string name="sheet_schedule_update_room_hint">Room</string>
@@ -52,9 +53,11 @@
<string name="sheet_schedule_update_hint_quarter_error">Sorry, an error occurred!</string> <string name="sheet_schedule_update_hint_quarter_error">Sorry, an error occurred!</string>
<string name="sheet_schedule_update_timestamp_error_start">The course can\'t begin after it ends!</string> <string name="sheet_schedule_update_timestamp_error_start">The course can\'t begin after it ends!</string>
<string name="sheet_schedule_update_timestamp_error_end">The course can\'t end before it begins!</string> <string name="sheet_schedule_update_timestamp_error_end">The course can\'t end before it begins!</string>
<string name="sheet_schedule_update_text_field_empty_error">This field cannot be empty</string>
<string name="canteen_no_offer_header">No offers</string> <string name="canteen_no_offer_header">No offers</string>
<string name="canteen_no_offer_desc">There are no offers available for this day</string> <string name="canteen_no_offer_desc">There are no offers available for this day</string>
<string name="canteen_fab_refresh_content_desc">Refresh offers</string>
<string name="sheet_licences_header">Licences</string> <string name="sheet_licences_header">Licences</string>
<string name="sheet_licences_content" translatable="false">Android developer resources provided by Google.\nhttps://developer.android.com/\n\nCrash reporting provided by Google.\nhttps://firebase.google.com/products/crashlytics/\n\nDesign guidelines, icons, and colour palette provided by Google.\nhttps://m3.material.io/\n\nAdditional icons provided by Flaticon.\nhttps://www.flaticon.com/\n\nWeb scraping functionality provided by Jonathan Hedley.\nhttps://jhy.io/ | https://jsoup.org/</string> <string name="sheet_licences_content" translatable="false">Android developer resources provided by Google.\nhttps://developer.android.com/\n\nCrash reporting provided by Google.\nhttps://firebase.google.com/products/crashlytics/\n\nDesign guidelines, icons, and colour palette provided by Google.\nhttps://m3.material.io/\n\nAdditional icons provided by Flaticon.\nhttps://www.flaticon.com/\n\nWeb scraping functionality provided by Jonathan Hedley.\nhttps://jhy.io/ | https://jsoup.org/</string>