From d18d2b93971b32c9cd94a38ae6f35dda9b5bf583 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 18 Oct 2012 18:11:49 -0700 Subject: [PATCH] Better interactions and copy in the friend status views --- .../astrid/people/PersonViewFragment.java | 30 +++++++++++++++++-- astrid/res/values/strings-actfm.xml | 16 ++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java b/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java index a98f14277..0397937d7 100644 --- a/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java @@ -59,8 +59,8 @@ public class PersonViewFragment extends TaskListFragment { if (user != null) { userImage.setUrl(user.getValue(User.PICTURE)); - userSubtitle.setText(user.getValue(User.STATUS)); - userStatusButton.setText(user.getValue(User.STATUS)); + userSubtitle.setText(getUserSubtitleText()); + setupUserStatusButton(); } else { getView().findViewById(R.id.user_header).setVisibility(View.GONE); } @@ -81,6 +81,32 @@ public class PersonViewFragment extends TaskListFragment { } + private String getUserSubtitleText() { + String status = user.getValue(User.STATUS); + String userName = user.getDisplayName(); + if (User.STATUS_PENDING.equals(status)) + return getString(R.string.actfm_friendship_pending, userName); + else if (User.STATUS_BLOCKED.equals(status)) + return getString(R.string.actfm_friendship_blocked, userName); + else if (User.STATUS_FRIENDS.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 return getString(R.string.actfm_friendship_no_status, userName); + + } + + private void setupUserStatusButton() { + String status = user.getValue(User.STATUS); + userStatusButton.setVisibility(View.VISIBLE); + if (TextUtils.isEmpty(status)) + 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(); diff --git a/astrid/res/values/strings-actfm.xml b/astrid/res/values/strings-actfm.xml index 27945a109..7e2a5fe98 100644 --- a/astrid/res/values/strings-actfm.xml +++ b/astrid/res/values/strings-actfm.xml @@ -51,6 +51,22 @@ No shared tasks + + + + You\'ve sent a friend request to %s! + + You\'ve blocked %s. + + You\'re friends with %s! Add tasks for them below. + + %s wants to be friends with you! + + Connect with %s to share and see activity on public tasks! + + Add friend + + Accept