Skip to content

Conversation

@ardevd
Copy link
Owner

@ardevd ardevd commented Nov 27, 2025

Fixes #4
Fixes #3

@ardevd ardevd requested a review from Copilot November 27, 2025 21:56
@ardevd ardevd self-assigned this Nov 27, 2025
@ardevd ardevd added the enhancement New feature or request label Nov 27, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds record editing and deletion functionality to the Tagius time tracking application. The implementation follows the TimeTagger API convention of marking records as "HIDDEN" for deletion and allows users to edit record descriptions through a bottom sheet interface.

  • Introduces an EditRecordBottomSheet that allows users to edit or delete time records
  • Adds updateRecord and deleteRecord methods to the repository and view model layers
  • Implements item click handling in the records adapter to open the edit bottom sheet
  • Creates delete confirmation dialog for user safety

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
app/src/main/res/layout/fragment_edit_record.xml New layout for the edit record bottom sheet with save/delete buttons
app/src/main/res/drawable/ic_delete.xml New delete icon drawable resource
app/src/main/java/net/ardevd/tagius/features/records/viewmodel/RecordsViewModel.kt Added updateRecord and deleteRecord methods to handle record modifications
app/src/main/java/net/ardevd/tagius/features/records/ui/list/RecordsFragment.kt Updated adapter initialization to include item click handler for opening edit sheet
app/src/main/java/net/ardevd/tagius/features/records/ui/list/RecordsAdapter.kt Added onItemClick callback and wired up click listeners on record items
app/src/main/java/net/ardevd/tagius/features/records/ui/list/OnRecordsClickListener.kt New interface file (appears unused)
app/src/main/java/net/ardevd/tagius/features/records/ui/edit/EditRecordBottomSheet.kt New bottom sheet fragment for editing and deleting records
app/src/main/java/net/ardevd/tagius/features/records/data/RecordsRepository.kt Added updateRecord and deleteRecord repository methods implementing TimeTagger API conventions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return try {
val response = apiService.updateRecords(listOf(deletedRecord))
response.accepted.contains(record.key)
} catch (e: Exception) {
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception is silently swallowed without logging. For consistency with other methods in this repository (e.g., startRecord at line 33 uses e.printStackTrace(), and fetchRecords at line 105 uses Log.d), consider adding error logging here to aid debugging.

Suggested change
} catch (e: Exception) {
} catch (e: Exception) {
Log.d("Tagius", "Error deleting record: ${e.message}", e)

Copilot uses AI. Check for mistakes.
return try {
val response = apiService.updateRecords(listOf(updatedRecord))
response.accepted.contains(record.key)
} catch (e: Exception) {
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception is silently swallowed without logging. For consistency with other methods in this repository (e.g., startRecord at line 33 uses e.printStackTrace(), and fetchRecords at line 105 uses Log.d), consider adding error logging here to aid debugging.

Suggested change
} catch (e: Exception) {
} catch (e: Exception) {
Log.d("Tagius", "Error updating record: ${e.message}")

Copilot uses AI. Check for mistakes.
Comment on lines 12 to 16
class EditRecordBottomSheet(
private val record: TimeTaggerRecord,
private val onSave: (String) -> Unit,
private val onDelete: () -> Unit
) : BottomSheetDialogFragment() {
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing record and callback functions via constructor parameters will cause issues on configuration changes (e.g., screen rotation). Android will attempt to recreate the fragment using a no-arg constructor, which will fail. Consider using a companion object factory method with arguments bundle, or make TimeTaggerRecord implement Parcelable and pass it via arguments. See similar pattern in Android best practices for fragment instantiation.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,5 @@
package net.ardevd.tagius.features.records.ui.list

interface OnRecordClickListener {
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interface name OnRecordClickListener doesn't match the file name OnRecordsClickListener.kt (note "Record" vs "Records"). They should match for consistency.

Suggested change
interface OnRecordClickListener {
interface OnRecordsClickListener {

Copilot uses AI. Check for mistakes.
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="24dp"
app:layout_constraintTop_toBottomOf="@id/title">
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TextInputLayout is missing an android:hint attribute. For consistency with fragment_add_record.xml and better user experience, consider adding a hint like android:hint="Description" to guide users on what to enter.

Suggested change
app:layout_constraintTop_toBottomOf="@id/title">
app:layout_constraintTop_toBottomOf="@id/title"
android:hint="Description">

Copilot uses AI. Check for mistakes.
@ardevd ardevd merged commit 78a94f1 into main Nov 29, 2025
@ardevd ardevd deleted the record-edit branch January 18, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Record editing Record deletion

2 participants