Skip to content

Commit

Permalink
Rename sentiment to style (microsoft#2979)
Browse files Browse the repository at this point in the history
* Update samples

* Update shared model

* Update UWP

* Udpate UWP tests

* Update .NET

* Udpate Android

* ios coresponding changes

* update project file
  • Loading branch information
RebeccaAnne authored and paulcam206 committed May 28, 2019
1 parent 5fc4bcc commit 44f0990
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 73 deletions.
36 changes: 18 additions & 18 deletions source/android/adaptivecards/src/main/cpp/objectmodel_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2770,15 +2770,15 @@ void SwigDirector_BaseActionElement::SetIconUrl(std::string const &value) {
if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

std::string SwigDirector_BaseActionElement::GetSentiment() const {
std::string SwigDirector_BaseActionElement::GetStyle() const {
std::string c_result ;
jstring jresult = 0 ;
JNIEnvWrapper swigjnienv(this) ;
JNIEnv * jenv = swigjnienv.getJNIEnv() ;
jobject swigjobj = (jobject) NULL ;

if (!swig_override[10]) {
return AdaptiveCards::BaseActionElement::GetSentiment();
return AdaptiveCards::BaseActionElement::GetStyle();
}
swigjobj = swig_get_self(jenv);
if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
Expand All @@ -2799,20 +2799,20 @@ std::string SwigDirector_BaseActionElement::GetSentiment() const {
c_result.assign(c_result_pstr);
jenv->ReleaseStringUTFChars(jresult, c_result_pstr);
} else {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AdaptiveCards::BaseActionElement::GetSentiment ");
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AdaptiveCards::BaseActionElement::GetStyle ");
}
if (swigjobj) jenv->DeleteLocalRef(swigjobj);
return c_result;
}

void SwigDirector_BaseActionElement::SetSentiment(std::string const &value) {
void SwigDirector_BaseActionElement::SetStyle(std::string const &value) {
JNIEnvWrapper swigjnienv(this) ;
JNIEnv * jenv = swigjnienv.getJNIEnv() ;
jobject swigjobj = (jobject) NULL ;
jstring jvalue = 0 ;

if (!swig_override[11]) {
AdaptiveCards::BaseActionElement::SetSentiment(value);
AdaptiveCards::BaseActionElement::SetStyle(value);
return;
}
swigjobj = swig_get_self(jenv);
Expand All @@ -2826,7 +2826,7 @@ void SwigDirector_BaseActionElement::SetSentiment(std::string const &value) {
}

} else {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AdaptiveCards::BaseActionElement::SetSentiment ");
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AdaptiveCards::BaseActionElement::SetStyle ");
}
if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}
Expand Down Expand Up @@ -2894,10 +2894,10 @@ void SwigDirector_BaseActionElement::swig_connect_director(JNIEnv *jenv, jobject
"SetIconUrl", "(Ljava/lang/String;)V", NULL
},
{
"GetSentiment", "()Ljava/lang/String;", NULL
"GetStyle", "()Ljava/lang/String;", NULL
},
{
"SetSentiment", "(Ljava/lang/String;)V", NULL
"SetStyle", "(Ljava/lang/String;)V", NULL
},
{
"GetElementType", "()Lio/adaptivecards/objectmodel/ActionType;", NULL
Expand Down Expand Up @@ -10411,7 +10411,7 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode
}


SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseActionElement_1GetSentiment(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseActionElement_1GetStyle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jstring jresult = 0 ;
AdaptiveCards::BaseActionElement *arg1 = (AdaptiveCards::BaseActionElement *) 0 ;
std::shared_ptr< AdaptiveCards::BaseActionElement const > *smartarg1 = 0 ;
Expand All @@ -10423,13 +10423,13 @@ SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectM

smartarg1 = *(std::shared_ptr< const AdaptiveCards::BaseActionElement > **)&jarg1;
arg1 = (AdaptiveCards::BaseActionElement *)(smartarg1 ? smartarg1->get() : 0);
result = ((AdaptiveCards::BaseActionElement const *)arg1)->GetSentiment();
result = ((AdaptiveCards::BaseActionElement const *)arg1)->GetStyle();
jresult = jenv->NewStringUTF((&result)->c_str());
return jresult;
}


SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseActionElement_1GetSentimentSwigExplicitBaseActionElement(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseActionElement_1GetStyleSwigExplicitBaseActionElement(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jstring jresult = 0 ;
AdaptiveCards::BaseActionElement *arg1 = (AdaptiveCards::BaseActionElement *) 0 ;
std::shared_ptr< AdaptiveCards::BaseActionElement const > *smartarg1 = 0 ;
Expand All @@ -10441,13 +10441,13 @@ SWIGEXPORT jstring JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectM

smartarg1 = *(std::shared_ptr< const AdaptiveCards::BaseActionElement > **)&jarg1;
arg1 = (AdaptiveCards::BaseActionElement *)(smartarg1 ? smartarg1->get() : 0);
result = ((AdaptiveCards::BaseActionElement const *)arg1)->AdaptiveCards::BaseActionElement::GetSentiment();
result = ((AdaptiveCards::BaseActionElement const *)arg1)->AdaptiveCards::BaseActionElement::GetStyle();
jresult = jenv->NewStringUTF((&result)->c_str());
return jresult;
}


SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseActionElement_1SetSentiment(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseActionElement_1SetStyle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
AdaptiveCards::BaseActionElement *arg1 = (AdaptiveCards::BaseActionElement *) 0 ;
std::string *arg2 = 0 ;
std::shared_ptr< AdaptiveCards::BaseActionElement > *smartarg1 = 0 ;
Expand All @@ -10467,11 +10467,11 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode
std::string arg2_str(arg2_pstr);
arg2 = &arg2_str;
jenv->ReleaseStringUTFChars(jarg2, arg2_pstr);
(arg1)->SetSentiment((std::string const &)*arg2);
(arg1)->SetStyle((std::string const &)*arg2);
}


SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseActionElement_1SetSentimentSwigExplicitBaseActionElement(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectModelJNI_BaseActionElement_1SetStyleSwigExplicitBaseActionElement(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
AdaptiveCards::BaseActionElement *arg1 = (AdaptiveCards::BaseActionElement *) 0 ;
std::string *arg2 = 0 ;
std::shared_ptr< AdaptiveCards::BaseActionElement > *smartarg1 = 0 ;
Expand All @@ -10491,7 +10491,7 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode
std::string arg2_str(arg2_pstr);
arg2 = &arg2_str;
jenv->ReleaseStringUTFChars(jarg2, arg2_pstr);
(arg1)->AdaptiveCards::BaseActionElement::SetSentiment((std::string const &)*arg2);
(arg1)->AdaptiveCards::BaseActionElement::SetStyle((std::string const &)*arg2);
}


Expand Down Expand Up @@ -28679,10 +28679,10 @@ SWIGEXPORT void JNICALL Java_io_adaptivecards_objectmodel_AdaptiveCardObjectMode
"SwigDirector_BaseActionElement_SetIconUrl", "(Lio/adaptivecards/objectmodel/BaseActionElement;Ljava/lang/String;)V"
},
{
"SwigDirector_BaseActionElement_GetSentiment", "(Lio/adaptivecards/objectmodel/BaseActionElement;)Ljava/lang/String;"
"SwigDirector_BaseActionElement_GetStyle", "(Lio/adaptivecards/objectmodel/BaseActionElement;)Ljava/lang/String;"
},
{
"SwigDirector_BaseActionElement_SetSentiment", "(Lio/adaptivecards/objectmodel/BaseActionElement;Ljava/lang/String;)V"
"SwigDirector_BaseActionElement_SetStyle", "(Lio/adaptivecards/objectmodel/BaseActionElement;Ljava/lang/String;)V"
},
{
"SwigDirector_BaseActionElement_GetElementType", "(Lio/adaptivecards/objectmodel/BaseActionElement;)I"
Expand Down
4 changes: 2 additions & 2 deletions source/android/adaptivecards/src/main/cpp/objectmodel_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class SwigDirector_BaseActionElement : public AdaptiveCards::BaseActionElement,
virtual void SetTitle(std::string const &value);
virtual std::string GetIconUrl() const;
virtual void SetIconUrl(std::string const &value);
virtual std::string GetSentiment() const;
virtual void SetSentiment(std::string const &value);
virtual std::string GetStyle() const;
virtual void SetStyle(std::string const &value);
virtual AdaptiveCards::ActionType const GetElementType() const;
public:
bool swig_overrides(int n) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,10 @@ public class AdaptiveCardObjectModelJNI {
public final static native String BaseActionElement_GetIconUrlSwigExplicitBaseActionElement(long jarg1, BaseActionElement jarg1_);
public final static native void BaseActionElement_SetIconUrl(long jarg1, BaseActionElement jarg1_, String jarg2);
public final static native void BaseActionElement_SetIconUrlSwigExplicitBaseActionElement(long jarg1, BaseActionElement jarg1_, String jarg2);
public final static native String BaseActionElement_GetSentiment(long jarg1, BaseActionElement jarg1_);
public final static native String BaseActionElement_GetSentimentSwigExplicitBaseActionElement(long jarg1, BaseActionElement jarg1_);
public final static native void BaseActionElement_SetSentiment(long jarg1, BaseActionElement jarg1_, String jarg2);
public final static native void BaseActionElement_SetSentimentSwigExplicitBaseActionElement(long jarg1, BaseActionElement jarg1_, String jarg2);
public final static native String BaseActionElement_GetStyle(long jarg1, BaseActionElement jarg1_);
public final static native String BaseActionElement_GetStyleSwigExplicitBaseActionElement(long jarg1, BaseActionElement jarg1_);
public final static native void BaseActionElement_SetStyle(long jarg1, BaseActionElement jarg1_, String jarg2);
public final static native void BaseActionElement_SetStyleSwigExplicitBaseActionElement(long jarg1, BaseActionElement jarg1_, String jarg2);
public final static native int BaseActionElement_GetElementType(long jarg1, BaseActionElement jarg1_);
public final static native int BaseActionElement_GetElementTypeSwigExplicitBaseActionElement(long jarg1, BaseActionElement jarg1_);
public final static native void BaseActionElement_GetResourceInformation(long jarg1, BaseActionElement jarg1_, long jarg2, RemoteResourceInformationVector jarg2_);
Expand Down Expand Up @@ -1493,11 +1493,11 @@ public static String SwigDirector_BaseActionElement_GetIconUrl(BaseActionElement
public static void SwigDirector_BaseActionElement_SetIconUrl(BaseActionElement jself, String value) {
jself.SetIconUrl(value);
}
public static String SwigDirector_BaseActionElement_GetSentiment(BaseActionElement jself) {
return jself.GetSentiment();
public static String SwigDirector_BaseActionElement_GetStyle(BaseActionElement jself) {
return jself.GetStyle();
}
public static void SwigDirector_BaseActionElement_SetSentiment(BaseActionElement jself, String value) {
jself.SetSentiment(value);
public static void SwigDirector_BaseActionElement_SetStyle(BaseActionElement jself, String value) {
jself.SetStyle(value);
}
public static int SwigDirector_BaseActionElement_GetElementType(BaseActionElement jself) {
return (jself.GetElementType()).swigValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public enum AdaptiveCardSchemaKey {
RichTextBlock,
Right,
SelectAction,
Sentiment,
Separator,
ShowActionMode,
ShowCard,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ public void SetIconUrl(String value) {
if (getClass() == BaseActionElement.class) AdaptiveCardObjectModelJNI.BaseActionElement_SetIconUrl(swigCPtr, this, value); else AdaptiveCardObjectModelJNI.BaseActionElement_SetIconUrlSwigExplicitBaseActionElement(swigCPtr, this, value);
}

public String GetSentiment() {
return (getClass() == BaseActionElement.class) ? AdaptiveCardObjectModelJNI.BaseActionElement_GetSentiment(swigCPtr, this) : AdaptiveCardObjectModelJNI.BaseActionElement_GetSentimentSwigExplicitBaseActionElement(swigCPtr, this);
public String GetStyle() {
return (getClass() == BaseActionElement.class) ? AdaptiveCardObjectModelJNI.BaseActionElement_GetStyle(swigCPtr, this) : AdaptiveCardObjectModelJNI.BaseActionElement_GetStyleSwigExplicitBaseActionElement(swigCPtr, this);
}

public void SetSentiment(String value) {
if (getClass() == BaseActionElement.class) AdaptiveCardObjectModelJNI.BaseActionElement_SetSentiment(swigCPtr, this, value); else AdaptiveCardObjectModelJNI.BaseActionElement_SetSentimentSwigExplicitBaseActionElement(swigCPtr, this, value);
public void SetStyle(String value) {
if (getClass() == BaseActionElement.class) AdaptiveCardObjectModelJNI.BaseActionElement_SetStyle(swigCPtr, this, value); else AdaptiveCardObjectModelJNI.BaseActionElement_SetStyleSwigExplicitBaseActionElement(swigCPtr, this, value);
}

public ActionType GetElementType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,17 @@ private static Button createButtonWithTheme(Context context, int theme)
return new Button(themedContext);
}

protected static Button getButtonForSentiment(Context context, String sentiment, HostConfig hostConfig)
protected static Button getButtonForStyle(Context context, String style, HostConfig hostConfig)
{
boolean isPositiveSentiment = sentiment.equalsIgnoreCase("Positive");
boolean isDestructiveSentiment = sentiment.equalsIgnoreCase("Destructive");
boolean isPositiveStyle = style.equalsIgnoreCase("Positive");
boolean isDestructiveStyle = style.equalsIgnoreCase("Destructive");

if(isPositiveSentiment || isDestructiveSentiment)
if(isPositiveStyle || isDestructiveStyle)
{
Resources.Theme theme = context.getTheme();
TypedValue buttonStyle = new TypedValue();

if(isPositiveSentiment)
if(isPositiveStyle)
{
if(theme.resolveAttribute(R.attr.adaptiveActionPositive, buttonStyle, true))
{
Expand Down Expand Up @@ -174,7 +174,7 @@ public Button renderButton(
RenderedAdaptiveCard renderedCard,
RenderArgs renderArgs)
{
Button button = getButtonForSentiment(context, baseActionElement.GetSentiment(), hostConfig);
Button button = getButtonForStyle(context, baseActionElement.GetStyle(), hostConfig);

button.setText(baseActionElement.GetTitle());
ActionAlignment alignment = hostConfig.GetActions().getActionAlignment();
Expand Down
Loading

0 comments on commit 44f0990

Please sign in to comment.