package de.danoeh.antennapod.core.util.flattr;

import android.util.Log;
import de.danoeh.antennapod.core.BuildConfig;
import org.shredzone.flattr4j.FlattrFactory;
import org.shredzone.flattr4j.FlattrService;
import org.shredzone.flattr4j.oauth.AccessToken;

/** Ensures that only one instance of the FlattrService class exists at a time */

public class FlattrServiceCreator {
	public static final String TAG = "FlattrServiceCreator";
	
	private static volatile FlattrService flattrService;
	
	public static FlattrService getService(AccessToken token) {
		return FlattrFactory.getInstance().createFlattrService(token);
	}
	
	public static void deleteFlattrService() {
		if (BuildConfig.DEBUG) Log.d(TAG, "Deleting service instance");
		flattrService = null;
	}
}


@@ -70,54 +70,9 @@
 og;%0A
-import de.danoeh.antennapod.core.BuildConfig;
 %0A
+
 impo
@@ -207,16 +207,63 @@
 Token;%0A%0A
+import de.danoeh.antennapod.core.BuildConfig;%0A%0A
 /** Ensu
@@ -556,14 +556,55 @@
 %7B%0A%09%09
-return
+if (flattrService == null) %7B%0A%09%09%09flattrService =
  Fla
@@ -656,16 +656,44 @@
 token);%0A
+%09%09%7D%0A%09%09return flattrService;%0A
 %09%7D%0A%09%0A%09pu

fix FlattrServiceCreator