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

Drawer support dynamic submenu #3

Merged
merged 8 commits into from
Jan 7, 2024
Merged

Drawer support dynamic submenu #3

merged 8 commits into from
Jan 7, 2024

Conversation

DJ-Raven
Copy link
Owner

@DJ-Raven DJ-Raven commented Jan 7, 2024

Updated

  • Remove animation layout when push popup
  • Drawer menu support dynamic submenu
  • And fixed some component style

Code changed

  • Create drawer menu item from package raven.drawer.component.menu.data.MenuItem
MenuItem items[] = new MenuItem[]{
        new Item.Label("MAIN"),
        new Item("Dashboard", "dashboard.svg"),
        new Item.Label("WEB APP"),
        new Item("Email", "email.svg")
                .subMenu("Inbox")
                .subMenu(
                        new Item("Group Read")
                                .subMenu("Read 1")
                                .subMenu("Read 2")
                                .subMenu("Read 3")
                                .subMenu("Read 4")
                                .subMenu("Read 5")
                )
                .subMenu("Compost"),
        new Item("Chat", "chat.svg"),
};
  • Menu Style
// old code changed
public void styleMenuItem(JButton menu, int index)

// new code
public void styleMenuItem(JButton menu, int[] index)

// removed
public void styleSubMenuItem(JButton subMenu, int index, int subIndex)
  • Menu event
// old code
simpleMenuOption.addMenuEvent(new MenuEvent() {
    @Override
    public void selected(MenuAction action, int index, int subIndex) {
        if (index == 0) {
            FormManager.showForm(new DashboardForm());
        }
    }
});

// new code
simpleMenuOption.addMenuEvent(new MenuEvent() {
    @Override
    public void selected(MenuAction action, int[] index) {
        if (index.length == 1) {
            if (index[0] == 0) {
                FormManager.showForm(new DashboardForm());
            }
        } else if (index.length == 2) {
            if (index[0] == 1) {
                if (index[1] == 0) {
                    FormManager.showForm(new InboxForm());
                } else if (index[1] == 1) {
                    FormManager.showForm(new ReadForm());
                }
            }
        }
    }
});
  • Method removed simpleMenuOption.setIcons(icons)

2024-01-07_191754

@DJ-Raven DJ-Raven merged commit 20679e9 into main Jan 7, 2024
@DJ-Raven DJ-Raven deleted the fix-push-popup branch January 18, 2024 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant