mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Add swap tap and long click option.
This commit is contained in:
parent
c705292bf8
commit
3c32daaca2
@ -150,6 +150,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
private boolean mExpandChildren;
|
private boolean mExpandChildren;
|
||||||
private boolean mCommentToolbarHidden;
|
private boolean mCommentToolbarHidden;
|
||||||
private boolean mCommentToolbarHideOnClick;
|
private boolean mCommentToolbarHideOnClick;
|
||||||
|
private boolean mSwapTapAndLong;
|
||||||
private boolean mShowCommentDivider;
|
private boolean mShowCommentDivider;
|
||||||
private boolean mShowAbsoluteNumberOfVotes;
|
private boolean mShowAbsoluteNumberOfVotes;
|
||||||
private boolean mAutoplay = false;
|
private boolean mAutoplay = false;
|
||||||
@ -306,6 +307,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false);
|
mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false);
|
||||||
mCommentToolbarHidden = mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDDEN, false);
|
mCommentToolbarHidden = mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDDEN, false);
|
||||||
mCommentToolbarHideOnClick= mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDE_ON_CLICK, true);
|
mCommentToolbarHideOnClick= mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDE_ON_CLICK, true);
|
||||||
|
mSwapTapAndLong = mSharedPreferences.getBoolean(SharedPreferencesUtils.SWAP_TAP_AND_LONG_COMMENTS, false);
|
||||||
mShowCommentDivider = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_COMMENT_DIVIDER, false);
|
mShowCommentDivider = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_COMMENT_DIVIDER, false);
|
||||||
mShowAbsoluteNumberOfVotes = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES, true);
|
mShowAbsoluteNumberOfVotes = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES, true);
|
||||||
|
|
||||||
@ -2703,23 +2705,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
|
|
||||||
authorFlairTextView.setOnClickListener(view -> authorTextView.performClick());
|
authorFlairTextView.setOnClickListener(view -> authorTextView.performClick());
|
||||||
|
|
||||||
View.OnClickListener hideToolbarOnClickListener = view -> {
|
|
||||||
if (mCommentToolbarHideOnClick) {
|
|
||||||
if (bottomConstraintLayout.getLayoutParams().height == 0) {
|
|
||||||
bottomConstraintLayout.getLayoutParams().height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
|
||||||
topScoreTextView.setVisibility(View.GONE);
|
|
||||||
((ViewPostDetailActivity) mActivity).delayTransition();
|
|
||||||
} else {
|
|
||||||
((ViewPostDetailActivity) mActivity).delayTransition();
|
|
||||||
bottomConstraintLayout.getLayoutParams().height = 0;
|
|
||||||
topScoreTextView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
linearLayout.setOnClickListener(hideToolbarOnClickListener);
|
|
||||||
commentMarkdownView.setOnClickListener(hideToolbarOnClickListener);
|
|
||||||
commentTimeTextView.setOnClickListener(hideToolbarOnClickListener);
|
|
||||||
|
|
||||||
moreButton.setOnClickListener(view -> {
|
moreButton.setOnClickListener(view -> {
|
||||||
CommentData comment = getCurrentComment();
|
CommentData comment = getCurrentComment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
@ -2961,15 +2946,45 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
commentMarkdownView.setOnLongClickListener(view -> {
|
if (mSwapTapAndLong) {
|
||||||
expandButton.performClick();
|
if (mCommentToolbarHideOnClick) {
|
||||||
return true;
|
View.OnLongClickListener hideToolbarOnLongClickListener = view -> hideToolbar();
|
||||||
});
|
linearLayout.setOnLongClickListener(hideToolbarOnLongClickListener);
|
||||||
|
commentMarkdownView.setOnLongClickListener(hideToolbarOnLongClickListener);
|
||||||
|
commentTimeTextView.setOnLongClickListener(hideToolbarOnLongClickListener);
|
||||||
|
}
|
||||||
|
View.OnClickListener expandCommentsOnClickListener = view -> expandComments();
|
||||||
|
commentMarkdownView.setOnClickListener(expandCommentsOnClickListener);
|
||||||
|
itemView.setOnClickListener(expandCommentsOnClickListener);
|
||||||
|
} else {
|
||||||
|
if (mCommentToolbarHideOnClick) {
|
||||||
|
View.OnClickListener hideToolbarOnClickListener = view -> hideToolbar();
|
||||||
|
linearLayout.setOnClickListener(hideToolbarOnClickListener);
|
||||||
|
commentMarkdownView.setOnClickListener(hideToolbarOnClickListener);
|
||||||
|
commentTimeTextView.setOnClickListener(hideToolbarOnClickListener);
|
||||||
|
}
|
||||||
|
View.OnLongClickListener expandsCommentsOnLongClickListener = view -> expandComments();
|
||||||
|
commentMarkdownView.setOnLongClickListener(expandsCommentsOnLongClickListener);
|
||||||
|
itemView.setOnLongClickListener(expandsCommentsOnLongClickListener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
itemView.setOnLongClickListener(view -> {
|
private boolean expandComments() {
|
||||||
expandButton.performClick();
|
expandButton.performClick();
|
||||||
return true;
|
return true;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
private boolean hideToolbar() {
|
||||||
|
if (bottomConstraintLayout.getLayoutParams().height == 0) {
|
||||||
|
bottomConstraintLayout.getLayoutParams().height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||||
|
topScoreTextView.setVisibility(View.GONE);
|
||||||
|
((ViewPostDetailActivity) mActivity).delayTransition();
|
||||||
|
} else {
|
||||||
|
((ViewPostDetailActivity) mActivity).delayTransition();
|
||||||
|
bottomConstraintLayout.getLayoutParams().height = 0;
|
||||||
|
topScoreTextView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommentData getCurrentComment() {
|
private CommentData getCurrentComment() {
|
||||||
|
@ -81,6 +81,7 @@ public class SharedPreferencesUtils {
|
|||||||
public static final String VIDEO_AUTOPLAY_VALUE_ON_WIFI = "1";
|
public static final String VIDEO_AUTOPLAY_VALUE_ON_WIFI = "1";
|
||||||
public static final String VIDEO_AUTOPLAY_VALUE_NEVER = "0";
|
public static final String VIDEO_AUTOPLAY_VALUE_NEVER = "0";
|
||||||
public static final String LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "lock_jump_to_next_top_level_comment_button";
|
public static final String LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "lock_jump_to_next_top_level_comment_button";
|
||||||
|
public static final String SWAP_TAP_AND_LONG_COMMENTS = "swap_tap_and_long_in_comments";
|
||||||
public static final String SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "swipe_up_to_hide_jump_to_next_top_level_comments_button";
|
public static final String SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "swipe_up_to_hide_jump_to_next_top_level_comments_button";
|
||||||
public static final String SHOW_TOP_LEVEL_COMMENTS_FIRST = "show_top_level_comments_first";
|
public static final String SHOW_TOP_LEVEL_COMMENTS_FIRST = "show_top_level_comments_first";
|
||||||
public static final String CONFIRM_TO_EXIT = "confirm_to_exit";
|
public static final String CONFIRM_TO_EXIT = "confirm_to_exit";
|
||||||
|
@ -336,6 +336,7 @@
|
|||||||
<string name="settings_show_elapsed_time">Show Elapsed Time in Posts and Comments</string>
|
<string name="settings_show_elapsed_time">Show Elapsed Time in Posts and Comments</string>
|
||||||
<string name="settings_default_post_layout">Default Post Layout</string>
|
<string name="settings_default_post_layout">Default Post Layout</string>
|
||||||
<string name="settings_show_divider_in_compact_layout">Show Divider in Compact Layout</string>
|
<string name="settings_show_divider_in_compact_layout">Show Divider in Compact Layout</string>
|
||||||
|
<string name="settings_swap_tap_and_long_title">Swap Tap and Long Press in Comments</string>
|
||||||
<string name="settings_swipe_to_go_back_from_post_detail_title">Swipe Right to Go Back From Comments</string>
|
<string name="settings_swipe_to_go_back_from_post_detail_title">Swipe Right to Go Back From Comments</string>
|
||||||
<string name="settings_lock_jump_to_next_top_level_comment_button_title">Lock Jump to Next Top-level Comment Button</string>
|
<string name="settings_lock_jump_to_next_top_level_comment_button_title">Lock Jump to Next Top-level Comment Button</string>
|
||||||
<string name="settings_lock_bottom_app_bar_title">Lock Bottom Navigation Bar</string>
|
<string name="settings_lock_bottom_app_bar_title">Lock Bottom Navigation Bar</string>
|
||||||
|
@ -33,4 +33,9 @@
|
|||||||
app:key="volume_keys_navigate_posts"
|
app:key="volume_keys_navigate_posts"
|
||||||
app:title="@string/settings_volume_keys_navigate_posts_title" />
|
app:title="@string/settings_volume_keys_navigate_posts_title" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="swap_tap_and_long_in_comments"
|
||||||
|
app:title="@string/settings_swap_tap_and_long_title" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user