I am using component SfSplitButton of Blazor Syncfusion version 19.2.48 in razor page as below:
<SfSplitButton Content="Downloads"
Disabled="IsDownloadReportButtonDisabled"
CssClass="mr-2">
<SplitButtonEvents ItemSelected="OnDownloadReportItemSelected"></SplitButtonEvents>
<DropDownMenuItems>
<DropDownMenuItem Id="DownloadTcaReportItem" Text="Download Report"></DropDownMenuItem>
<DropDownMenuItem Id="DownloadTcaConsentReportItem" Text="Download Consent"></DropDownMenuItem>
#if (_isAccountOccupationalHealth)
{
<DropDownMenuItem Id="DownloadTcaSummaryReportItem" Text="Download Summary Report"></DropDownMenuItem>
}
</DropDownMenuItems>
</SfSplitButton>
#code{
private async Task OnDownloadReportItemSelected(MenuEventArgs args)
{
switch (args.Item.Id)
{
case "DownloadTcaReportItem":
//Do some task
break;
case "DownloadTcaSummaryReportItem":
//Do some task
break;
case "DownloadTcaConsentReportItem":
//Do some task
break;
}
}
}
after click on dropdown items still showing in the other pages
Related
I need some help with MVVM architecture.
I have a RecyclerView that receives LiveData and display it perfectly, however, my recyclerView requires another source of Data to customize colors and backgrounds of TextViews. for now I'm using a public list declared in the Mainactivity, But I've read that it's not a good practice.
is it possible to perform a non-live request to database from inside RecyclerView, in order to replace the public list ? if not I would really like some suggestions.
here is my onBindViewHolder:
#Override
public void onBindViewHolder(#NonNull ResultRecyclerViewAdapter.ResultHolder holder, int position) {
Results currentResult = results.get(position);
holder.ston1.setText(currentResult.getSton1());
holder.ston2.setText(String.valueOf(currentResult.getSton2()));
holder.ston1.setBackgroundColor(0xFF12FF45);
holder.ston2.setBackgroundColor(0xFF12FF45);
holder.ston1.getBackground().setAlpha(100);
holder.ston2.getBackground().setAlpha(100);
for (Ston ston: MainActivity.Stons){
if (currentResult.getStonCode().equals(ston.getStonCode()) && currentResult.getStonType().equals(ston.getStonType())){
switch (ston.getStonSelected()) {
case "WADS":
holder.ston1.getBackground().setAlpha(255);
break;
case "WQAS":
holder.ston2.getBackground().setAlpha(255);
break;
}
break;
}
}
holder.ston1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Boolean found = false;
for (Ston ston: MainActivity.Stons){
if (currentResult.getStonCode().equals(ston.getStonCode())){
found = true;
break;
}
}
if (!found) {
holder.ston1.getBackground().setAlpha(255);
MainActivity.Stons.add(new Stons(currentResult.getStonCode(),"WADS",
currentResult.getStonType()));
}
else {
for (Ston ston : MainActivity.Stons) {
if (currentResult.getStonCode().equals(ston.getStonCode()) && ston.getStonSelected().equals("WADS") &&
ston.getStonType().equals(currentResult.getStonType())){
MainActivity.Stons.remove(ston);
holder.ston1.getBackground().setAlpha(100);
break;
}
}
}
}
});
holder.ston2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Boolean found = false;
for (Ston ston: MainActivity.Stons){
if (currentResult.getStonCode().equals(ston.getStonCode())){
found = true;
break;
}
}
if (!found) {
holder.ston2.getBackground().setAlpha(255);
MainActivity.Stons.add(new Stons(currentResult.getStonCode(),"WQAS",
currentResult.getStonType()));
}
else {
for (Ston ston : MainActivity.Stons) {
if (currentResult.getStonCode().equals(ston.getStonCode()) && ston.getStonSelected().equals("WQAS") &&
ston.getStonType().equals(currentResult.getStonType())){
MainActivity.Stons.remove(ston);
holder.ston2.getBackground().setAlpha(100);
break;
}
}
}
}
});
One option that I see is to create new type specifically for your recyclerview adapter that will hold both Results object and information that you use for background alpha. So in your activity (or fragment) when livedata observer is triggered you don't directly pass it to adapter, but first create collection of objects of your new type, and then pass it to adapter. And I strongly suggest you to use Kotlin if possible, there you can use collection mapping to map collection from the db to your new type's collection.
I use this plugin
facebook_audience_network 0.5.0
and I implemented this by this way
class FacebookAd{
static void faceInit() {
FacebookAudienceNetwork.init(
testingId: "xxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxx",
);
}
static widget myBanner;
static void showBannerAd() {
myBanner = FacebookBannerAd(
placementId: "xxxxxxxxx_xxxxxxxxxxx",
keepAlive: true,
bannerSize: BannerSize.STANDARD,
listener: (result, value) {
print("Banner Ad: $result --> $value eee");
switch (result) {
case BannerAdResult.ERROR:
print("Error: $value");
break;
case BannerAdResult.LOADED:
print("Loaded: $value");
break;
case BannerAdResult.CLICKED:
print("Clicked: $value");
break;
case BannerAdResult.LOGGING_IMPRESSION:
print("Logging Impression: $value");
break;
}
},
);
}
}
}
and from other classes
return Scaffold(
bottomNavigationBar: FacebookAd.myBanner
)
so in the app, all of screens refer variable "myBanner" to show banner inside "bottomNavigationBar"
but the problem is when the screen is changed using pushNamed("/xxx")
sometimes the screen showing banner and sometimes not ! (mostly not)
how do I solve this problem this?
thank you
Here is how I was able to solve the FAN interstitials for different pages, unlike the AdMob you should manage the Facebook FAN ads centrally in a separate dart class.
class MyFacebookAdsManager {
static bool isInterstitialAdLoaded = false;
static String adsInterstitialUnitId = '';
static void init(String id) {
logger.i('$prefix init called');
adsInterstitialUnitId = id;
FacebookAudienceNetwork.init(
testingId: '<test-id-if-needed>',
);
loadNewFANInterstitialAd();
}
static void loadNewFANInterstitialAd() {
FacebookInterstitialAd.loadInterstitialAd(
placementId: adsInterstitialUnitId,
listener: (result, value) {
logger.i("$prefix >> FAN > Interstitial Ad: $result --> $value");
switch (result) {
case InterstitialAdResult.LOADED:
isInterstitialAdLoaded = true;
break;
case InterstitialAdResult.DISMISSED:
isInterstitialAdLoaded = false;
loadNewFANInterstitialAd();
break;
case InterstitialAdResult.ERROR:
isInterstitialAdLoaded = false;
logger.e('error loading facebook ads');
loadNewFANInterstitialAd();
break;
default:
}
},
);
}
static void showInterstitialAd() {
if (isInterstitialAdLoaded)
FacebookInterstitialAd.showInterstitialAd();
else
loadNewFANInterstitialAd();
}
}
Now in the main screen you will call the init once and only once.
MyFacebookAdsManager.init('test-id')
Finally, wherever you want to display the Ad, use the class created and show the ad.
MyFacebookAdsManager.showInterstitialAd();
In the same fashion, you should create separate classes and manage All banners & reward videos.
Where would I get callback for the positive/negetive - Yes/No buttons for this dialog?
Also, how can I customize the text on this Dialog?
Instead of this app I want to insert my App name. And I don't want the part that says Use Google's location service.......etc.etc.
Here is the answer.
protected static final int REQUEST_CHECK_SETTINGS = 0x1;
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_CHECK_SETTINGS:
switch (resultCode) {
case Activity.RESULT_OK:
// All required changes were successfully made
break;
case Activity.RESULT_CANCELED:
// The user was asked to change settings, but chose not to
break;
default:
break;
}
break;
}
}
Using switch case i wanted to add different list to combobox,when i compile i dont see any error. The following is my code, can any one please suggest what could be the reason for not updating combobox list ??
public void comboboxlist(Composite parent,String fruit) {
Combo combobox = new Combo(parent,SWT.NONE | SWT.DROP_DOWN | SWT.READ_ONLY);
switch(fruit) {
case "apple":
combobox.setItems(new String[]{"Red","green"});
combobox.addModifyListener( new ModifyListener() {
public void modifyText(final ModifyEvent e) {
}
});
break;
case "mango":
combobox.setItems(new String[]{"Yellow","green"});
combobox.addModifyListener( new ModifyListener() {
public void modifyText(final ModifyEvent e) {
}
});
break;
default : break;
}
}
The most plausible explanation for me would be that your fruit is neither "apple" nor "mango". Have you checked that?
What is the event type for the control click in a table cell in a GWT application? I want to basically change the color of the background when the user does this action.
This part of my code basically just looks like:
public void onBrowserEvent(Event event) {
Element td = getEventTargetCell(event);
if (td == null) return;
Element tr = DOM.getParent(td);
System.out.println("Event " + Event.getCurrentEvent());
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEDOWN: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
onRowClick(tr);
break;
}
case Event.ONMOUSEUP: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffffff");
break;
}
case Event.ONMOUSEOVER: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
onRowRollover(tr);
break;
}
case Event.ONMOUSEOUT: {
//DOM.setStyleAttribute(td, "backgroundColor","#ffffff");
break;
}
/*case Event.ONCLICK: {
DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
break;
}*/
case Event.ONDBLCLICK: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffffff");
break;
}
case Event.KEYEVENTS: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
break;
}
case Event.ONFOCUS: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
break;
}
/*case Event. {
DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
break;
}*/
}
}
What do I need to do to capture this event?
The http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/Event.html object passed into onBrowserEvent has methods. Methods such as boolean getCtrlKey().
case Event.ONCLICK: {
if (event.getCtrlKey()) {
DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
}
break;
}
This will work for Windows, not sure about Mac and Linux. On OS X you might check getMetaKey() instead, since Command is normally used where Control is used on Windows.
How about wrapping the contents of the cell in a FocusPanel and adding the appropriate handler (most likely MouseDownHandler)? (tip: create the handler once and add it to all the related cells)
You can also add key handlers, etc. to FocusPanel so you won't need to dabble in native browser events (which could lead to some trouble, browser-specific code, etc.), let GWT do that for you :)