diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-07-22 17:05:43 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-07-22 17:05:43 +0200 |
commit | d061f862667d13c2df80a958826f6e9b09aa654f (patch) | |
tree | 93ef373d377364c19b38a2801b843246ae07a698 | |
parent | e5b37b463c273389e9c9a8568f71b02610a7a178 (diff) | |
download | AntennaPod-d061f862667d13c2df80a958826f6e9b09aa654f.zip |
Removed flattr integration (not working)0.8_RC5
-rw-r--r-- | assets/about.html | 2 | ||||
-rw-r--r-- | res/xml/preferences.xml | 13 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/activity/FlattrAuthActivity.java | 5 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/activity/PreferenceActivity.java | 44 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java | 5 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java | 8 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/util/FeedItemMenuHandler.java | 4 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/util/FeedMenuHandler.java | 14 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/util/FlattrServiceCreator.java | 6 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/util/FlattrUtils.java | 29 |
10 files changed, 54 insertions, 76 deletions
diff --git a/assets/about.html b/assets/about.html index 386069c4a..b12ffe76d 100644 --- a/assets/about.html +++ b/assets/about.html @@ -52,7 +52,5 @@ <h2>Apache Commons <a href="http://commons.apache.org/">(Link)</a></h2> by The Apache Software Foundation, licensed under the Apache 2.0 license - <h2>flattr4j <a href="http://www.shredzone.org/projects/flattr4j/wiki">(Link)</a></h2> - licensed under the Apache 2.0 license </body> </html> diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index ef8d7a299..e13da035d 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -31,19 +31,8 @@ android:summary="@string/pref_mobileUpdate_sum" android:title="@string/pref_mobileUpdate_title" /> </PreferenceCategory> - <PreferenceCategory android:title="@string/flattr_settings_label" > - <PreferenceScreen - android:summary="@string/pref_flattr_auth_sum" - android:title="@string/pref_flattr_auth_title" android:key="pref_flattr_authenticate"> - <intent android:action=".activities.FlattrAuthActivity" /> - - </PreferenceScreen><Preference android:key="prefRevokeAccess" android:title="@string/pref_revokeAccess_title" android:summary="@string/pref_revokeAccess_sum"/> - <Preference - android:summary="@string/pref_flattr_this_app_sum" - android:title="@string/pref_flattr_this_app_title" android:key="prefFlattrThisApp"> + <PreferenceCategory android:title="@string/other_pref" ><Preference android:summary="@string/pref_flattr_this_app_sum" android:title="@string/pref_flattr_this_app_title" android:key="prefFlattrThisApp"> </Preference> - </PreferenceCategory> - <PreferenceCategory android:title="@string/other_pref" > <Preference android:title="@string/about_pref" android:key="prefAbout"/> </PreferenceCategory> diff --git a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java b/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java index 39ddd301f..339cb3e3f 100644 --- a/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java +++ b/src/de/danoeh/antennapod/activity/FlattrAuthActivity.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.activity; -import org.shredzone.flattr4j.exception.FlattrException; import android.content.Intent; import android.net.Uri; @@ -20,6 +19,7 @@ import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.R; /** Guides the user through the authentication process */ +/* public class FlattrAuthActivity extends SherlockActivity { private static final String TAG = "FlattrAuthActivity"; @@ -114,5 +114,6 @@ public class FlattrAuthActivity extends SherlockActivity { } return true; } + -} +}*/ diff --git a/src/de/danoeh/antennapod/activity/PreferenceActivity.java b/src/de/danoeh/antennapod/activity/PreferenceActivity.java index 55f7ec789..d9d00ce2e 100644 --- a/src/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/src/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -1,20 +1,17 @@ package de.danoeh.antennapod.activity; -import org.shredzone.flattr4j.model.Thing; - import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import android.preference.Preference; import android.preference.Preference.OnPreferenceClickListener; -import android.util.Log; import com.actionbarsherlock.app.SherlockPreferenceActivity; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; -import de.danoeh.antennapod.asynctask.FlattrClickWorker; -import de.danoeh.antennapod.util.FlattrUtils; import de.danoeh.antennapod.R; +import de.danoeh.antennapod.util.FlattrUtils; public class PreferenceActivity extends SherlockPreferenceActivity { private static final String TAG = "PreferenceActivity"; @@ -35,24 +32,24 @@ public class PreferenceActivity extends SherlockPreferenceActivity { @Override public boolean onPreferenceClick(Preference preference) { - new FlattrClickWorker(PreferenceActivity.this, - FlattrUtils.APP_URL).execute(); + Uri supportUri = Uri.parse(FlattrUtils.APP_LINK); + startActivity(new Intent(Intent.ACTION_VIEW, supportUri)); return true; } }); - findPreference(PREF_FLATTR_REVOKE).setOnPreferenceClickListener( - new OnPreferenceClickListener() { - - @Override - public boolean onPreferenceClick(Preference preference) { - FlattrUtils.revokeAccessToken(PreferenceActivity.this); - checkItemVisibility(); - return true; - } - - }); + /* + * Disabled until it works + * findPreference(PREF_FLATTR_REVOKE).setOnPreferenceClickListener( new + * OnPreferenceClickListener() { + * + * @Override public boolean onPreferenceClick(Preference preference) { + * FlattrUtils.revokeAccessToken(PreferenceActivity.this); + * checkItemVisibility(); return true; } + * + * }); + */ findPreference(PREF_ABOUT).setOnPreferenceClickListener( new OnPreferenceClickListener() { @@ -64,6 +61,7 @@ public class PreferenceActivity extends SherlockPreferenceActivity { } }); + } @Override @@ -74,10 +72,12 @@ public class PreferenceActivity extends SherlockPreferenceActivity { @SuppressWarnings("deprecation") private void checkItemVisibility() { - boolean hasFlattrToken = FlattrUtils.hasToken(); - findPreference(PREF_FLATTR_AUTH).setEnabled(!hasFlattrToken); - findPreference(PREF_FLATTR_REVOKE).setEnabled(hasFlattrToken); - + /* + * boolean hasFlattrToken = FlattrUtils.hasToken(); + * + * findPreference(PREF_FLATTR_AUTH).setEnabled(!hasFlattrToken); + * findPreference(PREF_FLATTR_REVOKE).setEnabled(hasFlattrToken); + */ } @Override diff --git a/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java b/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java index b992f74f8..4cf496eab 100644 --- a/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java +++ b/src/de/danoeh/antennapod/asynctask/FlattrClickWorker.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.asynctask; -import org.shredzone.flattr4j.exception.FlattrException; - import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.Context; @@ -13,6 +11,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.util.FlattrUtils; /** Performs a click action in a background thread. */ +/* public class FlattrClickWorker extends AsyncTask<Void, Void, Void> { protected static final String TAG = "FlattrClickWorker"; protected Context context; @@ -111,4 +110,4 @@ public class FlattrClickWorker extends AsyncTask<Void, Void, Void> { } } -} +}*/ diff --git a/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java b/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java index d3c1d73c6..7873cadf3 100644 --- a/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java +++ b/src/de/danoeh/antennapod/asynctask/FlattrTokenFetcher.java @@ -1,8 +1,5 @@ package de.danoeh.antennapod.asynctask; -import org.shredzone.flattr4j.exception.FlattrException; -import org.shredzone.flattr4j.oauth.AccessToken; -import org.shredzone.flattr4j.oauth.AndroidAuthenticator; import android.annotation.SuppressLint; import android.app.ProgressDialog; @@ -12,10 +9,10 @@ import android.os.AsyncTask; import android.util.Log; import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.activity.FlattrAuthActivity; import de.danoeh.antennapod.util.FlattrUtils; /** Fetches the access token in the background in order to avoid networkOnMainThread exception. */ +/* public class FlattrTokenFetcher extends AsyncTask<Void, Void, AccessToken> { private static final String TAG = "FlattrTokenFetcher"; Context context; @@ -91,4 +88,5 @@ public class FlattrTokenFetcher extends AsyncTask<Void, Void, AccessToken> { } } -}
\ No newline at end of file +} +*/
\ No newline at end of file diff --git a/src/de/danoeh/antennapod/util/FeedItemMenuHandler.java b/src/de/danoeh/antennapod/util/FeedItemMenuHandler.java index 5c5fe452b..c8c6d9eb3 100644 --- a/src/de/danoeh/antennapod/util/FeedItemMenuHandler.java +++ b/src/de/danoeh/antennapod/util/FeedItemMenuHandler.java @@ -9,7 +9,6 @@ import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.asynctask.FlattrClickWorker; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedManager; import de.danoeh.antennapod.storage.DownloadRequester; @@ -103,7 +102,8 @@ public class FeedItemMenuHandler { context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); break; case R.id.support_item: - new FlattrClickWorker(context, selectedItem.getPaymentLink()).executeAsync(); + Uri supportUri = Uri.parse(selectedItem.getPaymentLink()); + context.startActivity(new Intent(Intent.ACTION_VIEW, supportUri)); break; case R.id.share_link_item: ShareUtils.shareFeedItemLink(context, selectedItem); diff --git a/src/de/danoeh/antennapod/util/FeedMenuHandler.java b/src/de/danoeh/antennapod/util/FeedMenuHandler.java index 31d3febdf..2c24c973c 100644 --- a/src/de/danoeh/antennapod/util/FeedMenuHandler.java +++ b/src/de/danoeh/antennapod/util/FeedMenuHandler.java @@ -11,7 +11,6 @@ import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import de.danoeh.antennapod.activity.FeedInfoActivity; -import de.danoeh.antennapod.asynctask.FlattrClickWorker; import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedManager; @@ -30,7 +29,8 @@ public class FeedMenuHandler { } public static boolean onPrepareOptionsMenu(Menu menu, Feed selectedFeed) { - if (AppConfig.DEBUG) Log.d(TAG, "Preparing options menu"); + if (AppConfig.DEBUG) + Log.d(TAG, "Preparing options menu"); if (selectedFeed.getPaymentLink() != null) { menu.findItem(R.id.support_item).setVisible(true); } @@ -42,9 +42,10 @@ public class FeedMenuHandler { } else { refresh.setVisible(true); } - - menu.findItem(R.id.share_link_item).setVisible(selectedFeed.getLink() != null); - + + menu.findItem(R.id.share_link_item).setVisible( + selectedFeed.getLink() != null); + return true; } @@ -70,7 +71,8 @@ public class FeedMenuHandler { context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); break; case R.id.support_item: - new FlattrClickWorker(context, selectedFeed.getPaymentLink()).executeAsync(); + Uri supportUri = Uri.parse(selectedFeed.getPaymentLink()); + context.startActivity(new Intent(Intent.ACTION_VIEW, supportUri)); break; case R.id.share_link_item: ShareUtils.shareFeedlink(context, selectedFeed); diff --git a/src/de/danoeh/antennapod/util/FlattrServiceCreator.java b/src/de/danoeh/antennapod/util/FlattrServiceCreator.java index 1eb1635b9..99aaa82e8 100644 --- a/src/de/danoeh/antennapod/util/FlattrServiceCreator.java +++ b/src/de/danoeh/antennapod/util/FlattrServiceCreator.java @@ -1,3 +1,4 @@ +/* package de.danoeh.antennapod.util; import org.shredzone.flattr4j.FlattrFactory; @@ -7,8 +8,9 @@ import org.shredzone.flattr4j.oauth.AccessToken; import de.danoeh.antennapod.AppConfig; import android.util.Log; - +*/ /** Ensures that only one instance of the FlattrService class exists at a time */ +/* public class FlattrServiceCreator { public static final String TAG = "FlattrServiceCreator"; @@ -23,3 +25,5 @@ public class FlattrServiceCreator { flattrService = null; } } + +*/
\ No newline at end of file diff --git a/src/de/danoeh/antennapod/util/FlattrUtils.java b/src/de/danoeh/antennapod/util/FlattrUtils.java index 3256a7f29..b72d71ff1 100644 --- a/src/de/danoeh/antennapod/util/FlattrUtils.java +++ b/src/de/danoeh/antennapod/util/FlattrUtils.java @@ -2,14 +2,6 @@ package de.danoeh.antennapod.util; import java.util.EnumSet; -import org.shredzone.flattr4j.FlattrFactory; -import org.shredzone.flattr4j.FlattrService; -import org.shredzone.flattr4j.exception.FlattrException; -import org.shredzone.flattr4j.model.Thing; -import org.shredzone.flattr4j.oauth.AccessToken; -import org.shredzone.flattr4j.oauth.AndroidAuthenticator; -import org.shredzone.flattr4j.oauth.Scope; - import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.ProgressDialog; @@ -25,11 +17,11 @@ import android.util.Log; import android.widget.Toast; import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.activity.FlattrAuthActivity; -import de.danoeh.antennapod.asynctask.FlattrTokenFetcher; + import de.danoeh.antennapod.R; /** Utility methods for doing something with flattr. */ + public class FlattrUtils { private static final String TAG = "FlattrUtils"; @@ -39,12 +31,12 @@ public class FlattrUtils { private static final String PREF_ACCESS_TOKEN = "de.danoeh.antennapod.preference.flattrAccessToken"; - /** Flattr URL for this app. */ + // Flattr URL for this app. public static final String APP_URL = "http://antennapod.com"; - /** Human-readable flattr-page. */ + // Human-readable flattr-page. public static final String APP_LINK = "https://flattr.com/thing/745609/"; public static final String APP_THING_ID = "745609"; - +/* private static volatile AccessToken cachedToken; private static AndroidAuthenticator createAuthenticator() { @@ -58,10 +50,6 @@ public class FlattrUtils { context.startActivity(intent); } - /** - * Returns the access token from the preferences or null if no access token - * was saved before. - */ private static AccessToken retrieveToken() { if (cachedToken == null) { if (AppConfig.DEBUG) Log.d(TAG, "Retrieving access token"); @@ -80,12 +68,10 @@ public class FlattrUtils { } - /** Returns true if the application has saved an access token */ public static boolean hasToken() { return retrieveToken() != null; } - /** Stores the token as a preference */ public static void storeToken(AccessToken token) { if (AppConfig.DEBUG) Log.d(TAG, "Storing token"); SharedPreferences.Editor editor = PreferenceManager @@ -104,7 +90,6 @@ public class FlattrUtils { storeToken(null); } - /** Get the thing that represents this app */ public static Thing getAppThing(Context context) { FlattrService fs = FlattrServiceCreator.getService(retrieveToken()); try { @@ -226,5 +211,7 @@ public class FlattrUtils { }); builder.create().show(); } + */ + -} +}
\ No newline at end of file |