Improvements to gtasks import ui

pull/14/head
Sam Bosley 12 years ago
parent 8049a3395d
commit 79afb0b861

@ -96,7 +96,7 @@ public class GtasksPreferences extends SyncProviderPreferences {
private void startBlockingImport() {
//TODO: Implement me
final ProgressDialog pd = DialogUtilities.progressDialog(this, "Importing Google Tasks");
final ProgressDialog pd = DialogUtilities.progressDialog(this, getString(R.string.gtasks_import_progress));
pd.setCancelable(false);
pd.show();
@ -106,8 +106,13 @@ public class GtasksPreferences extends SyncProviderPreferences {
super.finished();
for (GtasksImportTuple tuple : importConflicts) {
final GtasksImportTuple finalTuple = tuple;
DialogUtilities.okCancelDialog(GtasksPreferences.this,
"Add task " + tuple.taskUuid + " to shared list " + tuple.tagUuid + "?",
String prompt = getString(R.string.gtasks_import_add_to_shared_list, tuple.tagName, tuple.taskName);
DialogUtilities.okCancelCustomDialog(GtasksPreferences.this,
getString(R.string.gtasks_import_dlg_title),
prompt,
R.string.gtasks_import_add_task_ok,
R.string.gtasks_import_add_task_cancel,
android.R.drawable.ic_dialog_alert,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@ -116,7 +121,8 @@ public class GtasksPreferences extends SyncProviderPreferences {
task.setUuid(finalTuple.taskUuid);
tagService.createLink(task, finalTuple.tagName, finalTuple.tagUuid);
}
}, null);
},
null);
}
DialogUtilities.dismissDialog(GtasksPreferences.this, pd);
}

@ -118,6 +118,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
public static class GtasksImportTuple {
public long taskId;
public String taskName;
public String taskUuid;
public String tagUuid;
public String tagName;
@ -405,7 +406,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
}
private void finishImport(SyncResultCallback callback) {
TodorooCursor<Task> tasks = taskService.query(Query.select(Task.ID, Task.UUID, GtasksList.NAME)
TodorooCursor<Task> tasks = taskService.query(Query.select(Task.ID, Task.UUID, Task.TITLE, GtasksList.NAME)
.join(Join.inner(Metadata.TABLE, Task.ID.eq(Metadata.TASK)))
.join(Join.left(StoreObject.TABLE, GtasksMetadata.LIST_ID.eq(GtasksList.REMOTE_ID)))
.where(MetadataCriteria.withKey(GtasksMetadata.METADATA_KEY)));
@ -430,6 +431,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
if (tagMetadataDao.tagHasMembers(tagUuid) && !taskIsInTag) {
GtasksImportTuple tuple = new GtasksImportTuple();
tuple.taskId = tasks.get(Task.ID);
tuple.taskName = tasks.get(Task.TITLE);
tuple.taskUuid = tasks.get(Task.UUID);
tuple.tagUuid = tagUuid;
tuple.tagName = listName;

@ -102,5 +102,15 @@
<string name="gtasks_dual_sync_warning">You are currently synchronizing with Astrid.com.
Be advised that synchronizing with both services can in some cases lead to unexpected results.
Are you sure you want to sync with Google Tasks?</string>
<string name="gtasks_import_progress">Importing Google Tasks...</string>
<string name="gtasks_import_add_to_shared_list">The list %1$s is shared with others! Do you still want to add the task %2$s to it?</string>
<string name="gtasks_import_dlg_title">Google Tasks Import</string>
<string name="gtasks_import_add_task_ok">Add task</string>
<string name="gtasks_import_add_task_cancel">Don\'t add task</string>
</resources>

Loading…
Cancel
Save