mirror of
https://github.com/etesync/android
synced 2024-11-21 23:48:11 +00:00
More tasks progress.
This commit is contained in:
parent
5ebc101ca6
commit
e5a409f538
@ -83,8 +83,8 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC
|
||||
private Account account;
|
||||
private AccountInfo accountInfo;
|
||||
|
||||
ListView listCalDAV, listCardDAV;
|
||||
Toolbar tbCardDAV, tbCalDAV;
|
||||
ListView listCalDAV, listCardDAV, listTasks;
|
||||
Toolbar tbCardDAV, tbCalDAV, tbTasks;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -111,6 +111,14 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC
|
||||
tbCalDAV.setOnMenuItemClickListener(this);
|
||||
tbCalDAV.setTitle(R.string.settings_caldav);
|
||||
|
||||
// Tasks toolbar
|
||||
tbTasks = (Toolbar)findViewById(R.id.tasks_menu);
|
||||
tbTasks.setOverflowIcon(icMenu);
|
||||
tbTasks.inflateMenu(R.menu.vtodo_actions);
|
||||
tbTasks.setOnMenuItemClickListener(this);
|
||||
tbTasks.setTitle(R.string.settings_tasks);
|
||||
|
||||
|
||||
// load CardDAV/CalDAV journals
|
||||
getLoaderManager().initLoader(0, getIntent().getExtras(), this);
|
||||
|
||||
@ -228,7 +236,7 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC
|
||||
/* LOADERS AND LOADED DATA */
|
||||
|
||||
protected static class AccountInfo {
|
||||
ServiceInfo carddav, caldav;
|
||||
ServiceInfo carddav, caldav, tasks;
|
||||
|
||||
public static class ServiceInfo {
|
||||
long id;
|
||||
@ -283,6 +291,21 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC
|
||||
listCalDAV.setOnItemClickListener(onItemClickListener);
|
||||
} else
|
||||
card.setVisibility(View.GONE);
|
||||
|
||||
card = (CardView)findViewById(R.id.tasklist);
|
||||
if (info.tasks != null) {
|
||||
ProgressBar progress = (ProgressBar)findViewById(R.id.caldav_refreshing);
|
||||
progress.setVisibility(info.tasks.refreshing ? View.VISIBLE : View.GONE);
|
||||
|
||||
listTasks = (ListView)findViewById(R.id.calendars);
|
||||
listTasks.setEnabled(!info.tasks.refreshing);
|
||||
listTasks.setAlpha(info.tasks.refreshing ? 0.5f : 1);
|
||||
|
||||
final CollectionListAdapter adapter = new CollectionListAdapter(this, account);
|
||||
adapter.addAll(info.tasks.journals);
|
||||
listTasks.setAdapter(adapter);
|
||||
listTasks.setOnItemClickListener(onItemClickListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -292,6 +315,9 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC
|
||||
|
||||
if (listCalDAV != null)
|
||||
listCalDAV.setAdapter(null);
|
||||
|
||||
if (listTasks != null)
|
||||
listTasks.setAdapter(null);
|
||||
}
|
||||
|
||||
|
||||
@ -375,11 +401,11 @@ public class AccountActivity extends BaseActivity implements Toolbar.OnMenuItemC
|
||||
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)) ||
|
||||
info.tasks = new AccountInfo.ServiceInfo();
|
||||
info.tasks.id = id;
|
||||
info.tasks.refreshing = (davService != null && davService.isRefreshing(id)) ||
|
||||
ContentResolver.isSyncActive(account, TaskProvider.ProviderName.OpenTasks.authority);
|
||||
info.caldav.journals = JournalEntity.getJournals(data, serviceEntity);
|
||||
info.tasks.journals = JournalEntity.getJournals(data, serviceEntity);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
|
@ -100,5 +100,46 @@
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/tasklist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:cardElevation="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/tasks_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/toolbar_theme"
|
||||
style="@style/toolbar_style"
|
||||
app:navigationIcon="@drawable/ic_event_light"
|
||||
app:title="@string/settings_tasks"
|
||||
android:elevation="2dp" tools:ignore="UnusedAttribute"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/tasks_refreshing"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:indeterminate="true"/>
|
||||
|
||||
<com.etesync.syncadapter.ui.widget.MaximizedListView
|
||||
android:id="@+id/tasks"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:choiceMode="multipleChoice"
|
||||
android:descendantFocusability="beforeDescendants"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -254,6 +254,7 @@
|
||||
<string name="settings_sync_wifi_only_ssid_message">Enter the name of a WiFi network (SSID) to restrict synchronization to this network, or leave blank for all WiFi connections.</string>
|
||||
<string name="settings_carddav">Contacts</string>
|
||||
<string name="settings_caldav">Calendar</string>
|
||||
<string name="settings_tasks">Tasks</string>
|
||||
|
||||
<!-- collection management -->
|
||||
<string name="create_addressbook">Create address book</string>
|
||||
|
Loading…
Reference in New Issue
Block a user