# HG changeset patch # User Michael Schloh von Bennewitz # Date 1423870090 -3600 # Node ID af469395626313eb9ee409d183ef51eccfb08a48 # Parent dd635af15958245738f9dc926862f1c3bcc26f35 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. diff -r dd635af15958 -r af4693956263 build.gradle --- a/build.gradle Sat Feb 14 00:21:19 2015 +0100 +++ b/build.gradle Sat Feb 14 00:28:10 2015 +0100 @@ -40,38 +40,6 @@ } productFlavors { } - //dexOptions { - // preDexLibraries = false - //} -} - -// Kludgy attempt to patch ical4j -//task fixDeps(type: zip) { -// zip -d $cache/ical4j-*.jar net/fortuna/ical4j/model/TimeZoneRegistryImpl.class -// zip -d $cache/ical4j-*.jar net/fortuna/ical4j/util/ResourceLoader.class -//} -// Hack contains patched ical4j files -task patchIcal(type: Copy) { - from 'hack' - include 'model/' - include 'util/' - into 'src/net/fortuna/ical4j' -} -configure(patchIcal) { - group = BasePlugin.ASSEMBLE_TASK_NAME // Or BUILD_GROUP - description = 'Patch embedded ical4j dependency in a kludgy way' -} -task patchWipe(type: Delete) { - delete 'src/net' -} -configure(patchWipe) { - group = BasePlugin.ASSEMBLE_TASK_NAME // Or BUILD_GROUP - description = 'Deletes patched dependencies in a kludgy way' -} -project.afterEvaluate{ - clean.dependsOn(patchWipe) - compileDebugJava.dependsOn(patchIcal) - compileReleaseJava.dependsOn(patchIcal) } dependencies { diff -r dd635af15958 -r af4693956263 src/com/europalab/caldavsyncadapter/Appctxpro.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/com/europalab/caldavsyncadapter/Appctxpro.java Sat Feb 14 00:28:10 2015 +0100 @@ -0,0 +1,41 @@ +/** + * Copyright © 2015, Michael Schloh von Bennewitz + * + * This project source file is free software: you can redistribute + * it and/or modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the + * License, or at your option any later version. + * + * Andoid Caldav Sync Adapter Free is distributed in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Andoid Caldav Sync Adapter Free. + * If not, see . + */ + +package com.europalab.caldavsyn; + +import android.app.Application; +import android.content.Context; + +public class Appctxpro extends Application { + // Store a app context reference + private static Context sContext; + + // Construct a ctx provider + public Appctxpro() { + super(); + sContext = this; + } + + // Context accessor methods + public static Context getContext() { + return sContext; + } + public static void setContext(Context aContext) { + sContext = aContext; + } +} diff -r dd635af15958 -r af4693956263 src/org/gege/caldavsyncadapter/android/entities/AndroidEvent.java --- a/src/org/gege/caldavsyncadapter/android/entities/AndroidEvent.java Sat Feb 14 00:21:19 2015 +0100 +++ b/src/org/gege/caldavsyncadapter/android/entities/AndroidEvent.java Sat Feb 14 00:28:10 2015 +0100 @@ -72,6 +72,8 @@ import java.net.URISyntaxException; import java.text.ParseException; +import com.europalab.caldavsyn.Appctxpro; + //import android.accounts.Account; //import android.content.ContentProviderClient; //import android.content.ContentValues; @@ -317,6 +319,8 @@ public boolean createIcs(String strUid) { boolean Result = false; TimeZone timeZone = null; + //Thread.currentThread().setContextClassLoader(Context.getApplicationContext().getClassLoader()); + Thread.currentThread().setContextClassLoader(Appctxpro.getContext().getClassLoader()); TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); //TODO: do not simply create the ics-file new. take into account the RAWDATA if available /*