1// Modifiers for composable layout elements.
2syntax = "proto3";
3
4package androidx.wear.tiles.testing.proto;
5
6import "action.proto";
7import "color.proto";
8import "dimension.proto";
9import "types.proto";
10
11option java_package = "androidx.wear.tiles.testing.proto";
12option java_outer_classname = "ModifiersProto";
13
14// A modifier for an element which can have associated Actions for click events.
15// When an element with a ClickableModifier is clicked it will fire the
16// associated action.
17message Clickable {
18  // The ID associated with this action.
19  string id = 1;
20
21  // The action to perform when the element this modifier is attached to is
22  // clicked.
23  Action on_click = 2;
24}
25
26// A modifier for an element which has accessibility semantics associated with
27// it. This should generally be used sparingly, and in most cases should only be
28// applied to the top-level layout element or to Clickables.
29message Semantics {
30  // The content description associated with this element. This will be dictated
31  // when the element is focused by the screen reader.
32  string content_description = 1;
33}
34
35// A modifier to apply padding around an element.
36message Padding {
37  // The padding on the end of the content, depending on the layout direction,
38  // in DP and the value of "rtl_aware".
39  DpProp end = 1;
40
41  // The padding on the start of the content, depending on the layout direction,
42  // in DP and the value of "rtl_aware".
43  DpProp start = 2;
44
45  // The padding at the top, in DP.
46  DpProp top = 3;
47
48  // The padding at the bottom, in DP.
49  DpProp bottom = 4;
50
51  // Whether the start/end padding is aware of RTL support. If true, the values
52  // for start/end will follow the layout direction (i.e. start will refer to
53  // the right hand side of the container if the device is using an RTL locale).
54  // If false, start/end will always map to left/right, accordingly.
55  BoolProp rtl_aware = 5;
56}
57
58// A modifier to apply a border around an element.
59message Border {
60  // The width of the border, in DP.
61  DpProp width = 1;
62
63  // The color of the border.
64  ColorProp color = 2;
65}
66
67// The corner of a Box element.
68message Corner {
69  // The radius of the corner in DP.
70  DpProp radius = 1;
71}
72
73// A modifier to apply a background to an element.
74message Background {
75  // The background color for this element. If not defined, defaults to being
76  // transparent.
77  ColorProp color = 1;
78
79  // The corner properties of this element. This only affects the drawing of
80  // this element if it has a background color or border. If not defined,
81  // defaults to having a square corner.
82  Corner corner = 2;
83}
84
85// Modifiers for an element. These may change the way they are drawn (e.g.
86// Padding or Background), or change their behaviour (e.g. Clickable, or
87// Semantics).
88message Modifiers {
89  // Allows its wrapped element to have actions associated with it, which will
90  // be executed when the element is tapped.
91  Clickable clickable = 1;
92
93  // Adds metadata for the modified element, for example, screen reader content
94  // descriptions.
95  Semantics semantics = 2;
96
97  // Adds padding to the modified element.
98  Padding padding = 3;
99
100  // Draws a border around the modified element.
101  Border border = 4;
102
103  // Adds a background (with optional corner radius) to the modified element.
104  Background background = 5;
105}
106
107// Modifiers that can be used with ArcLayoutElements. These may change the way
108// they are drawn, or change their behaviour.
109message ArcModifiers {
110  // Allows its wrapped element to have actions associated with it, which will
111  // be executed when the element is tapped.
112  Clickable clickable = 1;
113
114  // Adds metadata for the modified element, for example, screen reader content
115  // descriptions.
116  Semantics semantics = 2;
117}
118
119// Modifiers that can be used with Span elements. These may change the way
120// they are drawn, or change their behaviour.
121message SpanModifiers {
122  // Allows its wrapped element to have actions associated with it, which will
123  // be executed when the element is tapped.
124  Clickable clickable = 1;
125}
126