Sat, 14 Feb 2015 00:28:10 +0100
Implement a quasi singleton to access the main application context,
and use this as a alternative solution to ical4j correction but
unfortunately this doesn't work either as too many errors are
in the embedded library.
1.1 --- a/build.gradle Sat Feb 14 00:21:19 2015 +0100 1.2 +++ b/build.gradle Sat Feb 14 00:28:10 2015 +0100 1.3 @@ -40,38 +40,6 @@ 1.4 } 1.5 productFlavors { 1.6 } 1.7 - //dexOptions { 1.8 - // preDexLibraries = false 1.9 - //} 1.10 -} 1.11 - 1.12 -// Kludgy attempt to patch ical4j 1.13 -//task fixDeps(type: zip) { 1.14 -// zip -d $cache/ical4j-*.jar net/fortuna/ical4j/model/TimeZoneRegistryImpl.class 1.15 -// zip -d $cache/ical4j-*.jar net/fortuna/ical4j/util/ResourceLoader.class 1.16 -//} 1.17 -// Hack contains patched ical4j files 1.18 -task patchIcal(type: Copy) { 1.19 - from 'hack' 1.20 - include 'model/' 1.21 - include 'util/' 1.22 - into 'src/net/fortuna/ical4j' 1.23 -} 1.24 -configure(patchIcal) { 1.25 - group = BasePlugin.ASSEMBLE_TASK_NAME // Or BUILD_GROUP 1.26 - description = 'Patch embedded ical4j dependency in a kludgy way' 1.27 -} 1.28 -task patchWipe(type: Delete) { 1.29 - delete 'src/net' 1.30 -} 1.31 -configure(patchWipe) { 1.32 - group = BasePlugin.ASSEMBLE_TASK_NAME // Or BUILD_GROUP 1.33 - description = 'Deletes patched dependencies in a kludgy way' 1.34 -} 1.35 -project.afterEvaluate{ 1.36 - clean.dependsOn(patchWipe) 1.37 - compileDebugJava.dependsOn(patchIcal) 1.38 - compileReleaseJava.dependsOn(patchIcal) 1.39 } 1.40 1.41 dependencies {
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/src/com/europalab/caldavsyncadapter/Appctxpro.java Sat Feb 14 00:28:10 2015 +0100 2.3 @@ -0,0 +1,41 @@ 2.4 +/** 2.5 + * Copyright © 2015, Michael Schloh von Bennewitz 2.6 + * 2.7 + * This project source file is free software: you can redistribute 2.8 + * it and/or modify it under the terms of the GNU General Public License 2.9 + * as published by the Free Software Foundation, either version 3 of the 2.10 + * License, or at your option any later version. 2.11 + * 2.12 + * Andoid Caldav Sync Adapter Free is distributed in the hope that 2.13 + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 2.14 + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2.15 + * GNU General Public License for more details. 2.16 + * 2.17 + * You should have received a copy of the GNU General Public License 2.18 + * along with Andoid Caldav Sync Adapter Free. 2.19 + * If not, see <http://www.gnu.org/licenses/>. 2.20 + */ 2.21 + 2.22 +package com.europalab.caldavsyn; 2.23 + 2.24 +import android.app.Application; 2.25 +import android.content.Context; 2.26 + 2.27 +public class Appctxpro extends Application { 2.28 + // Store a app context reference 2.29 + private static Context sContext; 2.30 + 2.31 + // Construct a ctx provider 2.32 + public Appctxpro() { 2.33 + super(); 2.34 + sContext = this; 2.35 + } 2.36 + 2.37 + // Context accessor methods 2.38 + public static Context getContext() { 2.39 + return sContext; 2.40 + } 2.41 + public static void setContext(Context aContext) { 2.42 + sContext = aContext; 2.43 + } 2.44 +}
3.1 --- a/src/org/gege/caldavsyncadapter/android/entities/AndroidEvent.java Sat Feb 14 00:21:19 2015 +0100 3.2 +++ b/src/org/gege/caldavsyncadapter/android/entities/AndroidEvent.java Sat Feb 14 00:28:10 2015 +0100 3.3 @@ -72,6 +72,8 @@ 3.4 import java.net.URISyntaxException; 3.5 import java.text.ParseException; 3.6 3.7 +import com.europalab.caldavsyn.Appctxpro; 3.8 + 3.9 //import android.accounts.Account; 3.10 //import android.content.ContentProviderClient; 3.11 //import android.content.ContentValues; 3.12 @@ -317,6 +319,8 @@ 3.13 public boolean createIcs(String strUid) { 3.14 boolean Result = false; 3.15 TimeZone timeZone = null; 3.16 + //Thread.currentThread().setContextClassLoader(Context.getApplicationContext().getClassLoader()); 3.17 + Thread.currentThread().setContextClassLoader(Appctxpro.getContext().getClassLoader()); 3.18 TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); 3.19 //TODO: do not simply create the ics-file new. take into account the RAWDATA if available 3.20 /*