Remove People
@ -1,48 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
package com.todoroo.astrid.people;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.todoroo.astrid.adapter.FilterAdapter;
|
||||
import com.todoroo.astrid.utility.Constants;
|
||||
|
||||
public class PeopleFilterAdapter extends FilterAdapter {
|
||||
|
||||
public static final String BROADCAST_REQUEST_PEOPLE_FILTERS = Constants.PACKAGE + ".REQUEST_PEOPLE_FILTERS"; //$NON-NLS-1$
|
||||
public static final String BROADCAST_SEND_PEOPLE_FILTERS = Constants.PACKAGE + ".SEND_PEOPLE_FILTERS"; //$NON-NLS-1$
|
||||
|
||||
public PeopleFilterAdapter(Activity activity, ListView listView,
|
||||
int rowLayout, boolean skipIntentFilters) {
|
||||
super(activity, listView, rowLayout, skipIntentFilters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLists() {
|
||||
Intent broadcastIntent = new Intent(BROADCAST_REQUEST_PEOPLE_FILTERS);
|
||||
activity.sendBroadcast(broadcastIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRecevier() {
|
||||
IntentFilter peopleFilter = new IntentFilter(BROADCAST_SEND_PEOPLE_FILTERS);
|
||||
activity.registerReceiver(filterReceiver, peopleFilter);
|
||||
getLists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterRecevier() {
|
||||
activity.unregisterReceiver(filterReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldDirectlyPopulateFilters() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
package com.todoroo.astrid.people;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.tasks.R;
|
||||
import com.todoroo.andlib.data.TodorooCursor;
|
||||
import com.todoroo.andlib.service.ContextManager;
|
||||
import com.todoroo.andlib.sql.Criterion;
|
||||
import com.todoroo.andlib.sql.Field;
|
||||
import com.todoroo.andlib.sql.Join;
|
||||
import com.todoroo.andlib.sql.Order;
|
||||
import com.todoroo.andlib.sql.Query;
|
||||
import com.todoroo.andlib.sql.QueryTemplate;
|
||||
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
|
||||
import com.todoroo.astrid.api.AstridApiConstants;
|
||||
import com.todoroo.astrid.api.Filter;
|
||||
import com.todoroo.astrid.api.FilterListItem;
|
||||
import com.todoroo.astrid.api.FilterWithCustomIntent;
|
||||
import com.todoroo.astrid.api.FilterWithUpdate;
|
||||
import com.todoroo.astrid.core.PluginServices;
|
||||
import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
|
||||
import com.todoroo.astrid.data.Metadata;
|
||||
import com.todoroo.astrid.data.RemoteModel;
|
||||
import com.todoroo.astrid.data.TagData;
|
||||
import com.todoroo.astrid.data.Task;
|
||||
import com.todoroo.astrid.data.User;
|
||||
import com.todoroo.astrid.service.ThemeService;
|
||||
import com.todoroo.astrid.tags.TaskToTagMetadata;
|
||||
import com.todoroo.astrid.utility.AstridPreferences;
|
||||
|
||||
public class PeopleFilterExposer extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
FilterListItem[] listAsArray = prepareFilters(context);
|
||||
|
||||
Intent broadcastIntent = new Intent(PeopleFilterAdapter.BROADCAST_SEND_PEOPLE_FILTERS);
|
||||
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, listAsArray);
|
||||
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_ADDON, "people"); //$NON-NLS-1$
|
||||
context.sendBroadcast(broadcastIntent);
|
||||
}
|
||||
|
||||
private FilterListItem[] prepareFilters(Context context) {
|
||||
TodorooCursor<User> users = PluginServices.getUserDao().query(Query.select(User.PROPERTIES)
|
||||
.where(Criterion.not(Criterion.or(User.STATUS.eq(User.STATUS_BLOCKED),
|
||||
User.STATUS.eq(User.STATUS_IGNORED), User.STATUS.eq(User.STATUS_RENOUNCE), User.STATUS.eq(User.STATUS_IGNORE))))
|
||||
.orderBy(Order.asc(User.FIRST_NAME), Order.asc(User.LAST_NAME), Order.asc(User.NAME)));
|
||||
try {
|
||||
List<FilterListItem> items = new ArrayList<FilterListItem>();
|
||||
items.add(mySharedTasks(context));
|
||||
User user = new User();
|
||||
for (users.moveToFirst(); !users.isAfterLast(); users.moveToNext()) {
|
||||
user.readFromCursor(users);
|
||||
if (ActFmPreferenceService.userId().equals(user.getValue(User.UUID))) {
|
||||
continue;
|
||||
}
|
||||
Filter currFilter = filterFromUserData(user);
|
||||
if (currFilter != null) {
|
||||
items.add(currFilter);
|
||||
}
|
||||
}
|
||||
return items.toArray(new FilterListItem[items.size()]);
|
||||
} finally {
|
||||
users.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static FilterWithCustomIntent filterFromUserData(User user) {
|
||||
String title = user.getDisplayName();
|
||||
if (TextUtils.isEmpty(title) || "null".equals(title)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String email = user.getValue(User.EMAIL);
|
||||
Criterion criterion;
|
||||
if (TextUtils.isEmpty(email) || "null".equals(email)) {
|
||||
criterion = Task.USER_ID.eq(user.getValue(User.UUID));
|
||||
} else {
|
||||
criterion = Criterion.or(Task.USER_ID.eq(user.getValue(User.UUID)),
|
||||
Task.USER.like("%" + email + "%")); // Deprecated field OK for backwards compatibility
|
||||
}
|
||||
|
||||
criterion = Criterion.and(TaskCriteria.activeAndVisible(), criterion);
|
||||
|
||||
QueryTemplate userTemplate = new QueryTemplate().where(criterion);
|
||||
|
||||
FilterWithUpdate filter = new FilterWithUpdate(title, title, userTemplate, null);
|
||||
|
||||
filter.customTaskList = new ComponentName(ContextManager.getContext(), PersonViewFragment.class);
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(Task.USER_ID.name, user.getValue(User.UUID));
|
||||
filter.valuesForNewTasks = values;
|
||||
|
||||
String imageUrl = user.getPictureUrl(User.PICTURE, RemoteModel.PICTURE_THUMB); //user.getValue(User.PICTURE);
|
||||
filter.imageUrl = imageUrl;
|
||||
|
||||
Bundle extras = new Bundle();
|
||||
extras.putLong(PersonViewFragment.EXTRA_USER_ID_LOCAL, user.getId());
|
||||
filter.customExtras = extras;
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
public static FilterWithCustomIntent mySharedTasks(Context context) {
|
||||
TodorooCursor<TagData> tagsWithMembers = PluginServices.getTagDataService()
|
||||
.query(Query.select(TagData.NAME).where(TagData.MEMBER_COUNT.gt(0)));
|
||||
String[] names;
|
||||
try {
|
||||
if (tagsWithMembers.getCount() == 0) {
|
||||
names = new String[1];
|
||||
names[0] = "\"\"";
|
||||
} else {
|
||||
names = new String[tagsWithMembers.getCount()];
|
||||
TagData curr = new TagData();
|
||||
int i = 0;
|
||||
for (tagsWithMembers.moveToFirst(); !tagsWithMembers.isAfterLast(); tagsWithMembers.moveToNext()) {
|
||||
curr.readFromCursor(tagsWithMembers);
|
||||
names[i] = "\"" + curr.getValue(TagData.NAME) + "\"";
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
tagsWithMembers.close();
|
||||
}
|
||||
|
||||
boolean isTablet = AstridPreferences.useTabletLayout(context);
|
||||
int themeFlags = isTablet ? ThemeService.FLAG_FORCE_LIGHT : 0;
|
||||
|
||||
String title = context.getString(R.string.actfm_my_shared_tasks_title);
|
||||
QueryTemplate template = new QueryTemplate().join(Join.inner(Metadata.TABLE.as("mtags"),
|
||||
Criterion.and(Task.ID.eq(Field.field("mtags." + Metadata.TASK.name)),
|
||||
Field.field("mtags." + Metadata.KEY.name).eq(TaskToTagMetadata.KEY),
|
||||
Field.field("mtags." + TaskToTagMetadata.TAG_NAME.name).in(names),
|
||||
TaskCriteria.activeVisibleMine())));
|
||||
|
||||
FilterWithCustomIntent filter = new FilterWithCustomIntent(title, title, template, null);
|
||||
|
||||
filter.customTaskList = new ComponentName(ContextManager.getContext(), PersonViewFragment.class);
|
||||
|
||||
Bundle extras = new Bundle();
|
||||
extras.putBoolean(PersonViewFragment.EXTRA_HIDE_QUICK_ADD, true);
|
||||
filter.customExtras = extras;
|
||||
|
||||
filter.listingIcon = ((BitmapDrawable)context.getResources().getDrawable(
|
||||
ThemeService.getDrawable(R.drawable.icn_menu_friends, themeFlags))).getBitmap();
|
||||
|
||||
return filter;
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package com.todoroo.astrid.people;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.tasks.R;
|
||||
import com.todoroo.astrid.activity.FilterListFragment;
|
||||
import com.todoroo.astrid.activity.FilterModeSpec;
|
||||
import com.todoroo.astrid.activity.TaskListFragment;
|
||||
import com.todoroo.astrid.api.Filter;
|
||||
import com.todoroo.astrid.api.FilterListItem;
|
||||
import com.todoroo.astrid.ui.MainMenuPopover;
|
||||
|
||||
public class PeopleFilterMode implements FilterModeSpec {
|
||||
|
||||
@Override
|
||||
public Filter getDefaultFilter(Context context) {
|
||||
Filter defaultFilter = PeopleFilterExposer.mySharedTasks(context);
|
||||
return defaultFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends FilterListFragment> getFilterListClass() {
|
||||
return PeopleListFragment.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFilterItemClickedCallback(FilterListItem item) {/**/}
|
||||
|
||||
@Override
|
||||
public int[] getForbiddenMenuItems() {
|
||||
return FORBIDDEN_MENU_ITEMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMainMenuIconAttr() {
|
||||
return R.attr.asPeopleMenu;
|
||||
}
|
||||
|
||||
private static final int[] FORBIDDEN_MENU_ITEMS = {
|
||||
TaskListFragment.MENU_NEW_FILTER_ID,
|
||||
MainMenuPopover.MAIN_MENU_ITEM_FRIENDS
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean showComments() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
package com.todoroo.astrid.people;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import org.tasks.R;
|
||||
import com.todoroo.astrid.activity.FilterListFragment;
|
||||
import com.todoroo.astrid.adapter.FilterAdapter;
|
||||
import com.todoroo.astrid.utility.AstridPreferences;
|
||||
|
||||
public class PeopleListFragment extends FilterListFragment {
|
||||
|
||||
@Override
|
||||
protected FilterAdapter instantiateAdapter() {
|
||||
return new PeopleFilterAdapter(getActivity(), null, R.layout.filter_adapter_row, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout(Activity activity) {
|
||||
if (AstridPreferences.useTabletLayout(activity)) {
|
||||
return R.layout.filter_list_fragment_alternative_3pane;
|
||||
} else {
|
||||
return R.layout.filter_list_fragment_alternative;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,258 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
package com.todoroo.astrid.people;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import org.tasks.R;
|
||||
import com.todoroo.andlib.data.TodorooCursor;
|
||||
import com.todoroo.andlib.service.Autowired;
|
||||
import com.todoroo.andlib.utility.DateUtilities;
|
||||
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
|
||||
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
|
||||
import com.todoroo.astrid.actfm.sync.ActFmSyncThread;
|
||||
import com.todoroo.astrid.actfm.sync.ActFmSyncThread.SyncMessageCallback;
|
||||
import com.todoroo.astrid.actfm.sync.messages.BriefMe;
|
||||
import com.todoroo.astrid.activity.TaskListFragment;
|
||||
import com.todoroo.astrid.dao.UserDao;
|
||||
import com.todoroo.astrid.data.RemoteModel;
|
||||
import com.todoroo.astrid.data.Task;
|
||||
import com.todoroo.astrid.data.User;
|
||||
import com.todoroo.astrid.helper.AsyncImageView;
|
||||
import com.todoroo.astrid.service.SyncV2Service;
|
||||
import com.todoroo.astrid.service.ThemeService;
|
||||
import com.todoroo.astrid.utility.ResourceDrawableCache;
|
||||
|
||||
public class PersonViewFragment extends TaskListFragment {
|
||||
|
||||
public static final String EXTRA_USER_ID_LOCAL = "user_local_id"; //$NON-NLS-1$
|
||||
|
||||
public static final String EXTRA_HIDE_QUICK_ADD = "hide_quickAdd"; //$NON-NLS-1$
|
||||
|
||||
protected static final int MENU_REFRESH_ID = MENU_SUPPORT_ID + 1;
|
||||
|
||||
@Autowired UserDao userDao;
|
||||
|
||||
@Autowired SyncV2Service syncService;
|
||||
|
||||
@Autowired ActFmPreferenceService actFmPreferenceService;
|
||||
|
||||
@Autowired ActFmSyncService actFmSyncService;
|
||||
|
||||
private AsyncImageView userImage;
|
||||
private TextView userSubtitle;
|
||||
private TextView userStatusButton;
|
||||
private TextView emptyView;
|
||||
|
||||
private User user;
|
||||
|
||||
@Override
|
||||
protected void initializeData() {
|
||||
super.initializeData();
|
||||
if (extras.containsKey(EXTRA_USER_ID_LOCAL)) {
|
||||
user = userDao.fetch(extras.getLong(EXTRA_USER_ID_LOCAL), User.PROPERTIES);
|
||||
}
|
||||
emptyView = ((TextView) getView().findViewById(android.R.id.empty));
|
||||
emptyView.setText(getEmptyDisplayString());
|
||||
|
||||
setupUserHeader();
|
||||
}
|
||||
|
||||
private void setupUserHeader() {
|
||||
if (user != null) {
|
||||
userImage.setDefaultImageDrawable(ResourceDrawableCache.getImageDrawableFromId(resources, R.drawable.icn_default_person_image));
|
||||
userImage.setUrl(user.getPictureUrl(User.PICTURE, RemoteModel.PICTURE_MEDIUM));
|
||||
|
||||
userSubtitle.setText(getUserSubtitleText());
|
||||
setupUserStatusButton();
|
||||
} else {
|
||||
getView().findViewById(R.id.user_header).setVisibility(View.GONE);
|
||||
userStatusButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupQuickAddBar() {
|
||||
super.setupQuickAddBar();
|
||||
if (user != null) {
|
||||
quickAddBar.getQuickAddBox().setHint(getString(R.string.TLA_quick_add_hint_assign, user.getDisplayName()));
|
||||
}
|
||||
|
||||
if (extras.containsKey(EXTRA_HIDE_QUICK_ADD)) {
|
||||
quickAddBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// set listener for astrid icon
|
||||
emptyView.setOnClickListener(null);
|
||||
|
||||
}
|
||||
|
||||
private String getUserSubtitleText() {
|
||||
String status = user.getValue(User.STATUS);
|
||||
String userName = user.getDisplayName();
|
||||
if (User.STATUS_PENDING.equals(status) || User.STATUS_REQUEST.equals(status)) {
|
||||
return getString(R.string.actfm_friendship_pending, userName);
|
||||
} else if (User.STATUS_BLOCKED.equals(status) || User.STATUS_RENOUNCE.equals(status)) {
|
||||
return getString(R.string.actfm_friendship_blocked, userName);
|
||||
} else if (User.STATUS_FRIENDS.equals(status) || User.STATUS_CONFIRM.equals(status)) {
|
||||
return getString(R.string.actfm_friendship_friends, userName);
|
||||
} else if (User.STATUS_OTHER_PENDING.equals(status)) {
|
||||
return getString(R.string.actfm_friendship_other_pending, userName);
|
||||
} else if (User.STATUS_IGNORED.equals(status) || User.STATUS_IGNORE.equals(status)) {
|
||||
return getString(R.string.actfm_friendship_ignored, userName);
|
||||
} else {
|
||||
return getString(R.string.actfm_friendship_no_status, userName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setupUserStatusButton() {
|
||||
String status = user.getValue(User.STATUS);
|
||||
userStatusButton.setVisibility(View.VISIBLE);
|
||||
if (User.STATUS_CONFIRM.equals(status) || User.STATUS_IGNORE.equals(status) || User.STATUS_RENOUNCE.equals(status) || User.STATUS_REQUEST.equals(user)) // All the pending status options
|
||||
{
|
||||
userStatusButton.setVisibility(View.GONE);
|
||||
} else if (TextUtils.isEmpty(status) || "null".equals(status)) //$NON-NLS-1$
|
||||
{
|
||||
userStatusButton.setText(getString(R.string.actfm_friendship_connect));
|
||||
} else if (User.STATUS_OTHER_PENDING.equals(status)) {
|
||||
userStatusButton.setText(getString(R.string.actfm_friendship_accept));
|
||||
} else {
|
||||
userStatusButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUpUiComponents() {
|
||||
super.setUpUiComponents();
|
||||
userImage = (AsyncImageView) getView().findViewById(R.id.user_image);
|
||||
userSubtitle = (TextView) getView().findViewById(R.id.user_subtitle);
|
||||
userStatusButton = (TextView) getActivity().findViewById(R.id.person_image);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getListBody(ViewGroup root) {
|
||||
ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.task_list_body_user, root, false);
|
||||
|
||||
View taskListView = super.getListBody(parent);
|
||||
parent.addView(taskListView);
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void handleStatusButtonClicked() {
|
||||
if (user != null) { // Just in case
|
||||
String status = user.getValue(User.STATUS);
|
||||
if (TextUtils.isEmpty(status) || "null".equals(status)) { // Add friend case //$NON-NLS-1$
|
||||
user.setValue(User.STATUS, User.STATUS_REQUEST);
|
||||
} else if (User.STATUS_OTHER_PENDING.equals(status)) { // Accept friend case
|
||||
user.setValue(User.STATUS, User.STATUS_CONFIRM);
|
||||
}
|
||||
|
||||
ContentValues setValues = user.getSetValues();
|
||||
if (setValues != null && setValues.containsKey(User.STATUS.name)) {
|
||||
userDao.saveExisting(user);
|
||||
userStatusButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addSyncRefreshMenuItem(Menu menu, int themeFlags) {
|
||||
if(actFmPreferenceService.isLoggedIn()) {
|
||||
addMenuItem(menu, R.string.actfm_TVA_menu_refresh,
|
||||
ThemeService.getDrawable(R.drawable.icn_menu_refresh, themeFlags), MENU_REFRESH_ID, true);
|
||||
} else {
|
||||
super.addSyncRefreshMenuItem(menu, themeFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOptionsMenuItemSelected(int id, Intent intent) {
|
||||
switch (id) {
|
||||
case MENU_REFRESH_ID:
|
||||
refreshData();
|
||||
return true;
|
||||
}
|
||||
return super.handleOptionsMenuItemSelected(id, intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initiateAutomaticSyncImpl() {
|
||||
if (!isCurrentTaskListFragment()) {
|
||||
return;
|
||||
}
|
||||
if (user != null) {
|
||||
long lastAutosync = user.getValue(User.LAST_AUTOSYNC);
|
||||
|
||||
if(DateUtilities.now() - lastAutosync > AUTOSYNC_INTERVAL) {
|
||||
refreshData();
|
||||
user.setValue(User.LAST_AUTOSYNC, DateUtilities.now());
|
||||
userDao.saveExisting(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reloadUserData() {
|
||||
user = userDao.fetch(extras.getLong(EXTRA_USER_ID_LOCAL), User.PROPERTIES);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void refresh() {
|
||||
super.refresh();
|
||||
setupUserHeader();
|
||||
}
|
||||
|
||||
private void refreshData() {
|
||||
if (user != null) {
|
||||
emptyView.setText(R.string.DLG_loading);
|
||||
SyncMessageCallback callback = new SyncMessageCallback() {
|
||||
@Override
|
||||
public void runOnSuccess() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
reloadUserData();
|
||||
refresh();
|
||||
emptyView.setText(getEmptyDisplayString());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void runOnErrors(List<JSONArray> errors) {/**/}
|
||||
};
|
||||
long pushedAt = user.getValue(User.TASKS_PUSHED_AT);
|
||||
JSONArray existingTasks = new JSONArray();
|
||||
TodorooCursor<Task> tasksCursor = (TodorooCursor<Task>) taskAdapter.getCursor();
|
||||
for (tasksCursor.moveToFirst(); !tasksCursor.isAfterLast(); tasksCursor.moveToNext()) {
|
||||
existingTasks.put(tasksCursor.get(Task.UUID));
|
||||
}
|
||||
|
||||
BriefMe<Task> briefMe = new BriefMe<Task>(Task.class, null, pushedAt, BriefMe.USER_ID_KEY, user.getValue(User.UUID), "existing_task_ids", existingTasks); //$NON-NLS-1$
|
||||
ActFmSyncThread.getInstance().enqueueMessage(briefMe, callback);
|
||||
}
|
||||
}
|
||||
|
||||
private String getEmptyDisplayString() {
|
||||
String userName = user != null ? user.getDisplayName() : null;
|
||||
return TextUtils.isEmpty(userName) ? getString(R.string.actfm_my_shared_tasks_empty) : getString(R.string.TLA_no_items_person, userName);
|
||||
}
|
||||
|
||||
}
|
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB |
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright (c) 2012 Todoroo Inc
|
||||
**
|
||||
** See the file "LICENSE" for the full license governing this code.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_selected="false" android:drawable="@drawable/people_menu_button_blue_off"/>
|
||||
<item android:state_selected="true" android:drawable="@drawable/people_menu_button_blue_on"/>
|
||||
</selector>
|
Before Width: | Height: | Size: 1019 B |
Before Width: | Height: | Size: 1.4 KiB |
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright (c) 2012 Todoroo Inc
|
||||
**
|
||||
** See the file "LICENSE" for the full license governing this code.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_selected="false" android:drawable="@drawable/people_menu_button_dark_blue_off"/>
|
||||
<item android:state_selected="true" android:drawable="@drawable/people_menu_button_dark_blue_on"/>
|
||||
</selector>
|
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB |
@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
** Copyright (c) 2012 Todoroo Inc
|
||||
**
|
||||
** See the file "LICENSE" for the full license governing this code.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="100">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/user_header"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dip"
|
||||
android:background="?attr/asMembersHeaderBackground">
|
||||
|
||||
<com.todoroo.astrid.helper.AsyncImageView
|
||||
android:id="@+id/user_image"
|
||||
android:layout_height="50dip"
|
||||
android:layout_width="50dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginRight="8dip"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_subtitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/user_image"
|
||||
android:layout_toRightOf="@id/user_image"
|
||||
android:textColor="@android:color/black"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- List body goes here -->
|
||||
|
||||
</LinearLayout>
|