Introduction
VioletDroid is an Android app that allows users to draw UML diagrams on their phones and tablets.
Android Framework
VioletDroid uses Activity - Fragment template to accomplish its major feature.
RecyclerView with corresponding adapter displays the elements needed in UML diagrams.
Custom View class to display and modify current diagrams.
Design Patterns
VioletDroid uses three major design patterns: Decorator Pattern, Composite Pattern, and Observer Pattern.
Decorator Pattern:
RecyclerAdapter class extends Android’s native RecyclerView.Adapter to display the icons in the toolbar menu as a scrolling dataset of images. This is an example of the decorator pattern used in the Android API—RecyclerView essentially decorates an Android ViewGroup to provide the additional scrolling functionality and link to a dataset of assets for the view. The following table represents this pattern:
Composite Pattern:
The composite pattern is used in the VioletDroid CanvasLayout class which extends Android’s native RelativeLayout class, which extends the ViewGroup abstract class which extends View. So CanvasLayout is a ViewGroup, which is a View that can contain other Views. The following table represents this pattern in our project:
Observer Pattern:
The observer pattern is another very common occurrence in User Interface design, particularly with Graphical User Interfaces, since the signal for the application to do something comes from the user’s interaction with elements on-screen, those elements must somehow notify the application what has happened - hence the listeners involved in an observer pattern:
Service Framework
We utilized a cloud service framework called LeanCloud in our project to facilitate user account maintenance and saving of diagrams. It's based on AWS but it is much more convenient for developers:
- No need to write codes for backend service and database.
- Easy to implement, support importing through Gradle.
- Free if there are under 1 million requests per day.
Run Demo
- Start your emulator (highly recommend Genymotion)
- Via bash, navigate to the VioletDroid project folder:
~ $ cd the_path_to_violetdroid_in_your_laptop/
- Execute just one line in your terminal:
~ $ ./exec.sh