diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml
index 1dcd9767e..9fc5ab59a 100644
--- a/astrid/res/values/strings-core.xml
+++ b/astrid/res/values/strings-core.xml
@@ -800,6 +800,9 @@ Astrid is open-source and proudly maintained by Todoroo, Inc.
Forums
+
+ Premium
+
diff --git a/astrid/res/values/strings-premium.xml b/astrid/res/values/strings-premium.xml
index dc8420a45..fe32bac2f 100644
--- a/astrid/res/values/strings-premium.xml
+++ b/astrid/res/values/strings-premium.xml
@@ -86,7 +86,7 @@
Attach files to to-dos (pdfs, doc, ppt…)
Syncs files with astrid.com
Turn emails with attachments into tasks
- Save voice notes at audio files
+ Save voice notes as audio files
Preview upcoming features
Support the Astrid Team!
You are already subscribed to Astrid Premium!
diff --git a/astrid/res/xml/preferences.xml b/astrid/res/xml/preferences.xml
index 385001063..3488fe932 100644
--- a/astrid/res/xml/preferences.xml
+++ b/astrid/res/xml/preferences.xml
@@ -12,6 +12,7 @@
+
diff --git a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java
index a6e516438..11cbb80a6 100644
--- a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java
+++ b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java
@@ -45,7 +45,9 @@ import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.andlib.utility.TodorooPreferenceActivity;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
+import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.api.AstridApiConstants;
+import com.todoroo.astrid.billing.BillingActivity;
import com.todoroo.astrid.core.LabsPreferences;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task;
@@ -81,8 +83,8 @@ public class EditPreferences extends TodorooPreferenceActivity {
private static final String SUPPORT_URL = "http://blog.astrid.com/topics/support/android"; //$NON-NLS-1$
- private static final int APPEARANCE_PREFERENCE = 4;
- private static final int POWER_PACK_PREFERENCE = 5;
+ private static final int APPEARANCE_PREFERENCE = 5;
+ private static final int POWER_PACK_PREFERENCE = 6;
private static final int REQUEST_CODE_SYNC = 0;
private static final int REQUEST_CODE_LABS = 1;
@@ -164,6 +166,19 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
});
+ preference = screen.findPreference(getString(R.string.p_premium));
+ if (ActFmPreferenceService.isPremiumUser())
+ screen.removePreference(preference);
+ else
+ preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference p) {
+ showPremium();
+ return true;
+ }
+ });
+
+
PreferenceCategory appearance = (PreferenceCategory) screen.getPreference(APPEARANCE_PREFERENCE);
Preference beastMode = appearance.getPreference(1);
beastMode.setTitle(r.getString(R.string.EPr_beastMode_title));
@@ -250,6 +265,11 @@ public class EditPreferences extends TodorooPreferenceActivity {
startActivity(intent);
}
+ private void showPremium() {
+ Intent intent = new Intent(this, BillingActivity.class);
+ startActivity(intent);
+ }
+
private static final HashMap, Integer> PREFERENCE_REQUEST_CODES = new HashMap, Integer>();
static {
PREFERENCE_REQUEST_CODES.put(SyncProviderPreferences.class, REQUEST_CODE_SYNC);
diff --git a/astrid/src/com/todoroo/astrid/billing/BillingActivity.java b/astrid/src/com/todoroo/astrid/billing/BillingActivity.java
index be81efb81..5aa261019 100644
--- a/astrid/src/com/todoroo/astrid/billing/BillingActivity.java
+++ b/astrid/src/com/todoroo/astrid/billing/BillingActivity.java
@@ -21,6 +21,7 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
+import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.billing.BillingConstants.PurchaseState;
@@ -61,18 +62,21 @@ public class BillingActivity extends Activity {
purchaseObserver = new AstridPurchaseObserver(handler);
ResponseHandler.register(purchaseObserver);
+ }
- // Enforce logged in here? If so, barrier to subscribing, if not, has the possibility of double subscribing.
+ @Override
+ protected void onResume() {
+ super.onResume();
if (!actFmPreferenceService.isLoggedIn()) {
// Prompt to log in
DialogUtilities.okCancelDialog(this, getString(R.string.premium_login_prompt), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- // Set result, finish, use callback to prompt for login
+ Intent login = new Intent(BillingActivity.this, ActFmLoginActivity.class);
+ startActivity(login);
}
},
new DialogInterface.OnClickListener() {
-
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
@@ -181,7 +185,6 @@ public class BillingActivity extends Activity {
boolean initialized = Preferences.getBoolean(TRANSACTIONS_INITIALIZED, false);
if (!initialized) {
billingService.restoreTransactions();
- Toast.makeText(this, R.string.restoring_transactions, Toast.LENGTH_LONG).show();
}
}
@@ -232,6 +235,7 @@ public class BillingActivity extends Activity {
@Override
public void run() {
Preferences.setBoolean(ActFmPreferenceService.PREF_PREMIUM, true);
+ Toast.makeText(BillingActivity.this, R.string.premium_success, Toast.LENGTH_LONG).show();
}
}, new Runnable() {
@Override