aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-11-11 03:42:04 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-11-11 03:42:04 +0000
commit2b92b48cb521fb5d3ec4e85d26b967b6de009cda (patch)
tree3fa3482e19500adf5d62f715e6752dcd03e94ffd /app
parent083924964490f20c5d3871f4c80eca696b842fe4 (diff)
downloadinfinity-for-reddit-2b92b48cb521fb5d3ec4e85d26b967b6de009cda.tar
infinity-for-reddit-2b92b48cb521fb5d3ec4e85d26b967b6de009cda.tar.gz
infinity-for-reddit-2b92b48cb521fb5d3ec4e85d26b967b6de009cda.tar.bz2
infinity-for-reddit-2b92b48cb521fb5d3ec4e85d26b967b6de009cda.tar.lz
infinity-for-reddit-2b92b48cb521fb5d3ec4e85d26b967b6de009cda.tar.xz
infinity-for-reddit-2b92b48cb521fb5d3ec4e85d26b967b6de009cda.tar.zst
infinity-for-reddit-2b92b48cb521fb5d3ec4e85d26b967b6de009cda.zip
Changing post layout in ViewSubredditDetailActivity is available. Tweak the compact post UI. Minor bugs fixed.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java4
-rw-r--r--app/src/main/res/layout/item_comment.xml2
-rw-r--r--app/src/main/res/layout/item_post_compact.xml37
-rw-r--r--app/src/main/res/menu/view_subreddit_detail_activity.xml6
6 files changed, 54 insertions, 14 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
index 7ab828f0..4d0e7fab 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
@@ -48,6 +48,7 @@ import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FetchSubredditData;
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
+import ml.docilealligator.infinityforreddit.Fragment.PostLayoutBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.PostTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.SortTimeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment;
@@ -68,7 +69,7 @@ import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
public class ViewSubredditDetailActivity extends BaseActivity implements SortTypeSelectionCallback,
- PostTypeBottomSheetFragment.PostTypeSelectionCallback {
+ PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback {
public static final String EXTRA_SUBREDDIT_NAME_KEY = "ESN";
public static final String EXTRA_MESSAGE_FULLNAME = "ENF";
@@ -136,6 +137,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
private PostTypeBottomSheetFragment postTypeBottomSheetFragment;
private SortTypeBottomSheetFragment sortTypeBottomSheetFragment;
private SortTimeBottomSheetFragment sortTimeBottomSheetFragment;
+ private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
private SubredditViewModel mSubredditViewModel;
@Override
@@ -232,6 +234,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment();
+ postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
+
params = (AppBarLayout.LayoutParams) collapsingToolbarLayout.getLayoutParams();
//Get status bar height
@@ -534,6 +538,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
isInLazyMode = false;
}
}
+ break;
+ case R.id.action_change_post_layout_view_subreddit_detail_activity:
+ postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
}
return false;
}
@@ -615,6 +622,14 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
}
+ @Override
+ public void postLayoutSelected(int postLayout) {
+ if (mFragment != null) {
+ mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST, postLayout).apply();
+ ((FragmentCommunicator) mFragment).changePostLayout(postLayout);
+ }
+ }
+
public void postScrollUp() {
fab.show();
}
@@ -635,7 +650,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
((FragmentCommunicator) mFragment).changeNSFW(changeNSFWEvent.nsfw);
}
-
private static class InsertSubredditDataAsyncTask extends AsyncTask<Void, Void, Void> {
private SubredditDao mSubredditDao;
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 cd7d0ad5..1e2861f7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -585,6 +585,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (comment.getAuthorFlair() != null && !comment.getAuthorFlair().equals("")) {
((CommentViewHolder) holder).authorFlairTextView.setVisibility(View.VISIBLE);
((CommentViewHolder) holder).authorFlairTextView.setText(comment.getAuthorFlair());
+ ((CommentViewHolder) holder).authorFlairTextView.setOnClickListener(view -> ((CommentViewHolder) holder).authorTextView.performClick());
}
if (comment.isSubmitter()) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 73e19118..b2d03d13 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -82,9 +82,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@Override
public boolean areContentsTheSame(@NonNull Post post, @NonNull Post t1) {
- return post.getTitle().equals(t1.getTitle()) && !(post.getSelfText() != null && t1.getSelfText() != null
- && !post.getSelfText().equals(t1.getSelfText()))
- && post.getScore() == t1.getScore() && post.getVoteType() == t1.getVoteType();
+ return false;
}
};
private Context mContext;
diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml
index ee85314e..faf11a07 100644
--- a/app/src/main/res/layout/item_comment.xml
+++ b/app/src/main/res/layout/item_comment.xml
@@ -58,7 +58,7 @@
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/authorFlairTextColor"
- android:textSize="?attr/font_default"
+ android:textSize="?attr/font_12"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/barrier"
diff --git a/app/src/main/res/layout/item_post_compact.xml b/app/src/main/res/layout/item_post_compact.xml
index cdf3bd64..dc0f5876 100644
--- a/app/src/main/res/layout/item_post_compact.xml
+++ b/app/src/main/res/layout/item_post_compact.xml
@@ -13,7 +13,10 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="16dp">
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
android:id="@+id/icon_gif_image_view_item_post_compact"
@@ -92,12 +95,15 @@
android:id="@+id/flow_layout_item_post_compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:padding="16dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
app:layout_constraintTop_toBottomOf="@id/title_text_view_best_item_post_compact"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/barrier2"
app:layout_constraintBottom_toTopOf="@id/link_text_view_item_post_compact"
- app:flChildSpacing="16dp"
+ app:flChildSpacing="8dp"
app:flChildSpacingForLastRow="align"
app:flRowSpacing="8dp">
@@ -275,7 +281,10 @@
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
- android:padding="12dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"
android:src="@drawable/ic_arrow_upward_grey_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -299,7 +308,10 @@
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
- android:padding="12dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"
android:src="@drawable/ic_arrow_downward_grey_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_compact"
@@ -312,7 +324,10 @@
android:drawableStart="@drawable/ic_comment_grey_24dp"
android:drawablePadding="12dp"
android:gravity="center_vertical"
- android:padding="12dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"
android:textSize="?attr/font_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
@@ -326,7 +341,10 @@
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
- android:padding="12dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_compact"
app:layout_constraintHorizontal_bias="1"
@@ -340,7 +358,10 @@
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
- android:padding="12dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"
android:src="@drawable/ic_share_grey_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/app/src/main/res/menu/view_subreddit_detail_activity.xml b/app/src/main/res/menu/view_subreddit_detail_activity.xml
index 5893920a..c51b5b3a 100644
--- a/app/src/main/res/menu/view_subreddit_detail_activity.xml
+++ b/app/src/main/res/menu/view_subreddit_detail_activity.xml
@@ -28,4 +28,10 @@
android:orderInCategory="4"
android:title="@string/action_start_lazy_mode"
app:showAsAction="never" />
+
+ <item
+ android:id="@+id/action_change_post_layout_view_subreddit_detail_activity"
+ android:orderInCategory="5"
+ android:title="@string/action_change_post_layout"
+ app:showAsAction="never" />
</menu> \ No newline at end of file