summaryrefslogtreecommitdiff
path: root/src/de
diff options
context:
space:
mode:
Diffstat (limited to 'src/de')
-rw-r--r--src/de/podfetcher/activity/PreferenceActivity.java35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/de/podfetcher/activity/PreferenceActivity.java b/src/de/podfetcher/activity/PreferenceActivity.java
index 1fa85940e..4a76a871c 100644
--- a/src/de/podfetcher/activity/PreferenceActivity.java
+++ b/src/de/podfetcher/activity/PreferenceActivity.java
@@ -10,25 +10,44 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import de.podfetcher.R;
+import de.podfetcher.util.FlattrUtils;
public class PreferenceActivity extends SherlockPreferenceActivity {
private static final String TAG = "PreferenceActivity";
-
+
private static final String PREF_FLATTR_THIS_APP = "prefFlattrThisApp";
-
+ private static final String PREF_FLATTR_AUTH = "pref_flattr_authenticate";
+ private static final String PREF_FLATTR_REVOKE = "prefRevokeAccess";
+
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
addPreferencesFromResource(R.xml.preferences);
- findPreference(PREF_FLATTR_THIS_APP).setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ findPreference(PREF_FLATTR_THIS_APP).setOnPreferenceClickListener(
+ new OnPreferenceClickListener() {
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ Log.d(TAG, "Flattring this app");
+ return true;
+ }
+ });
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ checkItemVisibility();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void checkItemVisibility() {
+ boolean hasFlattrToken = FlattrUtils.hasToken();
+ findPreference(PREF_FLATTR_AUTH).setEnabled(!hasFlattrToken);
+ findPreference(PREF_FLATTR_REVOKE).setEnabled(hasFlattrToken);
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Log.d(TAG, "Flattring this app");
- return true;
- }});
}
@Override