Skip to content

Instantly share code, notes, and snippets.

@arriolac
Created September 7, 2015 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arriolac/fd2431ab5e8c1cd9fac3 to your computer and use it in GitHub Desktop.
Save arriolac/fd2431ab5e8c1cd9fac3 to your computer and use it in GitHub Desktop.
DrawingView Architecture

This is the proposed architecture for implementing drawing on text, photos and videos on Leo.

DrawingView

  • This is the custom view that will display the drawing created by the user.
  • Will be the View on "top" (relative to z-axis) of all the other views in AddTextActivity except the top bar Views.
  • Notes:
    • overrides onTouchEvent(...)
    • has a method called setEnabled(boolean enabled)
      • enabled value will be returned by onTouchEvent(...). this means that it will intercept all touch events when enabled.
      • Note: this will be toggled by the compose views (enabled when in drawing mode, disabled when not in drawing mode).
    • has a setColor(...) method
    • contains a transcript (LinkedList) of "drawing events" (I think these "drawing events" will be Path objects)
    • has an undo function that removes the last drawn event from the canvas (head of the LinkedList)
    • Look at the FingerPaint sample app in the API demos to see how to draw to canvas given a sequence of touch points.
  • Create a screenshot (Bitmap) of the composition by calling View.getDrawingCache(). The screenshot should not include the EditText, top & bottom bar views. This means getDrawingCache() should only be called on the ViewGroup that contains the ImageView + DrawingView.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment