Archived
Added button to change order for tasks (functionality unimplemented); moved options menu for events to long press, single click is now functionless
This commit is contained in:
@@ -146,7 +146,6 @@ class CanteenFragment : AppFragment<FragmentCanteenBinding>() {
|
|||||||
|
|
||||||
// Set up floating action button for switching canteens
|
// Set up floating action button for switching canteens
|
||||||
binding.fabSwitchCanteen.setOnClickListener {
|
binding.fabSwitchCanteen.setOnClickListener {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show an error message is the user is trying to switch canteens while another one is
|
* Show an error message is the user is trying to switch canteens while another one is
|
||||||
* being downloaded.
|
* being downloaded.
|
||||||
|
|||||||
@@ -97,11 +97,11 @@ class CanteenPageFragment : AppFragment<RecyclerViewBinding>(), CanteenOfferItem
|
|||||||
// Set up scroll change listener to shrink and extend FAB accordingly
|
// Set up scroll change listener to shrink and extend FAB accordingly
|
||||||
binding.recyclerView.setOnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
binding.recyclerView.setOnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
||||||
// Calculate the vertical scroll difference
|
// Calculate the vertical scroll difference
|
||||||
val dy = scrollY - oldScrollY
|
val differenceY = scrollY - oldScrollY
|
||||||
if (dy > 0) {
|
if (differenceY > 0) {
|
||||||
// If scrolling down, shrink the FAB
|
// If scrolling down, shrink the FAB
|
||||||
parentFragment.shrinkFab()
|
parentFragment.shrinkFab()
|
||||||
} else if (dy < 0) {
|
} else if (differenceY < 0) {
|
||||||
// If scrolling up, extend the FAB
|
// If scrolling up, extend the FAB
|
||||||
parentFragment.extendFab()
|
parentFragment.extendFab()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ class EventFragment : AppFragment<FragmentEventBinding>() {
|
|||||||
|
|
||||||
// Set the view pager's current page to the current day, if the user chose this option
|
// Set the view pager's current page to the current day, if the user chose this option
|
||||||
if (viewModel.preferenceCurrentDay) {
|
if (viewModel.preferenceCurrentDay) {
|
||||||
|
|
||||||
// Determine the current day and go to the respective page.
|
// Determine the current day and go to the respective page.
|
||||||
binding.viewPager.setCurrentItem(
|
binding.viewPager.setCurrentItem(
|
||||||
when (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {
|
when (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.denizk0461.weserplaner.adapter.StudIPEventItemAdapter
|
|||||||
import com.denizk0461.weserplaner.databinding.RecyclerViewBinding
|
import com.denizk0461.weserplaner.databinding.RecyclerViewBinding
|
||||||
import com.denizk0461.weserplaner.model.StudIPEvent
|
import com.denizk0461.weserplaner.model.StudIPEvent
|
||||||
import com.denizk0461.weserplaner.sheet.EventActionSheet
|
import com.denizk0461.weserplaner.sheet.EventActionSheet
|
||||||
import com.denizk0461.weserplaner.sheet.ScheduleUpdateSheet
|
|
||||||
import com.denizk0461.weserplaner.viewmodel.EventPageViewModel
|
import com.denizk0461.weserplaner.viewmodel.EventPageViewModel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,11 +75,11 @@ class EventPageFragment : AppFragment<RecyclerViewBinding>(), StudIPEventItemAda
|
|||||||
// Set up scroll change listener to shrink and extend FAB accordingly
|
// Set up scroll change listener to shrink and extend FAB accordingly
|
||||||
binding.recyclerView.setOnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
binding.recyclerView.setOnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
||||||
// Calculate the vertical scroll difference
|
// Calculate the vertical scroll difference
|
||||||
val dy = scrollY - oldScrollY
|
val differenceY = scrollY - oldScrollY
|
||||||
if (dy > 0) {
|
if (differenceY > 0) {
|
||||||
// If scrolling down, shrink the FAB
|
// If scrolling down, shrink the FAB
|
||||||
parent?.shrinkFab()
|
parent?.shrinkFab()
|
||||||
} else if (dy < 0) {
|
} else if (differenceY < 0) {
|
||||||
// If scrolling up, extend the FAB
|
// If scrolling up, extend the FAB
|
||||||
parent?.extendFab()
|
parent?.extendFab()
|
||||||
}
|
}
|
||||||
@@ -128,6 +127,19 @@ class EventPageFragment : AppFragment<RecyclerViewBinding>(), StudIPEventItemAda
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(event: StudIPEvent) {
|
override fun onClick(event: StudIPEvent) {
|
||||||
|
// TODO implement something or delete
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLongClick(event: StudIPEvent): Boolean {
|
||||||
|
// Open a bottom sheet to edit the event
|
||||||
|
// openBottomSheet(
|
||||||
|
// ScheduleUpdateSheet().also { sheet ->
|
||||||
|
// val bundle = Bundle()
|
||||||
|
// bundle.putBoolean("isEditing", true)
|
||||||
|
// bundle.putParcelable("event", event)
|
||||||
|
// sheet.arguments = bundle
|
||||||
|
// }
|
||||||
|
// )
|
||||||
// Open a bottom sheet to view options for the event
|
// Open a bottom sheet to view options for the event
|
||||||
openBottomSheet(
|
openBottomSheet(
|
||||||
EventActionSheet().also { sheet ->
|
EventActionSheet().also { sheet ->
|
||||||
@@ -136,18 +148,6 @@ class EventPageFragment : AppFragment<RecyclerViewBinding>(), StudIPEventItemAda
|
|||||||
sheet.arguments = bundle
|
sheet.arguments = bundle
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLongClick(event: StudIPEvent): Boolean {
|
|
||||||
// Open a bottom sheet to edit the event
|
|
||||||
openBottomSheet(
|
|
||||||
ScheduleUpdateSheet().also { sheet ->
|
|
||||||
val bundle = Bundle()
|
|
||||||
bundle.putBoolean("isEditing", true)
|
|
||||||
bundle.putParcelable("event", event)
|
|
||||||
sheet.arguments = bundle
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
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.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import com.denizk0461.weserplaner.R
|
import com.denizk0461.weserplaner.R
|
||||||
import com.denizk0461.weserplaner.data.showSnackBar
|
import com.denizk0461.weserplaner.data.showSnackBar
|
||||||
@@ -27,20 +28,46 @@ class TaskOverviewFragment : AppFragment<FragmentTaskOverviewBinding>() {
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
// Set the title to be selected so it scrolls (marquee)
|
||||||
|
binding.appTitleBar.isSelected = true
|
||||||
|
|
||||||
// Tell the user that this fragment's functionality is not yet implemented
|
// Tell the user that this fragment's functionality is not yet implemented
|
||||||
context.theme.showSnackBar(
|
context.theme.showSnackBar(
|
||||||
binding.coordinatorLayout,
|
binding.coordinatorLayout,
|
||||||
getString(R.string.task_overview_snack_unimplemented),
|
getString(R.string.task_overview_snack_unimplemented),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
binding.buttonOrder.setOnClickListener {
|
||||||
|
|
||||||
|
|
||||||
|
// Create menu for selecting a new canteen
|
||||||
|
PopupMenu(binding.root.context, binding.buttonOrder).apply {
|
||||||
|
setOnMenuItemClickListener { item ->
|
||||||
|
when (item?.itemId) {
|
||||||
|
R.id.title_alphabetically -> {}
|
||||||
|
R.id.date_created -> {}
|
||||||
|
R.id.date_due -> {}
|
||||||
|
else -> {} // repeat first option
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO set user's ordering preference
|
||||||
|
|
||||||
|
// TODO refresh the view
|
||||||
|
true
|
||||||
|
}
|
||||||
|
inflate(R.menu.menu_task_sort)
|
||||||
|
show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set up scroll change listener to shrink and extend FAB accordingly
|
// Set up scroll change listener to shrink and extend FAB accordingly
|
||||||
binding.recyclerViewLayout.recyclerView.setOnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
binding.recyclerViewLayout.recyclerView.setOnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
||||||
// Calculate the vertical scroll difference
|
// Calculate the vertical scroll difference
|
||||||
val dy = scrollY - oldScrollY
|
val differenceY = scrollY - oldScrollY
|
||||||
if (dy > 0) {
|
if (differenceY > 0) {
|
||||||
// If scrolling down, shrink the FAB
|
// If scrolling down, shrink the FAB
|
||||||
binding.fabAddTask.shrink()
|
binding.fabAddTask.shrink()
|
||||||
} else if (dy < 0) {
|
} else if (differenceY < 0) {
|
||||||
// If scrolling up, extend the FAB
|
// If scrolling up, extend the FAB
|
||||||
binding.fabAddTask.extend()
|
binding.fabAddTask.extend()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:autoMirrored="true" 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="M3,18h6v-2L3,16v2zM3,6v2h18L21,6L3,6zM3,13h12v-2L3,11v2z"/>
|
||||||
|
</vector>
|
||||||
@@ -14,17 +14,50 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="8dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/app_title_bar"
|
android:id="@+id/app_title_bar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="16dp"
|
android:text="@string/title_exam_overview"
|
||||||
|
android:textSize="28sp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
android:fontFamily="@font/lato_blackitalic"
|
android:fontFamily="@font/lato_blackitalic"
|
||||||
android:text="@string/title_exam_overview"
|
android:singleLine="true"
|
||||||
app:layout_scrollFlags="scroll"
|
android:ellipsize="marquee"
|
||||||
android:textSize="28sp"/>
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/button_order"/>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/Widget.Material3.Button.IconButton.Outlined"
|
||||||
|
android:id="@+id/button_order"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minWidth="0dp"
|
||||||
|
app:icon="@drawable/sort"
|
||||||
|
app:iconPadding="0dp"
|
||||||
|
app:strokeColor="?attr/colorOutlineVariant"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/app_title_bar"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/app_title_bar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:iconTint="?attr/colorOnSurfaceVariant"
|
||||||
|
tools:ignore="UnusedAttribute"
|
||||||
|
android:tooltipText="@string/task_overview_button_order_hint"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="8dp"
|
||||||
|
android:paddingVertical="4dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/card_background"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Widget.Material3.CardView.Outlined">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/linear_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/title_alphabetically"
|
||||||
|
android:title="@string/task_order_menu_title_alphabetically"
|
||||||
|
android:enabled="true"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/date_created"
|
||||||
|
android:title="@string/task_order_menu_date_created"
|
||||||
|
android:enabled="true"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/date_due"
|
||||||
|
android:title="@string/task_order_menu_date_due"
|
||||||
|
android:enabled="true"/>
|
||||||
|
</menu>
|
||||||
@@ -84,6 +84,12 @@
|
|||||||
<string name="sheet_schedule_update_time_dialog_start_hint">Startzeit der Veranstaltung</string>
|
<string name="sheet_schedule_update_time_dialog_start_hint">Startzeit der Veranstaltung</string>
|
||||||
<string name="sheet_schedule_update_time_dialog_end_hint">Schlusszeit der Veranstaltung</string>
|
<string name="sheet_schedule_update_time_dialog_end_hint">Schlusszeit der Veranstaltung</string>
|
||||||
|
|
||||||
|
<string name="task_overview_button_order_hint">Aufgaben sortieren</string>
|
||||||
|
<!-- these are TODO -->
|
||||||
|
<string name="task_order_menu_title_alphabetically">Alphabetisch</string>
|
||||||
|
<string name="task_order_menu_date_created">Erstellungszeit</string>
|
||||||
|
<string name="task_order_menu_date_due">Abgabezeit</string>
|
||||||
|
|
||||||
<string name="task_overview_snack_unimplemented">Aufgaben sind noch nicht implementiert!</string>
|
<string name="task_overview_snack_unimplemented">Aufgaben sind noch nicht implementiert!</string>
|
||||||
<string name="task_overview_fab_add_task">Aufgabe hinzufügen</string>
|
<string name="task_overview_fab_add_task">Aufgabe hinzufügen</string>
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,11 @@
|
|||||||
<string name="sheet_schedule_update_time_dialog_start_hint">Event start time</string>
|
<string name="sheet_schedule_update_time_dialog_start_hint">Event start time</string>
|
||||||
<string name="sheet_schedule_update_time_dialog_end_hint">Event end time</string>
|
<string name="sheet_schedule_update_time_dialog_end_hint">Event end time</string>
|
||||||
|
|
||||||
|
<string name="task_overview_button_order_hint">Order tasks</string>
|
||||||
|
<string name="task_order_menu_title_alphabetically">Alphabetically</string>
|
||||||
|
<string name="task_order_menu_date_created">Date created</string>
|
||||||
|
<string name="task_order_menu_date_due">Date due</string>
|
||||||
|
|
||||||
<string name="task_overview_snack_unimplemented">Tasks are not yet implemented!</string>
|
<string name="task_overview_snack_unimplemented">Tasks are not yet implemented!</string>
|
||||||
<string name="task_overview_fab_add_task">Add task</string>
|
<string name="task_overview_fab_add_task">Add task</string>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user