diff --git a/api/src/com/todoroo/astrid/data/User.java b/api/src/com/todoroo/astrid/data/User.java index d7e67e889..260f2cf34 100644 --- a/api/src/com/todoroo/astrid/data/User.java +++ b/api/src/com/todoroo/astrid/data/User.java @@ -80,6 +80,7 @@ public final class User extends RemoteModel { defaultValues.put(EMAIL.name, ""); defaultValues.put(PICTURE.name, ""); defaultValues.put(STATUS.name, ""); + defaultValues.put(PENDING_STATUS.name, ""); } @Override diff --git a/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java b/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java index 5de6482e5..c326d4fb3 100644 --- a/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java @@ -60,7 +60,12 @@ public class PersonViewFragment extends TaskListFragment { } ((TextView) getView().findViewById(android.R.id.empty)).setText(getEmptyDisplayString()); + setupUserHeader(); + } + + private void setupUserHeader() { if (user != null) { + userImage.setDefaultImageResource(R.drawable.icn_default_person_image); userImage.setUrl(user.getValue(User.PICTURE)); userSubtitle.setText(getUserSubtitleText()); setupUserStatusButton(); @@ -138,7 +143,8 @@ public class PersonViewFragment extends TaskListFragment { if (user.getSetValues().containsKey(User.PENDING_STATUS.name)) { userDao.saveExisting(user); - // Push + userStatusButton.setVisibility(View.GONE); + refreshData(false); } } @@ -173,10 +179,19 @@ public class PersonViewFragment extends TaskListFragment { } } + @Override + protected void refresh() { + super.refresh(); + setupUserHeader(); + } + private void refreshData(final boolean manual) { if (user != null) { ((TextView) getView().findViewById(android.R.id.empty)).setText(R.string.DLG_loading); - + if (!TextUtils.isEmpty(user.getValue(User.PENDING_STATUS))) { + actFmSyncService.pushUser(user); + user = userDao.fetch(user.getId(), User.PROPERTIES); + } syncService.synchronizeList(user, manual, new ProgressBarSyncResultCallback(getActivity(), this, R.id.progressBar, new Runnable() { @Override diff --git a/astrid/res/layout/task_list_body_user.xml b/astrid/res/layout/task_list_body_user.xml index 8e5e987c5..c6711105d 100644 --- a/astrid/res/layout/task_list_body_user.xml +++ b/astrid/res/layout/task_list_body_user.xml @@ -16,7 +16,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="8dip" - android:background="#ff0000"> + android:background="?attr/asMembersHeaderBackground">