Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating away from java.util.Date to java.time - DateTimePickerFragment #4552

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

rapterjet2004
Copy link
Contributor

@rapterjet2004 rapterjet2004 commented Dec 17, 2024

#4274

Migrating to java.time would remove so much code in DateTimePickerFragment that I figured I might as well also convert the dialog fragment to compose too. Honestly looks and feels way better now.

  • Added DateTimeCompose
    • Embedded the Date and Time pickers into the dialog
  • Removed DateTimeFragment + XML
  • Now uses java.time for all-in-one timezone handling + more robust features, instead of java.util.Calendar and java.util.TimeZone

Core logic

        val laterToday = LocalDateTime.now()
            .withHour(18)
            .withMinute(0)
            .withSecond(0)

        val tomorrow = LocalDateTime.now()
            .plusDays(1)
            .withHour(8)
            .withMinute(0)
            .withSecond(0)

        val thisWeekend = LocalDateTime.now()
            .with(nextOrSame(DayOfWeek.SATURDAY))
            .withHour(8)
            .withMinute(0)
            .withSecond(0)
        
        val nextWeek = LocalDateTime.now()
            .plusWeeks(1)
            .with(DayOfWeek.MONDAY)
            .withHour(8)
            .withMinute(0)
            .withSecond(0)
       
issue-4274.webm

🚧 TODO

  • Delete the old fragment + xml
  • Making the labels strings res
  • Checking the offset from datePicker
  • Theming

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@rapterjet2004 rapterjet2004 added the 2. developing Work in progress label Dec 17, 2024
@rapterjet2004 rapterjet2004 self-assigned this Dec 17, 2024
@rapterjet2004 rapterjet2004 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 19, 2024
@rapterjet2004 rapterjet2004 marked this pull request as ready for review December 19, 2024 15:32
- Also converted dialog fragment to compose

Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
Added string res
Fixed bug with embedded date picker boundaries, animated size change

Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
@rapterjet2004 rapterjet2004 force-pushed the issue-4274-migrate-javautil-date-time-1 branch from 99f1c46 to bcb7b60 Compare December 20, 2024 14:53
Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
Copy link
Contributor

@sowjanyakch sowjanyakch left a comment

Choose a reason for hiding this comment

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

  1. I set remainder using custom time and remind me later is always set to 03 Jan, 18:00 pm and it is not updated with the set custom time.

  2. Set a custom time for remainder, then try to change the time - use one of the predefined options, the remind me later is not updated.

  3. Replace hardcoded strings with stringResource()

Copy link
Contributor

github-actions bot commented Jan 7, 2025

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4552-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

Copy link
Contributor

github-actions bot commented Jan 7, 2025

Codacy

Lint

TypemasterPR
Warnings158161
Errors7171

SpotBugs

CategoryBaseNew
Bad practice66
Correctness22216
Dodgy code7171
Internationalization33
Malicious code vulnerability33
Performance44
Security11
Total310104

Lint increased!

@nickvergessen nickvergessen removed their request for review January 7, 2025 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants