diff --git a/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java b/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java index e24dd3a6d..9fdeadd88 100644 --- a/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java +++ b/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java @@ -37,6 +37,7 @@ import android.widget.ListView; import com.timsu.astrid.R; import com.todoroo.andlib.utility.AndroidUtilities; +@SuppressWarnings("nls") public class TouchListView extends ListView { private ImageView mDragView; private View mOriginalView; @@ -96,7 +97,7 @@ public class TouchListView extends ListView { } } - @Override + @Override final public void addHeaderView (View v, Object data, boolean isSelectable) { throw new RuntimeException("Headers are not supported with TouchListView"); } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java b/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java index ef8b122fc..570aeccf6 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java @@ -166,7 +166,7 @@ public class EditPeopleControlSet extends PopupControlSet { cbFacebook = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_facebook); cbTwitter = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_twitter); - sharedWithContainer.addPerson("", ""); //$NON-NLS-1$ + sharedWithContainer.addPerson(); setUpListeners(); } @@ -249,6 +249,7 @@ public class EditPeopleControlSet extends PopupControlSet { } } + @SuppressWarnings("nls") private static void addMembersFromTagData(TagData tagData, String tag, ArrayList sharedPeople, ArrayList collaborators) throws JSONException { JSONArray members = new JSONArray(tagData.getValue(TagData.MEMBERS)); if (tag == null) @@ -317,13 +318,13 @@ public class EditPeopleControlSet extends PopupControlSet { } @SuppressWarnings("nls") - private void buildAssignedToSpinner(Task model, ArrayList sharedPeople) throws JSONException { + private void buildAssignedToSpinner(Task t, ArrayList sharedPeople) throws JSONException { HashSet userIds = new HashSet(); HashSet emails = new HashSet(); HashMap names = new HashMap(); - if(model.getValue(Task.USER_ID) > 0) { - JSONObject user = new JSONObject(model.getValue(Task.USER)); + if(t.getValue(Task.USER_ID) > 0) { + JSONObject user = new JSONObject(t.getValue(Task.USER)); sharedPeople.add(0, user); } @@ -331,8 +332,8 @@ public class EditPeopleControlSet extends PopupControlSet { myself.put("id", Task.USER_ID_SELF); sharedPeople.add(0, myself); - boolean hasTags = model.getTransitory("tags") != null && - ((HashSet)model.getTransitory("tags")).size() > 0; + boolean hasTags = t.getTransitory("tags") != null && + ((HashSet)t.getTransitory("tags")).size() > 0; if (actFmPreferenceService.isLoggedIn() && hasTags) { JSONObject unassigned = new JSONObject(); unassigned.put("id", Task.USER_ID_UNASSIGNED); @@ -380,7 +381,7 @@ public class EditPeopleControlSet extends PopupControlSet { names.put(name, atu); } - String assignedStr = model.getValue(Task.USER); + String assignedStr = t.getValue(Task.USER); int assignedIndex = 0; if (!TextUtils.isEmpty(assignedStr)) { JSONObject assigned = new JSONObject(assignedStr); @@ -526,13 +527,13 @@ public class EditPeopleControlSet extends PopupControlSet { } @Override - public String writeToModel(Task model) { + public String writeToModel(Task t) { // do nothing, we use a separate method return null; } @Override - protected String writeToModelAfterInitialized(Task task) { + protected String writeToModelAfterInitialized(Task t) { // Nothing, we don't lazy load this control set yet return null; } @@ -680,7 +681,7 @@ public class EditPeopleControlSet extends PopupControlSet { private void makePrivateTask() { sharedWithContainer.removeAllViews(); - sharedWithContainer.addPerson("", ""); //$NON-NLS-1$ + sharedWithContainer.addPerson(); assignToMe(); } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java index b6d5cdb8f..21afaa220 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java @@ -220,6 +220,7 @@ public class TagSettingsActivity extends FragmentActivity { refreshSettingsPage(); } + @SuppressWarnings("nls") private void saveSettings() { String oldName = tagData.getValue(TagData.NAME); String newName = tagName.getText().toString().trim(); @@ -378,7 +379,6 @@ public class TagSettingsActivity extends FragmentActivity { } } - @SuppressWarnings("nls") private void refreshSettingsPage() { tagName.setText(tagData.getValue(TagData.NAME)); ActionBar ab = getSupportActionBar(); @@ -504,16 +504,19 @@ public class TagSettingsActivity extends FragmentActivity { return super.onOptionsItemSelected(item); } + protected void showDeleteDialog(TagData td) { + if(td == null) + return; - - - protected void showDeleteDialog(TagData tagData) { int string; - if (tagData != null && tagData.getValue(TagData.MEMBER_COUNT) > 0) + if (td.getValue(TagData.MEMBER_COUNT) > 0) string = R.string.DLG_leave_this_shared_tag_question; else string = R.string.DLG_delete_this_tag_question; - DialogUtilities.okCancelDialog(this, getString(string, tagData.getValue(TagData.NAME)), new DialogInterface.OnClickListener() { + + + DialogUtilities.okCancelDialog(this, getString(string, td.getValue(TagData.NAME)), + new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -539,7 +542,4 @@ public class TagSettingsActivity extends FragmentActivity { return true; } - - - } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagUpdatesFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagUpdatesFragment.java index 8ea34796f..ecd7438d3 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagUpdatesFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagUpdatesFragment.java @@ -1,6 +1,5 @@ package com.todoroo.astrid.actfm; -import com.todoroo.astrid.helper.AsyncImageView; import android.app.Activity; import android.content.Intent; import android.database.Cursor; @@ -45,6 +44,7 @@ import com.todoroo.astrid.adapter.UpdateAdapter; import com.todoroo.astrid.dao.UpdateDao; import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.Update; +import com.todoroo.astrid.helper.AsyncImageView; import com.todoroo.astrid.helper.ImageDiskCache; import com.todoroo.astrid.helper.ProgressBarSyncResultCallback; import com.todoroo.astrid.service.StatisticsConstants; @@ -128,7 +128,8 @@ public class TagUpdatesFragment extends ListFragment { protected void setUpUpdateList() { if (getActivity() instanceof TagUpdatesActivity) { ActionBar ab = ((AstridActivity) getActivity()).getSupportActionBar(); - String title = (tagData == null) ? getString(R.string.TLA_all_activity) : getString(R.string.tag_updates_title, tagData.getValue(TagData.NAME)); + String title = (tagData == null) ? getString(R.string.TLA_all_activity) : + getString(R.string.tag_updates_title, tagData.getValue(TagData.NAME)); ((TextView) ab.getCustomView().findViewById(R.id.title)).setText(title); } @@ -335,7 +336,7 @@ public class TagUpdatesFragment extends ListFragment { private String getPictureHashForUpdate(Update u) { - String s = u.getValue(Update.TASK) + "" + u.getValue(Update.CREATION_DATE); + String s = u.getValue(Update.TASK).toString() + u.getValue(Update.CREATION_DATE); return s; } diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/Calendars.java b/astrid/plugin-src/com/todoroo/astrid/gcal/Calendars.java index c8a556c5a..bfa76ec9d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/Calendars.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/Calendars.java @@ -171,7 +171,6 @@ public class Calendars { // Fetch the current setting. Invalid calendar id will // be changed to default value. String currentSetting = Preferences.getStringValue(R.string.gcal_p_default); - boolean calendarWasSelected = currentSetting != null && !currentSetting.equals("-1"); int currentSettingIndex = -1; @@ -189,7 +188,7 @@ public class Calendars { listPreference.setValueIndex(0); listPreference.setEnabled(true); - if (calendars == null || calendars.calendarIds.length == 0 || calendars.calendars.length == 0) { + if (calendars.calendarIds.length == 0 || calendars.calendars.length == 0) { // Something went wrong when querying calendars // Leave the preference at disabled. return; diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java b/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java index 132701c9a..e5a955400 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java @@ -55,6 +55,7 @@ public class GCalHelper { return createTaskEvent(task, cr, values, true); } + @SuppressWarnings("nls") public static Uri createTaskEvent(Task task, ContentResolver cr, ContentValues values, boolean deleteEventIfExists) { String eventuri = getTaskEventUri(task); @@ -88,13 +89,15 @@ public class GCalHelper { return eventUri; } catch (Exception e) { - // TODO FIX ME - // Log.e("astrid-gcal", "error-creating-calendar-event", e); //$NON-NLS-1$ //$NON-NLS-2$ + // won't work on emulator + Log.v("astrid-gcal", + "error-creating-calendar-event", e); } return null; } + @SuppressWarnings("nls") public static boolean deleteTaskEvent(Task task) { boolean eventDeleted = false; String uri; @@ -159,10 +162,11 @@ public class GCalHelper { values.put("dtend", tzCorrectedDueDateNow); values.put("allDay", "1"); } - adjustDateForIcs(task, values); + adjustDateForIcs(values); } - private static void adjustDateForIcs(Task task, ContentValues values) { + @SuppressWarnings("nls") + private static void adjustDateForIcs(ContentValues values) { if (AndroidUtilities.getSdkVersion() >= 14) { if ("1".equals(values.get("allDay"))) { values.put("eventTimezone", Time.TIMEZONE_UTC); diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java index e2b6528de..ea40399cc 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java @@ -18,6 +18,8 @@ import com.todoroo.astrid.gtasks.api.GtasksInvoker; public class GtasksTokenValidator { + private static final String MANUFACTURER_SAMSUNG = "samsung"; //$NON-NLS-1$ + /** * Invalidates and then revalidates the auth token for the currently logged in user * Shouldn't be called from the main thread--will block on network calls @@ -52,7 +54,7 @@ public class GtasksTokenValidator { } catch (IOException i2) { i2.printStackTrace(); String manufacturer = android.os.Build.MANUFACTURER.toLowerCase(); - if (!manufacturer.contains("samsung")) { // Try with the notifyAuthFailure set to true in case it was that that broke things + if (!manufacturer.contains(MANUFACTURER_SAMSUNG)) { // Try with the notifyAuthFailure set to true in case it was that that broke things accountManager.invalidateAuthToken(token); future = accountManager.manager.getAuthToken(a, GtasksInvoker.AUTH_TOKEN_TYPE, true, null, null); try { diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksLegacyMigrator.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksLegacyMigrator.java index 279e13f9b..94967d633 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksLegacyMigrator.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksLegacyMigrator.java @@ -81,7 +81,6 @@ public class GtasksLegacyMigrator { List tasksItems = allTasks.getItems(); if (tasksItems != null) { for (com.google.api.services.tasks.model.Task t : tasksItems) { - System.err.println("Constructing key with title: " + t.getTitle()); String key = constructKeyFromTitles(t.getTitle(), list.getTitle()); taskAndListTitlesToRemoteTaskIds.put(key, t.getId()); } @@ -102,8 +101,7 @@ public class GtasksLegacyMigrator { String originalListName = gtasksListService.getListName( container.gtaskMetadata.getValue(GtasksMetadata.LIST_ID)); String originalListId = null; - System.err.println("Migrating task with title: " + container.task.getValue(Task.TITLE) + - ", remote id: " + container.gtaskMetadata.getValue(GtasksMetadata.ID)); + //Search through lists to see if one of them has match String taskTitle = container.task.getValue(Task.TITLE); boolean foundMatch = false; @@ -117,7 +115,6 @@ public class GtasksLegacyMigrator { originalListId = list.getId(); if (taskAndListTitlesToRemoteTaskIds.containsKey(expectedKey)) { - System.err.println("Found match"); foundMatch = true; String newRemoteTaskId = taskAndListTitlesToRemoteTaskIds.get(expectedKey); String newRemoteListId = list.getId(); @@ -130,7 +127,6 @@ public class GtasksLegacyMigrator { } if (!foundMatch) { - System.err.println("Resetting metadata"); //For non-matches, make the task look newly created container.gtaskMetadata = GtasksMetadata.createEmptyMetadata(container.task.getId()); container.gtaskMetadata.setValue(GtasksMetadata.ID, ""); //$NON-NLS-1$ diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncService.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncService.java index 31009f236..81b39f9c4 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncService.java @@ -30,6 +30,7 @@ import com.todoroo.astrid.utility.Flags; public final class GtasksSyncService { + private static final String DEFAULT_LIST = "@default"; //$NON-NLS-1$ @Autowired MetadataService metadataService; @Autowired MetadataDao metadataDao; @Autowired GtasksMetadataService gtasksMetadataService; @@ -156,12 +157,12 @@ public final class GtasksSyncService { String remoteId = null; String listId = Preferences.getStringValue(GtasksPreferenceService.PREF_DEFAULT_LIST); if (listId == null) { - com.google.api.services.tasks.model.TaskList defaultList = invoker.getGtaskList("@default"); + com.google.api.services.tasks.model.TaskList defaultList = invoker.getGtaskList(DEFAULT_LIST); if (defaultList != null) { listId = defaultList.getId(); Preferences.setString(GtasksPreferenceService.PREF_DEFAULT_LIST, listId); } else { - listId = "@default"; //$NON-NLS-1$ + listId = DEFAULT_LIST; } } diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java index fb419d3df..ed1898a05 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncV2Provider.java @@ -188,7 +188,8 @@ public class GtasksSyncV2Provider extends SyncV2Provider { } - private void synchronizeListHelper(StoreObject list, GtasksInvoker invoker, SyncExceptionHandler handler, SyncResultCallback callback) { + private void synchronizeListHelper(StoreObject list, GtasksInvoker invoker, + SyncExceptionHandler errorHandler, SyncResultCallback callback) { // Do stuff String listId = list.getValue(GtasksList.REMOTE_ID); long lastSyncDate; @@ -218,8 +219,8 @@ public class GtasksSyncV2Provider extends SyncV2Provider { gtasksTaskListUpdater.correctOrderAndIndentForList(listId); } } catch (IOException e) { - if (handler != null) - handler.handleException("gtasks-sync-io", e); //$NON-NLS-1$ + if (errorHandler != null) + errorHandler.handleException("gtasks-sync-io", e); //$NON-NLS-1$ } } diff --git a/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java b/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java index 5c0b3d493..3a4174d03 100644 --- a/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java @@ -409,10 +409,11 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene } + @SuppressWarnings("nls") private void addComment(String message, String actionCode, boolean usePicture) { // Allow for users to just add picture if (TextUtils.isEmpty(message) && usePicture) { - message = " "; //$NON-NLS-1$ + message = " "; } Update update = new Update(); update.setValue(Update.MESSAGE, message); diff --git a/astrid/plugin-src/com/todoroo/astrid/opencrx/OpencrxControlSet.java b/astrid/plugin-src/com/todoroo/astrid/opencrx/OpencrxControlSet.java index 4f802ac9f..946df980b 100644 --- a/astrid/plugin-src/com/todoroo/astrid/opencrx/OpencrxControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/opencrx/OpencrxControlSet.java @@ -198,7 +198,6 @@ public class OpencrxControlSet extends PopupControlSet { @Autowired private StoreObjectDao storeObjectDao; - @SuppressWarnings("unused") public OpencrxControlSet(final Activity activity, int viewLayout, int displayViewLayout, int title) { super(activity, viewLayout, displayViewLayout, title); DependencyInjectionService.getInstance().inject(this); diff --git a/astrid/plugin-src/com/todoroo/astrid/opencrx/OpencrxCoreUtils.java b/astrid/plugin-src/com/todoroo/astrid/opencrx/OpencrxCoreUtils.java index 1090ddea7..c51450dfb 100644 --- a/astrid/plugin-src/com/todoroo/astrid/opencrx/OpencrxCoreUtils.java +++ b/astrid/plugin-src/com/todoroo/astrid/opencrx/OpencrxCoreUtils.java @@ -123,6 +123,6 @@ public class OpencrxCoreUtils extends SyncProviderUtilities{ @Override public String getLoggedInUserName() { - return ""; + return ""; //$NON-NLS-1$ } } diff --git a/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevControlSet.java b/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevControlSet.java index 60c24457b..9b3cecd11 100644 --- a/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/producteev/ProducteevControlSet.java @@ -177,11 +177,11 @@ public class ProducteevControlSet extends PopupControlSet { final EditText editor = new EditText(ProducteevControlSet.this.activity); OnClickListener okListener = new OnClickListener() { @Override - public void onClick(DialogInterface dialog, int which) { + public void onClick(DialogInterface dlg, int which) { Activity context = ProducteevControlSet.this.activity; String newDashboardName = editor.getText().toString(); if (newDashboardName == null || newDashboardName.length() == 0) { - dialog.cancel(); + dlg.cancel(); } else { // create the real dashboard, select it in the spinner and refresh responsiblespinner ProgressDialog progressDialog = com.todoroo.andlib.utility.DialogUtilities.progressDialog(context, @@ -213,8 +213,8 @@ public class ProducteevControlSet extends PopupControlSet { }; OnClickListener cancelListener = new OnClickListener() { @Override - public void onClick(DialogInterface dialog, int which) { - dialog.cancel(); + public void onClick(DialogInterface dlg, int which) { + dlg.cancel(); dashboardSelector.setSelection(lastDashboardSelection); } }; diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java b/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java index 8f605fb2a..415f810ec 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java @@ -50,13 +50,14 @@ public class Notifications extends BroadcastReceiver { * Action name for broadcast intent notifying that task was created from repeating template */ public static final String BROADCAST_IN_APP_NOTIFY = Constants.PACKAGE + ".IN_APP_NOTIFY"; //$NON-NLS-1$ - public static final String EXTRAS_CUSTOM_INTENT = "intent"; - public static final String EXTRAS_NOTIF_ID = "notifId"; + public static final String EXTRAS_CUSTOM_INTENT = "intent"; //$NON-NLS-1$ + public static final String EXTRAS_NOTIF_ID = "notifId"; //$NON-NLS-1$ + /** notification type extra */ public static final String EXTRAS_TYPE = "type"; //$NON-NLS-1$ - public static final String EXTRAS_TITLE = "title"; - public static final String EXTRAS_TEXT = "text"; - public static final String EXTRAS_RING_TIMES = "ringTimes"; + public static final String EXTRAS_TITLE = "title"; //$NON-NLS-1$ + public static final String EXTRAS_TEXT = "text"; //$NON-NLS-1$ + public static final String EXTRAS_RING_TIMES = "ringTimes"; //$NON-NLS-1$ // --- instance variables diff --git a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatControlSet.java b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatControlSet.java index 0eb126dfc..c1ffacc9c 100644 --- a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatControlSet.java @@ -67,7 +67,6 @@ public class RepeatControlSet extends PopupControlSet { private Button value; private Spinner interval; private Spinner type; - private LinearLayout repeatContainer; private LinearLayout daysOfWeekContainer; private final CompoundButton[] daysOfWeek = new CompoundButton[7]; @@ -132,6 +131,7 @@ public class RepeatControlSet extends PopupControlSet { listeners.remove(listener); } + @SuppressWarnings("nls") @Override public void readFromTask(Task task) { super.readFromTask(task); @@ -232,7 +232,6 @@ public class RepeatControlSet extends PopupControlSet { value = (Button) getView().findViewById(R.id.repeatValue); interval = (Spinner) getView().findViewById(R.id.repeatInterval); type = (Spinner) getView().findViewById(R.id.repeatType); - repeatContainer = (LinearLayout) getView().findViewById(R.id.repeatContainer); daysOfWeekContainer = (LinearLayout) getView().findViewById(R.id.repeatDayOfWeekContainer); setRepeatValue(1); diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagCaseMigrator.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagCaseMigrator.java index d076a6902..48fa80430 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/TagCaseMigrator.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagCaseMigrator.java @@ -35,9 +35,10 @@ public class TagCaseMigrator { private final HashMap nameToRemoteId = new HashMap(); private final HashMap nameCountMap = new HashMap(); - public void performTagCaseMigration(Context context) { + public void performTagCaseMigration(@SuppressWarnings("unused") Context context) { if (!Preferences.getBoolean(PREF_CASE_MIGRATION_PERFORMED, false)) { - TagService.Tag[] allTagData = TagService.getInstance().getGroupedTags(TagService.GROUPED_TAGS_BY_ALPHA, Criterion.all); + TagService.Tag[] allTagData = TagService.getInstance().getGroupedTags( + TagService.GROUPED_TAGS_BY_ALPHA, Criterion.all); boolean shouldShowDialog = false; for (int i = 0; i < allTagData.length - 1; i++) { diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java index 33c13d0c1..8bab8ac0a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java @@ -40,8 +40,8 @@ public final class TagsControlSet extends PopupControlSet { // --- instance variables - //private final Spinner tagSpinner; - //@Autowired private TagDataService tagDataService; + private static final String TRANSITORY_TAGS = "tags";//$NON-NLS-1$ + private final TagService tagService = TagService.getInstance(); private ArrayList allTagNames; @@ -124,8 +124,8 @@ public final class TagsControlSet extends PopupControlSet { tags.add(tagName.getText().toString()); } } else { - if (model.getTransitory("tags") != null) { - return (LinkedHashSet) model.getTransitory("tags"); + if (model.getTransitory(TRANSITORY_TAGS) != null) { + return (LinkedHashSet) model.getTransitory(TRANSITORY_TAGS); } } return tags; @@ -233,7 +233,7 @@ public final class TagsControlSet extends PopupControlSet { } finally { cursor.close(); } - model.putTransitory("tags", tags); //$NON-NLS-1$ + model.putTransitory(TRANSITORY_TAGS, tags); } } @@ -253,7 +253,7 @@ public final class TagsControlSet extends PopupControlSet { } private void selectTagsFromModel() { - LinkedHashSet tags = (LinkedHashSet) model.getTransitory("tags"); + LinkedHashSet tags = (LinkedHashSet) model.getTransitory(TRANSITORY_TAGS); if (tags != null) { for (String tag : tags) { setTagSelected(tag); diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitLocationManager.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitLocationManager.java index 5ca7e44c0..7c7e3e508 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitLocationManager.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitLocationManager.java @@ -38,10 +38,20 @@ public class TaskRabbitLocationManager { new GeoPoint(47606210, -122332070), //SEA new GeoPoint(29424120, -98493630) //SAN ANTONIO }; + public boolean isLocationUpdatesEnabled() { - boolean provider_enabled=false; - try{provider_enabled=lm.isProviderEnabled(LocationManager.GPS_PROVIDER);}catch(Exception ex){} - try{provider_enabled=provider_enabled || lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);}catch(Exception ex){} + boolean provider_enabled = false; + try { + provider_enabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); + } catch (Exception ex) { + // suppress + } + try { + provider_enabled = provider_enabled + || lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER); + } catch (Exception ex) { + // suppress + } return provider_enabled; } public Location getLastKnownLocation() @@ -49,8 +59,9 @@ public class TaskRabbitLocationManager { boolean gps_supported=false; boolean network_supported=false; Location location = null; - try{gps_supported=lm.isProviderEnabled(LocationManager.GPS_PROVIDER);}catch(Exception ex){} - try{network_supported=lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);}catch(Exception ex){} + + gps_supported = isGpsEnabled();; + network_supported = isNetworkProviderEnabled(); if(!gps_supported && !network_supported) return null; @@ -75,53 +86,59 @@ public class TaskRabbitLocationManager { return false; } + + public boolean getLocation(LocationResult result) { - locationResult=result; - try{gps_enabled=lm.isProviderEnabled(LocationManager.GPS_PROVIDER);}catch(Exception ex){} - try{network_enabled=lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);}catch(Exception ex){} + locationResult = result; + gps_enabled = isGpsEnabled(); + network_enabled = isNetworkProviderEnabled(); if(!gps_enabled && !network_enabled) return false; if(gps_enabled) - lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListenerGps); + lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); if(network_enabled) - lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListenerNetwork); + lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); timer1=new Timer(); timer1.schedule(new GetLastLocation(), 20000); return true; } - LocationListener locationListenerGps = new LocationListener() { - public void onLocationChanged(Location location) { - timer1.cancel(); - locationResult.gotLocation(location); - lm.removeUpdates(this); - lm.removeUpdates(locationListenerNetwork); + private boolean isNetworkProviderEnabled() { + try { + return lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER); + } catch (Exception ex) { + // suppress } - public void onProviderDisabled(String provider) {} - public void onProviderEnabled(String provider) {} - public void onStatusChanged(String provider, int status, Bundle extras) {} - }; + return false; + } + + private boolean isGpsEnabled() { + try { + return lm.isProviderEnabled(LocationManager.GPS_PROVIDER); + } catch (Exception ex) { + // suppress + } + return false; + } - LocationListener locationListenerNetwork = new LocationListener() { + private final LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { timer1.cancel(); locationResult.gotLocation(location); - lm.removeUpdates(this); - lm.removeUpdates(locationListenerGps); + lm.removeUpdates(locationListener); } - public void onProviderDisabled(String provider) {} - public void onProviderEnabled(String provider) {} - public void onStatusChanged(String provider, int status, Bundle extras) {} + public void onProviderDisabled(String provider) { /**/ } + public void onProviderEnabled(String provider) { /**/ } + public void onStatusChanged(String provider, int status, Bundle extras) { /**/ } }; class GetLastLocation extends TimerTask { @Override public void run() { - lm.removeUpdates(locationListenerGps); - lm.removeUpdates(locationListenerNetwork); + lm.removeUpdates(locationListener); Location net_loc=null, gps_loc=null; if(gps_enabled) diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java index d747c4568..b1d189855 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitMapActivity.java @@ -120,7 +120,7 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen AlertDialog.Builder adb = new AlertDialog.Builder(TaskRabbitMapActivity.this); adb.setTitle(getString(R.string.tr_alert_location_fail_title)); adb.setMessage(getString(R.string.tr_alert_location_fail_message)); - adb.setPositiveButton("Close",null); + adb.setPositiveButton(R.string.DLG_close, null); adb.show(); } } @@ -200,7 +200,7 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen } catch (Exception e) { e.printStackTrace(); } - return ""; + return ""; //$NON-NLS-1$ } private String updateAddress(Address address){ String addressString = null; @@ -256,7 +256,7 @@ public class TaskRabbitMapActivity extends MapActivity implements LocationListen } private Location geoPointToLocation(GeoPoint geoPoint) { - Location location = new Location(""); + Location location = new Location(""); //$NON-NLS-1$ location.setLatitude(((long)geoPoint.getLatitudeE6())/1E6); location.setLongitude(((long)geoPoint.getLongitudeE6())/1E6); return location; diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java index c67f2a04b..d1720247d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitNameControlSet.java @@ -16,7 +16,6 @@ import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.ImageButton; -import android.widget.LinearLayout; import android.widget.TextView; import com.timsu.astrid.R; @@ -32,8 +31,6 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab protected final EditText editText; protected final TextView notesPreview; - private final LinearLayout notesBody; - private final ImageButton pictureButton; private Bitmap pendingCommentPicture = null; @@ -44,7 +41,6 @@ public class TaskRabbitNameControlSet extends PopupControlSet implements TaskRab super(activity, viewLayout, displayViewLayout, titleID); editText = (EditText) getView().findViewById(R.id.notes); notesPreview = (TextView) getDisplayView().findViewById(R.id.display_row_edit); - notesBody = (LinearLayout) getDisplayView().findViewById(R.id.notes_body); displayText.setText(activity.getString(titleID)); editText.setMaxLines(Integer.MAX_VALUE); diff --git a/astrid/plugin-src/com/todoroo/astrid/timers/TimerActionControlSet.java b/astrid/plugin-src/com/todoroo/astrid/timers/TimerActionControlSet.java index ba2e3609e..47219ece5 100644 --- a/astrid/plugin-src/com/todoroo/astrid/timers/TimerActionControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/timers/TimerActionControlSet.java @@ -35,7 +35,6 @@ public class TimerActionControlSet extends TaskEditControlSet { } @Override - @SuppressWarnings("hiding") protected void readFromTaskOnInitialize() { if (model.getValue(Task.TIMER_START) == 0) timerActive = false; @@ -51,7 +50,6 @@ public class TimerActionControlSet extends TaskEditControlSet { } @Override - @SuppressWarnings("hiding") protected String writeToModelAfterInitialized(Task task) { // Nothing to do here return null; @@ -96,7 +94,7 @@ public class TimerActionControlSet extends TaskEditControlSet { chronometer.setOnChronometerTickListener(new OnChronometerTickListener() { public void onChronometerTick(Chronometer cArg) { long t = SystemClock.elapsedRealtime() - cArg.getBase(); - cArg.setText(DateFormat.format("d'd' h:mm", t)); + cArg.setText(DateFormat.format("d'd' h:mm", t)); //$NON-NLS-1$ } }); diff --git a/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java b/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java index 2b1cdf32f..7be0f763c 100644 --- a/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java @@ -126,7 +126,7 @@ public class ShortcutActivity extends Activity { Filter filter; if (extras.containsKey(TOKEN_CUSTOM_CLASS)) { - filter = new FilterWithCustomIntent("", title, sql, values); + filter = new FilterWithCustomIntent("", title, sql, values); //$NON-NLS-1$ ComponentName customTaskList = ComponentName.unflattenFromString(extras.getString(TOKEN_CUSTOM_CLASS)); ((FilterWithCustomIntent) filter).customTaskList = customTaskList; } else { diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditViewPager.java b/astrid/src/com/todoroo/astrid/activity/TaskEditViewPager.java index 61fe75b78..c696759fe 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditViewPager.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditViewPager.java @@ -13,11 +13,8 @@ public class TaskEditViewPager extends PagerAdapter implements TitleProvider { private static String[] titles; public TaskEditFragment parent; - private final int tabStyle; public TaskEditViewPager(Context context, int tabStyle) { - this.tabStyle = tabStyle; - switch(tabStyle) { case TaskEditFragment.TAB_STYLE_ACTIVITY_WEB: titles = new String[] { diff --git a/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java b/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java index e9d113d49..79d551ccb 100644 --- a/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java @@ -8,7 +8,6 @@ import org.json.JSONObject; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; -import android.content.res.Resources; import android.database.Cursor; import android.support.v4.app.Fragment; import android.text.Html; @@ -65,6 +64,7 @@ public class UpdateAdapter extends CursorAdapter { public static final String FROM_TAG_VIEW = "from_tag"; //$NON-NLS-1$ public static final String FROM_TASK_VIEW = "from_task"; //$NON-NLS-1$ public static final String FROM_RECENT_ACTIVITY_VIEW = "from_recent_activity"; //$NON-NLS-1$ + /** * Constructor * @@ -99,7 +99,7 @@ public class UpdateAdapter extends CursorAdapter { public static String getLinkColor(Fragment f) { TypedValue colorType = new TypedValue(); f.getActivity().getTheme().resolveAttribute(R.attr.asDetailsColor, colorType, false); - return "#" + Integer.toHexString(colorType.data).substring(2); + return "#" + Integer.toHexString(colorType.data).substring(2); //$NON-NLS-1$ } /* ====================================================================== @@ -134,7 +134,6 @@ public class UpdateAdapter extends CursorAdapter { @SuppressWarnings("nls") public synchronized void setFieldContentsAndVisibility(View view, Update update) { JSONObject user = ActFmPreferenceService.userFromModel(update); - Resources r = fragment.getResources(); // picture final AsyncImageView pictureView = (AsyncImageView)view.findViewById(R.id.picture); { @@ -205,6 +204,7 @@ public class UpdateAdapter extends CursorAdapter { return String.format("%s", linkColor, string); //$NON-NLS-1$ } + @SuppressWarnings("nls") public static Spanned getUpdateComment (Update update, JSONObject user, String linkColor, String fromView) { if (user == null) { user = ActFmPreferenceService.userFromModel(update); @@ -216,9 +216,12 @@ public class UpdateAdapter extends CursorAdapter { otherUser = new JSONObject(); } - return getUpdateComment(update.getValue(Update.ACTION_CODE), user.optString("name"), update.getValue(Update.TARGET_NAME), update.getValue(Update.MESSAGE), - otherUser.optString("name"), update.getValue(Update.ACTION), linkColor, fromView); + return getUpdateComment(update.getValue(Update.ACTION_CODE), + user.optString("name"), update.getValue(Update.TARGET_NAME), + update.getValue(Update.MESSAGE), otherUser.optString("name"), + update.getValue(Update.ACTION), linkColor, fromView); } + public static Spanned getUpdateComment (String actionCode, String user, String targetName, String message, String otherUser, String action, String linkColor, String fromView) { if (TextUtils.isEmpty(user)) { user = ContextManager.getString(R.string.ENA_no_user); diff --git a/astrid/src/com/todoroo/astrid/legacy/AlarmDatabase.java b/astrid/src/com/todoroo/astrid/legacy/AlarmDatabase.java index 6545096fb..d610e9e8c 100644 --- a/astrid/src/com/todoroo/astrid/legacy/AlarmDatabase.java +++ b/astrid/src/com/todoroo/astrid/legacy/AlarmDatabase.java @@ -15,7 +15,7 @@ import com.todoroo.andlib.data.Table; * @author Tim Su * */ -@SuppressWarnings({"nls","deprecation"}) +@SuppressWarnings("nls") public class AlarmDatabase extends AbstractDatabase { // --- constants diff --git a/astrid/src/com/todoroo/astrid/legacy/TransitionalAlarm.java b/astrid/src/com/todoroo/astrid/legacy/TransitionalAlarm.java index 4efe16bc2..ef9538748 100644 --- a/astrid/src/com/todoroo/astrid/legacy/TransitionalAlarm.java +++ b/astrid/src/com/todoroo/astrid/legacy/TransitionalAlarm.java @@ -21,7 +21,6 @@ import com.todoroo.astrid.data.Task; * */ @SuppressWarnings("nls") -@Deprecated public class TransitionalAlarm extends AbstractModel { // --- table @@ -72,6 +71,7 @@ public class TransitionalAlarm extends AbstractModel { // --- data access boilerplate + @Deprecated public TransitionalAlarm() { super(); } diff --git a/astrid/src/com/todoroo/astrid/service/Astrid2To3UpgradeHelper.java b/astrid/src/com/todoroo/astrid/service/Astrid2To3UpgradeHelper.java index c76c3a480..b658811f8 100644 --- a/astrid/src/com/todoroo/astrid/service/Astrid2To3UpgradeHelper.java +++ b/astrid/src/com/todoroo/astrid/service/Astrid2To3UpgradeHelper.java @@ -44,7 +44,6 @@ import com.todoroo.astrid.legacy.LegacyTaskModel; import com.todoroo.astrid.legacy.TransitionalAlarm; import com.todoroo.astrid.tags.TagService; -@SuppressWarnings("deprecation") public class Astrid2To3UpgradeHelper { @Autowired @@ -128,6 +127,7 @@ public class Astrid2To3UpgradeHelper { * Perform the upgrade from Astrid 2 to Astrid 3 * @param context2 */ + @SuppressWarnings("deprecation") public void upgrade2To3(final Context context, final int from) { // if from < 1 (we don't know what version, and database exists, leave it alone) diff --git a/astrid/src/com/todoroo/astrid/service/abtesting/ABOptions.java b/astrid/src/com/todoroo/astrid/service/abtesting/ABOptions.java index 2b091f5e1..b59bad1ff 100644 --- a/astrid/src/com/todoroo/astrid/service/abtesting/ABOptions.java +++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABOptions.java @@ -9,7 +9,6 @@ import java.util.List; * @author Sam Bosley * */ -@SuppressWarnings("nls") public class ABOptions { public ABOptions() { @@ -149,7 +148,7 @@ public class ABOptions { * tagged from StatisticsService, they will be appended with attributes * that have that event in this array */ - private void addOption(String optionKey, int[] probs, String[] descriptions, String[] relevantEvents) { + public void addOption(String optionKey, int[] probs, String[] descriptions, String[] relevantEvents) { ABOptionBundle bundle = new ABOptionBundle(probs, descriptions); bundles.put(optionKey, bundle); diff --git a/astrid/src/com/todoroo/astrid/ui/ContactListAdapter.java b/astrid/src/com/todoroo/astrid/ui/ContactListAdapter.java index 32ee2817a..85fefd0c9 100644 --- a/astrid/src/com/todoroo/astrid/ui/ContactListAdapter.java +++ b/astrid/src/com/todoroo/astrid/ui/ContactListAdapter.java @@ -39,8 +39,6 @@ public class ContactListAdapter extends CursorAdapter { @Autowired TagDataService tagDataService; - private final Activity activity; - private static final String[] PEOPLE_PROJECTION = new String[] { Email._ID, Email.CONTACT_ID, ContactsContract.Contacts.DISPLAY_NAME, Email.DATA }; @@ -49,7 +47,6 @@ public class ContactListAdapter extends CursorAdapter { public ContactListAdapter(Activity activity, Cursor c) { super(activity, c); - this.activity = activity; mContent = activity.getContentResolver(); DependencyInjectionService.getInstance().inject(this); } diff --git a/astrid/src/com/todoroo/astrid/ui/PeopleContainer.java b/astrid/src/com/todoroo/astrid/ui/PeopleContainer.java index 82597a60f..d6a02f983 100644 --- a/astrid/src/com/todoroo/astrid/ui/PeopleContainer.java +++ b/astrid/src/com/todoroo/astrid/ui/PeopleContainer.java @@ -55,6 +55,10 @@ public class PeopleContainer extends LinearLayout { // --- methods + public TextView addPerson() { + return addPerson("", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + /** Adds a tag to the tag field */ public TextView addPerson(String person, String image) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -121,13 +125,12 @@ public class PeopleContainer extends LinearLayout { int after) { // } + @SuppressWarnings("nls") @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if(count > 0 && getLastTextView() == textView) { - addPerson("", ""); //$NON-NLS-1$ - } - else { + addPerson("", ""); } if (TextUtils.isEmpty(textView.getText())) { imageView.setDefaultImageResource(R.drawable.icn_add_contact); @@ -144,12 +147,13 @@ public class PeopleContainer extends LinearLayout { }); textView.setOnEditorActionListener(new OnEditorActionListener() { + @SuppressWarnings("nls") @Override public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) { if(actionId != EditorInfo.IME_NULL) return false; if(getLastTextView().getText().length() != 0) { - addPerson("", ""); //$NON-NLS-1$ + addPerson("", ""); } return true; } diff --git a/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java b/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java index 3ec55b29b..d3816a8d0 100644 --- a/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java @@ -55,7 +55,7 @@ public abstract class PopupControlSet extends TaskEditControlSet { this.displayText = null; } - titleString = (title > 0) ? activity.getString(title) : ""; + titleString = (title > 0) ? activity.getString(title) : ""; //$NON-NLS-1$ if (displayView != null) { displayView.setOnClickListener(getDisplayClickListener()); diff --git a/astrid/src/com/todoroo/astrid/ui/RandomReminderControlSet.java b/astrid/src/com/todoroo/astrid/ui/RandomReminderControlSet.java index 25ced0bdb..f7ed8b6b6 100644 --- a/astrid/src/com/todoroo/astrid/ui/RandomReminderControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/RandomReminderControlSet.java @@ -25,14 +25,12 @@ public class RandomReminderControlSet extends TaskEditControlSet { private final CheckBox settingCheckbox; private final Spinner periodSpinner; - private final View parentView; private boolean periodSpinnerInitialized = false; private final int[] hours; public RandomReminderControlSet(Activity activity, View parentView, int layout) { super(activity, layout); - this.parentView = parentView; settingCheckbox = (CheckBox) parentView.findViewById(R.id.reminder_random); periodSpinner = (Spinner) parentView.findViewById(R.id.reminder_random_interval); periodSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { diff --git a/astrid/src/com/todoroo/astrid/voice/VoiceInputAssistant.java b/astrid/src/com/todoroo/astrid/voice/VoiceInputAssistant.java index 9ee75e8b7..183aa6a06 100644 --- a/astrid/src/com/todoroo/astrid/voice/VoiceInputAssistant.java +++ b/astrid/src/com/todoroo/astrid/voice/VoiceInputAssistant.java @@ -314,8 +314,7 @@ public class VoiceInputAssistant { // User wants to install voice search, take them to the market Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + packageName)); //$NON-NLS-1$ - if (ContextManager.getContext() instanceof Activity) { - Activity activity = (Activity) ContextManager.getContext(); + if (activity != null) { try { activity.startActivity(marketIntent); } catch (ActivityNotFoundException ane) {