From 3a81ca17e864dd76d77d4a6bd41ccfdcc54bbe1e Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 28 Oct 2019 21:17:09 +0800 Subject: [PATCH] Use FlowLayout to host all the information of a post in item_post and item_post_detail. --- app/build.gradle | 2 +- .../CommentAndPostRecyclerViewAdapter.java | 11 -- .../Adapter/PostRecyclerViewAdapter.java | 11 -- .../Settings/AcknowledgementFragment.java | 3 + app/src/main/res/drawable/gold.xml | 4 +- app/src/main/res/layout/item_post.xml | 152 +++++++---------- app/src/main/res/layout/item_post_detail.xml | 154 +++++++----------- 7 files changed, 116 insertions(+), 221 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bb09add8..33d60533 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -79,5 +79,5 @@ dependencies { annotationProcessor 'com.evernote:android-state-processor:1.4.1' implementation 'androidx.work:work-runtime:2.2.0' implementation 'androidx.preference:preference:1.1.0' - implementation 'org.sufficientlysecure:html-textview:3.6' + implementation 'com.nex3z:flow-layout:1.3.0' } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 825a3a1a..84585046 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -15,7 +15,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; @@ -359,7 +358,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter 0) { - ((PostDetailViewHolder) holder).mGildedImageView.setVisibility(View.VISIBLE); ((PostDetailViewHolder) holder).mGildedNumberTextView.setVisibility(View.VISIBLE); String gildedNumber = mActivity.getResources().getString(R.string.gilded_count, mPost.getGilded()); ((PostDetailViewHolder) holder).mGildedNumberTextView.setText(gildedNumber); @@ -373,10 +371,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter 0) { - ((DataViewHolder) holder).gildedImageView.setVisibility(View.VISIBLE); ((DataViewHolder) holder).gildedNumberTextView.setVisibility(View.VISIBLE); String gildedNumber = mContext.getResources().getString(R.string.gilded_count, gilded); ((DataViewHolder) holder).gildedNumberTextView.setText(gildedNumber); @@ -334,10 +333,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter + diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml index c09582f5..c702e529 100644 --- a/app/src/main/res/layout/item_post.xml +++ b/app/src/main/res/layout/item_post.xml @@ -94,10 +94,13 @@ android:textSize="?attr/content_font_default" android:ellipsize="end" /> - + android:padding="16dp" + app:flChildSpacing="16dp" + app:flChildSpacingForLastRow="align" + app:flRowSpacing="8dp"> - - - - - - - - - - - - - - - - + + - + + + + + + + + + - + android:padding="16dp" + app:flChildSpacing="16dp" + app:flChildSpacingForLastRow="align" + app:flRowSpacing="8dp"> - - - - - - - - - - - - - - - - + + - + + + + + + + + +