Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Scrolling speed about SmartGWT.mobile

    Hello,
    I am using smartgwt-mobile-1.0d_2013-05-09 and noticed that scrolling speed on android phone and iPhone is quite differnt.
    I thought that my code had some problem but I encountered same issue on helloworld.
    Scrolling speed on iPhone is fast as I expected but on Android, regardless of hardware specification, scrolling speed is too slow.

    Any solution for this?

    Code:
    package com.mycompany.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootLayoutPanel;
    import com.smartgwt.mobile.client.widgets.Button;
    import com.smartgwt.mobile.client.widgets.Dialog;
    import com.smartgwt.mobile.client.widgets.NavigationButton;
    import com.smartgwt.mobile.client.widgets.Panel;
    import com.smartgwt.mobile.client.widgets.ScrollablePanel;
    import com.smartgwt.mobile.client.widgets.NavigationButton.NavigationDirection;
    import com.smartgwt.mobile.client.widgets.events.ClickEvent;
    import com.smartgwt.mobile.client.widgets.events.ClickHandler;
    import com.smartgwt.mobile.client.widgets.layout.NavStack;
    import com.smartgwt.mobile.client.widgets.toolbar.ToolStrip;
    import com.smartgwt.mobile.client.widgets.toolbar.ToolStripButton;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class HelloWorld implements EntryPoint {
        // handles application pages history and transitions
        private NavStack navigationStack;
    
        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
    
            navigationStack = new NavStack(getColorsView());
            
            navigationStack.setMomentumScroll(true);
            
            RootLayoutPanel.get().add(navigationStack);
        }
    
        public Panel getColorsView() {
            Panel panel = new ScrollablePanel("Colors");
            panel.setMomentumScroll(true);
            String[] colors = new String[]{ "blue", "red", "yellow", "green", "gray", "white", "black", "pink", "brown" };
            for (int i = 0; i < 150; i++) {
                String color = colors[(int) (Math.random() * colors.length)];
                Button button = new Button(color);
                button.setTintColor(color);
                button.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        navigationStack.push(getSportsView(((Button)event.getSource()).getTitle()));
                    }
                });
                panel.addMember(button);
            }
            return panel;
        }
    
        public Panel getSportsView(String color) {
            Panel panel = new ScrollablePanel("Sports");
            
            NavigationButton buttonRefresh = new NavigationButton("Refresh", NavigationDirection.NONE);
    		
    		
            navigationStack.getNavigationBar().setRightButton(buttonRefresh);
            
            
            panel.setMomentumScroll(true);
            String[] sports = new String[]{ "Baseball", "Basketball", "Football", "Hockey", "Volleyball" };
            for (int i = 0; i < 150; i++) {
                String sport = sports[(int) (Math.random() * sports.length)];
                ToolStripButton button = new ToolStripButton(sport);
                button.setInheritTint(true);
                button.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        String sportName = ((ToolStripButton)event.getSource()).getTitle();
                        Dialog dialog = new Dialog("Do you like " + sportName + "?");
                        dialog.setButtons(Dialog.YES, Dialog.NO);
                        dialog.show();
                    }
                }); 
                ToolStrip toolbar = new ToolStrip();
                toolbar.setMomentumScroll(true);
                toolbar.setTintColor(color);
                toolbar.addMember(button);
                panel.addMember(toolbar);
            }
            return panel;
        }
    }
Working...
X