Bug fixes in preparation for 2.7:

- Fixed a couple issues with German localization
  - not listing smart lists in synchronization dialog
  - fixed bug where hiding a tag that corresponds to an RTM list doesn't work well
  - localizing more synchronization strings
pull/14/head
Tim Su 16 years ago
parent 309431bcdc
commit 96e5f46ef9

Binary file not shown.

Binary file not shown.

@ -1,50 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
ASTRID: Android's Simple Task Recording Dashboard
Copyright (c) 2009 Tim Su
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<!--
ASTRID: Android's Simple Task Recording Dashboard Copyright (c) 2009 Tim
Su This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version. This program is distributed in the hope that
it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. You should have received a
copy of the GNU General Public License along with this program; if not,
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- application -->
<string name="app_name">Astrid</string>
<!-- General String Constants -->
<skip />
<!-- Importance Labels -->
<string name="importance_1">!!!!</string>
<string name="importance_2">!!!</string>
<string name="importance_3">!!</string>
<string name="importance_4">!</string>
<!-- Repeat Interval Labels -->
<string name="repeat_days">Tag(e)</string>
<string name="repeat_weeks">Woche(n)</string>
<string name="repeat_months">Monat(e)</string>
<string name="repeat_hours">Stunde(n)</string>
<!-- Plurals -->
<plurals name="Ntasks">
<item quantity="one">1 Aufgabe</item>
<item quantity="other">%d Aufgaben</item>
</plurals>
<plurals name="NactiveTasks">
<item quantity="one">%d / %d Aktiv</item>
<!-- Importance Labels -->
<string name="importance_1">!!!!</string>
<string name="importance_2">!!!</string>
<string name="importance_3">!!</string>
<string name="importance_4">!</string>
<!-- Repeat Interval Labels -->
<string name="repeat_days">Tag(e)</string>
<string name="repeat_weeks">Woche(n)</string>
<string name="repeat_months">Monat(e)</string>
<string name="repeat_hours">Stunde(n)</string>
<!-- Plurals -->
<plurals name="Ntasks">
<item quantity="one">1 Aufgabe</item>
<item quantity="other">%d Aufgaben</item>
</plurals>
<plurals name="NactiveTasks">
<item quantity="one">%d / %d Aktiv</item>
<item quantity="other">%d / %d Aktiv</item>
</plurals>
<plurals name="Nalarms">
@ -58,11 +51,11 @@
</plurals>
<!-- Time Constants -->
<string name="dateFormatter">d. MMM</string> <!-- used for long due
<string name="dateFormatter">d. MMMM</string> <!-- used for long due
dates. c.f. Java's SimpleDateFormat -->
<string name="daysVertical">D\na\ny\ns</string> <!-- vertical labels
<string name="daysVertical">T\na\ng\ne</string> <!-- vertical labels
are used in the number dialogs -->
<string name="hoursVertical">H\no\nu\nr\ns</string>
<string name="hoursVertical">S\nt\nu\nn\nd\ne\nn</string>
<plurals name="Ndays">
<item quantity="one">1 Tag</item>
<item quantity="other">%d Tage</item>

@ -261,6 +261,7 @@ If you don\'t want to see the new task right after you complete the old one, you
<string name="p_sync_quiet">sync_dialogs</string>
<string name="sync_quiet_title">Hide Dialogs</string>
<string name="sync_quiet_desc">Hide the Sync Results dialogs</string>
<string name="p_sync_bgwifi">sync_bgwifi</string>
<string name="sync_bgwifi_title">Auto-Sync Wifi Only</string>
<string name="sync_bgwifi_desc">If set, auto-sync only happens when Wifi is active</string>
<string name="sync_error">Sync Error! Sorry for the inconvenience! Error:</string>
@ -276,6 +277,7 @@ occur (it is a minor drain on battery).
</string>
<string name="sync_now">Synchronize Now!</string>
<string name="sync_forget">Clear Personal Data</string>
<string name="sync_uptodate">Sync: Up to date!</string>
<string name="sync_forget_confirm">Clear data for selected services?</string>
<string name="sync_no_synchronizers">No Synchronizers Enabled!</string>
<string name="sync_last_sync">Last Sync Date: %s</string>
@ -288,6 +290,14 @@ occur (it is a minor drain on battery).
<string name="sync_result_updated">Updated: %d</string>
<string name="sync_result_deleted">Deleted: %d</string>
<string name="sync_result_merged">Merged: %d</string>
<string name="sync_progress_remote">Reading Remote Data</string>
<string name="sync_progress_rxlist">Reading List: %s</string>
<string name="sync_progress_repeating">Synchronizing Repeating Task</string>
<string name="sync_progress_localtx">Sending Task: %s</string>
<string name="sync_progress_localdel">Locally Deleted Tasks</string>
<string name="sync_progress_remotetx">Receiving Task: %s</string>
<!-- Dialog Boxes -->
<skip />

@ -24,17 +24,19 @@ import org.w3c.dom.Element;
public class RtmList extends RtmData {
private final String id;
private final boolean smart;
private final String name;
public RtmList(String id, String name) {
public RtmList(String id, String name, boolean smart) {
this.id = id;
this.name = name;
this.smart = smart;
}
public RtmList(Element elt) {
id = elt.getAttribute("id");
name = elt.getAttribute("name");
smart = elt.getAttribute("smart") == "1";
}
public String getId() {
@ -44,4 +46,8 @@ public class RtmList extends RtmData {
public String getName() {
return name;
}
public boolean isSmart() {
return smart;
}
}

@ -146,7 +146,26 @@ public class TagController extends AbstractController {
return saveSucessful;
}
/** Returns a TaskModelForView corresponding to the given TaskIdentifier */
/** Returns a TaskModelForView corresponding to the given Tag Name */
public TagModelForView fetchTagFromName(String name) throws SQLException {
Cursor cursor = tagDatabase.query(true, TAG_TABLE_NAME,
TagModelForView.FIELD_LIST,
AbstractTagModel.NAME + " = ?", new String[] {name}, null, null, null, null);
try {
if (cursor != null) {
cursor.moveToFirst();
TagModelForView model = new TagModelForView(cursor);
return model;
}
return null;
} finally {
if(cursor != null)
cursor.close();
}
}
/** Returns a TaskModelForView corresponding to the given TagIdentifier */
public TagModelForView fetchTagForView(TagIdentifier tagId) throws SQLException {
long id = tagId.getId();
Cursor cursor = tagDatabase.query(true, TAG_TABLE_NAME,

@ -51,6 +51,8 @@ import com.timsu.astrid.R;
import com.timsu.astrid.activities.TaskList;
import com.timsu.astrid.data.enums.Importance;
import com.timsu.astrid.data.sync.SyncMapping;
import com.timsu.astrid.data.tag.TagController;
import com.timsu.astrid.data.tag.TagModelForView;
import com.timsu.astrid.data.task.AbstractTaskModel;
import com.timsu.astrid.data.task.TaskModelForSync;
import com.timsu.astrid.utilities.DialogUtilities;
@ -168,7 +170,7 @@ public class RTMSyncProvider extends SynchronizationProvider {
private void performSyncInNewThread(final Context context) {
try {
postUpdate(new ProgressLabelUpdater("Reading remote data"));
postUpdate(new ProgressLabelUpdater(context, R.string.sync_progress_remote));
postUpdate(new ProgressUpdater(0, 5));
// get RTM timeline
@ -188,13 +190,15 @@ public class RTMSyncProvider extends SynchronizationProvider {
TaskModelForSync task = synchronizer.getTaskController(context).
fetchTaskForSync(getSingleTaskForSync());
localTask.readFromTaskModel(task);
postUpdate(new ProgressLabelUpdater("Synchronizing repeating task"));
postUpdate(new ProgressLabelUpdater(context, R.string.sync_progress_repeating));
pushLocalTask(timeline, localTask, null, mapping);
}
// load RTM lists
RtmLists lists = rtmService.lists_getList();
for(RtmList list : lists.getLists().values()) {
if(list.isSmart())
continue;
listNameToIdMap.put(list.getName().toLowerCase(), list.getId());
listIdToNameMap.put(list.getId(), list.getName());
@ -218,8 +222,9 @@ public class RTMSyncProvider extends SynchronizationProvider {
postUpdate(new ProgressUpdater(3, 5));
RtmTasks tasks = rtmService.tasks_getList(null, filter, lastSyncDate);
postUpdate(new ProgressUpdater(5, 5));
addTasksToList(tasks, remoteChanges);
addTasksToList(context, tasks, remoteChanges);
} catch (Exception e) {
Log.e("rtmsync", "Error sync-ing list!", e);
remoteChanges.clear();
shouldSyncIndividualLists = true;
}
@ -227,21 +232,22 @@ public class RTMSyncProvider extends SynchronizationProvider {
if(shouldSyncIndividualLists) {
int progress = 0;
for(final Entry<String, String> entry : listIdToNameMap.entrySet()) {
postUpdate(new ProgressLabelUpdater("Reading " +
" list: " + entry.getValue()));
postUpdate(new ProgressLabelUpdater(context,
R.string.sync_progress_rxlist, entry.getValue()));
postUpdate(new ProgressUpdater(progress++,
listIdToNameMap.size()));
try {
Thread.sleep(1500);
RtmTasks tasks = rtmService.tasks_getList(entry.getKey(),
filter, lastSyncDate);
addTasksToList(tasks, remoteChanges);
addTasksToList(context, tasks, remoteChanges);
} catch (Exception e) {
Log.e("rtmsync", "Error sync-ing list!", e);
postUpdate(new Runnable() {
public void run() {
DialogUtilities.okDialog(context,
"List '" + entry.getValue() +
"' import failed (too big?)", null);
"Sorry, list '" + entry.getValue() +
"' import failed. Try again later!", null);
}
});
continue;
@ -250,7 +256,7 @@ public class RTMSyncProvider extends SynchronizationProvider {
postUpdate(new ProgressUpdater(1, 1));
}
synchronizeTasks(context, remoteChanges, new RtmSyncHelper(timeline));
synchronizeTasks(context, remoteChanges, new RtmSyncHelper(context, timeline));
// add a bit of fudge time so we don't load tasks we just edited
Date syncTime = new Date(System.currentTimeMillis() + 1000);
@ -268,11 +274,12 @@ public class RTMSyncProvider extends SynchronizationProvider {
// --- helper methods
/** Add the tasks read from RTM to the given list */
private void addTasksToList(RtmTasks tasks, LinkedList<TaskProxy> list) {
private void addTasksToList(Context context, RtmTasks tasks, LinkedList<TaskProxy> list) {
for(RtmTaskList taskList : tasks.getLists()) {
for(RtmTaskSeries taskSeries : taskList.getSeries()) {
TaskProxy remoteTask =
parseRemoteTask(taskList.getId(), taskSeries);
parseRemoteTask(taskList.getId(), taskSeries,
synchronizer.getTagController(context));
list.add(remoteTask);
}
}
@ -296,7 +303,7 @@ public class RTMSyncProvider extends SynchronizationProvider {
if(remoteTask == null) {
RtmTaskSeries rtmTask = rtmService.tasks_getTask(id.taskSeriesId, task.name);
if(rtmTask != null)
remoteTask = parseRemoteTask(id.listId, rtmTask);
remoteTask = parseRemoteTask(id.listId, rtmTask, null);
}
if(remoteTask == null)
remoteTask = getDefaultTaskProxy();
@ -339,8 +346,16 @@ public class RTMSyncProvider extends SynchronizationProvider {
// tags
if(task.tags != null && !task.tags.equals(remoteTask.tags)) {
String listName = listIdToNameMap.get(id.listId);
if(task.tags.size() > 0 && listName.equals(task.tags.getFirst()))
task.tags.remove(0);
// if the first tag is the list, or _list, remove it
if(task.tags.size() > 0) {
String firstTag = task.tags.getFirst();
if(firstTag.startsWith(TagModelForView.HIDDEN_FROM_MAIN_LIST_PREFIX))
firstTag = firstTag.substring(TagModelForView.HIDDEN_FROM_MAIN_LIST_PREFIX.length());
if(firstTag.equals(listName))
task.tags.remove(0);
}
rtmService.tasks_setTags(timeline, id.listId, id.taskSeriesId,
id.taskId, task.tags.toArray(new String[task.tags.size()]));
}
@ -367,7 +382,8 @@ public class RTMSyncProvider extends SynchronizationProvider {
}
/** Create a task proxy for the given RtmTaskSeries */
private TaskProxy parseRemoteTask(String listId, RtmTaskSeries rtmTaskSeries) {
private TaskProxy parseRemoteTask(String listId, RtmTaskSeries
rtmTaskSeries, TagController tagController) {
TaskProxy task = new TaskProxy(getId(),
new RtmId(listId, rtmTaskSeries).toString());
@ -391,7 +407,13 @@ public class RTMSyncProvider extends SynchronizationProvider {
if(listName != null && !listName.equals(INBOX_LIST_NAME)) {
if(tagsList == null)
tagsList = new LinkedList<String>();
tagsList.addFirst(listName);
// if user has created a hidden version of this tag, use it
String hiddenName = TagModelForView.HIDDEN_FROM_MAIN_LIST_PREFIX + listName;
if(tagController != null && tagController.fetchTagFromName(hiddenName) != null)
tagsList.addFirst(hiddenName);
else
tagsList.addFirst(listName);
}
if(tagsList != null)
task.tags = tagsList;
@ -463,8 +485,9 @@ public class RTMSyncProvider extends SynchronizationProvider {
class RtmSyncHelper implements SynchronizeHelper {
private String timeline;
private String lastCreatedTask = null;
private Context context;
public RtmSyncHelper(String timeline) {
public RtmSyncHelper(Context context, String timeline) {
this.timeline = timeline;
}
public String createTask(TaskModelForSync task) throws IOException {
@ -494,7 +517,7 @@ public class RTMSyncProvider extends SynchronizationProvider {
task.name);
if(rtmTask == null)
return task; // can't fetch
return parseRemoteTask(id.listId, rtmTask);
return parseRemoteTask(id.listId, rtmTask, synchronizer.getTagController(context));
}
}

@ -215,7 +215,7 @@ public abstract class SynchronizationProvider {
log.append(">> on remote server:\n");
for(TaskIdentifier taskId : data.newlyCreatedTasks) {
TaskModelForSync task = taskController.fetchTaskForSync(taskId);
postUpdate(new ProgressLabelUpdater("Sending local task: " +
postUpdate(new ProgressLabelUpdater(context, R.string.sync_progress_localtx,
task.getName()));
postUpdate(new ProgressUpdater(stats.remoteCreatedTasks,
data.newlyCreatedTasks.size()));
@ -250,7 +250,7 @@ public abstract class SynchronizationProvider {
}
// 2. DELETE: find deleted tasks and remove them from the list
postUpdate(new ProgressLabelUpdater("Sending locally deleted tasks"));
postUpdate(new ProgressLabelUpdater(context, R.string.sync_progress_localdel));
for(TaskIdentifier taskId : data.deletedTasks) {
SyncMapping mapping = data.localIdToSyncMapping.get(taskId);
syncController.deleteSyncMapping(mapping);
@ -278,7 +278,7 @@ public abstract class SynchronizationProvider {
localTask.readTagsFromController(task.getTaskIdentifier(),
tagController, data.tags);
postUpdate(new ProgressLabelUpdater("Sending local task: " +
postUpdate(new ProgressLabelUpdater(context, R.string.sync_progress_localtx,
task.getName()));
postUpdate(new ProgressUpdater(stats.remoteUpdatedTasks,
data.localChanges.size()));
@ -317,10 +317,8 @@ public abstract class SynchronizationProvider {
postUpdate(new ProgressUpdater(0, 1));
for(TaskProxy remoteTask : remoteTasks) {
if(remoteTask.name != null)
postUpdate(new ProgressLabelUpdater("Updating local " +
"tasks: " + remoteTask.name));
else
postUpdate(new ProgressLabelUpdater("Updating local tasks"));
postUpdate(new ProgressLabelUpdater(context, R.string.sync_progress_remotetx,
remoteTask.name));
SyncMapping mapping = null;
TaskModelForSync task = null;
@ -527,7 +525,8 @@ public abstract class SynchronizationProvider {
mergedTasks + remoteCreatedTasks + remoteDeletedTasks +
remoteUpdatedTasks == 0) {
if(!isBackgroundService())
DialogUtilities.okDialog(context, "Sync: Up to date!", finishListener);
DialogUtilities.okDialog(context, context.getResources().
getString(R.string.sync_uptodate), finishListener);
return;
}
@ -577,8 +576,8 @@ public abstract class SynchronizationProvider {
protected class ProgressLabelUpdater implements Runnable {
String label;
public ProgressLabelUpdater(String label) {
this.label = label;
public ProgressLabelUpdater(Context context, int id, Object... args) {
this.label = context.getResources().getString(id, args);
}
public void run() {
if(isBackgroundService()) {

@ -212,11 +212,10 @@ public class Synchronizer {
typeClass = cls;
}
@SuppressWarnings("unchecked")
public TYPE get(Context context) {
if(controller == null) {
try {
controller = (TYPE)typeClass.getConstructors()[0].newInstance(
controller = typeClass.getConstructors()[0].newInstance(
context);
} catch (IllegalArgumentException e) {
Log.e(getClass().getSimpleName(), e.toString());

Loading…
Cancel
Save