The concept of "drawing" can be defined in its own class. It would allow generalizing things like shapes, with common properties such as border color / radius, corner radius, shadow, etc...
A drawing is made of one or multiple layers.
A layer is made of multiple properties:
fill color
fill gradient
border color
border thickness
shadow type
etc...
Basically the same thing as what make the view backgrounds now.
Note: the current view background has a stub for a "custom" shadow that's not actually implemented. It should be implemented in drawings. The idea is to ask the user for all shadow properties (width, feather, opacity, offset).
View backgrounds can then be entirely replaced with a single Drawing, which will then take care of all the rendering.
[ ] Make a Drawable class that only has a draw method (the same as the one in View)
[ ] Make View inherit from Drawable
[ ] Implement the new Drawing class, also inheriting from Drawable, taken from the current view backgrounds
[ ] Make a way to define and create drawings from XML, and generalize the XML attributes handlers to allow usage of @theme, @style... in drawing XML files,
[ ] Remove the view backgrounds logic and replace it by a Drawing instance (also remove all custom backgrounds like sidebar...)
[ ] Add a new drawing XML type for views: @drawing/... to reference drawings for view background for example (and add a backgroundDrawing attribute)
[ ] Add a DrawableView method that takes a Drawable and simply draws it across its entire surface
The concept of "drawing" can be defined in its own class. It would allow generalizing things like shapes, with common properties such as border color / radius, corner radius, shadow, etc...
A drawing is made of one or multiple layers.
A layer is made of multiple properties:
Basically the same thing as what make the view backgrounds now.
Note: the current view background has a stub for a "custom" shadow that's not actually implemented. It should be implemented in drawings. The idea is to ask the user for all shadow properties (width, feather, opacity, offset).
View backgrounds can then be entirely replaced with a single
Drawing
, which will then take care of all the rendering.draw
method (the same as the one inView
)View
inherit fromDrawable
Drawing
class, also inheriting fromDrawable
, taken from the current view backgrounds@theme
,@style
... in drawing XML files,Drawing
instance (also remove all custom backgrounds like sidebar...)drawing
XML type for views:@drawing/...
to reference drawings for view background for example (and add abackgroundDrawing
attribute)DrawableView
method that takes aDrawable
and simply draws it across its entire surface