This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
plugins:own_javascript_plugin [2015/07/08 09:03] octazid [Introduction] |
plugins:own_javascript_plugin [2019/09/17 15:35] (current) |
||
---|---|---|---|
Line 59: | Line 59: | ||
< | < | ||
- | <div class=" | + | <div class=" |
| | ||
< | < | ||
Line 76: | Line 76: | ||
& | & | ||
<b id=" | <b id=" | ||
- | & | + | & |
</ | </ | ||
& | & | ||
Line 107: | Line 107: | ||
& | & | ||
<b id=" | <b id=" | ||
- | & | + | & |
& | & | ||
</ | </ | ||
Line 140: | Line 140: | ||
<code Javascript MyPlugin.inc> | <code Javascript MyPlugin.inc> | ||
+ | |||
+ | app.CreateMyPlugin = function() | ||
+ | { | ||
+ | return new MyPlugin(); | ||
+ | } | ||
function MyPlugin() | function MyPlugin() | ||
Line 150: | Line 155: | ||
} | } | ||
- | | + | |
- | { | + | { |
this.callback( txt + " World!!", | this.callback( txt + " World!!", | ||
} | } | ||
- | | + | |
- | { | + | { |
this.callback = cb; | this.callback = cb; | ||
} | } | ||
Line 168: | Line 173: | ||
</ | </ | ||
- | * **File 4: A blanc jar-file | + | * **It is no longer necessary to add an empty jar-file |
- | + | ||
- | <code Java MyPlugin.jar> | + | |
- | + | ||
- | </ | + | |
Line 205: | Line 206: | ||
=====How can you uninstall your plugin? | =====How can you uninstall your plugin? | ||
- | (no answer | + | There are two ways at the moment: |
+ | You can download and run the following script if you want uninstall a plugin or you uninstall and reinstall Droidscript completely. Using the second option causes all your plugins to be uninstalled so you have to reinstall all plugins. | ||
+ | |||
+ | <code javascript UninstallPlugin.js> | ||
+ | |||
+ | // | ||
+ | function OnStart() | ||
+ | { | ||
+ | // | ||
+ | lay = app.CreateLayout( " | ||
+ | |||
+ | // | ||
+ | txt = app.CreateTextEdit( "" | ||
+ | txt.SetHint(" | ||
+ | lay.AddChild( txt ); | ||
+ | |||
+ | btn=app.CreateButton(" | ||
+ | btn.SetOnTouch(DeleteUserPlugin); | ||
+ | lay.AddChild(btn); | ||
+ | |||
+ | privFldr = app.GetPrivateFolder( " | ||
+ | plgins = app.ListFolder(privFldr); | ||
+ | |||
+ | lvw = app.CreateListView( plgins, | ||
+ | lvw.SetOnTouch( lvw_OnTouch ); | ||
+ | |||
+ | // | ||
+ | app.AddLayout( lay ); | ||
+ | |||
+ | lvw.Show(); | ||
+ | } | ||
+ | |||
+ | |||
+ | function lvw_OnTouch( item ) | ||
+ | { | ||
+ | txt.SetText( item ); | ||
+ | } | ||
+ | |||
+ | |||
+ | function DeleteUserPlugin() | ||
+ | { | ||
+ | var plg = "" | ||
+ | if (plg == "" | ||
+ | plugDir = privFldr + "/" | ||
+ | if (app.FolderExists(plugDir)) | ||
+ | { | ||
+ | var list = app.ListFolder(plugDir); | ||
+ | var yesNo = app.CreateYesNoDialog( " | ||
+ | yesNo.SetOnTouch( yesNo_OnTouch ); | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | function yesNo_OnTouch( yesNoresult ) | ||
+ | { | ||
+ | if( yesNoresult == " | ||
+ | { | ||
+ | app.DeleteFolder(plugDir); | ||
+ | |||
+ | app.Alert(" | ||
+ | txt.SetText("" | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | app.ShowPopup(" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
---- | ---- |