====== Differences ====== This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
script_calendar_widget [2015/04/21 12:48] lm13 |
script_calendar_widget [2016/06/28 12:11] (current) f43nd1r |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== About the script ====== | ====== About the script ====== | ||
| * Purpose : This script will allow you to set up a calendar widget replacement | * Purpose : This script will allow you to set up a calendar widget replacement | ||
| - | * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] | + | * Author : F43nd1r |
| - | * Current Version : 1.2 | + | * Current Version : 1.3 |
| - | * Link : | + | * Link : https://plus.google.com/+LukasMorawietz/posts/ENEoGArx8D4 |
| ====== Changelog ====== | ====== Changelog ====== | ||
| Line 9: | Line 9: | ||
| * Version 1.1 (20/4/2015): fixed showing yesterday's all-day-appointments, reduced minimum API level to 14 | * Version 1.1 (20/4/2015): fixed showing yesterday's all-day-appointments, reduced minimum API level to 14 | ||
| * Version 1.2 (21/4/2015): added fix for devices using 23:59 instead of 00:00 (manual) | * Version 1.2 (21/4/2015): added fix for devices using 23:59 instead of 00:00 (manual) | ||
| + | * Version 1.3 (21/4/2015): Fix memory leaks | ||
| ====== How to use the script ==== | ====== How to use the script ==== | ||
| + | * Either install Calendar package from [[http://www.pierrox.net/android/applications/lightning_launcher/permissions/|here]] or grant READ_ CALENDAR permission using Lightning Permission Manager | ||
| * Create a text item | * Create a text item | ||
| * set this script in its resumed event | * set this script in its resumed event | ||
| Line 56: | Line 58: | ||
| if (!calCursor.moveToFirst()){ | if (!calCursor.moveToFirst()){ | ||
| AndroiSD. makeNewToast("No Calendar found").show(); | AndroiSD. makeNewToast("No Calendar found").show(); | ||
| + | calCursor.close(); | ||
| return; | return; | ||
| } | } | ||
| Line 73: | Line 76: | ||
| update(cals); | update(cals); | ||
| Android.makeNewToast("Saved!",true).show(); | Android.makeNewToast("Saved!",true).show(); | ||
| + | calCursor.close(); | ||
| } | } | ||
| }) | }) | ||
| Line 100: | Line 104: | ||
| var cursor = LL.getContext().getContentResolver().query(uriBuilder.build(), proj, Instances.CALENDAR_ID+" IN "+s,null,Instances.BEGIN+" ASC"); | var cursor = LL.getContext().getContentResolver().query(uriBuilder.build(), proj, Instances.CALENDAR_ID+" IN "+s,null,Instances.BEGIN+" ASC"); | ||
| - | if(!cursor.moveToFirst())return; | + | if(!cursor.moveToFirst()){ |
| + | cursor.close(); | ||
| + | return; | ||
| + | } | ||
| var s=""; | var s=""; | ||
| for(var i=0;i<showMax;i++) | for(var i=0;i<showMax;i++) | ||
| Line 130: | Line 137: | ||
| } | } | ||
| LL.getEvent().getItem().setLabel(s, true); | LL.getEvent().getItem().setLabel(s, true); | ||
| + | cursor.close(); | ||
| } | } | ||
| </sxh> | </sxh> | ||