MicrosoftDocs / AdaptiveCards

Docs for Adaptive Cards
https://docs.microsoft.com/en-us/adaptive-cards/
Creative Commons Attribution 4.0 International
72 stars 140 forks source link

No Sample for handling clicks on custom actions #208

Open desaibijon opened 5 years ago

desaibijon commented 5 years ago

Could you give an example on how to handle clicks on custom action items declared. Like we have examples for onOpenURL, onSubmit and onShowCard. For now, it ends in a limbo as to how to perform some kind of task using the custom action data.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

bekao commented 5 years ago

+@Matt Hidingermailto:Matt.Hidinger@microsoft.com

From: Bijon Desai notifications@github.com Sent: Thursday, August 1, 2019 1:34 PM To: MicrosoftDocs/AdaptiveCards AdaptiveCards@noreply.github.com Cc: Ben Kao bekao@microsoft.com; Mention mention@noreply.github.com Subject: [MicrosoftDocs/AdaptiveCards] No Sample for handling clicks on custom actions (#208)

Could you give an example on how to handle clicks on custom action items declared. Like we have examples for onOpenURL, onSubmit and onShowCard. For now, it ends in a limbo as to how to perform some kind of task using the custom action data.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2FAdaptiveCards%2Fissues%2F208%3Femail_source%3Dnotifications%26email_token%3DAFRL7J5EGXBUHLCCR2XLKSDQCNCCBA5CNFSM4IIVII4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HC5JNOQ&data=02%7C01%7Cbekao%40microsoft.com%7C045a02bb392046bf9f1f08d716bf87e2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637002884187088177&sdata=WRUXmYkQoqDYEGRvKkrTRGilbgLIsSTNW6ObnL%2FkV%2Bs%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFRL7JZZKUXE7MZ2HLY4QVLQCNCCBANCNFSM4IIVII4A&data=02%7C01%7Cbekao%40microsoft.com%7C045a02bb392046bf9f1f08d716bf87e2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637002884187098175&sdata=guQB3DeNShrHl%2FYR0Bbz7pY4uBdCqpC8LM1mnMxuzc0%3D&reserved=0.

desaibijon commented 5 years ago

I found issue with Button myActionButton = new Button(context); CustomActionElement customAction = (CustomActionElement) baseActionElement.findImplObj(); myActionButton.setBackgroundColor(getResources().getColor(R.color.greenActionColor)); myActionButton.setText(customAction.getMessage()); myActionButton.setAllCaps(false); myActionButton.setOnClickListener(new BaseActionElementRenderer.ActionOnClickListener(renderedCard, baseActionElement, cardActionHandler));

Here, instead of passing baseActionElement in ActionOnClickListener, user should pass customAction to receive the customAction type when the button is clicked.