Implementing the UI

The Wordpress MIDlet UI consists of custom Canvas-based views. Due to the nature of the Canvas, a graphically intensive UI requires a fair amount of work. However, the Canvas approach provides good performance. In this MIDlet, a small UI framework is implemented to handle the various views.

The ViewMaster class manages the individual views, which are all inherited from the BaseView class. The ViewMaster class performs the view switches with smooth view transition animations. Each view handles user input and decides which view to activate next in the work flow. The OptionsMenu class implements the custom menu control. The menu content is implemented in individual views by extending the OptionsMenu class.

The following figure shows the main application structure related to the Wordpress UI framework.

Figure: Main application structure

The PostsView and CommentsView classes use a custom list component class, List. The List class draws a list on the screen with a focus highlight and scroll bar. An instance of ListDrawer is provided for the List to perform the actual drawing. The exact drawing needs differ based on the current view, since the PostsView displays posts, while the CommentsView displays comments.

Figure: Views with custom lists