diff --git a/src/027c66aaa6591edfa9bb6b42f39e45dd.smim.xml b/src/027c66aaa6591edfa9bb6b42f39e45dd.smim.xml new file mode 100644 index 00000000..bb4a2851 --- /dev/null +++ b/src/027c66aaa6591edfa9bb6b42f39e45dd.smim.xml @@ -0,0 +1,9 @@ + + + + + /SAP/PUBLIC/BC/ABAP/mime_demo/z2ui5_demo_error.mp3 + M_APP_L + + + diff --git a/src/027c66aaa6591edfa9bb6b42f39e45dd.smim.z2ui5_demo_error.mp3 b/src/027c66aaa6591edfa9bb6b42f39e45dd.smim.z2ui5_demo_error.mp3 new file mode 100644 index 00000000..a629c440 Binary files /dev/null and b/src/027c66aaa6591edfa9bb6b42f39e45dd.smim.z2ui5_demo_error.mp3 differ diff --git a/src/027c66aaa6591edfa9bb6fac299145df.smim.xml b/src/027c66aaa6591edfa9bb6fac299145df.smim.xml new file mode 100644 index 00000000..0667b774 --- /dev/null +++ b/src/027c66aaa6591edfa9bb6fac299145df.smim.xml @@ -0,0 +1,9 @@ + + + + + /SAP/PUBLIC/BC/ABAP/mime_demo/z2ui5_demo_success.mp3 + M_APP_L + + + diff --git a/src/027c66aaa6591edfa9bb6fac299145df.smim.z2ui5_demo_success.mp3 b/src/027c66aaa6591edfa9bb6fac299145df.smim.z2ui5_demo_success.mp3 new file mode 100644 index 00000000..71d80c70 Binary files /dev/null and b/src/027c66aaa6591edfa9bb6fac299145df.smim.z2ui5_demo_success.mp3 differ diff --git a/src/z2ui5_cl_demo_app_000.clas.abap b/src/z2ui5_cl_demo_app_000.clas.abap index e78c678a..3f526509 100644 --- a/src/z2ui5_cl_demo_app_000.clas.abap +++ b/src/z2ui5_cl_demo_app_000.clas.abap @@ -897,6 +897,14 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). + panel->generic_tile( + header = 'Sound' + subheader = 'Play success and error sounds' + press = client->_event( 'Z2UI5_CL_DEMO_APP_304' ) + mode = 'LineMode' + class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' + ). + panel = page->panel( expandable = abap_false expanded = abap_true diff --git a/src/z2ui5_cl_demo_app_304.clas.abap b/src/z2ui5_cl_demo_app_304.clas.abap new file mode 100644 index 00000000..92edf2d2 --- /dev/null +++ b/src/z2ui5_cl_demo_app_304.clas.abap @@ -0,0 +1,87 @@ +CLASS z2ui5_cl_demo_app_304 DEFINITION + PUBLIC + FINAL + CREATE PUBLIC . + + PUBLIC SECTION. + + INTERFACES z2ui5_if_app. + DATA magic_key TYPE string. + DATA: BEGIN OF message, + text TYPE string VALUE IS INITIAL, + type TYPE string VALUE 'None', + END OF message. + PROTECTED SECTION. + PRIVATE SECTION. + + DATA client TYPE REF TO z2ui5_if_client. + METHODS view_display. + METHODS on_event. + +ENDCLASS. + + +CLASS z2ui5_cl_demo_app_304 IMPLEMENTATION. + + METHOD z2ui5_if_app~main. + + me->client = client. + + IF client->check_on_init( ). + view_display( ). + ENDIF. + + on_event( ). + + ENDMETHOD. + + + METHOD view_display. + + DATA(view) = z2ui5_cl_xml_view=>factory( ). + + " Note, these are demo sounds and are part of the abap2UI5 sample repo. + " They are NOT meant to use in production. + view->_generic( name = `script` + ns = `html` )->_cc_plain_xml( + |function playSuccess() \{ new Audio("/SAP/PUBLIC/BC/ABAP/mime_demo/z2ui5_demo_success.mp3").play(); \}| + && |function playError() \{ new Audio("/SAP/PUBLIC/BC/ABAP/mime_demo/z2ui5_demo_error.mp3").play(); \}| ). + + DATA(vbox) = view->page( title = `Play success and error sounds` )->vbox( class = `sapUiSmallMargin` ). + vbox->message_strip( + text = client->_bind( message-text ) + type = client->_bind( message-type ) + visible = `{= !!$` && client->_bind( message-text ) && ` }` ). + vbox->text( text = `The magic key is: abap2UI5` ). + vbox->input( id = `inputApp` + value = client->_bind_edit( magic_key ) + placeholder = `Enter magic key` + submit = client->_event( 'enter' ) ). + vbox->button( text = `submit` + type = `accept` + press = client->_event( 'enter' ) ). + + view->_z2ui5( )->focus( focusid = `inputApp` ). + client->view_display( view->stringify( ) ). + ENDMETHOD. + + + METHOD on_event. + + IF client->get( )-event = 'enter'. + IF magic_key = `abap2UI5`. + client->follow_up_action( val = `playSuccess()` ). + message-type = 'Success'. + message-text = 'Hooray!'. + ELSE. + client->follow_up_action( val = `playError()` ). + message-type = 'Error'. + message-text = `That wasn't the magic key`. + ENDIF. + CLEAR magic_key. + client->view_model_update( ). + ENDIF. + + ENDMETHOD. + +ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_304.clas.xml b/src/z2ui5_cl_demo_app_304.clas.xml new file mode 100644 index 00000000..719f6f4a --- /dev/null +++ b/src/z2ui5_cl_demo_app_304.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_DEMO_APP_304 + E + Play Sound + 1 + X + X + X + + + +