Ejemplo n.º 1
0
 public Object getAsObject(FacesContext fc, UIComponent uic, String value) {
   if (value != null && value.trim().length() > 0) {
     try {
       ThemeService service =
           (ThemeService) fc.getExternalContext().getApplicationMap().get("themeService");
       return service.getThemes().get(Integer.parseInt(value));
     } catch (NumberFormatException e) {
       throw new ConverterException(
           new FacesMessage(
               FacesMessage.SEVERITY_ERROR, "Conversion Error", "Not a valid theme."));
     }
   } else {
     return null;
   }
 }
Ejemplo n.º 2
0
  /**
   * Return a change log string. Releases occur often enough that we don't expect change sets to be
   * localized.
   *
   * @param from
   * @param to
   * @return
   */
  @SuppressWarnings("nls")
  public void showChangeLog(Context context, int from) {
    if (!(context instanceof Activity) || from == 0) return;

    Preferences.clear(TagCaseMigrator.PREF_SHOW_MIGRATION_ALERT);

    Preferences.clear(AstridPreferences.P_UPGRADE_FROM);
    StringBuilder changeLog = new StringBuilder();

    if (from >= V4_2_0 && from < V4_2_1) {
      newVersionString(
          changeLog,
          "4.2.1 (6/08/12)",
          new String[] {
            "Fix for MyTouch 4G Lists",
            "Fixed a crash when adding tasks with due times to Google Calendar",
            "Better syncing of the people list",
            "Minor UI polish and bugfixes"
          });
    }

    if (from < V4_2_0) {
      newVersionString(
          changeLog,
          "4.2.0 (6/05/12)",
          new String[] {
            "Support for the Nook", "Fixed crash on large image attachments", "Minor bugfixes"
          });
    }

    if (from >= V4_1_3 && from < V4_1_3_1) {
      newVersionString(changeLog, "4.1.3.1 (5/18/12)", new String[] {"Fixed reminders for ICS"});
    }

    if (from >= V4_1_2 && from < V4_1_3) {
      newVersionString(
          changeLog,
          "4.1.3 (5/17/12)",
          new String[] {
            "Added ability to see shared tasks sorted by friend! Enable or disable "
                + "in Settings > Astrid Labs",
            "Fixed desktop shortcuts",
            "Fixed adding tasks from the Power Pack widget",
            "Fixed selecting photos on the Kindle Fire",
            "Various other minor bug and crash fixes"
          });
    }

    if (from >= V4_1_1 && from < V4_1_2) {
      newVersionString(
          changeLog, "4.1.2 (5/05/12)", new String[] {"Fixed some crashes and minor bugs"});
    }

    if (from < V4_1_1) {
      newVersionString(
          changeLog,
          "4.1.1 (5/04/12)",
          new String[] {
            "Respond to or set reminders for missed calls. This feature requires a new permission to read "
                + "the phone state.",
          });
    }

    if (from < V4_1_0) {
      newVersionString(
          changeLog,
          "4.1.0 (5/03/12)",
          new String[] {
            "Swipe between lists! Swipe left and right to move through your lists. Enable or adjust "
                + "in Settings > Astrid Labs",
            "Assign tasks to contacts without typing",
            "Links to tasks in comments",
            "Astrid.com sync improvements",
            "Other minor bugfixes",
          });
    }

    if (from >= V4_0_6 && from < V4_0_6_2) {
      newVersionString(
          changeLog,
          "4.0.6.2 (4/03/12)",
          new String[] {
            "Minor fix to backup migration fix to handle deleted tasks as well as completed tasks."
          });
    }

    if (from >= V4_0_6 && from < V4_0_6_1) {
      newVersionString(
          changeLog,
          "4.0.6.1 (4/03/12)",
          new String[] {
            "Fixed a bug where old tasks could become uncompleted. Sorry to those of you"
                + " who were affected by this! To recover, you can import your old tasks"
                + " from any backup file created before April 3 by clicking Menu -> Settings ->"
                + " Backups -> Manage Backups -> Import Tasks. Backup files from April 3 will start"
                + " with 'auto.120403'."
          });
    }

    if (from < V4_0_6) {
      newVersionString(
          changeLog,
          "4.0.6 (4/02/12)",
          new String[] {
            "Fixes and performance improvements to Astrid.com and Google Tasks sync",
            "Google TV support! (Beta)",
            "Fixed a bug that could put duetimes on tasks when changing timezones",
            "Fixed a rare crash when starting a task timer"
          });
    }

    if (from >= V4_0_0 && from < V4_0_5) {
      newVersionString(
          changeLog,
          "4.0.5 (3/22/12)",
          new String[] {
            "Better conflict resolution for Astrid.com sync",
            "Fixes and improvements to Gtasks sync",
            "Added option to report sync errors in sync preference screen"
          });
    }

    if (from >= V4_0_0 && from < V4_0_4) {
      newVersionString(
          changeLog,
          "4.0.4 (3/7/12)",
          new String[] {
            "Fixed crashes related to error reporting",
            "Fixed a crash when creating a task from the widget",
            "Fixed a bug where a manual sync wouldn't always start"
          });
    }

    if (from >= V4_0_0 && from < V4_0_3) {
      newVersionString(
          changeLog,
          "4.0.3 (3/6/12)",
          new String[] {
            "Fix some issues with Google Tasks sync. We're sorry to "
                + "everyone who's been having trouble with it!",
            "Updated translations for Portuguese, Chinese, German, Russian, and Dutch",
            "Centralize Android's menu key with in-app navigation",
            "Fixed crashes & improve crash logging",
          });
    }

    if (from >= V4_0_0 && from < V4_0_2) {
      newVersionString(
          changeLog,
          "4.0.2 (2/29/12)",
          new String[] {
            "Removed GPS permission - no longer needed",
            "Fixes for some subtasks issues",
            "No longer need to run the Crittercism service in the background",
            "Fixed a crash that could occur when cloning tasks",
            "Fixed a bug that prevented certain comments from syncing correctly",
            "Fixed issues where voice add wouldn't work correctly",
          });
    }

    if (from >= V4_0_0 && from < V4_0_1) {
      newVersionString(
          changeLog,
          "4.0.1 (2/23/12)",
          new String[] {
            "Fixed a database issue affecting Android 2.1 users",
            "Fixed a crash when using drag and drop in Google Tasks lists",
            "Other small bugfixes"
          });
    }

    if (from < V4_0_0) {
      newVersionString(
          changeLog,
          "4.0.0 (2/23/12)",
          new String[] {
            "Welcome to Astrid 4.0! Here's what's new:",
            "<b>Subtasks!!!</b><br>Press the Menu key and select 'Sort' to access",
            "<b>New Look!</b><br>Customize how Astrid looks from the Settings menu",
            "<b>Task Rabbit!</b><br>Outsource your tasks with the help of trustworthy people",
            "<b>More Reliable Sync</b><br>Including fixes to Astrid.com and Google Tasks sync",
            "<b>Tablet version</b><br>Enjoy Astrid on your luxurious Android tablet",
            "Many bug and usability fixes"
          });
    }

    // --- old messages

    if (from >= V3_0_0 && from < V3_9_0) {
      newVersionString(
          changeLog,
          "3.9 (12/09/11)",
          new String[] {
            "Cleaner design (especially the task edit page)!",
            "Customize the edit page (\"Beast Mode\" in preferences)",
            "Make shared lists with tasks open to anyone (perfect for potlucks, road trips etc)",
            "Fixes for some ICS crashes (full support coming soon)",
            "Google Tasks sync improvement - Note: If you have been experiencing \"Sync with errors\", try logging out and logging back in to Google Tasks.",
            "Other minor bug fixes",
            "Feedback welcomed!"
          });
    }

    if (from >= V3_0_0 && from < V3_8_0) {
      newVersionString(
          changeLog,
          "3.8.0 (7/15/11)",
          new String[] {
            "Astrid.com: sync & share tasks / lists with others!",
            "GTasks Sync using Google's official task API! Gtasks users "
                + "will need to perform a manual sync to set everything up.",
            "Renamed \"Tags\" to \"Lists\" (see blog.astrid.com for details)",
            "New style for \"Task Edit\" page!",
            "Purge completed or deleted tasks from settings menu!",
          });
      gtasksPreferenceService.setToken(null);
    }

    if (from >= V3_0_0 && from < V3_7_0) {
      newVersionString(
          changeLog,
          "3.7.0 (2/7/11)",
          new String[] {
            "Improved UI for displaying task actions. Tap a task to "
                + "bring up actions, tap again to dismiss.",
            "Task notes can be viewed by tapping the note icon to " + "the right of the task.",
            "Added Astrid as 'Send-To' choice in Android Browser and " + "other apps.",
            "Add tags and importance in quick-add, e.g. " + "\"call mom #family @phone !4\"",
            "Fixed bug with custom filters & tasks being hidden.",
          });
      upgrade3To3_7();
      if (gtasksPreferenceService.isLoggedIn()) taskService.clearDetails(Criterion.all);
      Preferences.setBoolean(Eula.PREFERENCE_EULA_ACCEPTED, true);
    }
    if (from >= V3_0_0 && from < V3_6_0) {
      newVersionString(
          changeLog,
          "3.6.0 (11/13/10)",
          new String[] {
            "Astrid Power Pack is now launched to the Android Market. "
                + "New Power Pack features include 4x2 and 4x4 widgets and voice "
                + "task reminders and creation. Go to the add-ons page to find out more!",
            "Fix for Google Tasks: due times got lost on sync, repeating tasks not repeated",
            "Fix for task alarms not always firing if multiple set",
            "Fix for various force closes",
          });
      upgrade3To3_6(context);
    }
    if (from >= V3_0_0 && from < V3_5_0)
      newVersionString(
          changeLog,
          "3.5.0 (10/25/10)",
          new String[] {
            "Google Tasks Sync (beta!)",
            "Bug fix with RMilk & new tasks not getting synced",
            "Fixed Force Closes and other bugs",
          });
    if (from >= V3_0_0 && from < V3_4_0) {
      newVersionString(
          changeLog,
          "3.4.0 (10/08/10)",
          new String[] {
            "End User License Agreement",
            "Option to disable usage statistics",
            "Bug fixes with Producteev",
          });
    }
    if (from >= V3_0_0 && from < V3_3_0)
      newVersionString(
          changeLog,
          "3.3.0 (9/17/10)",
          new String[] {
            "Fixed some RTM duplicated tasks issues",
            "UI updates based on your feedback",
            "Snooze now overrides other alarms",
            "Added preference option for selecting snooze style",
            "Hide until: now allows you to pick a specific time",
          });
    if (from >= V3_0_0 && from < V3_2_0)
      newVersionString(
          changeLog,
          "3.2.0 (8/16/10)",
          new String[] {
            "Build your own custom filters from the Filter page",
            "Easy task sorting (in the task list menu)",
            "Create widgets from any of your filters",
            "Synchronize with Producteev! (producteev.com)",
            "Select tags by drop-down box",
            "Cosmetic improvements, calendar & sync bug fixes",
          });
    if (from >= V3_0_0 && from < V3_1_0)
      newVersionString(
          changeLog,
          "3.1.0 (8/9/10)",
          new String[] {
            "Linkify phone numbers, e-mails, and web pages",
            "Swipe L => R to go from tasks to filters",
            "Moved task priority bar to left side",
            "Added ability to create fixed alerts for a task",
            "Restored tag hiding when tag begins with underscore (_)",
            "FROYO: disabled moving app to SD card, it would break alarms and widget",
            "Also gone: a couple force closes, bugs with repeating tasks",
          });

    if (changeLog.length() == 0) return;

    changeLog.append("Have a spectacular day!</body></html>");
    String color = ThemeService.getDialogTextColor();
    String changeLogHtml = "<html><body style='color: " + color + "'>" + changeLog;

    DialogUtilities.htmlDialog(context, changeLogHtml, R.string.UpS_changelog_title);
  }