diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java index 3eec741e2..d9b29821a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmPreferences.java @@ -75,6 +75,14 @@ public class ActFmPreferences extends SyncProviderPreferences { return true; } }); + + findPreference(getString(R.string.actfm_account_type)).setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + startSync(); + return true; + } + }); } private void startLogin() { @@ -92,6 +100,16 @@ public class ActFmPreferences extends SyncProviderPreferences { return actFmPreferenceService; } + @Override + protected void onResume() { + super.onResume(); + + Preference premiumUpgrade = findPreference(getString(R.string.actfm_inapp_billing)); + if (premiumUpgrade != null && (!actFmPreferenceService.isLoggedIn() || ActFmPreferenceService.isPremiumUser())) { + getPreferenceScreen().removePreference(premiumUpgrade); + } + } + @Override protected void onPause() { super.onPause(); @@ -115,8 +133,19 @@ public class ActFmPreferences extends SyncProviderPreferences { preference.setSummary(R.string.actfm_https_enabled); else preference.setSummary(R.string.actfm_https_disabled); - } else if (r.getString(R.string.actfm_inapp_billing).equals(preference.getKey())) { - // + } else if (r.getString(R.string.actfm_account_type).equals(preference.getKey())) { + if (ActFmPreferenceService.isPremiumUser()) { + // Premium user + preference.setSummary(R.string.actfm_account_premium); + } else if (actFmPreferenceService.isLoggedIn()) { + // Non premium user + preference.setSummary(R.string.actfm_account_basic); + } else { + // Not logged in + preference.setEnabled(true); + preference.setTitle(R.string.account_type_title_not_logged_in); + preference.setSummary(R.string.account_type_summary_not_logged_in); + } } else { super.updatePreferences(preference, value); } diff --git a/astrid/res/values/strings-actfm.xml b/astrid/res/values/strings-actfm.xml index 3b866d81a..86b1b3bf5 100644 --- a/astrid/res/values/strings-actfm.xml +++ b/astrid/res/values/strings-actfm.xml @@ -308,6 +308,11 @@ Are you sure you want to sync with Astrid.com? + Account Type + Sign up for a free account + Access tasks online, share lists and even delegate + + Premium Basic None diff --git a/astrid/res/xml/preferences_actfm.xml b/astrid/res/xml/preferences_actfm.xml index a604a8291..b81756708 100644 --- a/astrid/res/xml/preferences_actfm.xml +++ b/astrid/res/xml/preferences_actfm.xml @@ -6,7 +6,17 @@ --> - + + + + + @@ -21,14 +31,9 @@ android:key="@string/sync_SPr_key_last_error" android:textSize="24sp" android:gravity="center"/> - + - - diff --git a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java index 862e6895a..94290f2e7 100644 --- a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java +++ b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java @@ -437,7 +437,7 @@ public class EditPreferences extends TodorooPreferenceActivity { if (ActFmPreferenceService.isPremiumUser()) { accountType = getString(R.string.actfm_account_premium); } else if (actFmPreferenceService.isLoggedIn()) { - accountType = getString(R.string.actfm_account_premium); + accountType = getString(R.string.actfm_account_basic); } else { accountType = getString(R.string.actfm_account_none); }