GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adds page indicator to music app by SteveAmor · Pull Request #1875 · InfiniTimeOrg/InfiniTime

Conversation

@SteveAmor

@SteveAmor SteveAmor commented Oct 4, 2023

Copy link
Copy Markdown
Contributor

Fixes #1391

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

minacode reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@github-actions

github-actions Bot commented Oct 4, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Build size and comparison to main:

Section Size Difference
text 380180B 48B
data 944B 0B
bss 22544B 0B

Run in InfiniEmu

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor

SteveAmor commented Oct 4, 2023

Copy link
Copy Markdown
Contributor Author

InfiniSim_2023-10-04_202308

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@minacode

minacode commented Oct 4, 2023

Copy link
Copy Markdown
Contributor

I imagine it could look a little better with a little margin around the buttons. What do you think?

SteveAmor reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor

SteveAmor commented Oct 5, 2023

Copy link
Copy Markdown
Contributor Author

The page indicator is 2px wide.
However, if I move the buttons 3px, it conveniently has a 3px space between the play/pause button too, making it nice and symmetrical.
What do people think?

InfiniSim_2023-10-05_080028

For comparison, here are the buttons moved 2px

2px

minacode reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@minacode

minacode commented Oct 5, 2023

Copy link
Copy Markdown
Contributor

I like the first image where the bar is not touching the button.

SteveAmor, tituscmd, and marigoldfish reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor

SteveAmor commented Oct 5, 2023

Copy link
Copy Markdown
Contributor Author

PR updated to move the buttons 3px.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor

SteveAmor commented Oct 5, 2023

Copy link
Copy Markdown
Contributor Author

I experimented with hiding or deleting the page indicator object when you switch pages. According to the simulator, hiding the object used more lvgl memory than deleting and creating. So I went with deleting. I guess it used more memory as you actually had more objects at any one time, with one of them hidden.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@LinuxinaBit LinuxinaBit mentioned this pull request Nov 9, 2023
Music app redesign #1901
Closed
@SteveAmor
SteveAmor force-pushed the musicpageindicator branch 2 times, most recently from b3b9a27 to 72bc736 Compare December 1, 2024 20:23
@SteveAmor SteveAmor changed the title Adds scroll bar to music app Adds page indicator to music app Dec 1, 2024
@mark9064 mark9064 added this to the 1.16.0 milestone Dec 2, 2024
@mark9064 mark9064 added the enhancement Enhancement to an existing app/feature label Dec 2, 2024
@SteveAmor SteveAmor mentioned this pull request May 13, 2025
(small) Music App Redesign #2292
Merged
@mark9064

mark9064 commented Jul 5, 2025

Copy link
Copy Markdown
Member

I experimented with hiding or deleting the page indicator object when you switch pages. According to the simulator, hiding the object used more lvgl memory than deleting and creating. So I went with deleting. I guess it used more memory as you actually had more objects at any one time, with one of them hidden.

Just thinking, would it make more sense to have a SetCurrentScreen() method for pageindicator so that you only need to store one instance of the pageindicator object too?

minacode reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor
Adds page indicator to music app
90601f6
@SteveAmor
SteveAmor force-pushed the musicpageindicator branch from 12637b1 to 90601f6 Compare July 6, 2025 13:33
@SteveAmor

SteveAmor commented Jul 8, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

I remember now. Music.cpp doesn't have more than one page. It has a single page and hides/unhides buttons to make it look like two pages. This is the reason I went down this route. Perhaps the best thing to do (which is what I did originally) is to hide and unhide two page indicators?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor

SteveAmor commented Jul 8, 2025

Copy link
Copy Markdown
Contributor Author

I experimented with hiding or deleting the page indicator object when you switch pages. According to the simulator, hiding the object used more lvgl memory than deleting and creating. So I went with deleting. I guess it used more memory as you actually had more objects at any one time, with one of them hidden.

Just thinking, would it make more sense to have a SetCurrentScreen() method for pageindicator so that you only need to store one instance of the pageindicator object too?

I think that already exists:

PageIndicator(uint8_t nCurrentScreen, uint8_t nScreens)

But won't work for Music.cpp single page with hidden buttons for the "second page".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Jul 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

What I'm suggesting is a new method for PageIndicator that tears down the existing one and redraws at a different position. This way you'd only have one page indicator as a member of the app and you could do pageIndicator.SetCurrentScreen(x) whenever you wanted to move it, rather than having two and having to create/delete or hide/unhide

SteveAmor and minacode reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor
Adds SetCurrentScreen method to page indicator
f3b1942
@SteveAmor

SteveAmor commented Jul 13, 2025

Copy link
Copy Markdown
Contributor Author

@mark9064 hopefully this implementation of SetCurrentScreen is what you had in mind? Please let me know :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@minacode

minacode commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

Inside it, LVGL objects are created and dropped. Is that a good idea? Would it be better to create a function Refresh which can reset some of the properties of those objects based on the widgets attributes and call that instead and never use Delete? I imagine that this may take some work off the LVGL heap, but am not perfectly sure how it works internally.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor

SteveAmor commented Jul 15, 2025

Copy link
Copy Markdown
Contributor Author

Inside it, LVGL objects are created and dropped. Is that a good idea? Would it be better to create a function Refresh which can reset some of the properties of those objects based on the widgets attributes and call that instead and never use Delete? I imagine that this may take some work off the LVGL heap, but am not perfectly sure how it works internally.

I'm certainly no expert but having looked at the pageindicator code, I can't see an easy way to update some of the properties. If not all of them. Any guidance would be much appreciated.
I've tried to ballance the additional code space required with the functionality of a page indicator.
To fit in with the pattern the Music page(s) uses, I'm very much tending towards my original thought (and test) of having two page indicators and hiding/unhiding them.
From a UI point of view, I hadn't realised that you can also skip tracks back and forwards by swiping left and right!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Jul 16, 2025

Copy link
Copy Markdown
Member

Well I think the current implementation is pretty fine

But if you wanted to be more efficient, pull out

  const int16_t indicatorSize = LV_VER_RES / nScreens;
  const int16_t indicatorPos = indicatorSize * nCurrentScreen;

  pageIndicatorPoints[0].x = LV_HOR_RES - 1;
  pageIndicatorPoints[0].y = indicatorPos;
  pageIndicatorPoints[1].x = LV_HOR_RES - 1;
  pageIndicatorPoints[1].y = indicatorPos + indicatorSize;
  
  lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);

to a different method (eg SetPageIndicatorPosition(u8 position)) and then call that at the end of Create, and directly from the code here.

This works as you can leave the background stripe, and only want to move the highlight (current position indicator) stripe.

SteveAmor reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor
SteveAmor force-pushed the musicpageindicator branch 2 times, most recently from 9cfe584 to 2ac8a00 Compare July 18, 2025 17:44
@SteveAmor
Refactor pageindicator
d7370ab
@SteveAmor
SteveAmor force-pushed the musicpageindicator branch from 2ac8a00 to d7370ab Compare July 18, 2025 17:46
@SteveAmor

SteveAmor commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Well I think the current implementation is pretty fine

But if you wanted to be more efficient, pull out

  const int16_t indicatorSize = LV_VER_RES / nScreens;
  const int16_t indicatorPos = indicatorSize * nCurrentScreen;

  pageIndicatorPoints[0].x = LV_HOR_RES - 1;
  pageIndicatorPoints[0].y = indicatorPos;
  pageIndicatorPoints[1].x = LV_HOR_RES - 1;
  pageIndicatorPoints[1].y = indicatorPos + indicatorSize;
  
  lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);

to a different method (eg SetPageIndicatorPosition(u8 position)) and then call that at the end of Create, and directly from the code here.

This works as you can leave the background stripe, and only want to move the highlight (current position indicator) stripe.

All done :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Jul 18, 2025

Copy link
Copy Markdown
Member

If you move

  pageIndicator = lv_line_create(lv_scr_act(), nullptr);
  lv_obj_set_style_local_line_width(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
  lv_obj_set_style_local_line_color(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray);

to Create(), then you don't need an extra method at all as you won't be deleting the existing page indicator, instead it'll only be moved

SteveAmor reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor
Refactor pageindicator
6626868
@SteveAmor

SteveAmor commented Jul 19, 2025

Copy link
Copy Markdown
Contributor Author

If you move

  pageIndicator = lv_line_create(lv_scr_act(), nullptr);
  lv_obj_set_style_local_line_width(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
  lv_obj_set_style_local_line_color(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray);

to Create(), then you don't need an extra method at all as you won't be deleting the existing page indicator, instead it'll only be moved

My bad, I should have noticed that in your earlier message. This (hopefully final) commit is the most efficient in terms of additional program memory required and it certainly (looks to me) cleaner than previous commits.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor

SteveAmor commented Jul 19, 2025

Copy link
Copy Markdown
Contributor Author

@mark9064 could you please double check that I have declared everything that I need to, correctly, in PageIndicator.h

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mark9064
mark9064 approved these changes Aug 5, 2025
View reviewed changes

@mark9064 mark9064 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

All LGTM :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@LinuxinaBit LinuxinaBit mentioned this pull request Aug 18, 2025
Music: Redesign Part 2 #2337
Open
@tituscmd

tituscmd commented Sep 13, 2025

Copy link
Copy Markdown
Contributor

Would be superseded by #2337 if merged

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveAmor
Merge branch 'main' into musicpageindicator
898775c
@minacode

minacode commented Sep 27, 2025

Copy link
Copy Markdown
Contributor

I would argue that we still merge this, because it's ready and easy to do. And then we discuss your version 2 on top of that. Do you agree, @mark9064?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Sep 27, 2025

Copy link
Copy Markdown
Member

Yep, sounds good to me. Once this has a second review I'm happy to merge :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JF002
JF002 approved these changes Nov 3, 2025
View reviewed changes

@JF002 JF002 left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM, thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
NeroBurner
NeroBurner approved these changes Nov 3, 2025
View reviewed changes

@NeroBurner NeroBurner left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@JF002
JF002 merged commit 04afd22 into InfiniTimeOrg:main Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JF002 JF002 JF002 approved these changes
@NeroBurner NeroBurner NeroBurner approved these changes
@mark9064 mark9064 mark9064 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement Enhancement to an existing app/feature

Projects

None yet

Milestone

1.16.0

Development

Successfully merging this pull request may close these issues.

Add Scroll Bar to the Music App

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@SteveAmor @minacode @mark9064 @tituscmd @JF002 @NeroBurner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.