Skip to content

Commit e045bac

Browse files
306: add device selector (#553)
1 parent 9b8f516 commit e045bac

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

src/z2ui5_cl_demo_app_306.clas.abap

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,23 @@ CLASS z2ui5_cl_demo_app_306 DEFINITION
1515
selected TYPE abap_bool,
1616
END OF ty_picture.
1717

18+
TYPES:
19+
BEGIN OF t_combo,
20+
key TYPE string,
21+
text TYPE string,
22+
END OF t_combo,
23+
tt_combo TYPE STANDARD TABLE OF t_combo WITH EMPTY KEY.
24+
25+
1826
DATA mt_picture TYPE STANDARD TABLE OF ty_picture WITH EMPTY KEY.
1927
DATA mt_picture_out TYPE STANDARD TABLE OF ty_picture WITH EMPTY KEY.
2028
DATA mv_pic_display TYPE string.
2129
DATA mv_check_init TYPE abap_bool.
2230
DATA mv_picture_base TYPE string.
2331
DATA facing_mode TYPE string.
32+
DATA facing_modes TYPE tt_combo.
33+
DATA device TYPE string.
34+
DATA devices TYPE tt_combo.
2435

2536
PROTECTED SECTION.
2637

@@ -29,7 +40,6 @@ CLASS z2ui5_cl_demo_app_306 DEFINITION
2940
client TYPE REF TO z2ui5_if_client.
3041

3142
PRIVATE SECTION.
32-
3343
ENDCLASS.
3444

3545

@@ -47,17 +57,24 @@ CLASS z2ui5_cl_demo_app_306 IMPLEMENTATION.
4757
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ).
4858

4959
page->vbox( class = `sapUiSmallMargin`
50-
)->label( text = `facingMode: ` labelfor = `Combo`
51-
)->combobox( id = `Combo` selectedkey = client->_bind_edit( facing_mode )
52-
)->item( key = `environment` text = `environment`
53-
)->item( key = `user` text = `user`
54-
)->item( key = `left` text = `left`
55-
)->item( key = `right` text = `right` ).
60+
)->label( text = `facingMode: ` labelfor = `ComboFacingMode`
61+
)->combobox( id = `ComboFacingMode` selectedkey = client->_bind_edit( facing_mode )
62+
items = `{path:'` && client->_bind_edit( val = facing_modes path = abap_true ) && `', sorter: { path: 'TEXT' } }`
63+
)->get( )->item( key = `{KEY}` text = `{TEXT}` ).
64+
65+
page->vbox( class = `sapUiSmallMargin`
66+
)->label( text = `device: ` labelfor = `ComboDevice`
67+
)->_z2ui5( )->camera_selector(
68+
id = `ComboDevice`
69+
selectedkey = client->_bind_edit( device )
70+
items = `{path:'` && client->_bind_edit( val = devices path = abap_true ) && `', sorter: { path: 'TEXT' } }`
71+
)->get( )->item( key = `{KEY}` text = `{TEXT}` ).
5672

5773
page->_z2ui5( )->camera_picture(
5874
value = client->_bind_edit( mv_picture_base )
5975
onphoto = client->_event( 'CAPTURE' )
60-
facingmode = client->_bind_edit( facing_mode ) ).
76+
facingmode = client->_bind_edit( facing_mode )
77+
deviceid = client->_bind_edit( device ) ).
6178

6279
page->list(
6380
headertext = 'List Ouput'
@@ -89,11 +106,16 @@ CLASS z2ui5_cl_demo_app_306 IMPLEMENTATION.
89106
METHOD z2ui5_if_app~main.
90107

91108
IF mv_check_init = abap_false.
109+
92110
mv_check_init = abap_true.
93111

94-
facing_mode = `environment`.
95-
view_display( client ).
112+
facing_modes = VALUE tt_combo( ( key = `` text = `` )
113+
( key = `environment` text = `environment` )
114+
( key = `user` text = `user` )
115+
( key = `left` text = `left` )
116+
( key = `right` text = `right` ) ).
96117

118+
view_display( client ).
97119

98120
ENDIF.
99121

0 commit comments

Comments
 (0)