diff options
Diffstat (limited to 'app')
7 files changed, 187 insertions, 29 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java index ec46235d..095abbaa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java @@ -331,6 +331,14 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ((PostDetailViewHolder) holder).mGildedNumberTextView.setText(gildedNumber); } + if(mPost.isArchived()) { + ((PostDetailViewHolder) holder).mArchivedImageView.setVisibility(View.VISIBLE); + } + + if(mPost.isLocked()) { + ((PostDetailViewHolder) holder).mLockedImageView.setVisibility(View.VISIBLE); + } + if(mPost.isSpoiler() || mPost.getFlair() != null) { ((PostDetailViewHolder) holder).spoilerFlairlinearLayout.setVisibility(View.VISIBLE); } @@ -555,6 +563,12 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie android.graphics.PorterDuff.Mode.SRC_IN); } + if(mPost.isLocked()) { + ((CommentViewHolder) holder).replyButton + .setColorFilter(ContextCompat.getColor(mActivity, R.color.voteAndReplyUnavailableVoteButtonColor), + android.graphics.PorterDuff.Mode.SRC_IN); + } + ((CommentViewHolder) holder).replyButton.setOnClickListener(view -> { if(mAccessToken == null) { Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show(); @@ -989,6 +1003,8 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie @BindView(R.id.gilded_image_view_item_post_detail) ImageView mGildedImageView; @BindView(R.id.gilded_number_text_view_item_post_detail) TextView mGildedNumberTextView; @BindView(R.id.crosspost_image_view_item_post_detail) ImageView mCrosspostImageView; + @BindView(R.id.archived_image_view_item_post_detail) ImageView mArchivedImageView; + @BindView(R.id.locked_image_view_item_post_detail) ImageView mLockedImageView; @BindView(R.id.nsfw_text_view_item_post_detail) Chip mNSFWChip; @BindView(R.id.spoiler_flair_linear_layout_item_post_detail) LinearLayout spoilerFlairlinearLayout; @BindView(R.id.spoiler_custom_text_view_item_post_detail) CustomTextView spoilerTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java index 9747542a..5a1ec974 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java @@ -305,6 +305,10 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo ((DataViewHolder) holder).gildedNumberTextView.setText(gildedNumber); } + if(post.isLocked()) { + ((DataViewHolder) holder).lockedImageView.setVisibility(View.VISIBLE); + } + if(nsfw) { ((DataViewHolder) holder).nsfwChip.setVisibility(View.VISIBLE); } @@ -350,6 +354,8 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo } if(isArchived) { + ((DataViewHolder) holder).archivedImageView.setVisibility(View.VISIBLE); + ((DataViewHolder) holder).upvoteButton .setColorFilter(ContextCompat.getColor(mContext, R.color.voteAndReplyUnavailableVoteButtonColor), android.graphics.PorterDuff.Mode.SRC_IN); ((DataViewHolder) holder).downvoteButton @@ -691,6 +697,8 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo @BindView(R.id.type_text_view_item_post) Chip typeChip; @BindView(R.id.gilded_image_view_item_post) ImageView gildedImageView; @BindView(R.id.gilded_number_text_view_item_post) TextView gildedNumberTextView; + @BindView(R.id.archived_image_view_item_post) ImageView archivedImageView; + @BindView(R.id.locked_image_view_item_post) ImageView lockedImageView; @BindView(R.id.crosspost_image_view_item_post) ImageView crosspostImageView; @BindView(R.id.nsfw_text_view_item_post) Chip nsfwChip; @BindView(R.id.spoiler_flair_linear_layout_item_post) LinearLayout spoilerFlairLinearLayout; @@ -745,6 +753,8 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo ((DataViewHolder) holder).gildedImageView.setVisibility(View.GONE); ((DataViewHolder) holder).gildedNumberTextView.setVisibility(View.GONE); ((DataViewHolder) holder).crosspostImageView.setVisibility(View.GONE); + ((DataViewHolder) holder).archivedImageView.setVisibility(View.GONE); + ((DataViewHolder) holder).lockedImageView.setVisibility(View.GONE); ((DataViewHolder) holder).nsfwChip.setVisibility(View.GONE); ((DataViewHolder) holder).spoilerFlairLinearLayout.setVisibility(View.GONE); ((DataViewHolder) holder).spoilerTextView.setVisibility(View.GONE); diff --git a/app/src/main/res/drawable/ic_archive_outline_24dp.xml b/app/src/main/res/drawable/ic_archive_outline_24dp.xml new file mode 100644 index 00000000..adb84ff6 --- /dev/null +++ b/app/src/main/res/drawable/ic_archive_outline_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FF000000" + android:pathData="M20.54,5.23l-1.39,-1.68C18.88,3.21 18.47,3 18,3L6,3c-0.47,0 -0.88,0.21 -1.16,0.55L3.46,5.23C3.17,5.57 3,6.02 3,6.5L3,19c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6.5c0,-0.48 -0.17,-0.93 -0.46,-1.27zM6.24,5h11.52l0.81,0.97L5.44,5.97l0.8,-0.97zM5,19L5,8h14v11L5,19zM13.45,10h-2.9v3L8,13l4,4 4,-4h-2.55z"/> +</vector> diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index a9489d0a..16c4dafa 100644 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -92,8 +92,10 @@ android:src="@drawable/ic_arrow_downward_black_20dp" android:tint="@android:color/tab_indicator_text" app:layout_constraintStart_toEndOf="@+id/score_text_view_item_post_comment" + app:layout_constraintEnd_toStartOf="@id/more_button_item_post_comment" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintHorizontal_bias="0" /> <ImageView android:id="@+id/more_button_item_post_comment" diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml index 4c536025..10a9fbdd 100644 --- a/app/src/main/res/layout/item_post.xml +++ b/app/src/main/res/layout/item_post.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" @@ -80,67 +81,94 @@ android:textSize="18sp" android:textColor="@color/primaryTextColor"/> - <RelativeLayout + <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="16dp" - android:paddingEnd="16dp" - android:paddingTop="16dp"> + android:padding="16dp"> <com.google.android.material.chip.Chip android:id="@+id/type_text_view_item_post" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="16dp" android:textColor="@android:color/white" - android:layout_centerVertical="true" - app:chipBackgroundColor="@color/backgroundColorPrimaryDark" /> + app:chipBackgroundColor="@color/backgroundColorPrimaryDark" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/gilded_image_view_item_post" android:layout_width="24dp" android:layout_height="24dp" - android:layout_toEndOf="@id/type_text_view_item_post" - android:layout_centerVertical="true" - android:visibility="gone" /> + android:layout_marginStart="16dp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/type_text_view_item_post" + app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/gilded_number_text_view_item_post" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" - android:layout_marginEnd="8dp" - android:layout_toEndOf="@id/gilded_image_view_item_post" - android:visibility="gone" - android:textSize="20sp" android:textColor="@color/gold" - android:layout_centerVertical="true"/> + android:textSize="20sp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/gilded_image_view_item_post" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/archived_image_view_item_post" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginStart="16dp" + android:src="@drawable/ic_archive_outline_24dp" + android:tint="@color/archivedTint" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/crosspost_image_view_item_post" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/locked_image_view_item_post" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginStart="16dp" + android:src="@drawable/ic_outline_lock_24px" + android:tint="@color/lockedIconTint" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/nsfw_text_view_item_post" + app:layout_constraintStart_toEndOf="@+id/archived_image_view_item_post" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintHorizontal_bias="0" /> <ImageView android:id="@+id/crosspost_image_view_item_post" android:layout_width="24dp" android:layout_height="24dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:layout_toEndOf="@id/gilded_number_text_view_item_post" + android:layout_marginStart="16dp" android:src="@drawable/crosspost" android:tint="@color/colorAccent" - android:layout_centerVertical="true" - android:visibility="gone"/> + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/gilded_number_text_view_item_post" + app:layout_constraintTop_toTopOf="parent" /> <com.google.android.material.chip.Chip android:id="@+id/nsfw_text_view_item_post" - android:text="@string/nsfw" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_marginStart="8dp" + android:text="@string/nsfw" android:textColor="@android:color/white" android:visibility="gone" - android:layout_centerVertical="true" - app:chipBackgroundColor="@color/colorAccent"/> + app:chipBackgroundColor="@color/colorAccent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - </RelativeLayout> + </androidx.constraintlayout.widget.ConstraintLayout> <LinearLayout android:id="@+id/spoiler_flair_linear_layout_item_post" diff --git a/app/src/main/res/layout/item_post_detail.xml b/app/src/main/res/layout/item_post_detail.xml index 886f169f..b1299ca5 100644 --- a/app/src/main/res/layout/item_post_detail.xml +++ b/app/src/main/res/layout/item_post_detail.xml @@ -80,7 +80,96 @@ android:layout_marginTop="16dp" android:visibility="gone" /> - <RelativeLayout + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="16dp"> + + <com.google.android.material.chip.Chip + android:id="@+id/type_text_view_item_post_detail" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@android:color/white" + app:chipBackgroundColor="@color/backgroundColorPrimaryDark" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/gilded_image_view_item_post_detail" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginStart="16dp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/type_text_view_item_post_detail" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/gilded_number_text_view_item_post_detail" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="4dp" + android:textColor="@color/gold" + android:textSize="20sp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/gilded_image_view_item_post_detail" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/archived_image_view_item_post_detail" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginStart="16dp" + android:src="@drawable/ic_archive_outline_24dp" + android:tint="@color/archivedTint" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/crosspost_image_view_item_post_detail" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/locked_image_view_item_post_detail" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginStart="16dp" + android:src="@drawable/ic_outline_lock_24px" + android:tint="@color/lockedIconTint" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/nsfw_text_view_item_post_detail" + app:layout_constraintStart_toEndOf="@+id/archived_image_view_item_post_detail" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintHorizontal_bias="0" /> + + <ImageView + android:id="@+id/crosspost_image_view_item_post_detail" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginStart="16dp" + android:src="@drawable/crosspost" + android:tint="@color/colorAccent" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/gilded_number_text_view_item_post_detail" + app:layout_constraintTop_toTopOf="parent" /> + + <com.google.android.material.chip.Chip + android:id="@+id/nsfw_text_view_item_post_detail" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/nsfw" + android:textColor="@android:color/white" + android:visibility="gone" + app:chipBackgroundColor="@color/colorAccent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + <!--<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingStart="16dp" @@ -140,7 +229,7 @@ android:layout_centerVertical="true" app:chipBackgroundColor="@color/colorAccent"/> - </RelativeLayout> + </RelativeLayout>--> <LinearLayout android:id="@+id/spoiler_flair_linear_layout_item_post_detail" diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 65c75a1d..a83bdede 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -51,4 +51,8 @@ <color name="singleCommentThreadBackgroundColor">#B3E5F9</color> <color name="unreadMessageBackgroundColor">#B3E5F9</color> + + <color name="archivedTint">#B4009F</color> + + <color name="lockedIconTint">#EE7302</color> </resources> |