mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-21 05:45:13 +00:00
Modified comment-view creation. Modified activities link colour.
This commit is contained in:
parent
7be202ac1e
commit
f85e517b2a
12 changed files with 222 additions and 189 deletions
|
@ -78,6 +78,7 @@
|
||||||
<string name="profile_started_following">Started following </string>
|
<string name="profile_started_following">Started following </string>
|
||||||
<string name="profile_replied_to">Replied to</string>
|
<string name="profile_replied_to">Replied to</string>
|
||||||
<string name="profile_with_comment">with the comment</string>
|
<string name="profile_with_comment">with the comment</string>
|
||||||
|
<string name="profile_liked_comment">Liked the comment</string>
|
||||||
<string name="profile_shared_story">Shared the story</string>
|
<string name="profile_shared_story">Shared the story</string>
|
||||||
<string name="profile_button_follow">Follow</string>
|
<string name="profile_button_follow">Follow</string>
|
||||||
<string name="profile_button_unfollow">Following</string>
|
<string name="profile_button_unfollow">Following</string>
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.newsblur.fragment.ProfileDetailsFragment;
|
||||||
import com.newsblur.network.APIManager;
|
import com.newsblur.network.APIManager;
|
||||||
import com.newsblur.network.domain.ActivitiesResponse;
|
import com.newsblur.network.domain.ActivitiesResponse;
|
||||||
import com.newsblur.network.domain.ProfileResponse;
|
import com.newsblur.network.domain.ProfileResponse;
|
||||||
import com.newsblur.util.PrefsUtil;
|
import com.newsblur.util.PrefsUtils;
|
||||||
|
|
||||||
public class Profile extends SherlockFragmentActivity {
|
public class Profile extends SherlockFragmentActivity {
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public class Profile extends SherlockFragmentActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
if (TextUtils.isEmpty(userId)) {
|
if (TextUtils.isEmpty(userId)) {
|
||||||
detailsFragment.setUser(PrefsUtil.getUserDetails(Profile.this), true);
|
detailsFragment.setUser(PrefsUtils.getUserDetails(Profile.this), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class Profile extends SherlockFragmentActivity {
|
||||||
activities = profileResponse.activities;
|
activities = profileResponse.activities;
|
||||||
} else {
|
} else {
|
||||||
apiManager.updateUserProfile();
|
apiManager.updateUserProfile();
|
||||||
user = PrefsUtil.getUserDetails(Profile.this);
|
user = PrefsUtils.getUserDetails(Profile.this);
|
||||||
profileResponse = apiManager.getUser(user.id);
|
profileResponse = apiManager.getUser(user.id);
|
||||||
if (profileResponse != null) {
|
if (profileResponse != null) {
|
||||||
activities = profileResponse.activities;
|
activities = profileResponse.activities;
|
||||||
|
|
|
@ -35,7 +35,7 @@ import com.newsblur.fragment.ShareDialogFragment;
|
||||||
import com.newsblur.fragment.SyncUpdateFragment;
|
import com.newsblur.fragment.SyncUpdateFragment;
|
||||||
import com.newsblur.fragment.TextSizeDialogFragment;
|
import com.newsblur.fragment.TextSizeDialogFragment;
|
||||||
import com.newsblur.util.PrefConstants;
|
import com.newsblur.util.PrefConstants;
|
||||||
import com.newsblur.util.PrefsUtil;
|
import com.newsblur.util.PrefsUtils;
|
||||||
import com.newsblur.util.UIUtils;
|
import com.newsblur.util.UIUtils;
|
||||||
|
|
||||||
public abstract class Reading extends SherlockFragmentActivity implements OnPageChangeListener, SyncUpdateFragment.SyncUpdateFragmentInterface, OnSeekBarChangeListener {
|
public abstract class Reading extends SherlockFragmentActivity implements OnPageChangeListener, SyncUpdateFragment.SyncUpdateFragmentInterface, OnSeekBarChangeListener {
|
||||||
|
@ -106,7 +106,7 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int currentItem = pager.getCurrentItem();
|
int currentItem = pager.getCurrentItem();
|
||||||
Story story = readingAdapter.getStory(currentItem);
|
Story story = readingAdapter.getStory(currentItem);
|
||||||
UserProfile user = PrefsUtil.getUserDetails(this);
|
UserProfile user = PrefsUtils.getUserDetails(this);
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.newsblur.network.domain.LoginResponse;
|
||||||
import com.newsblur.service.DetachableResultReceiver;
|
import com.newsblur.service.DetachableResultReceiver;
|
||||||
import com.newsblur.service.SyncService;
|
import com.newsblur.service.SyncService;
|
||||||
import com.newsblur.service.DetachableResultReceiver.Receiver;
|
import com.newsblur.service.DetachableResultReceiver.Receiver;
|
||||||
import com.newsblur.util.PrefsUtil;
|
import com.newsblur.util.PrefsUtils;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
@ -116,7 +116,7 @@ public class LoginProgressFragment extends Fragment implements Receiver {
|
||||||
updateStatus.setText(R.string.login_logged_in);
|
updateStatus.setText(R.string.login_logged_in);
|
||||||
updateStatus.startAnimation(a);
|
updateStatus.startAnimation(a);
|
||||||
|
|
||||||
loginProfilePicture.setImageBitmap(PrefsUtil.getUserImage(getActivity()));
|
loginProfilePicture.setImageBitmap(PrefsUtils.getUserImage(getActivity()));
|
||||||
feedProgress.setVisibility(View.VISIBLE);
|
feedProgress.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
Log.d(TAG, "Authenticated. Starting receiver.");
|
Log.d(TAG, "Authenticated. Starting receiver.");
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.newsblur.activity.NewsBlurApplication;
|
||||||
import com.newsblur.domain.UserProfile;
|
import com.newsblur.domain.UserProfile;
|
||||||
import com.newsblur.network.APIManager;
|
import com.newsblur.network.APIManager;
|
||||||
import com.newsblur.util.ImageLoader;
|
import com.newsblur.util.ImageLoader;
|
||||||
import com.newsblur.util.PrefsUtil;
|
import com.newsblur.util.PrefsUtils;
|
||||||
import com.newsblur.util.UIUtils;
|
import com.newsblur.util.UIUtils;
|
||||||
|
|
||||||
public class ProfileDetailsFragment extends Fragment implements OnClickListener {
|
public class ProfileDetailsFragment extends Fragment implements OnClickListener {
|
||||||
|
@ -111,7 +111,7 @@ public class ProfileDetailsFragment extends Fragment implements OnClickListener
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
followButton.setVisibility(View.GONE);
|
followButton.setVisibility(View.GONE);
|
||||||
Bitmap userPicture = PrefsUtil.getUserImage(getActivity());
|
Bitmap userPicture = PrefsUtils.getUserImage(getActivity());
|
||||||
userPicture = UIUtils.roundCorners(userPicture, 5);
|
userPicture = UIUtils.roundCorners(userPicture, 5);
|
||||||
imageView.setImageBitmap(userPicture);
|
imageView.setImageBitmap(userPicture);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v7.widget.GridLayout;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -33,8 +34,9 @@ import com.newsblur.network.APIManager;
|
||||||
import com.newsblur.network.SetupCommentSectionTask;
|
import com.newsblur.network.SetupCommentSectionTask;
|
||||||
import com.newsblur.util.ImageLoader;
|
import com.newsblur.util.ImageLoader;
|
||||||
import com.newsblur.util.PrefConstants;
|
import com.newsblur.util.PrefConstants;
|
||||||
import com.newsblur.util.PrefsUtil;
|
import com.newsblur.util.PrefsUtils;
|
||||||
import com.newsblur.util.UIUtils;
|
import com.newsblur.util.UIUtils;
|
||||||
|
import com.newsblur.util.ViewUtils;
|
||||||
import com.newsblur.view.NewsblurWebview;
|
import com.newsblur.view.NewsblurWebview;
|
||||||
import com.newsblur.view.TagAdapter;
|
import com.newsblur.view.TagAdapter;
|
||||||
|
|
||||||
|
@ -85,20 +87,20 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
|
|
||||||
resolver = getActivity().getContentResolver();
|
resolver = getActivity().getContentResolver();
|
||||||
inflater = getActivity().getLayoutInflater();
|
inflater = getActivity().getLayoutInflater();
|
||||||
|
|
||||||
|
|
||||||
user = PrefsUtil.getUserDetails(getActivity());
|
|
||||||
|
user = PrefsUtils.getUserDetails(getActivity());
|
||||||
|
|
||||||
feedTitle = getArguments().getString("feedTitle");
|
feedTitle = getArguments().getString("feedTitle");
|
||||||
feedColor = getArguments().getString("feedColor");
|
feedColor = getArguments().getString("feedColor");
|
||||||
feedFade = getArguments().getString("feedFade");
|
feedFade = getArguments().getString("feedFade");
|
||||||
|
|
||||||
classifier = (Classifier) getArguments().getSerializable("classifier");
|
classifier = (Classifier) getArguments().getSerializable("classifier");
|
||||||
|
|
||||||
receiver = new TextSizeReceiver();
|
receiver = new TextSizeReceiver();
|
||||||
getActivity().registerReceiver(receiver, new IntentFilter(TEXT_SIZE_CHANGED));
|
getActivity().registerReceiver(receiver, new IntentFilter(TEXT_SIZE_CHANGED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
getActivity().unregisterReceiver(receiver);
|
getActivity().unregisterReceiver(receiver);
|
||||||
|
@ -113,7 +115,7 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
setupWebview(web);
|
setupWebview(web);
|
||||||
setupItemMetadata(view);
|
setupItemMetadata(view);
|
||||||
setupShareButton(view);
|
setupShareButton(view);
|
||||||
|
|
||||||
if (story.sharedUserIds.length > 0 || story.commentCount > 0 ) {
|
if (story.sharedUserIds.length > 0 || story.commentCount > 0 ) {
|
||||||
view.findViewById(R.id.reading_share_bar).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.reading_share_bar).setVisibility(View.VISIBLE);
|
||||||
view.findViewById(R.id.share_bar_underline).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.share_bar_underline).setVisibility(View.VISIBLE);
|
||||||
|
@ -126,14 +128,14 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
private void setupShareButton(View view) {
|
private void setupShareButton(View view) {
|
||||||
|
|
||||||
Button shareButton = (Button) view.findViewById(R.id.share_story_button);
|
Button shareButton = (Button) view.findViewById(R.id.share_story_button);
|
||||||
|
|
||||||
for (String userId : story.sharedUserIds) {
|
for (String userId : story.sharedUserIds) {
|
||||||
if (TextUtils.equals(userId, user.id)) {
|
if (TextUtils.equals(userId, user.id)) {
|
||||||
shareButton.setText(R.string.edit);
|
shareButton.setText(R.string.edit);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shareButton.setOnClickListener(new OnClickListener() {
|
shareButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -174,11 +176,11 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
|
|
||||||
itemDate.setText(story.shortDate);
|
itemDate.setText(story.shortDate);
|
||||||
itemTitle.setText(story.title);
|
itemTitle.setText(story.title);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(story.authors)) {
|
if (!TextUtils.isEmpty(story.authors)) {
|
||||||
itemAuthors.setText(story.authors.toUpperCase());
|
itemAuthors.setText(story.authors.toUpperCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
itemAuthors.setOnClickListener(new OnClickListener() {
|
itemAuthors.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -186,7 +188,7 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
classifierFragment.show(getFragmentManager(), "dialog");
|
classifierFragment.show(getFragmentManager(), "dialog");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
itemFeed.setOnClickListener(new OnClickListener() {
|
itemFeed.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -194,7 +196,7 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
classifierFragment.show(getFragmentManager(), "dialog");
|
classifierFragment.show(getFragmentManager(), "dialog");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
itemFeed.setText(feedTitle);
|
itemFeed.setText(feedTitle);
|
||||||
|
|
||||||
itemTitle.setOnClickListener(new OnClickListener() {
|
itemTitle.setOnClickListener(new OnClickListener() {
|
||||||
|
@ -218,7 +220,7 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
private void setupWebview(NewsblurWebview web) {
|
private void setupWebview(NewsblurWebview web) {
|
||||||
final SharedPreferences preferences = getActivity().getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
final SharedPreferences preferences = getActivity().getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||||
float currentSize = preferences.getFloat(PrefConstants.PREFERENCE_TEXT_SIZE, 1.0f);
|
float currentSize = preferences.getFloat(PrefConstants.PREFERENCE_TEXT_SIZE, 1.0f);
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("<html><head><meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />");
|
builder.append("<html><head><meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />");
|
||||||
builder.append("<style style=\"text/css\">");
|
builder.append("<style style=\"text/css\">");
|
||||||
|
@ -228,7 +230,7 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
builder.append(story.content);
|
builder.append(story.content);
|
||||||
builder.append("</body></html>");
|
builder.append("</body></html>");
|
||||||
web.loadDataWithBaseURL("file:///android_asset/", builder.toString(), "text/html", "UTF-8", null);
|
web.loadDataWithBaseURL("file:///android_asset/", builder.toString(), "text/html", "UTF-8", null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TextSizeReceiver extends BroadcastReceiver {
|
private class TextSizeReceiver extends BroadcastReceiver {
|
||||||
|
@ -241,101 +243,112 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
||||||
@Override
|
@Override
|
||||||
public void updateTagView(String key, int classifierType, int classifierAction) {
|
public void updateTagView(String key, int classifierType, int classifierAction) {
|
||||||
switch (classifierType) {
|
switch (classifierType) {
|
||||||
case Classifier.AUTHOR:
|
case Classifier.AUTHOR:
|
||||||
switch (classifierAction) {
|
switch (classifierAction) {
|
||||||
case Classifier.LIKE:
|
case Classifier.LIKE:
|
||||||
itemAuthors.setTextColor(getActivity().getResources().getColor(R.color.positive));
|
itemAuthors.setTextColor(getActivity().getResources().getColor(R.color.positive));
|
||||||
break;
|
|
||||||
case Classifier.DISLIKE:
|
|
||||||
itemAuthors.setTextColor(getActivity().getResources().getColor(R.color.negative));
|
|
||||||
break;
|
|
||||||
case Classifier.CLEAR_DISLIKE:
|
|
||||||
itemAuthors.setTextColor(getActivity().getResources().getColor(R.color.darkgray));
|
|
||||||
break;
|
|
||||||
case Classifier.CLEAR_LIKE:
|
|
||||||
itemAuthors.setTextColor(getActivity().getResources().getColor(R.color.darkgray));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Classifier.FEED:
|
case Classifier.DISLIKE:
|
||||||
switch (classifierAction) {
|
itemAuthors.setTextColor(getActivity().getResources().getColor(R.color.negative));
|
||||||
case Classifier.LIKE:
|
|
||||||
itemFeed.setTextColor(getActivity().getResources().getColor(R.color.positive));
|
|
||||||
break;
|
|
||||||
case Classifier.DISLIKE:
|
|
||||||
itemFeed.setTextColor(getActivity().getResources().getColor(R.color.negative));
|
|
||||||
break;
|
|
||||||
case Classifier.CLEAR_DISLIKE:
|
|
||||||
itemFeed.setTextColor(getActivity().getResources().getColor(R.color.darkgray));
|
|
||||||
break;
|
|
||||||
case Classifier.CLEAR_LIKE:
|
|
||||||
itemFeed.setTextColor(getActivity().getResources().getColor(R.color.darkgray));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Classifier.TAG:
|
case Classifier.CLEAR_DISLIKE:
|
||||||
classifier.tags.put(key, classifierAction);
|
itemAuthors.setTextColor(getActivity().getResources().getColor(R.color.darkgray));
|
||||||
tagAdapter.setClassifier(classifier);
|
break;
|
||||||
tagAdapter.notifyDataSetInvalidated();
|
case Classifier.CLEAR_LIKE:
|
||||||
|
itemAuthors.setTextColor(getActivity().getResources().getColor(R.color.darkgray));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Classifier.FEED:
|
||||||
|
switch (classifierAction) {
|
||||||
|
case Classifier.LIKE:
|
||||||
|
itemFeed.setTextColor(getActivity().getResources().getColor(R.color.positive));
|
||||||
|
break;
|
||||||
|
case Classifier.DISLIKE:
|
||||||
|
itemFeed.setTextColor(getActivity().getResources().getColor(R.color.negative));
|
||||||
|
break;
|
||||||
|
case Classifier.CLEAR_DISLIKE:
|
||||||
|
itemFeed.setTextColor(getActivity().getResources().getColor(R.color.darkgray));
|
||||||
|
break;
|
||||||
|
case Classifier.CLEAR_LIKE:
|
||||||
|
itemFeed.setTextColor(getActivity().getResources().getColor(R.color.darkgray));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Classifier.TAG:
|
||||||
|
classifier.tags.put(key, classifierAction);
|
||||||
|
tagAdapter.setClassifier(classifier);
|
||||||
|
tagAdapter.notifyDataSetInvalidated();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sharedCallback(String sharedText, boolean hasBeenShared) {
|
public void sharedCallback(String sharedText, boolean hasAlreadyBeenShared) {
|
||||||
|
view.findViewById(R.id.reading_share_bar).setVisibility(View.VISIBLE);
|
||||||
|
view.findViewById(R.id.share_bar_underline).setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (!hasBeenShared) {
|
if (!hasAlreadyBeenShared) {
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
|
||||||
|
|
||||||
View commentView = inflater.inflate(R.layout.include_comment, null);
|
|
||||||
commentView.setTag(SetupCommentSectionTask.COMMENT_VIEW_BY + user.id);
|
|
||||||
|
|
||||||
TextView commentText = (TextView) commentView.findViewById(R.id.comment_text);
|
|
||||||
commentText.setTag("commentBy" + user.id);
|
|
||||||
commentText.setText(sharedText);
|
|
||||||
|
|
||||||
ImageView commentImage = (ImageView) commentView.findViewById(R.id.comment_user_image);
|
|
||||||
commentImage.setImageBitmap(UIUtils.roundCorners(PrefsUtil.getUserImage(getActivity()), 10f));
|
|
||||||
|
|
||||||
TextView commentSharedDate = (TextView) commentView.findViewById(R.id.comment_shareddate);
|
|
||||||
commentSharedDate.setText(R.string.now);
|
|
||||||
|
|
||||||
TextView commentUsername = (TextView) commentView.findViewById(R.id.comment_username);
|
|
||||||
commentUsername.setText(user.username);
|
|
||||||
|
|
||||||
((LinearLayout) view.findViewById(R.id.reading_friend_comment_container)).addView(commentView);
|
|
||||||
|
|
||||||
commentView.setBackgroundResource(R.drawable.transition_edit_background);
|
|
||||||
|
|
||||||
final TransitionDrawable transition = (TransitionDrawable) commentView.getBackground();
|
|
||||||
transition.startTransition(1000);
|
|
||||||
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
transition.reverseTransition(1000);
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(sharedText)) {
|
||||||
|
View commentView = inflater.inflate(R.layout.include_comment, null);
|
||||||
|
commentView.setTag(SetupCommentSectionTask.COMMENT_VIEW_BY + user.id);
|
||||||
|
|
||||||
|
TextView commentText = (TextView) commentView.findViewById(R.id.comment_text);
|
||||||
|
commentText.setTag("commentBy" + user.id);
|
||||||
|
commentText.setText(sharedText);
|
||||||
|
|
||||||
|
ImageView commentImage = (ImageView) commentView.findViewById(R.id.comment_user_image);
|
||||||
|
commentImage.setImageBitmap(UIUtils.roundCorners(PrefsUtils.getUserImage(getActivity()), 10f));
|
||||||
|
|
||||||
|
TextView commentSharedDate = (TextView) commentView.findViewById(R.id.comment_shareddate);
|
||||||
|
commentSharedDate.setText(R.string.now);
|
||||||
|
|
||||||
|
TextView commentUsername = (TextView) commentView.findViewById(R.id.comment_username);
|
||||||
|
commentUsername.setText(user.username);
|
||||||
|
|
||||||
|
((LinearLayout) view.findViewById(R.id.reading_friend_comment_container)).addView(commentView);
|
||||||
|
|
||||||
|
commentView.setBackgroundResource(R.drawable.transition_edit_background);
|
||||||
|
|
||||||
|
final TransitionDrawable transition = (TransitionDrawable) commentView.getBackground();
|
||||||
|
transition.startTransition(1000);
|
||||||
|
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
transition.reverseTransition(1000);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
ViewUtils.setupCommentCount(getActivity(), view, story.commentCount + 1);
|
||||||
|
|
||||||
|
final ImageView image = ViewUtils.createSharebarImage(getActivity(), imageLoader, user);
|
||||||
|
((GridLayout) view.findViewById(R.id.reading_social_commentimages)).addView(image);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ViewUtils.setupShareCount(getActivity(), view, story.sharedUserIds.length + 1);
|
||||||
|
final ImageView image = ViewUtils.createSharebarImage(getActivity(), imageLoader, user);
|
||||||
|
((GridLayout) view.findViewById(R.id.reading_social_shareimages)).addView(image);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
View commentViewForUser = view.findViewWithTag(SetupCommentSectionTask.COMMENT_VIEW_BY + user.id);
|
View commentViewForUser = view.findViewWithTag(SetupCommentSectionTask.COMMENT_VIEW_BY + user.id);
|
||||||
commentViewForUser.setBackgroundResource(R.drawable.transition_edit_background);
|
commentViewForUser.setBackgroundResource(R.drawable.transition_edit_background);
|
||||||
|
|
||||||
final TransitionDrawable transition = (TransitionDrawable) commentViewForUser.getBackground();
|
final TransitionDrawable transition = (TransitionDrawable) commentViewForUser.getBackground();
|
||||||
transition.startTransition(1000);
|
transition.startTransition(1000);
|
||||||
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
transition.reverseTransition(1000);
|
transition.reverseTransition(1000);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
TextView commentText = (TextView) view.findViewWithTag(SetupCommentSectionTask.COMMENT_BY + user.id);
|
TextView commentText = (TextView) view.findViewWithTag(SetupCommentSectionTask.COMMENT_BY + user.id);
|
||||||
commentText.setText(sharedText);
|
commentText.setText(sharedText);
|
||||||
|
|
||||||
TextView commentDateText = (TextView) view.findViewWithTag(SetupCommentSectionTask.COMMENT_DATE_BY + user.id);
|
TextView commentDateText = (TextView) view.findViewWithTag(SetupCommentSectionTask.COMMENT_DATE_BY + user.id);
|
||||||
commentDateText.setText(R.string.now);
|
commentDateText.setText(R.string.now);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.newsblur.domain.Comment;
|
||||||
import com.newsblur.domain.Story;
|
import com.newsblur.domain.Story;
|
||||||
import com.newsblur.domain.UserProfile;
|
import com.newsblur.domain.UserProfile;
|
||||||
import com.newsblur.network.APIManager;
|
import com.newsblur.network.APIManager;
|
||||||
import com.newsblur.util.PrefsUtil;
|
import com.newsblur.util.PrefsUtils;
|
||||||
|
|
||||||
public class ShareDialogFragment extends DialogFragment {
|
public class ShareDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class ShareDialogFragment extends DialogFragment {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
story = (Story) getArguments().getSerializable(STORY);
|
story = (Story) getArguments().getSerializable(STORY);
|
||||||
callback = (SharedCallbackDialog) getArguments().getSerializable(CALLBACK);
|
callback = (SharedCallbackDialog) getArguments().getSerializable(CALLBACK);
|
||||||
user = PrefsUtil.getUserDetails(getActivity());
|
user = PrefsUtils.getUserDetails(getActivity());
|
||||||
previouslySavedShareText = getArguments().getString(PREVIOUSLY_SAVED_SHARE_TEXT);
|
previouslySavedShareText = getArguments().getString(PREVIOUSLY_SAVED_SHARE_TEXT);
|
||||||
|
|
||||||
apiManager = new APIManager(getActivity());
|
apiManager = new APIManager(getActivity());
|
||||||
|
|
|
@ -38,7 +38,7 @@ import com.newsblur.network.domain.ProfileResponse;
|
||||||
import com.newsblur.network.domain.SocialFeedResponse;
|
import com.newsblur.network.domain.SocialFeedResponse;
|
||||||
import com.newsblur.network.domain.StoriesResponse;
|
import com.newsblur.network.domain.StoriesResponse;
|
||||||
import com.newsblur.serialization.DateStringTypeAdapter;
|
import com.newsblur.serialization.DateStringTypeAdapter;
|
||||||
import com.newsblur.util.PrefsUtil;
|
import com.newsblur.util.PrefsUtils;
|
||||||
|
|
||||||
public class APIManager {
|
public class APIManager {
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class APIManager {
|
||||||
final APIResponse response = client.post(APIConstants.URL_LOGIN, values);
|
final APIResponse response = client.post(APIConstants.URL_LOGIN, values);
|
||||||
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
|
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
|
||||||
LoginResponse loginResponse = gson.fromJson(response.responseString, LoginResponse.class);
|
LoginResponse loginResponse = gson.fromJson(response.responseString, LoginResponse.class);
|
||||||
PrefsUtil.saveCookie(context, response.cookie);
|
PrefsUtils.saveCookie(context, response.cookie);
|
||||||
return loginResponse;
|
return loginResponse;
|
||||||
} else {
|
} else {
|
||||||
return new LoginResponse();
|
return new LoginResponse();
|
||||||
|
@ -148,7 +148,7 @@ public class APIManager {
|
||||||
final APIResponse response = client.post(APIConstants.URL_SIGNUP, values);
|
final APIResponse response = client.post(APIConstants.URL_SIGNUP, values);
|
||||||
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
|
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
|
||||||
LoginResponse loginResponse = gson.fromJson(response.responseString, LoginResponse.class);
|
LoginResponse loginResponse = gson.fromJson(response.responseString, LoginResponse.class);
|
||||||
PrefsUtil.saveCookie(context, response.cookie);
|
PrefsUtils.saveCookie(context, response.cookie);
|
||||||
|
|
||||||
CookieSyncManager.createInstance(context.getApplicationContext());
|
CookieSyncManager.createInstance(context.getApplicationContext());
|
||||||
CookieManager cookieManager = CookieManager.getInstance();
|
CookieManager cookieManager = CookieManager.getInstance();
|
||||||
|
@ -167,7 +167,7 @@ public class APIManager {
|
||||||
final APIResponse response = client.get(APIConstants.URL_MY_PROFILE);
|
final APIResponse response = client.get(APIConstants.URL_MY_PROFILE);
|
||||||
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
|
if (response.responseCode == HttpStatus.SC_OK && !response.hasRedirected) {
|
||||||
ProfileResponse profileResponse = gson.fromJson(response.responseString, ProfileResponse.class);
|
ProfileResponse profileResponse = gson.fromJson(response.responseString, ProfileResponse.class);
|
||||||
PrefsUtil.saveUserDetails(context, profileResponse.user);
|
PrefsUtils.saveUserDetails(context, profileResponse.user);
|
||||||
return profileResponse;
|
return profileResponse;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -14,7 +14,6 @@ import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v7.widget.GridLayout;
|
import android.support.v7.widget.GridLayout;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
@ -33,8 +32,8 @@ import com.newsblur.domain.UserProfile;
|
||||||
import com.newsblur.fragment.ReplyDialogFragment;
|
import com.newsblur.fragment.ReplyDialogFragment;
|
||||||
import com.newsblur.network.domain.ProfileResponse;
|
import com.newsblur.network.domain.ProfileResponse;
|
||||||
import com.newsblur.util.ImageLoader;
|
import com.newsblur.util.ImageLoader;
|
||||||
import com.newsblur.util.PrefsUtil;
|
import com.newsblur.util.PrefsUtils;
|
||||||
import com.newsblur.util.UIUtils;
|
import com.newsblur.util.ViewUtils;
|
||||||
|
|
||||||
public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
||||||
public static final String COMMENT_BY = "commentBy";
|
public static final String COMMENT_BY = "commentBy";
|
||||||
|
@ -56,8 +55,6 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
||||||
private UserProfile user;
|
private UserProfile user;
|
||||||
private final FragmentManager manager;
|
private final FragmentManager manager;
|
||||||
private Cursor commentCursor;
|
private Cursor commentCursor;
|
||||||
private String comment;
|
|
||||||
private String sharedBy;
|
|
||||||
|
|
||||||
public SetupCommentSectionTask(final Context context, final View view, final FragmentManager manager, LayoutInflater inflater, final ContentResolver resolver, final APIManager apiManager, final Story story, final ImageLoader imageLoader) {
|
public SetupCommentSectionTask(final Context context, final View view, final FragmentManager manager, LayoutInflater inflater, final ContentResolver resolver, final APIManager apiManager, final Story story, final ImageLoader imageLoader) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
@ -68,9 +65,7 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
||||||
this.story = story;
|
this.story = story;
|
||||||
this.imageLoader = imageLoader;
|
this.imageLoader = imageLoader;
|
||||||
viewHolder = new WeakReference<View>(view);
|
viewHolder = new WeakReference<View>(view);
|
||||||
comment = context.getResources().getString(R.string.reading_comment_count);
|
user = PrefsUtils.getUserDetails(context);
|
||||||
sharedBy = context.getResources().getString(R.string.reading_shared_count);
|
|
||||||
user = PrefsUtil.getUserDetails(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -248,48 +243,11 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
||||||
GridLayout sharedGrid = (GridLayout) viewHolder.get().findViewById(R.id.reading_social_shareimages);
|
GridLayout sharedGrid = (GridLayout) viewHolder.get().findViewById(R.id.reading_social_shareimages);
|
||||||
GridLayout commentGrid = (GridLayout) viewHolder.get().findViewById(R.id.reading_social_commentimages);
|
GridLayout commentGrid = (GridLayout) viewHolder.get().findViewById(R.id.reading_social_commentimages);
|
||||||
|
|
||||||
TextView commentText = (TextView) viewHolder.get().findViewById(R.id.comment_by);
|
ViewUtils.setupCommentCount(context, viewHolder.get(), commentCursor.getCount());
|
||||||
if (commentCursor.getCount() > 0) {
|
ViewUtils.setupShareCount(context, viewHolder.get(), story.sharedUserIds.length);
|
||||||
comment = String.format(comment, commentCursor.getCount());
|
|
||||||
commentText.setText(commentCursor.getCount() > 1 ? comment : comment.substring(0, comment.length() - 1));
|
|
||||||
} else {
|
|
||||||
commentText.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView sharesText = (TextView) viewHolder.get().findViewById(R.id.shared_by);
|
|
||||||
if (story.sharedUserIds.length > 0) {
|
|
||||||
sharedBy = String.format(sharedBy, story.sharedUserIds.length);
|
|
||||||
sharesText.setText(story.sharedUserIds.length > 1 ? sharedBy : sharedBy.substring(0, sharedBy.length() - 1));
|
|
||||||
} else {
|
|
||||||
sharesText.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (final String userId : story.publicUserIds) {
|
for (final String userId : story.publicUserIds) {
|
||||||
ImageView image = new ImageView(context);
|
ImageView image = ViewUtils.createSharebarImage(context, imageLoader, publicUserMap.get(userId));
|
||||||
int imageLength = UIUtils.convertDPsToPixels(context, 25);
|
|
||||||
image.setMaxHeight(imageLength);
|
|
||||||
image.setMaxWidth(imageLength);
|
|
||||||
GridLayout.LayoutParams imageParameters = new GridLayout.LayoutParams();
|
|
||||||
imageParameters.height = imageLength;
|
|
||||||
imageParameters.setGravity(Gravity.RIGHT);
|
|
||||||
imageParameters.width = imageLength;
|
|
||||||
imageParameters.leftMargin = UIUtils.convertDPsToPixels(context, 3);
|
|
||||||
imageParameters.rightMargin = UIUtils.convertDPsToPixels(context, 3);
|
|
||||||
imageParameters.topMargin = UIUtils.convertDPsToPixels(context, 3);
|
|
||||||
imageParameters.bottomMargin = UIUtils.convertDPsToPixels(context, 3);
|
|
||||||
|
|
||||||
image.setLayoutParams(imageParameters);
|
|
||||||
|
|
||||||
imageLoader.displayImageByUid(publicUserMap.get(userId).photoUrl, image);
|
|
||||||
image.setOnClickListener(new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Intent i = new Intent(context, Profile.class);
|
|
||||||
i.putExtra(Profile.USER_ID, userId);
|
|
||||||
context.startActivity(i);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sharedGrid.addView(image);
|
sharedGrid.addView(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,30 +255,11 @@ public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
for (int i = 0; i < commentCursor.getCount(); i++) {
|
for (int i = 0; i < commentCursor.getCount(); i++) {
|
||||||
final Comment comment = Comment.fromCursor(commentCursor);
|
final Comment comment = Comment.fromCursor(commentCursor);
|
||||||
ImageView image = new ImageView(context);
|
UserProfile user;
|
||||||
int imageLength = UIUtils.convertDPsToPixels(context, 25);
|
if ((user = publicUserMap.get(comment.userId)) == null) {
|
||||||
image.setMaxHeight(imageLength);
|
user = friendUserMap.get(comment.userId);
|
||||||
image.setMaxWidth(imageLength);
|
}
|
||||||
GridLayout.LayoutParams imageParameters = new GridLayout.LayoutParams();
|
ImageView image = ViewUtils.createSharebarImage(context, imageLoader, user);
|
||||||
|
|
||||||
imageParameters.height = imageLength;
|
|
||||||
imageParameters.width = imageLength;
|
|
||||||
imageParameters.leftMargin = UIUtils.convertDPsToPixels(context, 3);
|
|
||||||
imageParameters.rightMargin = UIUtils.convertDPsToPixels(context, 3);
|
|
||||||
imageParameters.topMargin = UIUtils.convertDPsToPixels(context, 3);
|
|
||||||
imageParameters.bottomMargin = UIUtils.convertDPsToPixels(context, 3);
|
|
||||||
|
|
||||||
image.setLayoutParams(imageParameters);
|
|
||||||
|
|
||||||
imageLoader.displayImageByUid(publicUserMap.get(comment.userId).photoUrl, image);
|
|
||||||
image.setOnClickListener(new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Intent i = new Intent(context, Profile.class);
|
|
||||||
i.putExtra(Profile.USER_ID, comment.userId);
|
|
||||||
context.startActivity(i);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
commentGrid.addView(image);
|
commentGrid.addView(image);
|
||||||
commentCursor.moveToNext();
|
commentCursor.moveToNext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import android.graphics.BitmapFactory;
|
||||||
|
|
||||||
import com.newsblur.domain.UserProfile;
|
import com.newsblur.domain.UserProfile;
|
||||||
|
|
||||||
public class PrefsUtil {
|
public class PrefsUtils {
|
||||||
|
|
||||||
public static void saveCookie(final Context context, final String cookie) {
|
public static void saveCookie(final Context context, final String cookie) {
|
||||||
final SharedPreferences preferences = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
final SharedPreferences preferences = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
68
media/android/NewsBlur/src/com/newsblur/util/ViewUtils.java
Normal file
68
media/android/NewsBlur/src/com/newsblur/util/ViewUtils.java
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
package com.newsblur.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v7.widget.GridLayout;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.newsblur.R;
|
||||||
|
import com.newsblur.activity.Profile;
|
||||||
|
import com.newsblur.domain.UserProfile;
|
||||||
|
|
||||||
|
public class ViewUtils {
|
||||||
|
|
||||||
|
public static void setupShareCount(Context context, View storyView, int sharedUserCount) {
|
||||||
|
String sharedBy = context.getResources().getString(R.string.reading_shared_count);
|
||||||
|
TextView sharesText = (TextView) storyView.findViewById(R.id.shared_by);
|
||||||
|
if (sharedUserCount > 0) {
|
||||||
|
sharedBy = String.format(sharedBy, sharedUserCount);
|
||||||
|
sharesText.setText(sharedUserCount > 1 ? sharedBy : sharedBy.substring(0, sharedBy.length() - 1));
|
||||||
|
} else {
|
||||||
|
sharesText.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setupCommentCount(Context context, View storyView, int sharedCommentCount) {
|
||||||
|
String commentsBy = context.getResources().getString(R.string.reading_comment_count);
|
||||||
|
TextView sharesText = (TextView) storyView.findViewById(R.id.comment_by);
|
||||||
|
if (sharedCommentCount > 0) {
|
||||||
|
commentsBy = String.format(commentsBy, sharedCommentCount);
|
||||||
|
sharesText.setText(sharedCommentCount > 1 ? commentsBy : commentsBy.substring(0, commentsBy.length() - 1));
|
||||||
|
} else {
|
||||||
|
sharesText.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageView createSharebarImage(final Context context, final ImageLoader imageLoader, final UserProfile user) {
|
||||||
|
ImageView image = new ImageView(context);
|
||||||
|
int imageLength = UIUtils.convertDPsToPixels(context, 25);
|
||||||
|
image.setMaxHeight(imageLength);
|
||||||
|
image.setMaxWidth(imageLength);
|
||||||
|
GridLayout.LayoutParams imageParameters = new GridLayout.LayoutParams();
|
||||||
|
imageParameters.height = imageLength;
|
||||||
|
imageParameters.setGravity(Gravity.RIGHT);
|
||||||
|
imageParameters.width = imageLength;
|
||||||
|
imageParameters.leftMargin = UIUtils.convertDPsToPixels(context, 3);
|
||||||
|
imageParameters.rightMargin = UIUtils.convertDPsToPixels(context, 3);
|
||||||
|
imageParameters.topMargin = UIUtils.convertDPsToPixels(context, 3);
|
||||||
|
imageParameters.bottomMargin = UIUtils.convertDPsToPixels(context, 3);
|
||||||
|
|
||||||
|
image.setLayoutParams(imageParameters);
|
||||||
|
|
||||||
|
imageLoader.displayImageByUid(user.photoUrl, image);
|
||||||
|
image.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent i = new Intent(context, Profile.class);
|
||||||
|
i.putExtra(Profile.USER_ID, user.userId);
|
||||||
|
context.startActivity(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -26,7 +26,7 @@ public class ActivitiesAdapter extends ArrayAdapter<ActivitiesResponse> {
|
||||||
|
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
private ImageLoader imageLoader;
|
private ImageLoader imageLoader;
|
||||||
private final String startedFollowing, ago, repliedTo, sharedStory, withComment;
|
private final String startedFollowing, ago, repliedTo, sharedStory, withComment, likedComment;
|
||||||
private ForegroundColorSpan midgray, highlight, darkgray;
|
private ForegroundColorSpan midgray, highlight, darkgray;
|
||||||
private String TAG = "ActivitiesAdapter";
|
private String TAG = "ActivitiesAdapter";
|
||||||
private Context context;
|
private Context context;
|
||||||
|
@ -44,11 +44,12 @@ public class ActivitiesAdapter extends ArrayAdapter<ActivitiesResponse> {
|
||||||
Resources resources = context.getResources();
|
Resources resources = context.getResources();
|
||||||
startedFollowing = resources.getString(R.string.profile_started_following);
|
startedFollowing = resources.getString(R.string.profile_started_following);
|
||||||
repliedTo = resources.getString(R.string.profile_replied_to);
|
repliedTo = resources.getString(R.string.profile_replied_to);
|
||||||
|
likedComment = resources.getString(R.string.profile_liked_comment);
|
||||||
sharedStory = resources.getString(R.string.profile_shared_story);
|
sharedStory = resources.getString(R.string.profile_shared_story);
|
||||||
withComment = resources.getString(R.string.profile_with_comment);
|
withComment = resources.getString(R.string.profile_with_comment);
|
||||||
ago = resources.getString(R.string.profile_ago);
|
ago = resources.getString(R.string.profile_ago);
|
||||||
|
|
||||||
highlight = new ForegroundColorSpan(resources.getColor(R.color.lightorange));
|
highlight = new ForegroundColorSpan(resources.getColor(R.color.linkblue));
|
||||||
midgray = new ForegroundColorSpan(resources.getColor(R.color.midgray));
|
midgray = new ForegroundColorSpan(resources.getColor(R.color.midgray));
|
||||||
darkgray = new ForegroundColorSpan(resources.getColor(R.color.darkgray));
|
darkgray = new ForegroundColorSpan(resources.getColor(R.color.darkgray));
|
||||||
}
|
}
|
||||||
|
@ -80,17 +81,28 @@ public class ActivitiesAdapter extends ArrayAdapter<ActivitiesResponse> {
|
||||||
stringBuilder.setSpan(darkgray, 0, startedFollowing.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stringBuilder.setSpan(darkgray, 0, startedFollowing.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
stringBuilder.setSpan(usernameClick, startedFollowing.length() + 1, startedFollowing.length() + 1 + activity.user.username.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stringBuilder.setSpan(usernameClick, startedFollowing.length() + 1, startedFollowing.length() + 1 + activity.user.username.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
stringBuilder.setSpan(highlight, startedFollowing.length() + 1, startedFollowing.length() + 1 + activity.user.username.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stringBuilder.setSpan(highlight, startedFollowing.length() + 1, startedFollowing.length() + 1 + activity.user.username.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
} else if (TextUtils.equals(activity.category, "comment_reply")) {
|
} else if (TextUtils.equals(activity.category, "comment_like")) {
|
||||||
stringBuilder.append(repliedTo);
|
stringBuilder.append(likedComment);
|
||||||
stringBuilder.append(" ");
|
stringBuilder.append(" \"");
|
||||||
stringBuilder.append(activity.user.username);
|
|
||||||
stringBuilder.append(": \"");
|
|
||||||
stringBuilder.append(activity.content);
|
stringBuilder.append(activity.content);
|
||||||
stringBuilder.append("\"");
|
stringBuilder.append("\" ");
|
||||||
stringBuilder.setSpan(darkgray, 0, repliedTo.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stringBuilder.append("by ");
|
||||||
stringBuilder.setSpan(usernameClick, repliedTo.length() + 1, repliedTo.length() + 1 + activity.user.username.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stringBuilder.append(activity.user.username);
|
||||||
stringBuilder.setSpan(highlight, repliedTo.length() + 1, repliedTo.length() + 1 + activity.user.username.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stringBuilder.setSpan(darkgray, 0, likedComment.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
stringBuilder.setSpan(midgray, stringBuilder.length() - activity.content.length() - 2, stringBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stringBuilder.setSpan(highlight, likedComment.length() + 1, likedComment.length() + 3 + activity.content.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
stringBuilder.setSpan(midgray, stringBuilder.length() - activity.user.username.length() - 4, stringBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
stringBuilder.setSpan(usernameClick, likedComment.length() + 3 + activity.content.length() + 4, stringBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
} else if (TextUtils.equals(activity.category, "comment_reply")) {
|
||||||
|
stringBuilder.append(repliedTo);
|
||||||
|
stringBuilder.append(" ");
|
||||||
|
stringBuilder.append(activity.user.username);
|
||||||
|
stringBuilder.append(": \"");
|
||||||
|
stringBuilder.append(activity.content);
|
||||||
|
stringBuilder.append("\"");
|
||||||
|
stringBuilder.setSpan(darkgray, 0, repliedTo.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
stringBuilder.setSpan(usernameClick, repliedTo.length() + 1, repliedTo.length() + 1 + activity.user.username.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
stringBuilder.setSpan(highlight, repliedTo.length() + 1, repliedTo.length() + 1 + activity.user.username.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
stringBuilder.setSpan(midgray, stringBuilder.length() - activity.content.length() - 2, stringBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
} else if (TextUtils.equals(activity.category, "sharedstory")) {
|
} else if (TextUtils.equals(activity.category, "sharedstory")) {
|
||||||
stringBuilder.append(sharedStory);
|
stringBuilder.append(sharedStory);
|
||||||
stringBuilder.append(" \"");
|
stringBuilder.append(" \"");
|
||||||
|
|
Loading…
Add table
Reference in a new issue