summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/de/podfetcher/activity/PreferenceActivity.java12
-rw-r--r--src/de/podfetcher/util/FlattrUtils.java24
3 files changed, 37 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c661ea6cb..5f539e38f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -118,5 +118,7 @@
<string name="pref_flattr_this_app_sum">Support the development of Antennacast by flattring it. Thanks!</string>
<string name="pref_revokeAccess_title">Revoke access</string>
<string name="pref_revokeAccess_sum">Revoke the access permission to your flattr account for this app.</string>
+ <string name="access_revoked_title">Access revoked</string>
+ <string name="access_revoked_info">You have successfully revoked deleted Antennapod\'s access token to your account. In order to complete the process, you have to remove this app from the list of approved applications in your account settings on the flattr website.</string>
</resources> \ No newline at end of file
diff --git a/src/de/podfetcher/activity/PreferenceActivity.java b/src/de/podfetcher/activity/PreferenceActivity.java
index 4a76a871c..4d1c4314b 100644
--- a/src/de/podfetcher/activity/PreferenceActivity.java
+++ b/src/de/podfetcher/activity/PreferenceActivity.java
@@ -30,10 +30,20 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
@Override
public boolean onPreferenceClick(Preference preference) {
- Log.d(TAG, "Flattring this app");
+ Log.d(TAG, "Flattring this app"); // TODO implement
return true;
}
});
+ findPreference(PREF_FLATTR_REVOKE).setOnPreferenceClickListener(new OnPreferenceClickListener() {
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ FlattrUtils.revokeAccessToken(PreferenceActivity.this);
+ checkItemVisibility();
+ return true;
+ }
+
+ });
}
@Override
diff --git a/src/de/podfetcher/util/FlattrUtils.java b/src/de/podfetcher/util/FlattrUtils.java
index d4eb1aa64..01f0ca4f9 100644
--- a/src/de/podfetcher/util/FlattrUtils.java
+++ b/src/de/podfetcher/util/FlattrUtils.java
@@ -10,6 +10,7 @@ import org.shredzone.flattr4j.oauth.AndroidAuthenticator;
import org.shredzone.flattr4j.oauth.Scope;
import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
@@ -115,6 +116,29 @@ public class FlattrUtils {
return null;
}
}
+
+ public static void revokeAccessToken(Context context) {
+ Log.d(TAG, "Revoking access token");
+ deleteToken();
+ showRevokeDialog(context);
+ }
+
+
+ //------------------------------------------------ DIALOGS
+
+ private static void showRevokeDialog(final Context context) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setTitle(R.string.access_revoked_title);
+ builder.setMessage(R.string.access_revoked_info);
+ builder.setNeutralButton(android.R.string.ok, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.cancel();
+ }
+ });
+ builder.create().show();
+ }
private static void showNoTokenDialog(final Context context,
final String url) {