From f4b45372c62ee4d771adce88dba2e2db245ac29a Mon Sep 17 00:00:00 2001 From: Alberto Medina Gutierrez Date: Wed, 13 Mar 2019 10:52:54 -0700 Subject: [PATCH 1/6] Add working version without select actions --- .../src/AdaptiveCardObjectModel.i | 17 + .../src/main/cpp/objectmodel_wrap.cpp | 1133 ++++++++++++++--- .../AdaptiveCardObjectModelJNI.java | 33 + .../objectmodel/InlineVector.java | 148 +++ .../adaptivecards/objectmodel/Paragraph.java | 4 +- .../objectmodel/ParagraphVector.java | 148 +++ .../objectmodel/RichTextBlock.java | 4 +- .../io/adaptivecards/objectmodel/TextRun.java | 5 + .../readonly/RichTextBlockRenderer.java | 213 ++++ .../renderer/readonly/TextBlockRenderer.java | 45 +- .../renderer/readonly/TextRendererUtil.java | 91 ++ .../CardRendererRegistration.java | 3 + source/shared/cpp/ObjectModel/Paragraph.cpp | 2 +- 13 files changed, 1601 insertions(+), 245 deletions(-) create mode 100644 source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/InlineVector.java create mode 100644 source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/ParagraphVector.java create mode 100644 source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java create mode 100644 source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/TextRendererUtil.java diff --git a/source/android/adaptivecards/src/AdaptiveCardObjectModel.i b/source/android/adaptivecards/src/AdaptiveCardObjectModel.i index 33b53fcb69..ce1e95d92f 100644 --- a/source/android/adaptivecards/src/AdaptiveCardObjectModel.i +++ b/source/android/adaptivecards/src/AdaptiveCardObjectModel.i @@ -341,6 +341,8 @@ namespace Json { %template(ToggleVisibilityTargetVector) std::vector >; %template(StringVector) std::vector; %template(CharVector) std::vector; +%template(InlineVector) std::vector>; +%template(ParagraphVector) std::vector>; %template(EnableSharedFromThisContainer) std::enable_shared_from_this; @@ -659,6 +661,21 @@ namespace Json { } }; +%exception AdaptiveCards::TextRun::dynamic_cast(AdaptiveCards::Inline *inlineVar) { + $action + if (!result) { + jclass excep = jenv->FindClass("java/lang/ClassCastException"); + if (excep) { + jenv->ThrowNew(excep, "dynamic_cast exception"); + } + } +} +%extend AdaptiveCards::TextRun { + static AdaptiveCards::TextRun *dynamic_cast(AdaptiveCards::Inline *inlineVar) { + return dynamic_cast(inlineVar); + } +}; + %include "../../../shared/cpp/ObjectModel/pch.h" %include "../../../shared/cpp/ObjectModel/EnumMagic.h" %include "../../../shared/cpp/ObjectModel/Enums.h" diff --git a/source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp b/source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp index 226f81872e..3f4d486fc8 100644 --- a/source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp +++ b/source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp @@ -1611,6 +1611,124 @@ SWIGINTERN void std_vector_Sl_char_Sg__doRemoveRange(std::vector< char > *self,j throw std::out_of_range("vector index out of range"); } } +SWIGINTERN std::vector< std::shared_ptr< AdaptiveCards::Inline > > *new_std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg___SWIG_2(jint count){ + if (count < 0) + throw std::out_of_range("vector count must be positive"); + return new std::vector< std::shared_ptr< AdaptiveCards::Inline > >(static_cast >::size_type>(count)); + } +SWIGINTERN std::vector< std::shared_ptr< AdaptiveCards::Inline > > *new_std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg___SWIG_3(jint count,std::shared_ptr< AdaptiveCards::Inline > const &value){ + if (count < 0) + throw std::out_of_range("vector count must be positive"); + return new std::vector< std::shared_ptr< AdaptiveCards::Inline > >(static_cast >::size_type>(count), value); + } +SWIGINTERN jint std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doSize(std::vector< std::shared_ptr< AdaptiveCards::Inline > > const *self){ + return SWIG_VectorSize(self->size()); + } +SWIGINTERN void std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doAdd__SWIG_0(std::vector< std::shared_ptr< AdaptiveCards::Inline > > *self,std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type const &value){ + self->push_back(value); + } +SWIGINTERN void std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doAdd__SWIG_1(std::vector< std::shared_ptr< AdaptiveCards::Inline > > *self,jint index,std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type const &value){ + jint size = static_cast(self->size()); + if (0 <= index && index <= size) { + self->insert(self->begin() + index, value); + } else { + throw std::out_of_range("vector index out of range"); + } + } +SWIGINTERN std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doRemove(std::vector< std::shared_ptr< AdaptiveCards::Inline > > *self,jint index){ + jint size = static_cast(self->size()); + if (0 <= index && index < size) { + std::shared_ptr< AdaptiveCards::Inline > const old_value = (*self)[index]; + self->erase(self->begin() + index); + return old_value; + } else { + throw std::out_of_range("vector index out of range"); + } + } +SWIGINTERN std::shared_ptr< AdaptiveCards::Inline > const &std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doGet(std::vector< std::shared_ptr< AdaptiveCards::Inline > > *self,jint index){ + jint size = static_cast(self->size()); + if (index >= 0 && index < size) + return (*self)[index]; + else + throw std::out_of_range("vector index out of range"); + } +SWIGINTERN std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doSet(std::vector< std::shared_ptr< AdaptiveCards::Inline > > *self,jint index,std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type const &value){ + jint size = static_cast(self->size()); + if (index >= 0 && index < size) { + std::shared_ptr< AdaptiveCards::Inline > const old_value = (*self)[index]; + (*self)[index] = value; + return old_value; + } + else + throw std::out_of_range("vector index out of range"); + } +SWIGINTERN void std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doRemoveRange(std::vector< std::shared_ptr< AdaptiveCards::Inline > > *self,jint fromIndex,jint toIndex){ + jint size = static_cast(self->size()); + if (0 <= fromIndex && fromIndex <= toIndex && toIndex <= size) { + self->erase(self->begin() + fromIndex, self->begin() + toIndex); + } else { + throw std::out_of_range("vector index out of range"); + } + } +SWIGINTERN std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *new_std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg___SWIG_2(jint count){ + if (count < 0) + throw std::out_of_range("vector count must be positive"); + return new std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >(static_cast >::size_type>(count)); + } +SWIGINTERN std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *new_std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg___SWIG_3(jint count,std::shared_ptr< AdaptiveCards::Paragraph > const &value){ + if (count < 0) + throw std::out_of_range("vector count must be positive"); + return new std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >(static_cast >::size_type>(count), value); + } +SWIGINTERN jint std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doSize(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > const *self){ + return SWIG_VectorSize(self->size()); + } +SWIGINTERN void std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doAdd__SWIG_0(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *self,std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type const &value){ + self->push_back(value); + } +SWIGINTERN void std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doAdd__SWIG_1(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *self,jint index,std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type const &value){ + jint size = static_cast(self->size()); + if (0 <= index && index <= size) { + self->insert(self->begin() + index, value); + } else { + throw std::out_of_range("vector index out of range"); + } + } +SWIGINTERN std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doRemove(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *self,jint index){ + jint size = static_cast(self->size()); + if (0 <= index && index < size) { + std::shared_ptr< AdaptiveCards::Paragraph > const old_value = (*self)[index]; + self->erase(self->begin() + index); + return old_value; + } else { + throw std::out_of_range("vector index out of range"); + } + } +SWIGINTERN std::shared_ptr< AdaptiveCards::Paragraph > const &std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doGet(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *self,jint index){ + jint size = static_cast(self->size()); + if (index >= 0 && index < size) + return (*self)[index]; + else + throw std::out_of_range("vector index out of range"); + } +SWIGINTERN std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doSet(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *self,jint index,std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type const &value){ + jint size = static_cast(self->size()); + if (index >= 0 && index < size) { + std::shared_ptr< AdaptiveCards::Paragraph > const old_value = (*self)[index]; + (*self)[index] = value; + return old_value; + } + else + throw std::out_of_range("vector index out of range"); + } +SWIGINTERN void std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doRemoveRange(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *self,jint fromIndex,jint toIndex){ + jint size = static_cast(self->size()); + if (0 <= fromIndex && fromIndex <= toIndex && toIndex <= size) { + self->erase(self->begin() + fromIndex, self->begin() + toIndex); + } else { + throw std::out_of_range("vector index out of range"); + } + } SWIGINTERN jobject AdaptiveCards_BaseCardElement_swigOriginalObject(AdaptiveCards::BaseCardElement *self,JNIEnv *jenv){ Swig::Director *dir = dynamic_cast(self); if (dir) { @@ -1688,6 +1806,9 @@ SWIGINTERN AdaptiveCards::ActionSet *AdaptiveCards_ActionSet_dynamic_cast(Adapti SWIGINTERN AdaptiveCards::RichTextBlock *AdaptiveCards_RichTextBlock_dynamic_cast(AdaptiveCards::BaseCardElement *baseCardElement){ return dynamic_cast(baseCardElement); } +SWIGINTERN AdaptiveCards::TextRun *AdaptiveCards_TextRun_dynamic_cast(AdaptiveCards::Inline *inlineVar){ + return dynamic_cast(inlineVar); + } /* --------------------------------------------------- @@ -6570,47 +6691,649 @@ SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMod SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1StringVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - std::vector< std::string > *arg1 = 0 ; - std::vector< std::string > *result = 0 ; + std::vector< std::string > *arg1 = 0 ; + std::vector< std::string > *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > const & reference is null"); + return 0; + } + result = (std::vector< std::string > *)new std::vector< std::string >((std::vector< std::string > const &)*arg1); + *(std::vector< std::string > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + result = ((std::vector< std::string > const *)arg1)->capacity(); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = (std::vector< std::string >::size_type)jarg2; + try { + (arg1)->reserve(arg2); + } catch(std::length_error &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } +} + + +SWIGEXPORT jboolean JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + result = (bool)((std::vector< std::string > const *)arg1)->empty(); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + (arg1)->clear(); +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1StringVector_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jint jarg1) { + jlong jresult = 0 ; + jint arg1 ; + std::vector< std::string > *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = jarg1; + try { + result = (std::vector< std::string > *)new_std_vector_Sl_std_string_Sg___SWIG_2(arg1); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + *(std::vector< std::string > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1StringVector_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jint jarg1, jstring jarg2) { + jlong jresult = 0 ; + jint arg1 ; + std::string *arg2 = 0 ; + std::vector< std::string > *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (std::vector< std::string > *)new_std_vector_Sl_std_string_Sg___SWIG_3(arg1,(std::string const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + *(std::vector< std::string > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doSize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + jint result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + try { + result = std_vector_Sl_std_string_Sg__doSize((std::vector< std::string > const *)arg1); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doAdd_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::value_type *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::vector< std::string >::value_type arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + std_vector_Sl_std_string_Sg__doAdd__SWIG_0(arg1,(std::string const &)*arg2); +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doAdd_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + jint arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = jarg2; + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return ; + std::vector< std::string >::value_type arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + std_vector_Sl_std_string_Sg__doAdd__SWIG_1(arg1,arg2,(std::string const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } +} + + +SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doRemove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jstring jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + jint arg2 ; + std::vector< std::string >::value_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = jarg2; + try { + result = std_vector_Sl_std_string_Sg__doRemove(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doGet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jstring jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + jint arg2 ; + std::string *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = jarg2; + try { + result = (std::string *) &std_vector_Sl_std_string_Sg__doGet(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + jresult = jenv->NewStringUTF(result->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doSet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) { + jstring jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + jint arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + std::vector< std::string >::value_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = jarg2; + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::vector< std::string >::value_type arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + result = std_vector_Sl_std_string_Sg__doSet(arg1,arg2,(std::string const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doRemoveRange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + jint arg2 ; + jint arg3 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = jarg2; + arg3 = jarg3; + try { + std_vector_Sl_std_string_Sg__doRemoveRange(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_delete_1StringVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(std::vector< std::string > **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1CharVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + std::vector< char > *result = 0 ; + + (void)jenv; + (void)jcls; + result = (std::vector< char > *)new std::vector< char >(); + *(std::vector< char > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1CharVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< char > *arg1 = 0 ; + std::vector< char > *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< char > const & reference is null"); + return 0; + } + result = (std::vector< char > *)new std::vector< char >((std::vector< char > const &)*arg1); + *(std::vector< char > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + std::vector< char >::size_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + result = ((std::vector< char > const *)arg1)->capacity(); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + std::vector< char >::size_type arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + arg2 = (std::vector< char >::size_type)jarg2; + try { + (arg1)->reserve(arg2); + } catch(std::length_error &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } +} + + +SWIGEXPORT jboolean JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + result = (bool)((std::vector< char > const *)arg1)->empty(); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + (arg1)->clear(); +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1CharVector_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jint jarg1) { + jlong jresult = 0 ; + jint arg1 ; + std::vector< char > *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = jarg1; + try { + result = (std::vector< char > *)new_std_vector_Sl_char_Sg___SWIG_2(arg1); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + *(std::vector< char > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1CharVector_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jint jarg1, jchar jarg2) { + jlong jresult = 0 ; + jint arg1 ; + char *arg2 = 0 ; + char temp2 ; + std::vector< char > *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = jarg1; + temp2 = (char)jarg2; + arg2 = &temp2; + try { + result = (std::vector< char > *)new_std_vector_Sl_char_Sg___SWIG_3(arg1,(char const &)*arg2); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + *(std::vector< char > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doSize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + jint result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + try { + result = std_vector_Sl_char_Sg__doSize((std::vector< char > const *)arg1); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doAdd_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jchar jarg2) { + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + std::vector< char >::value_type *arg2 = 0 ; + std::vector< char >::value_type temp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + temp2 = (std::vector< char >::value_type)jarg2; + arg2 = &temp2; + std_vector_Sl_char_Sg__doAdd__SWIG_0(arg1,(char const &)*arg2); +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doAdd_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jchar jarg3) { + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + jint arg2 ; + std::vector< char >::value_type *arg3 = 0 ; + std::vector< char >::value_type temp3 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + arg2 = jarg2; + temp3 = (std::vector< char >::value_type)jarg3; + arg3 = &temp3; + try { + std_vector_Sl_char_Sg__doAdd__SWIG_1(arg1,arg2,(char const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } +} + + +SWIGEXPORT jchar JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doRemove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jchar jresult = 0 ; + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + jint arg2 ; + std::vector< char >::value_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + arg2 = jarg2; + try { + result = (std::vector< char >::value_type)std_vector_Sl_char_Sg__doRemove(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + jresult = (jchar)result; + return jresult; +} + + +SWIGEXPORT jchar JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doGet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jchar jresult = 0 ; + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + jint arg2 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + arg2 = jarg2; + try { + result = (char *) &std_vector_Sl_char_Sg__doGet(arg1,arg2); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + jresult = (jchar)*result; + return jresult; +} + + +SWIGEXPORT jchar JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doSet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jchar jarg3) { + jchar jresult = 0 ; + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + jint arg2 ; + std::vector< char >::value_type *arg3 = 0 ; + std::vector< char >::value_type temp3 ; + std::vector< char >::value_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + arg2 = jarg2; + temp3 = (std::vector< char >::value_type)jarg3; + arg3 = &temp3; + try { + result = (std::vector< char >::value_type)std_vector_Sl_char_Sg__doSet(arg1,arg2,(char const &)*arg3); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + jresult = (jchar)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doRemoveRange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) { + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + jint arg2 ; + jint arg3 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< char > **)&jarg1; + arg2 = jarg2; + arg3 = jarg3; + try { + std_vector_Sl_char_Sg__doRemoveRange(arg1,arg2,arg3); + } catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_delete_1CharVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { + std::vector< char > *arg1 = (std::vector< char > *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(std::vector< char > **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1InlineVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *result = 0 ; + + (void)jenv; + (void)jcls; + result = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *)new std::vector< std::shared_ptr< AdaptiveCards::Inline > >(); + *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1InlineVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > const & reference is null"); + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::shared_ptr< AdaptiveCards::Inline > > const & reference is null"); return 0; } - result = (std::vector< std::string > *)new std::vector< std::string >((std::vector< std::string > const &)*arg1); - *(std::vector< std::string > **)&jresult = result; + result = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *)new std::vector< std::shared_ptr< AdaptiveCards::Inline > >((std::vector< std::shared_ptr< AdaptiveCards::Inline > > const &)*arg1); + *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type result; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::size_type result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - result = ((std::vector< std::string > const *)arg1)->capacity(); + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; + result = ((std::vector< std::shared_ptr< AdaptiveCards::Inline > > const *)arg1)->capacity(); jresult = (jlong)result; return jresult; } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type arg2 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::size_type arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - arg2 = (std::vector< std::string >::size_type)jarg2; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; + arg2 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > >::size_type)jarg2; try { (arg1)->reserve(arg2); } catch(std::length_error &_e) { @@ -6620,91 +7343,85 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode } -SWIGEXPORT jboolean JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jboolean JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jboolean jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; bool result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - result = (bool)((std::vector< std::string > const *)arg1)->empty(); + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; + result = (bool)((std::vector< std::shared_ptr< AdaptiveCards::Inline > > const *)arg1)->empty(); jresult = (jboolean)result; return jresult; } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; (arg1)->clear(); } -SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1StringVector_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jint jarg1) { +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1InlineVector_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jint jarg1) { jlong jresult = 0 ; jint arg1 ; - std::vector< std::string > *result = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *result = 0 ; (void)jenv; (void)jcls; arg1 = jarg1; try { - result = (std::vector< std::string > *)new_std_vector_Sl_std_string_Sg___SWIG_2(arg1); + result = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *)new_std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg___SWIG_2(arg1); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - *(std::vector< std::string > **)&jresult = result; + *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1StringVector_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jint jarg1, jstring jarg2) { +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1InlineVector_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jint jarg1, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; jint arg1 ; - std::string *arg2 = 0 ; - std::vector< std::string > *result = 0 ; + std::shared_ptr< AdaptiveCards::Inline > *arg2 = 0 ; + std::shared_ptr< AdaptiveCards::Inline > tempnull2 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *result = 0 ; (void)jenv; (void)jcls; + (void)jarg2_; arg1 = jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg2 = jarg2 ? *(std::shared_ptr< AdaptiveCards::Inline > **)&jarg2 : &tempnull2; try { - result = (std::vector< std::string > *)new_std_vector_Sl_std_string_Sg___SWIG_3(arg1,(std::string const &)*arg2); + result = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *)new_std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg___SWIG_3(arg1,(std::shared_ptr< AdaptiveCards::Inline > const &)*arg2); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - *(std::vector< std::string > **)&jresult = result; + *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jresult = result; return jresult; } -SWIGEXPORT jint JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doSize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jint JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1doSize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; jint result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; try { - result = std_vector_Sl_std_string_Sg__doSize((std::vector< std::string > const *)arg1); + result = std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doSize((std::vector< std::shared_ptr< AdaptiveCards::Inline > > const *)arg1); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; @@ -6714,48 +7431,36 @@ SWIGEXPORT jint JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doAdd_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::value_type *arg2 = 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1doAdd_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type *arg2 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type tempnull2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::vector< std::string >::value_type arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - std_vector_Sl_std_string_Sg__doAdd__SWIG_0(arg1,(std::string const &)*arg2); + (void)jarg2_; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; + arg2 = jarg2 ? *(std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type **)&jarg2 : &tempnull2; + std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doAdd__SWIG_0(arg1,(std::shared_ptr< AdaptiveCards::Inline > const &)*arg2); } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doAdd_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1doAdd_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; jint arg2 ; - std::vector< std::string >::value_type *arg3 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type *arg3 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type tempnull3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; + (void)jarg3_; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; arg2 = jarg2; - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return ; - std::vector< std::string >::value_type arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + arg3 = jarg3 ? *(std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type **)&jarg3 : &tempnull3; try { - std_vector_Sl_std_string_Sg__doAdd__SWIG_1(arg1,arg2,(std::string const &)*arg3); + std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doAdd__SWIG_1(arg1,arg2,(std::shared_ptr< AdaptiveCards::Inline > const &)*arg3); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return ; @@ -6763,95 +7468,89 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode } -SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doRemove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jstring jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1doRemove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; jint arg2 ; - std::vector< std::string >::value_type result; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; arg2 = jarg2; try { - result = std_vector_Sl_std_string_Sg__doRemove(arg1,arg2); + result = std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doRemove(arg1,arg2); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - jresult = jenv->NewStringUTF((&result)->c_str()); + *(std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type **)&jresult = result ? new std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type(result) : 0; return jresult; } -SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doGet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jstring jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1doGet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; jint arg2 ; - std::string *result = 0 ; + std::shared_ptr< AdaptiveCards::Inline > *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; arg2 = jarg2; try { - result = (std::string *) &std_vector_Sl_std_string_Sg__doGet(arg1,arg2); + result = (std::shared_ptr< AdaptiveCards::Inline > *) &std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doGet(arg1,arg2); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - jresult = jenv->NewStringUTF(result->c_str()); + *(std::shared_ptr< AdaptiveCards::Inline > **)&jresult = *result ? new std::shared_ptr< AdaptiveCards::Inline >(*result) : 0; return jresult; } -SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doSet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) { - jstring jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1doSet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; jint arg2 ; - std::vector< std::string >::value_type *arg3 = 0 ; - std::vector< std::string >::value_type result; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type *arg3 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type tempnull3 ; + std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; + (void)jarg3_; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; arg2 = jarg2; - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::vector< std::string >::value_type arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + arg3 = jarg3 ? *(std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type **)&jarg3 : &tempnull3; try { - result = std_vector_Sl_std_string_Sg__doSet(arg1,arg2,(std::string const &)*arg3); + result = std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doSet(arg1,arg2,(std::shared_ptr< AdaptiveCards::Inline > const &)*arg3); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - jresult = jenv->NewStringUTF((&result)->c_str()); + *(std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type **)&jresult = result ? new std::vector< std::shared_ptr< AdaptiveCards::Inline > >::value_type(result) : 0; return jresult; } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_StringVector_1doRemoveRange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_InlineVector_1doRemoveRange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) { + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; jint arg2 ; jint arg3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; arg2 = jarg2; arg3 = jarg3; try { - std_vector_Sl_std_string_Sg__doRemoveRange(arg1,arg2,arg3); + std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Inline_Sg__Sg__doRemoveRange(arg1,arg2,arg3); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return ; @@ -6859,71 +7558,71 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_delete_1StringVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_delete_1InlineVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { + std::vector< std::shared_ptr< AdaptiveCards::Inline > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Inline > > *) 0 ; (void)jenv; (void)jcls; - arg1 = *(std::vector< std::string > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Inline > > **)&jarg1; delete arg1; } -SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1CharVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1ParagraphVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { jlong jresult = 0 ; - std::vector< char > *result = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *result = 0 ; (void)jenv; (void)jcls; - result = (std::vector< char > *)new std::vector< char >(); - *(std::vector< char > **)&jresult = result; + result = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *)new std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >(); + *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1CharVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1ParagraphVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - std::vector< char > *arg1 = 0 ; - std::vector< char > *result = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< char > const & reference is null"); + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > const & reference is null"); return 0; } - result = (std::vector< char > *)new std::vector< char >((std::vector< char > const &)*arg1); - *(std::vector< char > **)&jresult = result; + result = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *)new std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >((std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > const &)*arg1); + *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - std::vector< char > *arg1 = (std::vector< char > *) 0 ; - std::vector< char >::size_type result; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::size_type result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; - result = ((std::vector< char > const *)arg1)->capacity(); + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; + result = ((std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > const *)arg1)->capacity(); jresult = (jlong)result; return jresult; } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - std::vector< char > *arg1 = (std::vector< char > *) 0 ; - std::vector< char >::size_type arg2 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::size_type arg2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; - arg2 = (std::vector< char >::size_type)jarg2; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; + arg2 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::size_type)jarg2; try { (arg1)->reserve(arg2); } catch(std::length_error &_e) { @@ -6933,85 +7632,85 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode } -SWIGEXPORT jboolean JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jboolean JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jboolean jresult = 0 ; - std::vector< char > *arg1 = (std::vector< char > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; bool result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; - result = (bool)((std::vector< char > const *)arg1)->empty(); + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; + result = (bool)((std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > const *)arg1)->empty(); jresult = (jboolean)result; return jresult; } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - std::vector< char > *arg1 = (std::vector< char > *) 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; (arg1)->clear(); } -SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1CharVector_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jint jarg1) { +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1ParagraphVector_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jint jarg1) { jlong jresult = 0 ; jint arg1 ; - std::vector< char > *result = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *result = 0 ; (void)jenv; (void)jcls; arg1 = jarg1; try { - result = (std::vector< char > *)new_std_vector_Sl_char_Sg___SWIG_2(arg1); + result = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *)new_std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg___SWIG_2(arg1); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - *(std::vector< char > **)&jresult = result; + *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1CharVector_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jint jarg1, jchar jarg2) { +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_new_1ParagraphVector_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jint jarg1, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; jint arg1 ; - char *arg2 = 0 ; - char temp2 ; - std::vector< char > *result = 0 ; + std::shared_ptr< AdaptiveCards::Paragraph > *arg2 = 0 ; + std::shared_ptr< AdaptiveCards::Paragraph > tempnull2 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *result = 0 ; (void)jenv; (void)jcls; + (void)jarg2_; arg1 = jarg1; - temp2 = (char)jarg2; - arg2 = &temp2; + arg2 = jarg2 ? *(std::shared_ptr< AdaptiveCards::Paragraph > **)&jarg2 : &tempnull2; try { - result = (std::vector< char > *)new_std_vector_Sl_char_Sg___SWIG_3(arg1,(char const &)*arg2); + result = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *)new_std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg___SWIG_3(arg1,(std::shared_ptr< AdaptiveCards::Paragraph > const &)*arg2); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - *(std::vector< char > **)&jresult = result; + *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jresult = result; return jresult; } -SWIGEXPORT jint JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doSize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jint JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1doSize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; - std::vector< char > *arg1 = (std::vector< char > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; jint result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; try { - result = std_vector_Sl_char_Sg__doSize((std::vector< char > const *)arg1); + result = std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doSize((std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > const *)arg1); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; @@ -7021,36 +7720,36 @@ SWIGEXPORT jint JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doAdd_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jchar jarg2) { - std::vector< char > *arg1 = (std::vector< char > *) 0 ; - std::vector< char >::value_type *arg2 = 0 ; - std::vector< char >::value_type temp2 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1doAdd_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type *arg2 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type tempnull2 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; - temp2 = (std::vector< char >::value_type)jarg2; - arg2 = &temp2; - std_vector_Sl_char_Sg__doAdd__SWIG_0(arg1,(char const &)*arg2); + (void)jarg2_; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; + arg2 = jarg2 ? *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type **)&jarg2 : &tempnull2; + std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doAdd__SWIG_0(arg1,(std::shared_ptr< AdaptiveCards::Paragraph > const &)*arg2); } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doAdd_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jchar jarg3) { - std::vector< char > *arg1 = (std::vector< char > *) 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1doAdd_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; jint arg2 ; - std::vector< char >::value_type *arg3 = 0 ; - std::vector< char >::value_type temp3 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type *arg3 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type tempnull3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; + (void)jarg3_; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; arg2 = jarg2; - temp3 = (std::vector< char >::value_type)jarg3; - arg3 = &temp3; + arg3 = jarg3 ? *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type **)&jarg3 : &tempnull3; try { - std_vector_Sl_char_Sg__doAdd__SWIG_1(arg1,arg2,(char const &)*arg3); + std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doAdd__SWIG_1(arg1,arg2,(std::shared_ptr< AdaptiveCards::Paragraph > const &)*arg3); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return ; @@ -7058,89 +7757,89 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode } -SWIGEXPORT jchar JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doRemove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jchar jresult = 0 ; - std::vector< char > *arg1 = (std::vector< char > *) 0 ; +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1doRemove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; jint arg2 ; - std::vector< char >::value_type result; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; arg2 = jarg2; try { - result = (std::vector< char >::value_type)std_vector_Sl_char_Sg__doRemove(arg1,arg2); + result = std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doRemove(arg1,arg2); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - jresult = (jchar)result; + *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type **)&jresult = result ? new std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type(result) : 0; return jresult; } -SWIGEXPORT jchar JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doGet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jchar jresult = 0 ; - std::vector< char > *arg1 = (std::vector< char > *) 0 ; +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1doGet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; jint arg2 ; - char *result = 0 ; + std::shared_ptr< AdaptiveCards::Paragraph > *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; arg2 = jarg2; try { - result = (char *) &std_vector_Sl_char_Sg__doGet(arg1,arg2); + result = (std::shared_ptr< AdaptiveCards::Paragraph > *) &std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doGet(arg1,arg2); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - jresult = (jchar)*result; + *(std::shared_ptr< AdaptiveCards::Paragraph > **)&jresult = *result ? new std::shared_ptr< AdaptiveCards::Paragraph >(*result) : 0; return jresult; } -SWIGEXPORT jchar JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doSet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jchar jarg3) { - jchar jresult = 0 ; - std::vector< char > *arg1 = (std::vector< char > *) 0 ; +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1doSet(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; jint arg2 ; - std::vector< char >::value_type *arg3 = 0 ; - std::vector< char >::value_type temp3 ; - std::vector< char >::value_type result; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type *arg3 = 0 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type tempnull3 ; + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; + (void)jarg3_; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; arg2 = jarg2; - temp3 = (std::vector< char >::value_type)jarg3; - arg3 = &temp3; + arg3 = jarg3 ? *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type **)&jarg3 : &tempnull3; try { - result = (std::vector< char >::value_type)std_vector_Sl_char_Sg__doSet(arg1,arg2,(char const &)*arg3); + result = std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doSet(arg1,arg2,(std::shared_ptr< AdaptiveCards::Paragraph > const &)*arg3); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return 0; } - jresult = (jchar)result; + *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type **)&jresult = result ? new std::vector< std::shared_ptr< AdaptiveCards::Paragraph > >::value_type(result) : 0; return jresult; } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_CharVector_1doRemoveRange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) { - std::vector< char > *arg1 = (std::vector< char > *) 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_ParagraphVector_1doRemoveRange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) { + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; jint arg2 ; jint arg3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(std::vector< char > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; arg2 = jarg2; arg3 = jarg3; try { - std_vector_Sl_char_Sg__doRemoveRange(arg1,arg2,arg3); + std_vector_Sl_std_shared_ptr_Sl_AdaptiveCards_Paragraph_Sg__Sg__doRemoveRange(arg1,arg2,arg3); } catch(std::out_of_range &_e) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); return ; @@ -7148,12 +7847,12 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode } -SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_delete_1CharVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { - std::vector< char > *arg1 = (std::vector< char > *) 0 ; +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_delete_1ParagraphVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { + std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *arg1 = (std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > *) 0 ; (void)jenv; (void)jcls; - arg1 = *(std::vector< char > **)&jarg1; + arg1 = *(std::vector< std::shared_ptr< AdaptiveCards::Paragraph > > **)&jarg1; delete arg1; } @@ -26447,6 +27146,34 @@ SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectM } +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_TextRun_1dynamic_1cast(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + AdaptiveCards::Inline *arg1 = (AdaptiveCards::Inline *) 0 ; + std::shared_ptr< AdaptiveCards::Inline > *smartarg1 = 0 ; + AdaptiveCards::TextRun *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + + smartarg1 = *(std::shared_ptr< AdaptiveCards::Inline > **)&jarg1; + arg1 = (AdaptiveCards::Inline *)(smartarg1 ? smartarg1->get() : 0); + { + result = (AdaptiveCards::TextRun *)AdaptiveCards_TextRun_dynamic_cast(arg1); + if (!result) { + jclass excep = jenv->FindClass("java/lang/ClassCastException"); + if (excep) { + jenv->ThrowNew(excep, "dynamic_cast exception"); + } + } + } + + *(std::shared_ptr< AdaptiveCards::TextRun > **)&jresult = result ? new std::shared_ptr< AdaptiveCards::TextRun >(result SWIG_NO_NULL_DELETER_0) : 0; + + return jresult; +} + + SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseCardElement_1SWIGSmartPtrUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { jlong baseptr = 0; std::shared_ptr< AdaptiveCards::BaseCardElement > *argp1; diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/AdaptiveCardObjectModelJNI.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/AdaptiveCardObjectModelJNI.java index e0292fd5a6..12ba7c2e27 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/AdaptiveCardObjectModelJNI.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/AdaptiveCardObjectModelJNI.java @@ -250,6 +250,38 @@ public class AdaptiveCardObjectModelJNI { public final static native char CharVector_doSet(long jarg1, CharVector jarg1_, int jarg2, char jarg3); public final static native void CharVector_doRemoveRange(long jarg1, CharVector jarg1_, int jarg2, int jarg3); public final static native void delete_CharVector(long jarg1); + public final static native long new_InlineVector__SWIG_0(); + public final static native long new_InlineVector__SWIG_1(long jarg1, InlineVector jarg1_); + public final static native long InlineVector_capacity(long jarg1, InlineVector jarg1_); + public final static native void InlineVector_reserve(long jarg1, InlineVector jarg1_, long jarg2); + public final static native boolean InlineVector_isEmpty(long jarg1, InlineVector jarg1_); + public final static native void InlineVector_clear(long jarg1, InlineVector jarg1_); + public final static native long new_InlineVector__SWIG_2(int jarg1); + public final static native long new_InlineVector__SWIG_3(int jarg1, long jarg2, Inline jarg2_); + public final static native int InlineVector_doSize(long jarg1, InlineVector jarg1_); + public final static native void InlineVector_doAdd__SWIG_0(long jarg1, InlineVector jarg1_, long jarg2, Inline jarg2_); + public final static native void InlineVector_doAdd__SWIG_1(long jarg1, InlineVector jarg1_, int jarg2, long jarg3, Inline jarg3_); + public final static native long InlineVector_doRemove(long jarg1, InlineVector jarg1_, int jarg2); + public final static native long InlineVector_doGet(long jarg1, InlineVector jarg1_, int jarg2); + public final static native long InlineVector_doSet(long jarg1, InlineVector jarg1_, int jarg2, long jarg3, Inline jarg3_); + public final static native void InlineVector_doRemoveRange(long jarg1, InlineVector jarg1_, int jarg2, int jarg3); + public final static native void delete_InlineVector(long jarg1); + public final static native long new_ParagraphVector__SWIG_0(); + public final static native long new_ParagraphVector__SWIG_1(long jarg1, ParagraphVector jarg1_); + public final static native long ParagraphVector_capacity(long jarg1, ParagraphVector jarg1_); + public final static native void ParagraphVector_reserve(long jarg1, ParagraphVector jarg1_, long jarg2); + public final static native boolean ParagraphVector_isEmpty(long jarg1, ParagraphVector jarg1_); + public final static native void ParagraphVector_clear(long jarg1, ParagraphVector jarg1_); + public final static native long new_ParagraphVector__SWIG_2(int jarg1); + public final static native long new_ParagraphVector__SWIG_3(int jarg1, long jarg2, Paragraph jarg2_); + public final static native int ParagraphVector_doSize(long jarg1, ParagraphVector jarg1_); + public final static native void ParagraphVector_doAdd__SWIG_0(long jarg1, ParagraphVector jarg1_, long jarg2, Paragraph jarg2_); + public final static native void ParagraphVector_doAdd__SWIG_1(long jarg1, ParagraphVector jarg1_, int jarg2, long jarg3, Paragraph jarg3_); + public final static native long ParagraphVector_doRemove(long jarg1, ParagraphVector jarg1_, int jarg2); + public final static native long ParagraphVector_doGet(long jarg1, ParagraphVector jarg1_, int jarg2); + public final static native long ParagraphVector_doSet(long jarg1, ParagraphVector jarg1_, int jarg2, long jarg3, Paragraph jarg3_); + public final static native void ParagraphVector_doRemoveRange(long jarg1, ParagraphVector jarg1_, int jarg2, int jarg3); + public final static native void delete_ParagraphVector(long jarg1); public final static native long EnableSharedFromThisContainer_shared_from_this(long jarg1, EnableSharedFromThisContainer jarg1_); public final static native long new_CaseInsensitiveEqualTo(); public final static native void delete_CaseInsensitiveEqualTo(long jarg1); @@ -1281,6 +1313,7 @@ public class AdaptiveCardObjectModelJNI { public final static native void TextRun_SetIsSubtle(long jarg1, TextRun jarg1_, boolean jarg2); public final static native void TextRun_SetLanguage(long jarg1, TextRun jarg1_, String jarg2); public final static native String TextRun_GetLanguage(long jarg1, TextRun jarg1_); + public final static native long TextRun_dynamic_cast(long jarg1, Inline jarg1_); public final static native long BaseCardElement_SWIGSmartPtrUpcast(long jarg1); public final static native long BaseActionElement_SWIGSmartPtrUpcast(long jarg1); public final static native long BaseInputElement_SWIGSmartPtrUpcast(long jarg1); diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/InlineVector.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/InlineVector.java new file mode 100644 index 0000000000..762fa2740a --- /dev/null +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/InlineVector.java @@ -0,0 +1,148 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 4.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package io.adaptivecards.objectmodel; + +public class InlineVector extends java.util.AbstractList implements java.util.RandomAccess { + private transient long swigCPtr; + protected transient boolean swigCMemOwn; + + protected InlineVector(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + protected static long getCPtr(InlineVector obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + AdaptiveCardObjectModelJNI.delete_InlineVector(swigCPtr); + } + swigCPtr = 0; + } + } + + public InlineVector(Inline[] initialElements) { + this(); + for (Inline element : initialElements) { + add(element); + } + } + + public InlineVector(Iterable initialElements) { + this(); + for (Inline element : initialElements) { + add(element); + } + } + + public Inline get(int index) { + return doGet(index); + } + + public Inline set(int index, Inline e) { + return doSet(index, e); + } + + public boolean add(Inline e) { + modCount++; + doAdd(e); + return true; + } + + public void add(int index, Inline e) { + modCount++; + doAdd(index, e); + } + + public Inline remove(int index) { + modCount++; + return doRemove(index); + } + + protected void removeRange(int fromIndex, int toIndex) { + modCount++; + doRemoveRange(fromIndex, toIndex); + } + + public int size() { + return doSize(); + } + + public InlineVector() { + this(AdaptiveCardObjectModelJNI.new_InlineVector__SWIG_0(), true); + } + + public InlineVector(InlineVector other) { + this(AdaptiveCardObjectModelJNI.new_InlineVector__SWIG_1(InlineVector.getCPtr(other), other), true); + } + + public long capacity() { + return AdaptiveCardObjectModelJNI.InlineVector_capacity(swigCPtr, this); + } + + public void reserve(long n) { + AdaptiveCardObjectModelJNI.InlineVector_reserve(swigCPtr, this, n); + } + + public boolean isEmpty() { + return AdaptiveCardObjectModelJNI.InlineVector_isEmpty(swigCPtr, this); + } + + public void clear() { + AdaptiveCardObjectModelJNI.InlineVector_clear(swigCPtr, this); + } + + public InlineVector(int count) { + this(AdaptiveCardObjectModelJNI.new_InlineVector__SWIG_2(count), true); + } + + public InlineVector(int count, Inline value) { + this(AdaptiveCardObjectModelJNI.new_InlineVector__SWIG_3(count, Inline.getCPtr(value), value), true); + } + + private int doSize() { + return AdaptiveCardObjectModelJNI.InlineVector_doSize(swigCPtr, this); + } + + private void doAdd(Inline value) { + AdaptiveCardObjectModelJNI.InlineVector_doAdd__SWIG_0(swigCPtr, this, Inline.getCPtr(value), value); + } + + private void doAdd(int index, Inline value) { + AdaptiveCardObjectModelJNI.InlineVector_doAdd__SWIG_1(swigCPtr, this, index, Inline.getCPtr(value), value); + } + + private Inline doRemove(int index) { + long cPtr = AdaptiveCardObjectModelJNI.InlineVector_doRemove(swigCPtr, this, index); + return (cPtr == 0) ? null : new Inline(cPtr, true); + } + + private Inline doGet(int index) { + long cPtr = AdaptiveCardObjectModelJNI.InlineVector_doGet(swigCPtr, this, index); + return (cPtr == 0) ? null : new Inline(cPtr, true); + } + + private Inline doSet(int index, Inline value) { + long cPtr = AdaptiveCardObjectModelJNI.InlineVector_doSet(swigCPtr, this, index, Inline.getCPtr(value), value); + return (cPtr == 0) ? null : new Inline(cPtr, true); + } + + private void doRemoveRange(int fromIndex, int toIndex) { + AdaptiveCardObjectModelJNI.InlineVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex); + } + +} diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/Paragraph.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/Paragraph.java index d8450edfd0..4196734222 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/Paragraph.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/Paragraph.java @@ -51,8 +51,8 @@ public JsonValue SerializeToJsonValue() { return new JsonValue(AdaptiveCardObjectModelJNI.Paragraph_SerializeToJsonValue(swigCPtr, this), true); } - public SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t GetInlines() { - return new SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t(AdaptiveCardObjectModelJNI.Paragraph_GetInlines__SWIG_0(swigCPtr, this), false); + public InlineVector GetInlines() { + return new InlineVector(AdaptiveCardObjectModelJNI.Paragraph_GetInlines__SWIG_0(swigCPtr, this), false); } public static Paragraph Deserialize(ParseContext context, JsonValue root) { diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/ParagraphVector.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/ParagraphVector.java new file mode 100644 index 0000000000..380a9bbb40 --- /dev/null +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/ParagraphVector.java @@ -0,0 +1,148 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 4.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package io.adaptivecards.objectmodel; + +public class ParagraphVector extends java.util.AbstractList implements java.util.RandomAccess { + private transient long swigCPtr; + protected transient boolean swigCMemOwn; + + protected ParagraphVector(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + protected static long getCPtr(ParagraphVector obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + AdaptiveCardObjectModelJNI.delete_ParagraphVector(swigCPtr); + } + swigCPtr = 0; + } + } + + public ParagraphVector(Paragraph[] initialElements) { + this(); + for (Paragraph element : initialElements) { + add(element); + } + } + + public ParagraphVector(Iterable initialElements) { + this(); + for (Paragraph element : initialElements) { + add(element); + } + } + + public Paragraph get(int index) { + return doGet(index); + } + + public Paragraph set(int index, Paragraph e) { + return doSet(index, e); + } + + public boolean add(Paragraph e) { + modCount++; + doAdd(e); + return true; + } + + public void add(int index, Paragraph e) { + modCount++; + doAdd(index, e); + } + + public Paragraph remove(int index) { + modCount++; + return doRemove(index); + } + + protected void removeRange(int fromIndex, int toIndex) { + modCount++; + doRemoveRange(fromIndex, toIndex); + } + + public int size() { + return doSize(); + } + + public ParagraphVector() { + this(AdaptiveCardObjectModelJNI.new_ParagraphVector__SWIG_0(), true); + } + + public ParagraphVector(ParagraphVector other) { + this(AdaptiveCardObjectModelJNI.new_ParagraphVector__SWIG_1(ParagraphVector.getCPtr(other), other), true); + } + + public long capacity() { + return AdaptiveCardObjectModelJNI.ParagraphVector_capacity(swigCPtr, this); + } + + public void reserve(long n) { + AdaptiveCardObjectModelJNI.ParagraphVector_reserve(swigCPtr, this, n); + } + + public boolean isEmpty() { + return AdaptiveCardObjectModelJNI.ParagraphVector_isEmpty(swigCPtr, this); + } + + public void clear() { + AdaptiveCardObjectModelJNI.ParagraphVector_clear(swigCPtr, this); + } + + public ParagraphVector(int count) { + this(AdaptiveCardObjectModelJNI.new_ParagraphVector__SWIG_2(count), true); + } + + public ParagraphVector(int count, Paragraph value) { + this(AdaptiveCardObjectModelJNI.new_ParagraphVector__SWIG_3(count, Paragraph.getCPtr(value), value), true); + } + + private int doSize() { + return AdaptiveCardObjectModelJNI.ParagraphVector_doSize(swigCPtr, this); + } + + private void doAdd(Paragraph value) { + AdaptiveCardObjectModelJNI.ParagraphVector_doAdd__SWIG_0(swigCPtr, this, Paragraph.getCPtr(value), value); + } + + private void doAdd(int index, Paragraph value) { + AdaptiveCardObjectModelJNI.ParagraphVector_doAdd__SWIG_1(swigCPtr, this, index, Paragraph.getCPtr(value), value); + } + + private Paragraph doRemove(int index) { + long cPtr = AdaptiveCardObjectModelJNI.ParagraphVector_doRemove(swigCPtr, this, index); + return (cPtr == 0) ? null : new Paragraph(cPtr, true); + } + + private Paragraph doGet(int index) { + long cPtr = AdaptiveCardObjectModelJNI.ParagraphVector_doGet(swigCPtr, this, index); + return (cPtr == 0) ? null : new Paragraph(cPtr, true); + } + + private Paragraph doSet(int index, Paragraph value) { + long cPtr = AdaptiveCardObjectModelJNI.ParagraphVector_doSet(swigCPtr, this, index, Paragraph.getCPtr(value), value); + return (cPtr == 0) ? null : new Paragraph(cPtr, true); + } + + private void doRemoveRange(int fromIndex, int toIndex) { + AdaptiveCardObjectModelJNI.ParagraphVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex); + } + +} diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/RichTextBlock.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/RichTextBlock.java index d05b573984..bfbd086e38 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/RichTextBlock.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/RichTextBlock.java @@ -78,8 +78,8 @@ public void SetHorizontalAlignment(HorizontalAlignment value) { AdaptiveCardObjectModelJNI.RichTextBlock_SetHorizontalAlignment(swigCPtr, this, value.swigValue()); } - public SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t GetParagraphs() { - return new SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t(AdaptiveCardObjectModelJNI.RichTextBlock_GetParagraphs__SWIG_0(swigCPtr, this), false); + public ParagraphVector GetParagraphs() { + return new ParagraphVector(AdaptiveCardObjectModelJNI.RichTextBlock_GetParagraphs__SWIG_0(swigCPtr, this), false); } public static RichTextBlock dynamic_cast(BaseCardElement baseCardElement) { diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/TextRun.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/TextRun.java index d26628ee34..b3fbe5f05d 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/TextRun.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/TextRun.java @@ -119,4 +119,9 @@ public String GetLanguage() { return AdaptiveCardObjectModelJNI.TextRun_GetLanguage(swigCPtr, this); } + public static TextRun dynamic_cast(Inline inlineVar) { + long cPtr = AdaptiveCardObjectModelJNI.TextRun_dynamic_cast(Inline.getCPtr(inlineVar), inlineVar); + return (cPtr == 0) ? null : new TextRun(cPtr, true); + } + } diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java new file mode 100644 index 0000000000..d3c6c178f7 --- /dev/null +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java @@ -0,0 +1,213 @@ +package io.adaptivecards.renderer.readonly; + +import android.content.Context; +import android.os.Build; +import android.support.v4.app.FragmentManager; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.TextUtils; +import android.text.style.AbsoluteSizeSpan; +import android.text.style.ForegroundColorSpan; +import android.text.style.StyleSpan; +import android.text.style.TypefaceSpan; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; + +import io.adaptivecards.objectmodel.BaseCardElement; +import io.adaptivecards.objectmodel.ContainerStyle; +import io.adaptivecards.objectmodel.HeightType; +import io.adaptivecards.objectmodel.HostConfig; +import io.adaptivecards.objectmodel.Inline; +import io.adaptivecards.objectmodel.InlineElementType; +import io.adaptivecards.objectmodel.InlineVector; +import io.adaptivecards.objectmodel.Paragraph; +import io.adaptivecards.objectmodel.ParagraphVector; +import io.adaptivecards.objectmodel.RichTextBlock; +import io.adaptivecards.objectmodel.TextBlock; +import io.adaptivecards.objectmodel.TextRun; +import io.adaptivecards.renderer.BaseCardElementRenderer; +import io.adaptivecards.renderer.RenderedAdaptiveCard; +import io.adaptivecards.renderer.TagContent; +import io.adaptivecards.renderer.actionhandler.ICardActionHandler; + +public class RichTextBlockRenderer extends BaseCardElementRenderer +{ + + public static RichTextBlockRenderer getInstance() + { + if (s_instance == null) + { + s_instance = new RichTextBlockRenderer(); + } + + return s_instance; + } + + private SpannableStringBuilder processParagraph(InlineVector inlines, HostConfig hostConfig, ContainerStyle containerStyle) + { + SpannableStringBuilder paragraph = new SpannableStringBuilder(); + int lastStringLength = 0; + for(int i = 0; i < inlines.size(); ++i, lastStringLength = paragraph.length()) + { + Inline inline = inlines.get(i); + if(inline.GetInlineType() == InlineElementType.TextRun) + { + // TextRun textRun = (TextRun)inline; + + TextRun textRun = null; + if (inline instanceof TextRun) + { + textRun = (TextRun) inline; + } + else if ((textRun = TextRun.dynamic_cast(inline)) == null) + { + throw new InternalError("Unable to convert BaseCardElement to TextBlock object model."); + } + + DateTimeParser parser = new DateTimeParser(textRun.GetLanguage()); + String textWithFormattedDates = parser.GenerateString(textRun.GetTextForDateParsing()); + CharSequence text = RendererUtil.handleSpecialText(textWithFormattedDates); + + paragraph.append(text); + + int spanStart = lastStringLength; + int spanEnd = lastStringLength + text.length(); + + int color = getColor(TextRendererUtil.getTextColor(textRun.GetTextColor(), hostConfig, textRun.GetIsSubtle(), containerStyle)); + paragraph.setSpan(new ForegroundColorSpan(color), spanStart, spanEnd, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); + paragraph.setSpan(new StyleSpan(TextRendererUtil.getTextWeight(textRun.GetTextWeight())), spanStart, spanEnd, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); + + long textSize = TextRendererUtil.getTextSize(textRun.GetFontStyle(), textRun.GetTextSize(), hostConfig); + paragraph.setSpan(new AbsoluteSizeSpan((int)textSize, true), spanStart, spanEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + + // On API 28, TypefaceSpan(Typeface) was added so we don't have to use the TypefaceSpan(String) constructor + String fontName = hostConfig.GetFontFamily(textRun.GetFontStyle()); + if(fontName.isEmpty()) + { + fontName = "monospace"; + } + + paragraph.setSpan(new TypefaceSpan(fontName), spanStart, spanEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + + // Let's leave this for later + // textView.setOnTouchListener(new TextBlockRenderer.TouchTextView(new SpannableString(text))); + + // This is not implemeneted yet, so I must wait for it to be implemented + // if(textRun.GetAction() != null) + // { + // if (column.GetSelectAction() != null) + // { + // returnedView.setClickable(true); + // returnedView.setOnClickListener(new ActionElementRenderer.ButtonOnClickListener(renderedCard, column.GetSelectAction(), cardActionHandler)); + // } + // } + } + } + + return paragraph; + } + + @Override + public View render( + RenderedAdaptiveCard renderedCard, + Context context, + FragmentManager fragmentManager, + ViewGroup viewGroup, + BaseCardElement baseCardElement, + ICardActionHandler cardActionHandler, + HostConfig hostConfig, + ContainerStyle containerStyle) + { + RichTextBlock richTextBlock = null; + if (baseCardElement instanceof TextBlock) + { + richTextBlock = (RichTextBlock) baseCardElement; + } + else if ((richTextBlock = RichTextBlock.dynamic_cast(baseCardElement)) == null) + { + throw new InternalError("Unable to convert BaseCardElement to TextBlock object model."); + } + + TextView textView = new TextView(context); + textView.setTag(new TagContent(richTextBlock)); + textView.setEllipsize(TextUtils.TruncateAt.END); + textView.setHorizontallyScrolling(false); + + // BaseCardElement properties + // Separator + // Height + // IsVisible + // Spacing + setSpacingAndSeparator(context, viewGroup, richTextBlock.GetSpacing(), richTextBlock.GetSeparator(), hostConfig, true); + + if(!baseCardElement.GetIsVisible()) + { + textView.setVisibility(View.GONE); + } + + if( richTextBlock.GetHeight() == HeightType.Stretch ) + { + textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1)); + } + else + { + textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); + } + + // RichTextBlock properties + // Wrap + // MaxLines + // HorizontalAlignment + // Paragraphs + if (!richTextBlock.GetWrap()) + { + textView.setMaxLines(1); + } + + int maxLines = (int)richTextBlock.GetMaxLines(); + if (maxLines > 0 && richTextBlock.GetWrap()) + { + textView.setMaxLines(maxLines); + } + else if (!richTextBlock.GetWrap()) + { + textView.setMaxLines(1); + } + + textView.setGravity(TextRendererUtil.getTextAlignment(richTextBlock.GetHorizontalAlignment())); + + // This is the section for rendering the paragraphs + // Every paragraph may contain contains any number of inlines + // The inline element types are TextRun <- That's the only existing type so far + ParagraphVector paragraphs = richTextBlock.GetParagraphs(); + int paragraphCount = paragraphs.size(); + + textView.setText(""); + + for (int i = 0; i < paragraphCount; ++i) + { + Paragraph p = paragraphs.get(i); + InlineVector inlines = p.GetInlines(); + + if ((i != 0) && (inlines.size() != 0)) + { + textView.append(System.getProperty("line.separator")); + } + + SpannableStringBuilder convertedString = processParagraph(inlines, hostConfig, containerStyle); + + textView.append(convertedString); + } + + + // textView.setText(text); + + viewGroup.addView(textView); + return textView; + } + + private static RichTextBlockRenderer s_instance = null; +} diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/TextBlockRenderer.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/TextBlockRenderer.java index ea7d87afbf..5fec5ac2a2 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/TextBlockRenderer.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/TextBlockRenderer.java @@ -16,6 +16,8 @@ import android.widget.LinearLayout; import android.widget.TextView; +import org.w3c.dom.Text; + import io.adaptivecards.objectmodel.ContainerStyle; import io.adaptivecards.objectmodel.FontStyle; import io.adaptivecards.objectmodel.ForegroundColor; @@ -53,55 +55,24 @@ public static TextBlockRenderer getInstance() return s_instance; } - static void setTextSize(TextView textView, FontStyle style, TextSize textSize, HostConfig hostConfig) + static void setTextAlignment(TextView textView, HorizontalAlignment textAlignment) { - long value = hostConfig.GetFontSize(style, textSize); - textView.setTextSize(value); + textView.setGravity(TextRendererUtil.getTextAlignment(textAlignment)); } - static void setTextAlignment(TextView textView, HorizontalAlignment textAlignment) + static void setTextSize(TextView textView, FontStyle style, TextSize textSize, HostConfig hostConfig) { - int alignment; - if (textAlignment == HorizontalAlignment.Center) - { - alignment = Gravity.CENTER; - } - else if (textAlignment == HorizontalAlignment.Left) - { - alignment = Gravity.LEFT; - } - else if (textAlignment == HorizontalAlignment.Right) - { - alignment = Gravity.RIGHT; - } - else - { - throw new IllegalArgumentException("Invalid text alignment: " + textAlignment.toString()); - } - - textView.setGravity(alignment); + textView.setTextSize(TextRendererUtil.getTextSize(style, textSize, hostConfig)); } void setTextFormat(TextView textView, HostConfig hostConfig, FontStyle style, TextWeight textWeight) { - String fontFamily = hostConfig.GetFontFamily(style); - - Typeface typeface; - if (fontFamily.isEmpty() && style == FontStyle.Monospace) - { - typeface = Typeface.MONOSPACE; - } - else - { - typeface = Typeface.create(fontFamily, Typeface.NORMAL); - } - - textView.setTypeface(typeface, m_textWeightMap.get(textWeight)); + textView.setTypeface(TextRendererUtil.getTextFormat(hostConfig, style), m_textWeightMap.get(textWeight)); } static void setTextColor(TextView textView, ForegroundColor foregroundColor, HostConfig hostConfig, boolean isSubtle, ContainerStyle containerStyle) { - textView.setTextColor(getColor(hostConfig.GetForegroundColor(containerStyle, foregroundColor, isSubtle))); + textView.setTextColor(getColor(TextRendererUtil.getTextColor(foregroundColor, hostConfig, isSubtle, containerStyle))); } static class TouchTextView implements View.OnTouchListener diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/TextRendererUtil.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/TextRendererUtil.java new file mode 100644 index 0000000000..976467db51 --- /dev/null +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/TextRendererUtil.java @@ -0,0 +1,91 @@ +package io.adaptivecards.renderer.readonly; + +import android.graphics.Typeface; +import android.view.Gravity; +import android.widget.TextView; + +import io.adaptivecards.objectmodel.ContainerStyle; +import io.adaptivecards.objectmodel.FontStyle; +import io.adaptivecards.objectmodel.ForegroundColor; +import io.adaptivecards.objectmodel.HorizontalAlignment; +import io.adaptivecards.objectmodel.HostConfig; +import io.adaptivecards.objectmodel.TextSize; +import io.adaptivecards.objectmodel.TextWeight; + +public class TextRendererUtil +{ + + static int getTextAlignment(HorizontalAlignment textAlignment) + { + int alignment; + if (textAlignment == HorizontalAlignment.Center) + { + alignment = Gravity.CENTER; + } + else if (textAlignment == HorizontalAlignment.Left) + { + alignment = Gravity.LEFT; + } + else if (textAlignment == HorizontalAlignment.Right) + { + alignment = Gravity.RIGHT; + } + else + { + throw new IllegalArgumentException("Invalid text alignment: " + textAlignment.toString()); + } + + return alignment; + } + + static long getTextSize(FontStyle style, TextSize textSize, HostConfig hostConfig) + { + return hostConfig.GetFontSize(style, textSize); + } + + static Typeface getTextFormat(HostConfig hostConfig, FontStyle style) + { + String fontFamily = hostConfig.GetFontFamily(style); + + Typeface typeface; + if (fontFamily.isEmpty() && style == FontStyle.Monospace) + { + typeface = Typeface.MONOSPACE; + } + else + { + typeface = Typeface.create(fontFamily, Typeface.NORMAL); + } + + return typeface; + } + + static String getTextColor(ForegroundColor foregroundColor, HostConfig hostConfig, boolean isSubtle, ContainerStyle containerStyle) + { + return hostConfig.GetForegroundColor(containerStyle, foregroundColor, isSubtle); + } + + static int getTextWeight(TextWeight textWeight) + { + int weight; + if (textWeight == TextWeight.Default) + { + weight = Typeface.NORMAL; + } + else if (textWeight == TextWeight.Bolder) + { + weight = Typeface.BOLD; + } + else if (textWeight == TextWeight.Lighter) + { + weight = Typeface.ITALIC; + } + else + { + throw new IllegalArgumentException("Invalid text weight: " + textWeight.toString()); + } + + return weight; + } + +} diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/registration/CardRendererRegistration.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/registration/CardRendererRegistration.java index f5a060740c..e1eb60468f 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/registration/CardRendererRegistration.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/registration/CardRendererRegistration.java @@ -13,6 +13,7 @@ import io.adaptivecards.objectmodel.Column; import io.adaptivecards.objectmodel.Container; import io.adaptivecards.objectmodel.ContainerStyle; +import io.adaptivecards.objectmodel.RichTextBlock; import io.adaptivecards.objectmodel.VerticalContentAlignment; import io.adaptivecards.renderer.AdaptiveWarning; import io.adaptivecards.renderer.IResourceResolver; @@ -42,6 +43,7 @@ import io.adaptivecards.renderer.readonly.ImageRenderer; import io.adaptivecards.renderer.readonly.ImageSetRenderer; import io.adaptivecards.renderer.readonly.MediaRenderer; +import io.adaptivecards.renderer.readonly.RichTextBlockRenderer; import io.adaptivecards.renderer.readonly.TextBlockRenderer; import java.util.HashMap; @@ -58,6 +60,7 @@ private CardRendererRegistration() registerRenderer(AdaptiveCardObjectModel.CardElementTypeToString(CardElementType.Image), ImageRenderer.getInstance()); registerRenderer(AdaptiveCardObjectModel.CardElementTypeToString(CardElementType.ImageSet), ImageSetRenderer.getInstance()); registerRenderer(AdaptiveCardObjectModel.CardElementTypeToString(CardElementType.Media), MediaRenderer.getInstance()); + registerRenderer(AdaptiveCardObjectModel.CardElementTypeToString(CardElementType.RichTextBlock), RichTextBlockRenderer.getInstance()); registerRenderer(AdaptiveCardObjectModel.CardElementTypeToString(CardElementType.TextBlock), TextBlockRenderer.getInstance()); // Register Input Renderers diff --git a/source/shared/cpp/ObjectModel/Paragraph.cpp b/source/shared/cpp/ObjectModel/Paragraph.cpp index 00a3b487e4..8e9aad4fb7 100644 --- a/source/shared/cpp/ObjectModel/Paragraph.cpp +++ b/source/shared/cpp/ObjectModel/Paragraph.cpp @@ -33,7 +33,7 @@ std::shared_ptr AdaptiveSharedNamespace::Paragraph::Deserialize(Parse std::shared_ptr paragraph = std::make_shared(); auto inlines = - ParseUtil::GetElementCollectionOfSingleType(context, json, AdaptiveCardSchemaKey::Inlines, Inline::Deserialize, true); + ParseUtil::GetElementCollectionOfSingleType(context, json, AdaptiveCardSchemaKey::Inlines, Inline::Deserialize, false); paragraph->m_inlines = std::move(inlines); HandleUnknownProperties(json, paragraph->m_knownProperties, paragraph->m_additionalProperties); From 0600626737c3fc408421edd1b902b2a021f2825d Mon Sep 17 00:00:00 2001 From: Rebecca Muraira Date: Wed, 13 Mar 2019 13:04:50 -0700 Subject: [PATCH 2/6] [Shared] Add select action to text runs --- .../EverythingBagel.cpp | 7 ++++++- .../EverythingBagel.h | 2 +- .../EverythingBagel.json | 3 ++- source/shared/cpp/ObjectModel/TextRun.cpp | 21 ++++++++++++++++++- source/shared/cpp/ObjectModel/TextRun.h | 4 ++++ 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.cpp b/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.cpp index 5c08e5a1ee..f50bac663f 100644 --- a/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.cpp +++ b/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.cpp @@ -388,7 +388,7 @@ namespace AdaptiveCardsSharedModelUnitTest Assert::IsTrue(ForegroundColor::Dark == inlineTextElement->GetTextColor()); Assert::AreEqual("en"s, inlineTextElement->GetLanguage()); Assert::IsTrue(TextSize::Large == inlineTextElement->GetTextSize()); - Assert::IsTrue(TextWeight::Bolder== inlineTextElement->GetTextWeight()); + Assert::IsTrue(TextWeight::Bolder == inlineTextElement->GetTextWeight()); Assert::IsTrue(FontStyle::Monospace == inlineTextElement->GetFontStyle()); Assert::IsTrue(inlineTextElement->GetIsSubtle()); @@ -401,6 +401,11 @@ namespace AdaptiveCardsSharedModelUnitTest Assert::IsTrue(InlineElementType::TextRun == inlines[0]->GetInlineType()); Assert::AreEqual("TextRun"s, inlines[0]->GetInlineTypeString()); + inlineTextElement = std::static_pointer_cast(inlines[0]); + auto selectAction = inlineTextElement->GetSelectAction(); + Assert::IsTrue(selectAction != nullptr); + Assert::IsTrue(ActionType::Submit == selectAction->GetElementType()); + Assert::IsTrue(InlineElementType::TextRun == inlines[1]->GetInlineType()); Assert::AreEqual("TextRun"s, inlines[1]->GetInlineTypeString()); } diff --git a/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.h b/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.h index 9d29ea1cd1..0ff7fabdad 100644 --- a/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.h +++ b/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.h @@ -1,3 +1,3 @@ #pragma once -#define EVERYTHING_JSON "{\"actions\":[{\"data\":{\"submitValue\":true},\"id\":\"Action.Submit_id\",\"title\":\"Action.Submit\",\"type\":\"Action.Submit\"},{\"card\":{\"actions\":[],\"backgroundImage\":{\"horizontalAlignment\":\"right\",\"mode\":\"repeat\",\"url\":\"https://adaptivecards.io/content/cats/1.png\",\"verticalAlignment\":\"center\"},\"body\":[{\"isSubtle\":true,\"text\":\"Action.ShowCard text\",\"type\":\"TextBlock\"}],\"lang\":\"en\",\"type\":\"AdaptiveCard\",\"version\":\"1.0\"},\"id\":\"Action.ShowCard_id\",\"title\":\"Action.ShowCard\",\"type\":\"Action.ShowCard\"}],\"backgroundImage\":\"https://adaptivecards.io/content/cats/1.png\",\"body\":[{\"id\":\"TextBlock_id\",\"maxLines\":1,\"text\":\"TextBlock_text\",\"type\":\"TextBlock\"},{\"fontStyle\":\"Monospace\",\"id\":\"TextBlock_id_mono\",\"maxLines\":1,\"text\":\"TextBlock_text\",\"type\":\"TextBlock\"},{\"id\":\"TextBlock_id_def\",\"maxLines\":1,\"text\":\"TextBlock_text\",\"type\":\"TextBlock\"},{\"altText\":\"Image_altText\",\"horizontalAlignment\":\"center\",\"id\":\"Image_id\",\"isVisible\":false,\"selectAction\":{\"title\":\"Image_Action.OpenUrl\",\"type\":\"Action.OpenUrl\",\"url\":\"https://adaptivecards.io/\"},\"separator\":true,\"size\":\"Auto\",\"spacing\":\"none\",\"style\":\"person\",\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/1.png\"},{\"id\":\"Container_id\",\"items\":[{\"columns\":[{\"id\":\"Column_id1\",\"items\":[{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/1.png\"}],\"style\":\"Default\",\"type\":\"Column\",\"width\":\"auto\"},{\"id\":\"Column_id2\",\"items\":[{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/2.png\"}],\"style\":\"Emphasis\",\"type\":\"Column\",\"width\":\"20px\"},{\"id\":\"Column_id3\",\"items\":[{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/3.png\"},{\"id\":\"Column3_TextBlock_id\",\"text\":\"Column3_TextBlock_text\",\"type\":\"TextBlock\"}],\"style\":\"Default\",\"type\":\"Column\",\"width\":\"stretch\"}],\"id\":\"ColumnSet_id\",\"separator\":true,\"spacing\":\"large\",\"type\":\"ColumnSet\"}],\"selectAction\":{\"data\":\"Container_data\",\"title\":\"Container_Action.Submit\",\"type\":\"Action.Submit\"},\"spacing\":\"medium\",\"style\":\"Default\",\"type\":\"Container\"},{\"facts\":[{\"title\":\"Topping\",\"value\":\"poppyseeds\"},{\"title\":\"Topping\",\"value\":\"onion flakes\"}],\"id\":\"FactSet_id\",\"type\":\"FactSet\"},{\"id\":\"ImageSet_id\",\"imageSize\":\"Auto\",\"images\":[{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/1.png\"},{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/2.png\"},{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/3.png\"}],\"separator\":true,\"type\":\"ImageSet\"},{\"id\":\"Container_id_inputs\",\"items\":[{\"id\":\"Input.Text_id\",\"inlineAction\":{\"iconUrl\":\"https://adaptivecards.io/content/cats/1.png\",\"title\":\"Input.Text_Action.Submit\",\"type\":\"Action.Submit\"},\"isRequired\":false,\"maxLength\":10,\"placeholder\":\"Input.Text_placeholder\",\"spacing\":\"small\",\"style\":\"text\",\"type\":\"Input.Text\",\"value\":\"Input.Text_value\"},{\"id\":\"Input.Number_id\",\"isRequired\":false,\"max\":10,\"min\":5,\"placeholder\":\"Input.Number_placeholder\",\"type\":\"Input.Number\",\"value\":7},{\"id\":\"Input.Date_id\",\"isRequired\":false,\"max\":\"1/1/2020\",\"min\":\"8/1/2018\",\"placeholder\":\"Input.Date_placeholder\",\"type\":\"Input.Date\",\"value\":\"8/9/2018\"},{\"id\":\"Input.Time_id\",\"isRequired\":false,\"max\":\"17:00\",\"min\":\"10:00\",\"placeholder\":\"Input.Time_placeholder\",\"type\":\"Input.Time\",\"value\":\"13:00\"},{\"id\":\"Input.Toggle_id\",\"isRequired\":false,\"title\":\"Input.Toggle_title\",\"type\":\"Input.Toggle\",\"value\":\"Input.Toggle_on\",\"valueOff\":\"Input.Toggle_off\",\"valueOn\":\"Input.Toggle_on\"},{\"size\":\"Large\",\"text\":\"Everybody's got choices\",\"type\":\"TextBlock\",\"weight\":\"Bolder\"},{\"choices\":[{\"title\":\"Input.Choice1_title\",\"value\":\"Input.Choice1\"},{\"title\":\"Input.Choice2_title\",\"value\":\"Input.Choice2\"},{\"title\":\"Input.Choice3_title\",\"value\":\"Input.Choice3\"},{\"title\":\"Input.Choice4_title\",\"value\":\"Input.Choice4\"}],\"id\":\"Input.ChoiceSet_id\",\"isMultiSelect\":true,\"isRequired\":false,\"style\":\"Compact\",\"type\":\"Input.ChoiceSet\",\"value\":\"Input.Choice2,Input.Choice4\"}],\"type\":\"Container\"},{\"actions\":[{\"id\":\"ActionSet.Action.Submit_id\",\"title\":\"ActionSet.Action.Submit\",\"type\":\"Action.Submit\"},{\"id\":\"ActionSet.Action.OpenUrl_id\",\"title\":\"ActionSet.Action.OpenUrl\",\"type\":\"Action.OpenUrl\",\"url\":\"https://adaptivecards.io/\"}],\"type\":\"ActionSet\"},{\"horizontalAlignment\":\"right\",\"id\":\"RichTextBlock_id\",\"maxLines\":5,\"paragraphs\":[{\"inlines\":[{\"color\":\"Dark\",\"fontStyle\":\"Monospace\",\"isSubtle\":true,\"size\":\"Large\",\"text\":\"This is a text run in paragraph 1\",\"type\":\"TextRun\",\"weight\":\"Bolder\"},{\"text\":\"This is another text run in paragraph 1\",\"type\":\"TextRun\"}]},{\"inlines\":[{\"text\":\"This is a text run in paragraph 2\",\"type\":\"TextRun\"},{\"text\":\"This is another text run in paragraph 2\",\"type\":\"TextRun\"}]}],\"type\":\"RichTextBlock\",\"wrap\":true}],\"fallbackText\":\"fallbackText\",\"lang\":\"en\",\"speak\":\"speak\",\"type\":\"AdaptiveCard\",\"version\":\"1.0\"}\n" +#define EVERYTHING_JSON "{\"actions\":[{\"data\":{\"submitValue\":true},\"id\":\"Action.Submit_id\",\"title\":\"Action.Submit\",\"type\":\"Action.Submit\"},{\"card\":{\"actions\":[],\"backgroundImage\":{\"horizontalAlignment\":\"right\",\"mode\":\"repeat\",\"url\":\"https://adaptivecards.io/content/cats/1.png\",\"verticalAlignment\":\"center\"},\"body\":[{\"isSubtle\":true,\"text\":\"Action.ShowCard text\",\"type\":\"TextBlock\"}],\"lang\":\"en\",\"type\":\"AdaptiveCard\",\"version\":\"1.0\"},\"id\":\"Action.ShowCard_id\",\"title\":\"Action.ShowCard\",\"type\":\"Action.ShowCard\"}],\"backgroundImage\":\"https://adaptivecards.io/content/cats/1.png\",\"body\":[{\"id\":\"TextBlock_id\",\"maxLines\":1,\"text\":\"TextBlock_text\",\"type\":\"TextBlock\"},{\"fontStyle\":\"Monospace\",\"id\":\"TextBlock_id_mono\",\"maxLines\":1,\"text\":\"TextBlock_text\",\"type\":\"TextBlock\"},{\"id\":\"TextBlock_id_def\",\"maxLines\":1,\"text\":\"TextBlock_text\",\"type\":\"TextBlock\"},{\"altText\":\"Image_altText\",\"horizontalAlignment\":\"center\",\"id\":\"Image_id\",\"isVisible\":false,\"selectAction\":{\"title\":\"Image_Action.OpenUrl\",\"type\":\"Action.OpenUrl\",\"url\":\"https://adaptivecards.io/\"},\"separator\":true,\"size\":\"Auto\",\"spacing\":\"none\",\"style\":\"person\",\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/1.png\"},{\"id\":\"Container_id\",\"items\":[{\"columns\":[{\"id\":\"Column_id1\",\"items\":[{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/1.png\"}],\"style\":\"Default\",\"type\":\"Column\",\"width\":\"auto\"},{\"id\":\"Column_id2\",\"items\":[{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/2.png\"}],\"style\":\"Emphasis\",\"type\":\"Column\",\"width\":\"20px\"},{\"id\":\"Column_id3\",\"items\":[{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/3.png\"},{\"id\":\"Column3_TextBlock_id\",\"text\":\"Column3_TextBlock_text\",\"type\":\"TextBlock\"}],\"style\":\"Default\",\"type\":\"Column\",\"width\":\"stretch\"}],\"id\":\"ColumnSet_id\",\"separator\":true,\"spacing\":\"large\",\"type\":\"ColumnSet\"}],\"selectAction\":{\"data\":\"Container_data\",\"title\":\"Container_Action.Submit\",\"type\":\"Action.Submit\"},\"spacing\":\"medium\",\"style\":\"Default\",\"type\":\"Container\"},{\"facts\":[{\"title\":\"Topping\",\"value\":\"poppyseeds\"},{\"title\":\"Topping\",\"value\":\"onion flakes\"}],\"id\":\"FactSet_id\",\"type\":\"FactSet\"},{\"id\":\"ImageSet_id\",\"imageSize\":\"Auto\",\"images\":[{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/1.png\"},{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/2.png\"},{\"type\":\"Image\",\"url\":\"https://adaptivecards.io/content/cats/3.png\"}],\"separator\":true,\"type\":\"ImageSet\"},{\"id\":\"Container_id_inputs\",\"items\":[{\"id\":\"Input.Text_id\",\"inlineAction\":{\"iconUrl\":\"https://adaptivecards.io/content/cats/1.png\",\"title\":\"Input.Text_Action.Submit\",\"type\":\"Action.Submit\"},\"isRequired\":false,\"maxLength\":10,\"placeholder\":\"Input.Text_placeholder\",\"spacing\":\"small\",\"style\":\"text\",\"type\":\"Input.Text\",\"value\":\"Input.Text_value\"},{\"id\":\"Input.Number_id\",\"isRequired\":false,\"max\":10,\"min\":5,\"placeholder\":\"Input.Number_placeholder\",\"type\":\"Input.Number\",\"value\":7},{\"id\":\"Input.Date_id\",\"isRequired\":false,\"max\":\"1/1/2020\",\"min\":\"8/1/2018\",\"placeholder\":\"Input.Date_placeholder\",\"type\":\"Input.Date\",\"value\":\"8/9/2018\"},{\"id\":\"Input.Time_id\",\"isRequired\":false,\"max\":\"17:00\",\"min\":\"10:00\",\"placeholder\":\"Input.Time_placeholder\",\"type\":\"Input.Time\",\"value\":\"13:00\"},{\"id\":\"Input.Toggle_id\",\"isRequired\":false,\"title\":\"Input.Toggle_title\",\"type\":\"Input.Toggle\",\"value\":\"Input.Toggle_on\",\"valueOff\":\"Input.Toggle_off\",\"valueOn\":\"Input.Toggle_on\"},{\"size\":\"Large\",\"text\":\"Everybody's got choices\",\"type\":\"TextBlock\",\"weight\":\"Bolder\"},{\"choices\":[{\"title\":\"Input.Choice1_title\",\"value\":\"Input.Choice1\"},{\"title\":\"Input.Choice2_title\",\"value\":\"Input.Choice2\"},{\"title\":\"Input.Choice3_title\",\"value\":\"Input.Choice3\"},{\"title\":\"Input.Choice4_title\",\"value\":\"Input.Choice4\"}],\"id\":\"Input.ChoiceSet_id\",\"isMultiSelect\":true,\"isRequired\":false,\"style\":\"Compact\",\"type\":\"Input.ChoiceSet\",\"value\":\"Input.Choice2,Input.Choice4\"}],\"type\":\"Container\"},{\"actions\":[{\"id\":\"ActionSet.Action.Submit_id\",\"title\":\"ActionSet.Action.Submit\",\"type\":\"Action.Submit\"},{\"id\":\"ActionSet.Action.OpenUrl_id\",\"title\":\"ActionSet.Action.OpenUrl\",\"type\":\"Action.OpenUrl\",\"url\":\"https://adaptivecards.io/\"}],\"type\":\"ActionSet\"},{\"horizontalAlignment\":\"right\",\"id\":\"RichTextBlock_id\",\"maxLines\":5,\"paragraphs\":[{\"inlines\":[{\"color\":\"Dark\",\"fontStyle\":\"Monospace\",\"isSubtle\":true,\"size\":\"Large\",\"text\":\"This is a text run in paragraph 1\",\"type\":\"TextRun\",\"weight\":\"Bolder\"},{\"text\":\"This is another text run in paragraph 1\",\"type\":\"TextRun\"}]},{\"inlines\":[{\"selectAction\":{\"type\":\"Action.Submit\"},\"text\":\"This is a text run in paragraph 2\",\"type\":\"TextRun\"},{\"text\":\"This is another text run in paragraph 2\",\"type\":\"TextRun\"}]}],\"type\":\"RichTextBlock\",\"wrap\":true}],\"fallbackText\":\"fallbackText\",\"lang\":\"en\",\"speak\":\"speak\",\"type\":\"AdaptiveCard\",\"version\":\"1.0\"}\n" diff --git a/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.json b/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.json index 2eb423eace..d117535b2f 100644 --- a/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.json +++ b/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/EverythingBagel.json @@ -300,7 +300,8 @@ "inlines": [ { "type": "TextRun", - "text": "This is a text run in paragraph 2" + "text": "This is a text run in paragraph 2", + "selectAction": { "type": "Action.Submit" } }, { "type": "TextRun", diff --git a/source/shared/cpp/ObjectModel/TextRun.cpp b/source/shared/cpp/ObjectModel/TextRun.cpp index 0deccf28d5..a325d51eab 100644 --- a/source/shared/cpp/ObjectModel/TextRun.cpp +++ b/source/shared/cpp/ObjectModel/TextRun.cpp @@ -3,7 +3,8 @@ using namespace AdaptiveSharedNamespace; -TextRun::TextRun() : Inline(InlineElementType::TextRun), m_textElementProperties(std::make_shared()) +TextRun::TextRun() : + Inline(InlineElementType::TextRun), m_textElementProperties(std::make_shared()) { PopulateKnownPropertiesSet(); } @@ -20,6 +21,11 @@ Json::Value TextRun::SerializeToJsonValue() const root[AdaptiveCardSchemaKeyToString(AdaptiveCardSchemaKey::Type)] = GetInlineTypeString(); m_textElementProperties->SerializeToJsonValue(root); + if (m_selectAction != nullptr) + { + root[AdaptiveCardSchemaKeyToString(AdaptiveCardSchemaKey::SelectAction)] = m_selectAction->SerializeToJsonValue(); + } + return root; } @@ -97,6 +103,17 @@ void TextRun::SetLanguage(const std::string& value) { m_textElementProperties->SetLanguage(value); } + +std::shared_ptr TextRun::GetSelectAction() const +{ + return m_selectAction; +} + +void TextRun::SetSelectAction(const std::shared_ptr action) +{ + m_selectAction = action; +} + std::shared_ptr TextRun::Deserialize(ParseContext& context, const Json::Value& json) { std::shared_ptr inlineTextRun = std::make_shared(); @@ -104,6 +121,8 @@ std::shared_ptr TextRun::Deserialize(ParseContext& context, const Json:: ParseUtil::ExpectTypeString(json, InlineElementTypeToString(InlineElementType::TextRun)); inlineTextRun->m_textElementProperties->Deserialize(context, json); + inlineTextRun->SetSelectAction(ParseUtil::GetAction(context, json, AdaptiveCardSchemaKey::SelectAction, false)); + HandleUnknownProperties(json, inlineTextRun->m_knownProperties, inlineTextRun->m_additionalProperties); return inlineTextRun; diff --git a/source/shared/cpp/ObjectModel/TextRun.h b/source/shared/cpp/ObjectModel/TextRun.h index 4e830c75a8..f808d61731 100644 --- a/source/shared/cpp/ObjectModel/TextRun.h +++ b/source/shared/cpp/ObjectModel/TextRun.h @@ -43,8 +43,12 @@ namespace AdaptiveSharedNamespace void SetLanguage(const std::string& value); std::string GetLanguage() const; + std::shared_ptr GetSelectAction() const; + void SetSelectAction(const std::shared_ptr action); + protected: std::shared_ptr m_textElementProperties; virtual void PopulateKnownPropertiesSet() override; + std::shared_ptr m_selectAction; }; } From f802743cacfa29f0631c9b0c12cde19711a30f1c Mon Sep 17 00:00:00 2001 From: Alberto Medina Gutierrez Date: Wed, 13 Mar 2019 13:47:44 -0700 Subject: [PATCH 3/6] Add support for select action in TextRun --- .../src/main/cpp/objectmodel_wrap.cpp | 37 ++++++++++++++ .../AdaptiveCardObjectModelJNI.java | 2 + .../io/adaptivecards/objectmodel/TextRun.java | 9 ++++ .../readonly/RichTextBlockRenderer.java | 51 ++++++++++++------- source/shared/cpp/ObjectModel/TextRun.cpp | 10 ++++ source/shared/cpp/ObjectModel/TextRun.h | 6 +++ 6 files changed, 98 insertions(+), 17 deletions(-) diff --git a/source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp b/source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp index 3f4d486fc8..7e996f8528 100644 --- a/source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp +++ b/source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp @@ -27146,6 +27146,43 @@ SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectM } +SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_TextRun_1GetSelectAction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + AdaptiveCards::TextRun *arg1 = (AdaptiveCards::TextRun *) 0 ; + std::shared_ptr< AdaptiveCards::TextRun const > *smartarg1 = 0 ; + std::shared_ptr< AdaptiveCards::BaseActionElement > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + + smartarg1 = *(std::shared_ptr< const AdaptiveCards::TextRun > **)&jarg1; + arg1 = (AdaptiveCards::TextRun *)(smartarg1 ? smartarg1->get() : 0); + result = ((AdaptiveCards::TextRun const *)arg1)->GetSelectAction(); + *(std::shared_ptr< AdaptiveCards::BaseActionElement > **)&jresult = result ? new std::shared_ptr< AdaptiveCards::BaseActionElement >(result) : 0; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_TextRun_1SetSelectAction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + AdaptiveCards::TextRun *arg1 = (AdaptiveCards::TextRun *) 0 ; + std::shared_ptr< AdaptiveCards::BaseActionElement > arg2 ; + std::shared_ptr< AdaptiveCards::TextRun > *smartarg1 = 0 ; + std::shared_ptr< AdaptiveCards::BaseActionElement > const *argp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + + smartarg1 = *(std::shared_ptr< AdaptiveCards::TextRun > **)&jarg1; + arg1 = (AdaptiveCards::TextRun *)(smartarg1 ? smartarg1->get() : 0); + argp2 = *(std::shared_ptr< AdaptiveCards::BaseActionElement > **)&jarg2; + if (argp2) arg2 = *argp2; + (arg1)->SetSelectAction(arg2); +} + + SWIGEXPORT jlong JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_TextRun_1dynamic_1cast(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; AdaptiveCards::Inline *arg1 = (AdaptiveCards::Inline *) 0 ; diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/AdaptiveCardObjectModelJNI.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/AdaptiveCardObjectModelJNI.java index 12ba7c2e27..37b3def6b1 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/AdaptiveCardObjectModelJNI.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/AdaptiveCardObjectModelJNI.java @@ -1313,6 +1313,8 @@ public class AdaptiveCardObjectModelJNI { public final static native void TextRun_SetIsSubtle(long jarg1, TextRun jarg1_, boolean jarg2); public final static native void TextRun_SetLanguage(long jarg1, TextRun jarg1_, String jarg2); public final static native String TextRun_GetLanguage(long jarg1, TextRun jarg1_); + public final static native long TextRun_GetSelectAction(long jarg1, TextRun jarg1_); + public final static native void TextRun_SetSelectAction(long jarg1, TextRun jarg1_, long jarg2, BaseActionElement jarg2_); public final static native long TextRun_dynamic_cast(long jarg1, Inline jarg1_); public final static native long BaseCardElement_SWIGSmartPtrUpcast(long jarg1); public final static native long BaseActionElement_SWIGSmartPtrUpcast(long jarg1); diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/TextRun.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/TextRun.java index b3fbe5f05d..e6e38ce58c 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/TextRun.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/TextRun.java @@ -119,6 +119,15 @@ public String GetLanguage() { return AdaptiveCardObjectModelJNI.TextRun_GetLanguage(swigCPtr, this); } + public BaseActionElement GetSelectAction() { + long cPtr = AdaptiveCardObjectModelJNI.TextRun_GetSelectAction(swigCPtr, this); + return (cPtr == 0) ? null : new BaseActionElement(cPtr, true); + } + + public void SetSelectAction(BaseActionElement action) { + AdaptiveCardObjectModelJNI.TextRun_SetSelectAction(swigCPtr, this, BaseActionElement.getCPtr(action), action); + } + public static TextRun dynamic_cast(Inline inlineVar) { long cPtr = AdaptiveCardObjectModelJNI.TextRun_dynamic_cast(Inline.getCPtr(inlineVar), inlineVar); return (cPtr == 0) ? null : new TextRun(cPtr, true); diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java index d3c6c178f7..f84c935d6e 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java @@ -1,13 +1,16 @@ package io.adaptivecards.renderer.readonly; import android.content.Context; +import android.drm.DrmStore; import android.os.Build; +import android.support.annotation.NonNull; import android.support.v4.app.FragmentManager; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; import android.text.style.AbsoluteSizeSpan; +import android.text.style.ClickableSpan; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; import android.text.style.TypefaceSpan; @@ -16,6 +19,8 @@ import android.widget.LinearLayout; import android.widget.TextView; +import io.adaptivecards.objectmodel.ActionElementParser; +import io.adaptivecards.objectmodel.BaseActionElement; import io.adaptivecards.objectmodel.BaseCardElement; import io.adaptivecards.objectmodel.ContainerStyle; import io.adaptivecards.objectmodel.HeightType; @@ -31,6 +36,7 @@ import io.adaptivecards.renderer.BaseCardElementRenderer; import io.adaptivecards.renderer.RenderedAdaptiveCard; import io.adaptivecards.renderer.TagContent; +import io.adaptivecards.renderer.action.ActionElementRenderer; import io.adaptivecards.renderer.actionhandler.ICardActionHandler; public class RichTextBlockRenderer extends BaseCardElementRenderer @@ -46,7 +52,29 @@ public static RichTextBlockRenderer getInstance() return s_instance; } - private SpannableStringBuilder processParagraph(InlineVector inlines, HostConfig hostConfig, ContainerStyle containerStyle) + private class ActionSpan extends ClickableSpan + { + public ActionSpan(BaseActionElement action, RenderedAdaptiveCard renderedCard, ICardActionHandler cardActionHandler) + { + m_actionListener = new ActionElementRenderer.ButtonOnClickListener(renderedCard, action, cardActionHandler); + } + + @Override + public void onClick(@NonNull View widget) + { + // Delegate the job to the listener + m_actionListener.onClick(widget); + } + + private ActionElementRenderer.ButtonOnClickListener m_actionListener; + } + + private SpannableStringBuilder buildSpannableParagraph( + RenderedAdaptiveCard renderedCard, + InlineVector inlines, + ICardActionHandler cardActionHandler, + HostConfig hostConfig, + ContainerStyle containerStyle) { SpannableStringBuilder paragraph = new SpannableStringBuilder(); int lastStringLength = 0; @@ -92,18 +120,10 @@ else if ((textRun = TextRun.dynamic_cast(inline)) == null) paragraph.setSpan(new TypefaceSpan(fontName), spanStart, spanEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); - // Let's leave this for later - // textView.setOnTouchListener(new TextBlockRenderer.TouchTextView(new SpannableString(text))); - - // This is not implemeneted yet, so I must wait for it to be implemented - // if(textRun.GetAction() != null) - // { - // if (column.GetSelectAction() != null) - // { - // returnedView.setClickable(true); - // returnedView.setOnClickListener(new ActionElementRenderer.ButtonOnClickListener(renderedCard, column.GetSelectAction(), cardActionHandler)); - // } - // } + if(textRun.GetSelectAction() != null) + { + paragraph.setSpan(new ActionSpan(textRun.GetSelectAction(), renderedCard, cardActionHandler), spanStart, spanEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + } } } @@ -197,14 +217,11 @@ else if (!richTextBlock.GetWrap()) textView.append(System.getProperty("line.separator")); } - SpannableStringBuilder convertedString = processParagraph(inlines, hostConfig, containerStyle); + SpannableStringBuilder convertedString = buildSpannableParagraph(renderedCard, inlines, cardActionHandler, hostConfig, containerStyle); textView.append(convertedString); } - - // textView.setText(text); - viewGroup.addView(textView); return textView; } diff --git a/source/shared/cpp/ObjectModel/TextRun.cpp b/source/shared/cpp/ObjectModel/TextRun.cpp index 0deccf28d5..06843de7f6 100644 --- a/source/shared/cpp/ObjectModel/TextRun.cpp +++ b/source/shared/cpp/ObjectModel/TextRun.cpp @@ -93,6 +93,16 @@ std::string TextRun::GetLanguage() const return m_textElementProperties->GetLanguage(); } +std::shared_ptr TextRun::GetSelectAction() const +{ + return m_selectAction; +} + +void TextRun::SetSelectAction(const std::shared_ptr action) +{ + m_selectAction = action; +} + void TextRun::SetLanguage(const std::string& value) { m_textElementProperties->SetLanguage(value); diff --git a/source/shared/cpp/ObjectModel/TextRun.h b/source/shared/cpp/ObjectModel/TextRun.h index 4e830c75a8..2dbafe4b07 100644 --- a/source/shared/cpp/ObjectModel/TextRun.h +++ b/source/shared/cpp/ObjectModel/TextRun.h @@ -43,8 +43,14 @@ namespace AdaptiveSharedNamespace void SetLanguage(const std::string& value); std::string GetLanguage() const; + std::shared_ptr GetSelectAction() const; + void SetSelectAction(const std::shared_ptr action); + protected: std::shared_ptr m_textElementProperties; virtual void PopulateKnownPropertiesSet() override; + + private: + std::shared_ptr m_selectAction; }; } From ea20ac32bb46ee31e288944d94bd46361b09df5d Mon Sep 17 00:00:00 2001 From: Alberto Medina Gutierrez Date: Wed, 13 Mar 2019 16:08:58 -0700 Subject: [PATCH 4/6] Check select action working correctly --- .../renderer/readonly/RichTextBlockRenderer.java | 4 ++++ source/shared/cpp/ObjectModel/TextRun.cpp | 10 ---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java index f84c935d6e..f2b614a4ee 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java @@ -9,6 +9,7 @@ import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; +import android.text.method.LinkMovementMethod; import android.text.style.AbsoluteSizeSpan; import android.text.style.ClickableSpan; import android.text.style.ForegroundColorSpan; @@ -222,6 +223,9 @@ else if (!richTextBlock.GetWrap()) textView.append(convertedString); } + textView.setMovementMethod(LinkMovementMethod.getInstance()); + textView.setClickable(true); + viewGroup.addView(textView); return textView; } diff --git a/source/shared/cpp/ObjectModel/TextRun.cpp b/source/shared/cpp/ObjectModel/TextRun.cpp index 55d1040fc1..b4bdd3d6cb 100644 --- a/source/shared/cpp/ObjectModel/TextRun.cpp +++ b/source/shared/cpp/ObjectModel/TextRun.cpp @@ -114,16 +114,6 @@ void TextRun::SetLanguage(const std::string& value) m_textElementProperties->SetLanguage(value); } -std::shared_ptr TextRun::GetSelectAction() const -{ - return m_selectAction; -} - -void TextRun::SetSelectAction(const std::shared_ptr action) -{ - m_selectAction = action; -} - std::shared_ptr TextRun::Deserialize(ParseContext& context, const Json::Value& json) { std::shared_ptr inlineTextRun = std::make_shared(); From 0fd00ca8612ea52749783ffec5b7ca3232dd3b49 Mon Sep 17 00:00:00 2001 From: Alberto Medina Gutierrez Date: Wed, 13 Mar 2019 16:38:11 -0700 Subject: [PATCH 5/6] Fix comments --- .../renderer/readonly/RichTextBlockRenderer.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java index f2b614a4ee..6a6c21627f 100644 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java +++ b/source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/readonly/RichTextBlockRenderer.java @@ -84,8 +84,6 @@ private SpannableStringBuilder buildSpannableParagraph( Inline inline = inlines.get(i); if(inline.GetInlineType() == InlineElementType.TextRun) { - // TextRun textRun = (TextRun)inline; - TextRun textRun = null; if (inline instanceof TextRun) { @@ -202,7 +200,7 @@ else if (!richTextBlock.GetWrap()) // This is the section for rendering the paragraphs // Every paragraph may contain contains any number of inlines - // The inline element types are TextRun <- That's the only existing type so far + // The current inline element types are TextRun ParagraphVector paragraphs = richTextBlock.GetParagraphs(); int paragraphCount = paragraphs.size(); @@ -223,6 +221,7 @@ else if (!richTextBlock.GetWrap()) textView.append(convertedString); } + // Properties required for actions to fire onClick event textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setClickable(true); From e4e5ed9a72d2ddc2300013f7f1945f4d6f535c64 Mon Sep 17 00:00:00 2001 From: Alberto Medina Gutierrez Date: Wed, 13 Mar 2019 16:48:40 -0700 Subject: [PATCH 6/6] Remove unused swig files --- ...shared_ptrT_AdaptiveCards__Inline_t_t.java | 26 ------------------- ...red_ptrT_AdaptiveCards__Paragraph_t_t.java | 26 ------------------- 2 files changed, 52 deletions(-) delete mode 100644 source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t.java delete mode 100644 source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t.java diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t.java deleted file mode 100644 index c1c38cacd0..0000000000 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t.java +++ /dev/null @@ -1,26 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 - * - * Do not make changes to this file unless you know what you are doing--modify - * the SWIG interface file instead. - * ----------------------------------------------------------------------------- */ - -package io.adaptivecards.objectmodel; - -public class SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t { - private transient long swigCPtr; - - protected SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) { - swigCPtr = cPtr; - } - - protected SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t() { - swigCPtr = 0; - } - - protected static long getCPtr(SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Inline_t_t obj) { - return (obj == null) ? 0 : obj.swigCPtr; - } -} - diff --git a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t.java b/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t.java deleted file mode 100644 index 60afd7f1ed..0000000000 --- a/source/android/adaptivecards/src/main/java/io/adaptivecards/objectmodel/SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t.java +++ /dev/null @@ -1,26 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 - * - * Do not make changes to this file unless you know what you are doing--modify - * the SWIG interface file instead. - * ----------------------------------------------------------------------------- */ - -package io.adaptivecards.objectmodel; - -public class SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t { - private transient long swigCPtr; - - protected SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) { - swigCPtr = cPtr; - } - - protected SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t() { - swigCPtr = 0; - } - - protected static long getCPtr(SWIGTYPE_p_std__vectorT_std__shared_ptrT_AdaptiveCards__Paragraph_t_t obj) { - return (obj == null) ? 0 : obj.swigCPtr; - } -} -