diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-04-20 09:34:14 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-04-20 09:34:14 +0000 |
commit | f634686eb8059ef5fa634ba1322c6340199f44bc (patch) | |
tree | 7437f3584039427f0e082046a04bf0ca5d87bac6 /app | |
parent | f4266bb35055687dbe46a7da54a9caeaad3fd9d4 (diff) | |
download | infinity-for-reddit-f634686eb8059ef5fa634ba1322c6340199f44bc.tar infinity-for-reddit-f634686eb8059ef5fa634ba1322c6340199f44bc.tar.gz infinity-for-reddit-f634686eb8059ef5fa634ba1322c6340199f44bc.tar.bz2 infinity-for-reddit-f634686eb8059ef5fa634ba1322c6340199f44bc.tar.lz infinity-for-reddit-f634686eb8059ef5fa634ba1322c6340199f44bc.tar.xz infinity-for-reddit-f634686eb8059ef5fa634ba1322c6340199f44bc.tar.zst infinity-for-reddit-f634686eb8059ef5fa634ba1322c6340199f44bc.zip |
Hide reply and save buttons in comments if the depth is larger than 5. Add reply and save options in CommentMoreBottomSheetFragment.
Diffstat (limited to '')
13 files changed, 331 insertions, 121 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index 4577cb96..41a09c37 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -48,6 +48,7 @@ import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SaveThing; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.asynctasks.SwitchAccount; @@ -59,6 +60,9 @@ import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.ViewPostDetailFragment; import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; +import retrofit2.Retrofit; + +import static ml.docilealligator.infinityforreddit.activities.CommentActivity.RETURN_EXTRA_COMMENT_DATA_KEY; public class ViewPostDetailActivity extends BaseActivity implements SortTypeSelectionCallback, ActivityToolbarInterface { @@ -73,8 +77,6 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele public static final int EDIT_COMMENT_REQUEST_CODE = 3; public static final int GIVE_AWARD_REQUEST_CODE = 100; @State - String mAccountName; - @State String mNewAccountName; @BindView(R.id.coordinator_layout_view_post_detail) CoordinatorLayout mCoordinatorLayout; @@ -87,6 +89,9 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele @BindView(R.id.fab_view_post_detail_activity) FloatingActionButton fab; @Inject + @Named("oauth") + Retrofit mOauthRetrofit; + @Inject RedditDataRoomDatabase mRedditDataRoomDatabase; @Inject @Named("default") @@ -105,6 +110,8 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele private FragmentManager fragmentManager; private SlidrInterface mSlidrInterface; private SectionsPagerAdapter sectionsPagerAdapter; + private String mAccessToken; + private String mAccountName; private long postFragmentId; private int postListPosition = -1; private int orientation; @@ -183,6 +190,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME); } + mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); mVolumeKeysNavigateComments = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOLUME_KEYS_NAVIGATE_COMMENTS, false); @@ -302,6 +310,52 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } } + public void saveComment(@NonNull Comment comment, int position) { + if (comment.isSaved()) { + comment.setSaved(false); + SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() { + @Override + public void success() { + ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); + if (fragment != null) { + fragment.saveComment(position, false); + } + Toast.makeText(ViewPostDetailActivity.this, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); + if (fragment != null) { + fragment.saveComment(position, true); + } + Toast.makeText(ViewPostDetailActivity.this, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show(); + } + }); + } else { + comment.setSaved(true); + SaveThing.saveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() { + @Override + public void success() { + ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); + if (fragment != null) { + fragment.saveComment(position, true); + } + Toast.makeText(ViewPostDetailActivity.this, R.string.comment_saved_success, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); + if (fragment != null) { + fragment.saveComment(position, false); + } + Toast.makeText(ViewPostDetailActivity.this, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show(); + } + }); + } + } + @Subscribe public void onAccountSwitchEvent(SwitchAccountEvent event) { if (!getClass().getName().equals(event.excludeActivityClassName)) { @@ -346,6 +400,26 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele int newAwardsCount = data.getIntExtra(GiveAwardActivity.EXTRA_RETURN_NEW_AWARDS_COUNT, 0); awardGiven(newAwardsHTML, newAwardsCount, position); } + } else if (requestCode == CommentActivity.WRITE_COMMENT_REQUEST_CODE) { + if (data != null && resultCode == Activity.RESULT_OK) { + if (data.hasExtra(RETURN_EXTRA_COMMENT_DATA_KEY)) { + ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); + if (fragment != null) { + Comment comment = data.getParcelableExtra(RETURN_EXTRA_COMMENT_DATA_KEY); + if (comment != null && comment.getDepth() == 0) { + fragment.addComment(comment); + } else { + String parentFullname = data.getStringExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY); + int parentPosition = data.getIntExtra(CommentActivity.EXTRA_PARENT_POSITION_KEY, -1); + if (parentFullname != null && parentPosition >= 0) { + fragment.addChildComment(comment, parentFullname, parentPosition); + } + } + } + } else { + Toast.makeText(this, R.string.send_comment_failed, Toast.LENGTH_SHORT).show(); + } + } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java index f463ed31..2aa5b555 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java @@ -192,6 +192,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy private boolean mHasMoreComments; private boolean loadMoreCommentsFailed; + private int depthThreshold = 5; private int mColorPrimaryLightTheme; private int mColorAccent; private int mCircularProgressBarBackgroundColor; @@ -224,13 +225,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy private int mNoPreviewPostTypeIconTint; private int mUpvotedColor; private int mDownvotedColor; - private int mCommentVerticalBarColor1; - private int mCommentVerticalBarColor2; - private int mCommentVerticalBarColor3; - private int mCommentVerticalBarColor4; - private int mCommentVerticalBarColor5; - private int mCommentVerticalBarColor6; - private int mCommentVerticalBarColor7; private int mSingleCommentThreadBackgroundColor; private int mVoteAndReplyUnavailableVoteButtonColor; private int mButtonTextColor; @@ -485,8 +479,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mShowElapsedTime = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false); mTimeFormatPattern = sharedPreferences.getString(SharedPreferencesUtils.TIME_FORMAT_KEY, SharedPreferencesUtils.TIME_FORMAT_DEFAULT_VALUE); mExpandChildren = !sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false); - //mCommentToolbarHidden = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDDEN, false); - mCommentToolbarHidden = true; + mCommentToolbarHidden = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDDEN, false); + //mCommentToolbarHidden = true; mCommentToolbarHideOnClick = sharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDE_ON_CLICK, true); mSwapTapAndLong = sharedPreferences.getBoolean(SharedPreferencesUtils.SWAP_TAP_AND_LONG_COMMENTS, false); mShowCommentDivider = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_COMMENT_DIVIDER, false); @@ -557,13 +551,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mUsernameColor = customThemeWrapper.getUsername(); mUpvotedColor = customThemeWrapper.getUpvoted(); mDownvotedColor = customThemeWrapper.getDownvoted(); - mCommentVerticalBarColor1 = customThemeWrapper.getCommentVerticalBarColor1(); - mCommentVerticalBarColor2 = customThemeWrapper.getCommentVerticalBarColor2(); - mCommentVerticalBarColor3 = customThemeWrapper.getCommentVerticalBarColor3(); - mCommentVerticalBarColor4 = customThemeWrapper.getCommentVerticalBarColor4(); - mCommentVerticalBarColor5 = customThemeWrapper.getCommentVerticalBarColor5(); - mCommentVerticalBarColor6 = customThemeWrapper.getCommentVerticalBarColor6(); - mCommentVerticalBarColor7 = customThemeWrapper.getCommentVerticalBarColor7(); mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor(); mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableButtonColor(); mButtonTextColor = customThemeWrapper.getButtonTextColor(); @@ -1118,6 +1105,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy comment.getScore() + comment.getVoteType()))); ((CommentViewHolder) holder).commentIndentationView.setLevelAndColors(comment.getDepth(), verticalBlockColors); + if (comment.getDepth() > depthThreshold) { + ((CommentViewHolder) holder).saveButton.setVisibility(View.GONE); + ((CommentViewHolder) holder).replyButton.setVisibility(View.GONE); + } else { + ((CommentViewHolder) holder).saveButton.setVisibility(View.VISIBLE); + ((CommentViewHolder) holder).replyButton.setVisibility(View.VISIBLE); + } if (comment.hasReply()) { if (comment.isExpanded()) { @@ -1882,6 +1876,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy } } + public void setSaveComment(int position, boolean isSaved) { + Comment comment = getCurrentComment(position); + if (comment != null) { + comment.setSaved(isSaved); + } + } + @Override public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { if (holder instanceof CommentViewHolder) { @@ -3365,6 +3366,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy } bundle.putString(CommentMoreBottomSheetFragment.EXTRA_COMMENT_MARKDOWN, comment.getCommentMarkdown()); bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_IS_NSFW, mPost.isNSFW()); + if (comment.getDepth() > depthThreshold) { + bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_SHOW_REPLY_AND_SAVE_OPTION, true); + } CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment(); commentMoreBottomSheetFragment.setArguments(bundle); commentMoreBottomSheetFragment.show(mActivity.getSupportFragmentManager(), commentMoreBottomSheetFragment.getTag()); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java index d1826cf2..6774b205 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java @@ -15,20 +15,22 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.activities.FullMarkdownActivity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.CommentActivity; import ml.docilealligator.infinityforreddit.activities.EditCommentActivity; +import ml.docilealligator.infinityforreddit.activities.FullMarkdownActivity; import ml.docilealligator.infinityforreddit.activities.GiveAwardActivity; import ml.docilealligator.infinityforreddit.activities.ReportActivity; import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity; import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity; import ml.docilealligator.infinityforreddit.comment.Comment; -import ml.docilealligator.infinityforreddit.R; /** @@ -40,13 +42,18 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag public static final String EXTRA_ACCESS_TOKEN = "EAT"; public static final String EXTRA_EDIT_AND_DELETE_AVAILABLE = "EEADA"; public static final String EXTRA_POSITION = "EP"; + public static final String EXTRA_SHOW_REPLY_AND_SAVE_OPTION = "ESSARO"; public static final String EXTRA_COMMENT_MARKDOWN = "ECM"; public static final String EXTRA_IS_NSFW = "EIN"; @BindView(R.id.edit_text_view_comment_more_bottom_sheet_fragment) TextView editTextView; @BindView(R.id.delete_text_view_comment_more_bottom_sheet_fragment) TextView deleteTextView; + @BindView(R.id.reply_text_view_comment_more_bottom_sheet_fragment) + TextView replyTextView; @BindView(R.id.save_text_view_comment_more_bottom_sheet_fragment) + TextView saveTextView; + @BindView(R.id.share_text_view_comment_more_bottom_sheet_fragment) TextView shareTextView; @BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment) TextView copyTextView; @@ -87,6 +94,7 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag } String accessToken = bundle.getString(EXTRA_ACCESS_TOKEN); boolean editAndDeleteAvailable = bundle.getBoolean(EXTRA_EDIT_AND_DELETE_AVAILABLE, false); + boolean showReplyAndSaveOption = bundle.getBoolean(EXTRA_SHOW_REPLY_AND_SAVE_OPTION, false); if (accessToken != null && !accessToken.equals("")) { giveAwardTextView.setVisibility(View.VISIBLE); @@ -131,6 +139,38 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag } } + if (showReplyAndSaveOption) { + replyTextView.setVisibility(View.VISIBLE); + saveTextView.setVisibility(View.VISIBLE); + if (comment.isSaved()) { + saveTextView.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(activity, R.drawable.ic_bookmark_24dp), null, null, null); + saveTextView.setText(R.string.unsave_comment); + } else { + saveTextView.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(activity, R.drawable.ic_bookmark_border_24dp), null, null, null); + saveTextView.setText(R.string.save_comment); + } + replyTextView.setOnClickListener(view -> { + Intent intent = new Intent(activity, CommentActivity.class); + intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, comment.getDepth() + 1); + intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_MARKDOWN_KEY, comment.getCommentMarkdown()); + intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, comment.getCommentRawText()); + intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, comment.getFullName()); + intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, true); + + intent.putExtra(CommentActivity.EXTRA_PARENT_POSITION_KEY, bundle.getInt(EXTRA_POSITION)); + activity.startActivityForResult(intent, CommentActivity.WRITE_COMMENT_REQUEST_CODE); + + dismiss(); + }); + + saveTextView.setOnClickListener(view -> { + if (activity instanceof ViewPostDetailActivity) { + ((ViewPostDetailActivity) activity).saveComment(comment, bundle.getInt(EXTRA_POSITION)); + } + dismiss(); + }); + } + shareTextView.setOnClickListener(view -> { dismiss(); try { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index 5f41dc1d..86cc6c4a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -729,6 +729,12 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic } } + public void saveComment(int position, boolean isSaved) { + if (mAdapter != null) { + mAdapter.setSaveComment(position, isSaved); + } + } + @Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { inflater.inflate(R.menu.view_post_detail_fragment, menu); diff --git a/app/src/main/res/drawable-night/ic_bookmark_24dp.xml b/app/src/main/res/drawable-night/ic_bookmark_24dp.xml new file mode 100644 index 00000000..edee7cf9 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_bookmark_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="#FFFFFF" + android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_bookmark_border_24dp.xml b/app/src/main/res/drawable-night/ic_bookmark_border_24dp.xml new file mode 100644 index 00000000..f41f953b --- /dev/null +++ b/app/src/main/res/drawable-night/ic_bookmark_border_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="#FFFFFF" + android:pathData="M17,3L7,3c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3L19,5c0,-1.1 -0.9,-2 -2,-2zM17,18l-5,-2.18L7,18L7,5h10v13z"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_reply_24dp.xml b/app/src/main/res/drawable-night/ic_reply_24dp.xml new file mode 100644 index 00000000..f8ebec5e --- /dev/null +++ b/app/src/main/res/drawable-night/ic_reply_24dp.xml @@ -0,0 +1,4 @@ +<vector android:height="24dp" android:viewportHeight="24.0" + android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="#FFFFFF" android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z"/> +</vector> diff --git a/app/src/main/res/drawable/ic_bookmark_24dp.xml b/app/src/main/res/drawable/ic_bookmark_24dp.xml new file mode 100644 index 00000000..05588d52 --- /dev/null +++ b/app/src/main/res/drawable/ic_bookmark_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="#000000" + android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/> +</vector> diff --git a/app/src/main/res/drawable/ic_bookmark_border_24dp.xml b/app/src/main/res/drawable/ic_bookmark_border_24dp.xml new file mode 100644 index 00000000..22c3d5fa --- /dev/null +++ b/app/src/main/res/drawable/ic_bookmark_border_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="#000000" + android:pathData="M17,3L7,3c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3L19,5c0,-1.1 -0.9,-2 -2,-2zM17,18l-5,-2.18L7,18L7,5h10v13z"/> +</vector> diff --git a/app/src/main/res/drawable/ic_reply_24dp.xml b/app/src/main/res/drawable/ic_reply_24dp.xml new file mode 100644 index 00000000..43e4df73 --- /dev/null +++ b/app/src/main/res/drawable/ic_reply_24dp.xml @@ -0,0 +1,4 @@ +<vector android:height="24dp" android:viewportHeight="24.0" + android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="#000000" android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z"/> +</vector> diff --git a/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml b/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml index 719935d5..4c03230f 100644 --- a/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml @@ -49,6 +49,26 @@ app:drawableStartCompat="@drawable/ic_delete_24dp" /> <TextView + android:id="@+id/reply_text_view_comment_more_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawablePadding="48dp" + android:focusable="true" + android:gravity="center_vertical" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" + android:text="@string/reply" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:visibility="gone" + app:drawableStartCompat="@drawable/ic_reply_24dp" /> + + <TextView android:id="@+id/save_text_view_comment_more_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -61,6 +81,24 @@ android:paddingTop="16dp" android:paddingEnd="32dp" android:paddingBottom="16dp" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:visibility="gone" + android:fontFamily="?attr/font_family" /> + + <TextView + android:id="@+id/share_text_view_comment_more_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawablePadding="48dp" + android:focusable="true" + android:gravity="center_vertical" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/share" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index a33b8a36..d4874801 100644 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -116,110 +116,110 @@ android:textSize="?attr/content_font_default" android:fontFamily="?attr/content_font_family" /> - </LinearLayout> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_comment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="4dp" + android:paddingEnd="4dp"> - </LinearLayout> + <ImageView + android:id="@+id/up_vote_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_arrow_upward_grey_24dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" /> - <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/bottom_constraint_layout_item_post_comment" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="4dp" - android:paddingEnd="4dp"> + <TextView + android:id="@+id/score_text_view_item_post_comment" + android:layout_width="64dp" + android:layout_height="wrap_content" + android:gravity="center" + android:textSize="?attr/font_12" + android:textStyle="bold" + android:fontFamily="?attr/font_family" + app:layout_constraintStart_toEndOf="@+id/up_vote_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> - <ImageView - android:id="@+id/up_vote_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_arrow_upward_grey_24dp" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" /> - - <TextView - android:id="@+id/score_text_view_item_post_comment" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - android:fontFamily="?attr/font_family" - app:layout_constraintStart_toEndOf="@+id/up_vote_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <ImageView - android:id="@+id/down_vote_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_arrow_downward_grey_24dp" - 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_constraintHorizontal_bias="0" /> - - <ImageView - android:id="@+id/more_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_more_vert_grey_24dp" - app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <ImageView - android:id="@+id/expand_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_expand_less_grey_24dp" - android:visibility="gone" - app:layout_constraintEnd_toStartOf="@+id/save_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <ImageView - android:id="@+id/save_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - app:layout_constraintEnd_toStartOf="@+id/reply_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <ImageView - android:id="@+id/reply_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_reply_grey_24dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - </androidx.constraintlayout.widget.ConstraintLayout> + <ImageView + android:id="@+id/down_vote_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_arrow_downward_grey_24dp" + 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_constraintHorizontal_bias="0" /> + + <ImageView + android:id="@+id/more_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_more_vert_grey_24dp" + app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + <ImageView + android:id="@+id/expand_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_expand_less_grey_24dp" + android:visibility="gone" + app:layout_constraintEnd_toStartOf="@+id/save_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + <ImageView + android:id="@+id/save_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + app:layout_constraintEnd_toStartOf="@+id/reply_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + <ImageView + android:id="@+id/reply_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_reply_grey_24dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + </androidx.constraintlayout.widget.ConstraintLayout> + + </LinearLayout> + + </LinearLayout> <View android:id="@+id/divider_item_comment" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e41edd82..f671784b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -583,6 +583,8 @@ <string name="no_email_client">No Email client found</string> <string name="no_app">No app available</string> + <string name="save_comment">Save</string> + <string name="unsave_comment">Unsave</string> <string name="comment_saved_success">Comment saved</string> <string name="comment_saved_failed">Unable to save comment</string> <string name="comment_unsaved_success">Comment unsaved</string> @@ -1104,4 +1106,6 @@ <string name="disable_nsfw_forever_message">Once enabled, NSFW will be permanently disabled, regardless of whether the NSFW setting is enabled or not. And this option is irreversible, the only way to re-enable NSFW is to clear the app data.\n\nStill want to enable it?</string> + <string name="reply">Reply</string> + </resources> |