From 0f60453c976acff1495ecef832fcec6b05ef15a1 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 3 Sep 2018 13:35:40 +0200 Subject: [PATCH] Added text parsing to post content --- .../client/ui/adapters/PostsAdapter.java | 17 +++++++++-------- .../ui/fragments/AbstractPostsListFragment.java | 9 ++------- app/src/main/res/layout/post_item.xml | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java index 4e59086..2b00566 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java @@ -23,6 +23,7 @@ import org.communiquons.android.comunic.client.data.models.UserInfo; import org.communiquons.android.comunic.client.data.utils.TimeUtils; import org.communiquons.android.comunic.client.ui.listeners.onPostUpdateListener; import org.communiquons.android.comunic.client.ui.utils.UiUtils; +import org.communiquons.android.comunic.client.ui.views.ContentTextView; import org.communiquons.android.comunic.client.ui.views.CountDownView; import org.communiquons.android.comunic.client.ui.views.EditCommentContentView; import org.communiquons.android.comunic.client.ui.views.EnlargeableWebImageView; @@ -175,7 +176,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter { private ImageView mPostVisibility; private ImageView mPostActions; private FrameLayout mAdditionnalViews; - private TextView mPostContent; + private ContentTextView mPostContent; private LikeButtonView mLikeButton; private LinearLayout mCommentsList; private LinearLayout mCreateCommentForm; @@ -208,7 +209,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter { /** * @return Additional views container */ - FrameLayout getAdditionnalViewsLayout(){ + FrameLayout getAdditionalViewsLayout(){ return mAdditionnalViews; } @@ -306,7 +307,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter { //Set post content - mPostContent.setText(UiUtils.prepareStringTextView(post.getContent())); + mPostContent.setParsedText(UiUtils.prepareStringTextView(post.getContent())); //Post likes @@ -401,7 +402,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter { super(itemView); mPostImage = new EnlargeableWebImageView(getContext()); - getAdditionnalViewsLayout().addView(mPostImage, + getAdditionalViewsLayout().addView(mPostImage, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, UiUtils.GetPixel(getContext(), 200))); } @@ -425,7 +426,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter { super(itemView); mPDFLinkButton = new PDFLinkButtonView(getContext(), null, R.style.PostPDFButton); - getAdditionnalViewsLayout().addView(mPDFLinkButton); + getAdditionalViewsLayout().addView(mPDFLinkButton); } @Override @@ -447,7 +448,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter { super(itemView); mWebLinkView = new WebLinkView(getContext()); - getAdditionnalViewsLayout().addView(mWebLinkView, + getAdditionalViewsLayout().addView(mWebLinkView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT )); @@ -472,7 +473,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter { super(itemView); mMovieView = new MovieView(getContext(), null, R.style.PostMovie); - getAdditionnalViewsLayout().addView(mMovieView, new FrameLayout.LayoutParams( + getAdditionalViewsLayout().addView(mMovieView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, UiUtils.GetPixel(getContext(), 200) )); @@ -497,7 +498,7 @@ public class PostsAdapter extends BaseRecyclerViewAdapter { super(itemView); mCountDownView = new CountDownView(getContext(), null); - getAdditionnalViewsLayout().addView(mCountDownView, new FrameLayout.LayoutParams( + getAdditionalViewsLayout().addView(mCountDownView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, UiUtils.GetPixel(getContext(), 30))); } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/AbstractPostsListFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/AbstractPostsListFragment.java index 0a10480..f75021d 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/AbstractPostsListFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/AbstractPostsListFragment.java @@ -188,21 +188,16 @@ public abstract class AbstractPostsListFragment extends Fragment //Create likes helper mLikesHelper = new LikesHelper(getActivity()); - } - - @Override - public void onResume() { - super.onResume(); - if(mPostsList == null) { setProgressBarVisibility(true); setNoPostsNoticeVisibility(false); onLoadPosts(); } - else{ + else { setPostsList(getPostsList()); show_posts(); } + } /** diff --git a/app/src/main/res/layout/post_item.xml b/app/src/main/res/layout/post_item.xml index 5320961..ab3d6b2 100644 --- a/app/src/main/res/layout/post_item.xml +++ b/app/src/main/res/layout/post_item.xml @@ -102,7 +102,7 @@ tools:layout_height="10dp" /> -