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

Up to date calendar app #1958

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JustScott
Copy link
Contributor

This calendar app was originally created by @thnikk in pull request #923, then was updated in June of 2023 by @Boteium to work with the most recent Infinitime version at that time. In the most recent version of Infinitime, 1.14 in January of 2024 (now), the way apps are handled has changed, so in this PR I've updated the code to work with those changes and to be able to be merged into version 1.14 of Infinitime. I've tested the pinetime-mcboot-app version on my sealed Pinetime and have yet to find and issue with it.

Also, I commented out the swipe up and down to increase and decrease the current calendar year feature as that interfered with the swipe down to exit ability users have come to expect when navigating apps... feel free to uncomment the code if you'd like that feature to stay.

Copy link

github-actions bot commented Jan 10, 2024

Build size and comparison to main:

Section Size Difference
text 376764B 3948B
data 948B 0B
bss 22544B 8B

@JustScott
Copy link
Contributor Author

JustScott commented Jan 10, 2024

I just saw the line: 'PRs are either rebase or squash merged' in https://github.com/InfiniTimeOrg/InfiniTime/blob/ecf2f564f7a0884b6acdfdf5530abe2b98cb9aa9/doc/maintainer-guide.md#reviewing-prs.

I don't squash merges or rebase often so I'm not great at it, but I can try if this is required, just let me know!

@vkareh
Copy link
Contributor

vkareh commented Jan 11, 2024

@JustScott the easiest way is to run git rebase -i HEAD~3 (where 3 is the number of commits that you want to squash).

In there it will give you instructions on how to use it:

  1. mark all but the first commit to be squashed
  2. write a proper commit message
  3. save and exit the editor
  4. run git push -f to update the PR

Note: You might have issues doing the above, since I think the branch you sourced this from has the actual calendar implementation buried deep in the git history. I would start over with a clean branch off of main and just cherry-pick the commit (or just copy/paste the code), then fix and squash.

@JustScott
Copy link
Contributor Author

JustScott commented Jan 11, 2024

@vkareh Okay I reset this PRs (local) branch to the latest upstream commit, then cherry picked code from @thnikk's & @Boteium's branches onto my branch (which helped me avoid some of the uneeded 'legacy' code, thanks for the suggestion!).

Since I didn't bring along any of the prior commits from the other branches, and can just put all of my changes under a single commit now, doesn't that mean I don't need to do any squashing?

@JustScott JustScott force-pushed the merge_calendar_upstream branch from a750e7a to c5d47d6 Compare January 11, 2024 04:53
@FintasticMan FintasticMan added the new app This thread is about a new app label Jan 11, 2024
@FintasticMan
Copy link
Member

Thanks for making this new PR. Could you attribute @thnikk and @Boteium in the commit? You can do that by adding Co-authored-by: <commit author> to the commit message.

@vkareh
Copy link
Contributor

vkareh commented Jan 11, 2024

@JustScott

Since I didn't bring along any of the prior commits from the other branches, and can just put all of my changes under a single commit now, doesn't that mean I don't need to do any squashing?

That's correct. The point of squashing is to merge multiple commits, which is no longer necessary in your case.

I also agree with @FintasticMan about adding attribution. You can change the commit message using the same git rebase -i HEAD~1 command and choosing reword (or just r) as the command. Once you save and exit, it will open up the editor with the commit message to edit. Save again, exit, git push -f.

lv_calendar_set_showed_date(calendar, &today);

// Use today's date as a reference for which month to show if moved
current = today;
Copy link
Contributor

@vkareh vkareh Jan 11, 2024

Choose a reason for hiding this comment

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

Do we need different current and today variables? The app always opens with the current date in view, and the lv_calendar_set_today_date never gets overridden (and also there's no refresh call). I think it would work the same if you used a single lv_calendar_date_t variable.

private:
bool OnTouchEvent(TouchEvents event);
Controllers::DateTime& dateTimeController;
lv_obj_t* label_time;
Copy link
Contributor

Choose a reason for hiding this comment

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

This label is not used anywhere

@JustScott JustScott force-pushed the merge_calendar_upstream branch from c5d47d6 to ddb84dc Compare January 11, 2024 16:03
@JustScott
Copy link
Contributor Author

JustScott commented Jan 11, 2024

@vkareh I believe I addressed all the concerns above with this last commit. I also tested this on my pinetime and everything is working as expected.

I'm also wondering what the thoughts on the ability to swipe up and down to increase and decrease the current year of the calendar are? I personally don't like this as it interferes with the user's ability swipe down to exit the app, but I'll leave it in if others want this capability.

@vkareh
Copy link
Contributor

vkareh commented Jan 11, 2024

@JustScott

@vkareh I believe I addressed all the concerns above with this last commit. I also tested this on my pinetime and everything is working as expected.

Awesome! You can still squash the new commit you made if you want to clean things up further. Not sure if it's necessary though.

I'm also wondering what the thoughts on the ability to swipe up and down to increase and decrease the current year of the calendar are? I personally don't like this as it interferes with the user's ability swipe down to exit the app, but I'll leave it in if others want this capability.

I saw that and thought the same thing. It would certainly be useful, but interfering with the global swipe mechanics feels wrong. You would need to use the button to exit, so it's a tradeoff between fuctionality and consistency. I would leave it up to the repo maintainers to determine that.

@JustScott
Copy link
Contributor Author

@vkareh I figured I'd wait until this was ready to be merged to the main branch to squash the commits so the maintainers can more clearly see what's changed. Also, I appreciate all the help you've given me with rebase commands above!

@JustScott JustScott force-pushed the merge_calendar_upstream branch 4 times, most recently from 94d384e to df96d81 Compare January 17, 2024 21:52
lv_obj_set_style_local_text_color(calendar, LV_CALENDAR_PART_DATE, LV_STATE_FOCUSED, LV_COLOR_RED);

// Set style of inactive month's days
lv_obj_set_style_local_text_color(calendar, LV_CALENDAR_PART_DATE, LV_STATE_DISABLED, lv_color_hex(0x505050));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use a color from the InfiniTime theme here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can replace the red with Colors::deepOrange, but Colors::lightGray doesn't look quite right. Would it be alright if I added something like static constexpr lv_color_t gray = LV_COLOR_MAKE(0x50, 0x50, 0x50); to the Colors namespace?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me

@JustScott JustScott force-pushed the merge_calendar_upstream branch from 820d6bb to 791952f Compare January 23, 2024 17:11
@JustScott JustScott force-pushed the merge_calendar_upstream branch from 791952f to 590e6f6 Compare February 1, 2024 14:01
@ZekeZDev
Copy link

Very nice app, I am personally a fan of the original implementation from #923 in which the calendar was placed to the right of the clock. I have found as I add more applications to infinitime its really nice to be able to access the calendar so simply. I'd personally like it as a default, however it might be a better option for a future pull request to customize the location of the launcher, setting and notification gestures too.

swipecal_webm.mp4

I find it also feels a bit more natural for the vertical swiping with this setup as its closer to a traditional calendar.

@JustScott JustScott force-pushed the merge_calendar_upstream branch from 590e6f6 to 67de7dc Compare February 20, 2024 22:35
@JustScott JustScott force-pushed the merge_calendar_upstream branch from 67de7dc to 577dfd5 Compare March 15, 2024 06:16
@JustScott JustScott force-pushed the merge_calendar_upstream branch from 577dfd5 to 1f5c0b6 Compare December 14, 2024 20:16
A basic calendar app that shows all the days dates in the current month along
with the correlating week days, highlights the current day, and allows swiping
left and right to increase and decrease the current month by one.

Co-authored-by: thnikk <[email protected]>
Co-authored-by: Boteium <[email protected]>
@JustScott JustScott force-pushed the merge_calendar_upstream branch from 1f5c0b6 to e374a77 Compare December 14, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new app This thread is about a new app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants