1
0
mirror of https://github.com/etesync/android synced 2024-11-22 16:08:13 +00:00

Continue bringing back the task list.

This commit is contained in:
Tom Hacohen 2017-12-11 10:51:26 +00:00
parent 23ab80acc0
commit 5ebc101ca6
6 changed files with 41 additions and 2 deletions

View File

@ -67,6 +67,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import at.bitfire.ical4android.Task;
import at.bitfire.ical4android.TaskProvider; import at.bitfire.ical4android.TaskProvider;
import at.bitfire.vcard4android.ContactsStorageException; import at.bitfire.vcard4android.ContactsStorageException;
import io.requery.Persistable; import io.requery.Persistable;
@ -192,6 +193,11 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC
info.type = CollectionInfo.Type.ADDRESS_BOOK; info.type = CollectionInfo.Type.ADDRESS_BOOK;
startActivity(CreateCollectionActivity.newIntent(AccountActivity.this, account, info)); startActivity(CreateCollectionActivity.newIntent(AccountActivity.this, account, info));
break; 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; return false;
} }
@ -366,7 +372,12 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC
info.caldav = new AccountInfo.ServiceInfo(); info.caldav = new AccountInfo.ServiceInfo();
info.caldav.id = id; info.caldav.id = id;
info.caldav.refreshing = (davService != null && davService.isRefreshing(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); ContentResolver.isSyncActive(account, TaskProvider.ProviderName.OpenTasks.authority);
info.caldav.journals = JournalEntity.getJournals(data, serviceEntity); info.caldav.journals = JournalEntity.getJournals(data, serviceEntity);
} }

View File

@ -73,7 +73,13 @@ public class CreateCollectionActivity extends BaseActivity {
}).show(); }).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); setTitle(R.string.create_addressbook);
displayName.setHint(R.string.create_addressbook_display_name_hint); displayName.setHint(R.string.create_addressbook_display_name_hint);

View File

@ -36,6 +36,7 @@ import com.etesync.syncadapter.model.JournalEntity;
import com.etesync.syncadapter.model.JournalModel; import com.etesync.syncadapter.model.JournalModel;
import com.etesync.syncadapter.model.ServiceEntity; import com.etesync.syncadapter.model.ServiceEntity;
import at.bitfire.ical4android.TaskProvider;
import io.requery.Persistable; import io.requery.Persistable;
import io.requery.sql.EntityDataStore; import io.requery.sql.EntityDataStore;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
@ -133,6 +134,8 @@ public class CreateCollectionFragment extends DialogFragment implements LoaderMa
authority = App.getAddressBooksAuthority(); authority = App.getAddressBooksAuthority();
} else if (info.type == CollectionInfo.Type.CALENDAR) { } else if (info.type == CollectionInfo.Type.CALENDAR) {
authority = CalendarContract.AUTHORITY; authority = CalendarContract.AUTHORITY;
} else if (info.type == CollectionInfo.Type.TASK_LIST) {
authority = TaskProvider.ProviderName.OpenTasks.authority;
} else { } else {
throw new IllegalArgumentException("Collection must be an address book or calendar"); throw new IllegalArgumentException("Collection must be an address book or calendar");
} }

View File

@ -140,6 +140,8 @@ public class ListEntriesFragment extends ListFragment implements AdapterView.OnI
String prefix; String prefix;
if (info.type == CollectionInfo.Type.CALENDAR) { if (info.type == CollectionInfo.Type.CALENDAR) {
prefix = "SUMMARY:"; prefix = "SUMMARY:";
} else if (info.type == CollectionInfo.Type.TASK_LIST) {
prefix = "SUMMARY:";
} else { } else {
prefix = "FN:"; prefix = "FN:";
} }

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright © 2013 2016 Ricki Hirner (bitfire web engineering).
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the GNU Public License v3.0
~ which accompanies this distribution, and is available at
~ http://www.gnu.org/licenses/gpl.html
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/create_task_list"
android:title="@string/create_tasklist"/>
</menu>

View File

@ -260,6 +260,8 @@
<string name="create_addressbook_display_name_hint">My Address Book</string> <string name="create_addressbook_display_name_hint">My Address Book</string>
<string name="create_calendar">Create calendar</string> <string name="create_calendar">Create calendar</string>
<string name="create_calendar_display_name_hint">My Calendar</string> <string name="create_calendar_display_name_hint">My Calendar</string>
<string name="create_tasklist">Create task list</string>
<string name="create_tasklist_display_name_hint">My Task List</string>
<string name="edit_collection">Edit collection</string> <string name="edit_collection">Edit collection</string>
<string name="create_collection_color">Set the calendar\'s color</string> <string name="create_collection_color">Set the calendar\'s color</string>
<string name="create_collection_creating">Creating collection</string> <string name="create_collection_creating">Creating collection</string>