Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

The back button still enable when LoadingDialog is showing #32

Closed
vincywindy opened this issue Dec 12, 2018 · 11 comments
Closed

The back button still enable when LoadingDialog is showing #32

vincywindy opened this issue Dec 12, 2018 · 11 comments
Labels
bug Something isn't working valid This issue/bug/feature request is valid

Comments

@vincywindy
Copy link

Describe the bug
When the LoadingDialog is showing the back button press will go to last page.

To Reproduce
Steps to reproduce the behavior:
Here‘s two page :

public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private async void Button_Clicked(object sender, EventArgs e)
        {
            View1 view1 = new View1();
           await Navigation.PushModalAsync(view1);
        }
    }
public partial class View1 : ContentPage
    {
        public View1()
        {
            InitializeComponent();
        }

        private async void Button_Clicked(object sender, EventArgs e)
        {
            var dialog = await MaterialDialog.Instance.LoadingDialogAsync(message: "获取数据中……");
            await Task.Delay(5000);
            dialog.Dispose();
        }
    }

When the loadingdialog is showing,I press back button on android,it back to MainPage, but the loadingdialog still showing,after 5s loadingdialog hide.

@contrix09 contrix09 self-assigned this Dec 13, 2018
@contrix09 contrix09 added bug Something isn't working valid This issue/bug/feature request is valid labels Dec 13, 2018
@AnthonyLatty
Copy link

AnthonyLatty commented Dec 19, 2018

How was this solved??

@contrix09
Copy link

Hi, please update to the latest version. And instead of callingDispose to remove the dialog, you can now call DismissAsync.

@AnthonyLatty
Copy link

Thanks...Question is there a way to change the activity indicator color within the loading dialog??

@contrix09
Copy link

Yes, look for the overload method that takes the parameter of the type MaterialLoadingDialogConfiguration.

var loading = await MaterialDialog.Instance.LoadingDialogAsync("Please wait...", new XF.Material.Forms.UI.Dialogs.Configurations.MaterialLoadingDialogConfiguration
{
     TintColor = Color.Red
});

@AnthonyLatty
Copy link

I am going to test the DismissAsync() on a next Android device, because the one i am working with doesnt dismiss the dialog when the back button is pressed. What is the interval for a dialog to be dismissed?

@contrix09
Copy link

For now the loading dialog cannot by dismissed by pressing the back button on Android. If you used it in a using block, it will automatically be dismissed once the task inside the has completed, no need to call the DismissAsync. I'm still looking for a way to create an implementation where the user can cancel the dialog along with the task that is running. May be next year though.

@AnthonyLatty
Copy link

Okay no problem.

@vincywindy
Copy link
Author

I use new version 1.3.0.3,but the problem is same, I use this code:

 [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class View1 : ContentPage
    {
        public View1()
        {
            InitializeComponent();
        }

        private async void Button_Clicked(object sender, EventArgs e)
        {
            using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Something is running"))
            {
                await Task.Delay(5000); // Represents a task that is running.
            }


        }
    }

@contrix09
Copy link

Hi, did you override the OnBackPressed on Android like this:

public override void OnBackPressed()
{
    XF.Material.Droid.Material.HandleBackButton(base.OnBackPressed);
}

@vincywindy
Copy link
Author

No,so I need to override it?

@vincywindy
Copy link
Author

I override it,it works fine,thank you!

@contrix09 contrix09 removed their assignment Sep 30, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working valid This issue/bug/feature request is valid
Projects
None yet
Development

No branches or pull requests

2 participants