Esempio n. 1
0
  @SuppressWarnings("nls")
  private void upgrade3To3_3(final Context context) {
    // if RTM, store RTM to secondary preferences
    if (Preferences.getStringValue("rmilk_token") != null) {
      SharedPreferences settings = context.getSharedPreferences("rtm", Context.MODE_WORLD_READABLE);
      Editor editor = settings.edit();
      editor.putString("rmilk_token", Preferences.getStringValue("rmilk_token"));
      editor.putLong("rmilk_last_sync", Preferences.getLong("rmilk_last_sync", 0));
      editor.commit();

      final String message =
          "Hi, it looks like you are a Remember the Milk user! "
              + "In this version of Astrid, RTM is now a community-supported "
              + "add-on. Please go to the Android market to install it!";
      if (context instanceof Activity) {
        ((Activity) context)
            .runOnUiThread(
                new Runnable() {
                  @Override
                  public void run() {
                    new AlertDialog.Builder(context)
                        .setTitle(com.todoroo.astrid.api.R.string.DLG_information_title)
                        .setMessage(message)
                        .setPositiveButton(
                            "Go To Market",
                            new AddOnService.MarketClickListener(context, "org.weloveastrid.rmilk"))
                        .setNegativeButton("Later", null)
                        .show();
                  }
                });
      }
    }
  }
Esempio n. 2
0
 /** Check defaults */
 public void checkDefaults() {
   Preferences.setPreferenceDefaults();
   ContentValues defaults = new Task().getDefaultValues();
   assertTrue(defaults.containsKey(Task.TITLE.name));
   assertTrue(defaults.containsKey(Task.DUE_DATE.name));
   assertTrue(defaults.containsKey(Task.HIDE_UNTIL.name));
   assertTrue(defaults.containsKey(Task.COMPLETION_DATE.name));
   assertTrue(defaults.containsKey(Task.IMPORTANCE.name));
 }