diff --git a/app/src/main/java/com/etesync/syncadapter/ui/AccountActivity.java b/app/src/main/java/com/etesync/syncadapter/ui/AccountActivity.java index f8b6e0f4..579dce17 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/AccountActivity.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/AccountActivity.java @@ -67,6 +67,7 @@ import java.io.IOException; import java.util.List; import java.util.logging.Level; +import at.bitfire.ical4android.Task; import at.bitfire.ical4android.TaskProvider; import at.bitfire.vcard4android.ContactsStorageException; import io.requery.Persistable; @@ -192,6 +193,11 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC info.type = CollectionInfo.Type.ADDRESS_BOOK; startActivity(CreateCollectionActivity.newIntent(AccountActivity.this, account, info)); break; + case R.id.create_task_list: + info = new CollectionInfo(); + info.type = CollectionInfo.Type.TASK_LIST; + startActivity(CreateCollectionActivity.newIntent(AccountActivity.this, account, info)); + break; } return false; } @@ -366,7 +372,12 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC info.caldav = new AccountInfo.ServiceInfo(); info.caldav.id = id; info.caldav.refreshing = (davService != null && davService.isRefreshing(id)) || - ContentResolver.isSyncActive(account, CalendarContract.AUTHORITY) || + ContentResolver.isSyncActive(account, CalendarContract.AUTHORITY); + info.caldav.journals = JournalEntity.getJournals(data, serviceEntity); + } else if (service.equals(CollectionInfo.Type.TASK_LIST)) { + info.caldav = new AccountInfo.ServiceInfo(); + info.caldav.id = id; + info.caldav.refreshing = (davService != null && davService.isRefreshing(id)) || ContentResolver.isSyncActive(account, TaskProvider.ProviderName.OpenTasks.authority); info.caldav.journals = JournalEntity.getJournals(data, serviceEntity); } diff --git a/app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionActivity.java b/app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionActivity.java index 808fc26f..39ee2fdb 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionActivity.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionActivity.java @@ -73,7 +73,13 @@ public class CreateCollectionActivity extends BaseActivity { }).show(); } }); - } else { + } else if (info.type == CollectionInfo.Type.TASK_LIST) { + setTitle(R.string.create_tasklist); + displayName.setHint(R.string.create_tasklist_display_name_hint); + + final View colorGroup = findViewById(R.id.color_group); + colorGroup.setVisibility(View.GONE); + } else if (info.type == CollectionInfo.Type.ADDRESS_BOOK) { setTitle(R.string.create_addressbook); displayName.setHint(R.string.create_addressbook_display_name_hint); diff --git a/app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionFragment.java b/app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionFragment.java index d23fc146..cc666032 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionFragment.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionFragment.java @@ -36,6 +36,7 @@ import com.etesync.syncadapter.model.JournalEntity; import com.etesync.syncadapter.model.JournalModel; import com.etesync.syncadapter.model.ServiceEntity; +import at.bitfire.ical4android.TaskProvider; import io.requery.Persistable; import io.requery.sql.EntityDataStore; import okhttp3.HttpUrl; @@ -133,6 +134,8 @@ public class CreateCollectionFragment extends DialogFragment implements LoaderMa authority = App.getAddressBooksAuthority(); } else if (info.type == CollectionInfo.Type.CALENDAR) { authority = CalendarContract.AUTHORITY; + } else if (info.type == CollectionInfo.Type.TASK_LIST) { + authority = TaskProvider.ProviderName.OpenTasks.authority; } else { throw new IllegalArgumentException("Collection must be an address book or calendar"); } diff --git a/app/src/main/java/com/etesync/syncadapter/ui/journalviewer/ListEntriesFragment.java b/app/src/main/java/com/etesync/syncadapter/ui/journalviewer/ListEntriesFragment.java index 40ce849b..62564150 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/journalviewer/ListEntriesFragment.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/journalviewer/ListEntriesFragment.java @@ -140,6 +140,8 @@ public class ListEntriesFragment extends ListFragment implements AdapterView.OnI String prefix; if (info.type == CollectionInfo.Type.CALENDAR) { prefix = "SUMMARY:"; + } else if (info.type == CollectionInfo.Type.TASK_LIST) { + prefix = "SUMMARY:"; } else { prefix = "FN:"; } diff --git a/app/src/main/res/menu/vtodo_actions.xml b/app/src/main/res/menu/vtodo_actions.xml new file mode 100644 index 00000000..a39ac34c --- /dev/null +++ b/app/src/main/res/menu/vtodo_actions.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f88c5843..017bb1a2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -260,6 +260,8 @@ My Address Book Create calendar My Calendar + Create task list + My Task List Edit collection Set the calendar\'s color Creating collection