On Thu, Jan 17, 2013 at 12:06 PM, Cory <coryta...@gmail.com> wrote:
> Hello,
> I just realized that the Android native notification.confirm dialog can be
> closed by tapping the background.
> Is there a way to prevent it?
> Thanks!
> Using phonegap 2.3.0 , android 4.0.4 Xoom Tablet.
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phonegap@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
> For more info on PhoneGap or to download the code go to www.phonegap.com
> To compile in the cloud, check out build.phonegap.com
Also , i set mCancelable to false by default and also on the show method , i used the method "setCloseOnTouchOutside" on mWindow ,setting it to be false on the show method.
On Thu, Jan 17, 2013 at 1:11 PM, Cory <coryta...@gmail.com> wrote:
> I think you meant dialog class right?
> Also , i set mCancelable to false by default and also on the show method ,
> i used the method "setCloseOnTouchOutside" on mWindow ,setting it to be
> false on the show method.
> Hmmm, ok its not working.
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phonegap@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
> For more info on PhoneGap or to download the code go to www.phonegap.com
> To compile in the cloud, check out build.phonegap.com
Oh in phonegap itself... Ok, so how do I do this? Sorry , I havent done such a thing before. Do I download the source code from github, edit the file and then export the jar file? Thanks!
Instead of changing the way confirm behaves my suggestion would be writing a plugin instead. That way you can update to future PG releases without the danger (and annoyance) of updating it everytime.
> On Thu, Jan 17, 2013 at 12:06 PM, Cory <cory...@gmail.com <javascript:>>wrote:
>> Hello, >> I just realized that the Android native notification.confirm dialog can >> be closed by tapping the background. >> Is there a way to prevent it?
>> Thanks!
>> Using phonegap 2.3.0 , android 4.0.4 Xoom Tablet.
>> -- >> -- You received this message because you are subscribed to the Google >> Groups "phonegap" group. >> To post to this group, send email to phon...@googlegroups.com<javascript:> >> To unsubscribe from this group, send email to >> phonegap+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/phonegap?hl=en?hl=en
>> For more info on PhoneGap or to download the code go to www.phonegap.com
>> To compile in the cloud, check out build.phonegap.com
Well , I wish I knew how to do either. Found a plugin tutorial , will probably be able to do it , but it will probably take some time too. I just want to know how to update/edit the notification.java file. It'll be really helpful. Thanks!
Writing a plugin really isn't that hard, especially since you can basically copy the Notification plugin, give it a different name, throw out everything you don't need and add setCancelable(false). I wrote this just in a text editor, so I didn't test it and there are gonna be unused imports, but other than that it should hopefully work: http://pastebin.com/8G5KAnLe Now you just gotta write the JS interface for the plugin, register it in your config.xml and you should be good to go.
On Thursday, January 17, 2013 8:46:01 PM UTC+1, Cory wrote:
> Well , I wish I knew how to do either. Found a plugin tutorial , will > probably be able to do it , but it will probably take some time too. > I just want to know how to update/edit the notification.java file. > Well be really helpful. > Thanks!
But all i got for the JS interface was this. Im not sure how to continue. Really confused on the parameters for " confirm: function (success, fail, resultType) " I just want to call it like how you call it in phonegap, but in this case it will be ConfirmDialogPlugin.confirm(.....) of course.
var ConfirmDialogPlugin = { confirm: function (success, fail, resultType) { return cordova.exec( success, fail, "com.example.ConfirmDialogPlugin", "confirm", [resultType]); }
Again, untested, but try this: http://pastebin.com/jeUZXtQs You should be able to call it with window.modalConfirm.confirm(...) then. The signature is the same as the Notification plugin's confirm.
On Thursday, January 17, 2013 9:24:51 PM UTC+1, Cory wrote:
> Well thanks for the help!
> But all i got for the JS interface was this. > Im not sure how to continue. Really confused on the parameters for " > confirm: function (success, fail, resultType) " > I just want to call it like how you call it in phonegap, but in this case > it will be ConfirmDialogPlugin.confirm(.....) of course.
The easiest thing for you to do would be to extend the Notification class
and over-ride the confirm method. The new method would be identical to the
one that is already there except the one line change. Then in plugins.xml
where it specifies the class that provides the Notification interface you
would change it to be your class.
At least that is how I would do it. Mind you I wouldn't do it as the
confirm dialog is setup that way in the Android OS and we are just
following suit.
> Again, untested, but try this: http://pastebin.com/jeUZXtQs > You should be able to call it with window.modalConfirm.confirm(...) then.
> The signature is the same as the Notification plugin's confirm.
> On Thursday, January 17, 2013 9:24:51 PM UTC+1, Cory wrote:
>> Well thanks for the help!
>> But all i got for the JS interface was this.
>> Im not sure how to continue. Really confused on the parameters for "
>> confirm: function (success, fail, resultType) "
>> I just want to call it like how you call it in phonegap, but in this case
>> it will be ConfirmDialogPlugin.confirm(..**...) of course.
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phonegap@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
> For more info on PhoneGap or to download the code go to www.phonegap.com
> To compile in the cloud, check out build.phonegap.com
Man, its not working. Got define is not defined in the logs. I'm giving up.
Cant find a standard way to interface javascript with native code. I always thought there was , but cant seem to find it. Thanks for the help anyways. Cant learn how to setup the plugins from javascript side.
Could you write down the steps to override the notification class? In my mind it would be like: 1) Create a class in the package in src in the project (e.g com.projectname) 2) Copy the Notification code and edit 3) Change Notification plugin values in config.xml
On Thu, Jan 17, 2013 at 4:48 PM, Cory <coryta...@gmail.com> wrote:
> Man, its not working. Got define is not defined in the logs.
> I'm giving up.
> Cant find a standard way to interface javascript with native code. I
> always thought there was , but cant seem to find it.
> Thanks for the help anyways. Cant learn how to setup the plugins from
> javascript side.
> Could you write down the steps to override the notification class?
> In my mind it would be like:
> 1) Create a class in the package in src in the project (e.g
> com.projectname)
> 2) Copy the Notification code and edit
> 3) Change Notification plugin values in config.xml
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phonegap@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
> For more info on PhoneGap or to download the code go to www.phonegap.com
> To compile in the cloud, check out build.phonegap.com
I agree, Simon's idea is better (if in fact you do want every confirm to be modal). You got the steps pretty much right:
1) Copy the Notification.java plugin into your project 2) Modify the setCancelable call 3) Adjust the class to be in the correct package (your IDE should warn you and do that for you anyway) 4) Go to res/xml/config.xml and change the Notification plugin to refer to the class you just created
On Thursday, January 17, 2013 10:48:20 PM UTC+1, Cory wrote:
> Man, its not working. Got define is not defined in the logs. > I'm giving up.
> Cant find a standard way to interface javascript with native code. I > always thought there was , but cant seem to find it. > Thanks for the help anyways. Cant learn how to setup the plugins from > javascript side.
> Could you write down the steps to override the notification class? > In my mind it would be like: > 1) Create a class in the package in src in the project (e.g > com.projectname) > 2) Copy the Notification code and edit > 3) Change Notification plugin values in config.xml
@Simon Ahh yeah i saw that finally. I thought it would be atleast documented somewhere else. I understand , I dont want to ask for code too , just tutorials or examples.
@Airblader Ok thanks!
Anyway, I got it to work. Well , to me since the confirms have atleast two choices , the code should expect a selection to determine which course of action should be taken. Luckily for me , the default action does nothing so older versions of my app wont have major implications. But I just want to make sure the user reads the message and presses a button.
Its sort of like javascript confirms and alerts where you have to click the ok button before moving on.
I'm completely with you, confirm dialogs feel like a modal thing to me too – but I also agree with Simon that the native default behavior is what PG should go with. I had to do the same thing in my app, but I didn't just change the confirm dialog, I actually made a (modal) list dialog out of it to allow for more than three options.
On Friday, January 18, 2013 4:20:39 PM UTC+1, Cory wrote:
> @Simon Ahh yeah i saw that finally. I thought it would be atleast > documented somewhere else.
> I understand , I dont want to ask for code too , just tutorials or > examples.
> @Airblader
> Ok thanks!
> Anyway, I got it to work.
> Well , to me since the confirms have atleast two choices , the code should > expect a selection to determine which course of action should be taken.
> Luckily for me , the default action does nothing so older versions of my > app wont have major implications. But I just want to make sure the user > reads the message and presses a button.
> Its sort of like javascript confirms and alerts where you have to click > the ok button before moving on.