Removed more reddit related options

Removed options related to reddit, like flairs and awards.
This commit is contained in:
Bazsalanszky 2023-08-05 18:06:50 +02:00
parent 6cf69ee26d
commit 926e1162f0
5 changed files with 21 additions and 105 deletions

View File

@ -55,12 +55,8 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
TextView shareTextView;
@BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
TextView copyTextView;
@BindView(R.id.give_award_text_view_comment_more_bottom_sheet_fragment)
TextView giveAwardTextView;
@BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
TextView reportTextView;
@BindView(R.id.see_removed_view_comment_more_bottom_sheet_fragment)
TextView seeRemovedTextView;
private BaseActivity activity;
public CommentMoreBottomSheetFragment() {
@ -93,18 +89,6 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
boolean showReplyAndSaveOption = bundle.getBoolean(EXTRA_SHOW_REPLY_AND_SAVE_OPTION, false);
if (accessToken != null && !accessToken.equals("")) {
giveAwardTextView.setVisibility(View.VISIBLE);
giveAwardTextView.setOnClickListener(view -> {
Intent intent = new Intent(activity, GiveAwardActivity.class);
intent.putExtra(GiveAwardActivity.EXTRA_THING_FULLNAME, comment.getFullName());
intent.putExtra(GiveAwardActivity.EXTRA_ITEM_POSITION, bundle.getInt(EXTRA_POSITION));
if (activity instanceof ViewPostDetailActivity) {
activity.startActivityForResult(intent, ViewPostDetailActivity.GIVE_AWARD_REQUEST_CODE);
} else if (activity instanceof ViewUserDetailActivity) {
activity.startActivityForResult(intent, ViewUserDetailActivity.GIVE_AWARD_REQUEST_CODE);
}
dismiss();
});
if (editAndDeleteAvailable) {
editTextView.setVisibility(View.VISIBLE);
@ -193,27 +177,14 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
});
reportTextView.setOnClickListener(view -> {
Intent intent = new Intent(activity, ReportActivity.class);
/*Intent intent = new Intent(activity, ReportActivity.class);
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, comment.getCommunityName());
intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, comment.getFullName());
activity.startActivity(intent);
activity.startActivity(intent);*/
Toast.makeText(activity, R.string.not_implemented, Toast.LENGTH_SHORT).show();
dismiss();
});
if ("[deleted]".equals(comment.getAuthor()) ||
"[deleted]".equals(comment.getCommentRawText()) ||
"[removed]".equals(comment.getCommentRawText())
) {
seeRemovedTextView.setVisibility(View.VISIBLE);
seeRemovedTextView.setOnClickListener(view -> {
dismiss();
if (activity instanceof ViewPostDetailActivity) {
((ViewPostDetailActivity) activity).showRemovedComment(comment, bundle.getInt(EXTRA_POSITION));
}
});
}
if (activity.typeface != null) {
Utils.setFontToAllTextViews(rootView, activity.typeface);

View File

@ -78,7 +78,6 @@ import eu.toldi.infinityforlemmy.SaveThing;
import eu.toldi.infinityforlemmy.SortType;
import eu.toldi.infinityforlemmy.activities.CommentActivity;
import eu.toldi.infinityforlemmy.activities.EditPostActivity;
import eu.toldi.infinityforlemmy.activities.GiveAwardActivity;
import eu.toldi.infinityforlemmy.activities.PostFilterPreferenceActivity;
import eu.toldi.infinityforlemmy.activities.ReportActivity;
import eu.toldi.infinityforlemmy.activities.SubmitCrosspostActivity;
@ -114,7 +113,6 @@ import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
import eu.toldi.infinityforlemmy.subreddit.FetchSubredditData;
import eu.toldi.infinityforlemmy.subreddit.SubredditData;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import eu.toldi.infinityforlemmy.utils.Utils;
import eu.toldi.infinityforlemmy.videoautoplay.ExoCreator;
@ -709,7 +707,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
MenuItem spoilerItem = mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment);
spoilerItem.setVisible(true);
mMenu.findItem(R.id.action_edit_flair_view_post_detail_fragment).setVisible(true);
mMenu.findItem(R.id.action_block_user_view_post_detail_fragment).setVisible(false);
}
mMenu.findItem(R.id.action_view_crosspost_parent_view_post_detail_fragment).setVisible(mPost.getCrosspostParentId() != null);
@ -1072,35 +1070,18 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
return true;
} else if (itemId == R.id.action_spoiler_view_post_detail_fragment) {
return true;
} else if (itemId == R.id.action_edit_flair_view_post_detail_fragment) {
FlairBottomSheetFragment flairBottomSheetFragment = new FlairBottomSheetFragment();
Bundle bundle = new Bundle();
bundle.putString(FlairBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
bundle.putString(FlairBottomSheetFragment.EXTRA_SUBREDDIT_NAME, mPost.getSubredditName());
bundle.putLong(FlairBottomSheetFragment.EXTRA_VIEW_POST_DETAIL_FRAGMENT_ID, viewPostDetailFragmentId);
flairBottomSheetFragment.setArguments(bundle);
flairBottomSheetFragment.show(activity.getSupportFragmentManager(), flairBottomSheetFragment.getTag());
} else if (itemId == R.id.action_block_user_view_post_detail_fragment) {
Toast.makeText(activity, R.string.not_implemented, Toast.LENGTH_SHORT).show();
return true;
} else if (itemId == R.id.action_give_award_view_post_detail_fragment) {
if (mAccessToken == null) {
Toast.makeText(activity, R.string.login_first, Toast.LENGTH_SHORT).show();
return true;
}
Intent giveAwardIntent = new Intent(activity, GiveAwardActivity.class);
giveAwardIntent.putExtra(GiveAwardActivity.EXTRA_THING_FULLNAME, mPost.getFullName());
giveAwardIntent.putExtra(GiveAwardActivity.EXTRA_ITEM_POSITION, 0);
activity.startActivityForResult(giveAwardIntent, ViewPostDetailActivity.GIVE_AWARD_REQUEST_CODE);
} else if (itemId == R.id.action_block_community_view_post_detail_fragment) {
Toast.makeText(activity, R.string.not_implemented, Toast.LENGTH_SHORT).show();
return true;
} else if (itemId == R.id.action_report_view_post_detail_fragment) {
if (mAccessToken == null) {
Toast.makeText(activity, R.string.login_first, Toast.LENGTH_SHORT).show();
return true;
}
Intent intent = new Intent(activity, ReportActivity.class);
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, mPost.getSubredditName());
intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, mPost.getFullName());
startActivity(intent);
Toast.makeText(activity, R.string.not_implemented, Toast.LENGTH_SHORT).show();
return true;
} else if (itemId == R.id.action_see_removed_view_post_detail_fragment) {
showRemovedPost();
@ -1190,7 +1171,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
if (mCommentsRecyclerView != null) {
LinearLayoutManager myLayoutManager = (LinearLayoutManager) mCommentsRecyclerView.getLayoutManager();
scrollPosition = myLayoutManager != null ? myLayoutManager.findFirstVisibleItemPosition() : 0;
} else {
LinearLayoutManager myLayoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
scrollPosition = myLayoutManager != null ? myLayoutManager.findFirstVisibleItemPosition() : 0;
@ -1369,7 +1350,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
}
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken, mPost.getId(), commentId, sortType, mExpandChildren, pages_loaded + 1,
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken, mPost.getId(), mSingleCommentId == 0 ? null : mSingleCommentParentId == 0 ? mSingleCommentId : mSingleCommentParentId, sortType, mExpandChildren, pages_loaded + 1,
new FetchComment.FetchCommentListener() {
@Override
public void onFetchCommentSuccess(ArrayList<Comment> expandedComments,
@ -1438,8 +1419,8 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@Override
public void onFetchCommentFailed() {
isFetchingComments = false;
mCommentsAdapter.initiallyLoadCommentsFailed();
if(pages_loaded == 0)
mCommentsAdapter.initiallyLoadCommentsFailed();
if (changeRefreshState) {
isRefreshing = false;
}
@ -1459,7 +1440,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
isLoadingMoreChildren = true;
FetchComment.fetchComments(mExecutor, new Handler(), mRetrofit.getRetrofit(), mAccessToken,
mPost.getId(), null, sortType, mExpandChildren, pages_loaded + 1, new FetchComment.FetchCommentListener() {
mPost.getId(), mSingleCommentId == 0 ? null : mSingleCommentParentId == 0 ? mSingleCommentId : mSingleCommentParentId, sortType, mExpandChildren, pages_loaded + 1, new FetchComment.FetchCommentListener() {
@Override
public void onFetchCommentSuccess(ArrayList<Comment> expandedComments, Integer parentId, ArrayList<Integer> children) {
pages_loaded++;

View File

@ -124,25 +124,6 @@
android:fontFamily="?attr/font_family"
app:drawableStartCompat="@drawable/ic_copy_24dp" />
<TextView
android:id="@+id/give_award_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/action_give_award"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_give_award_24dp" />
<TextView
android:id="@+id/report_view_comment_more_bottom_sheet_fragment"
@ -163,25 +144,6 @@
android:fontFamily="?attr/font_family"
app:drawableStartCompat="@drawable/ic_report_24dp" />
<TextView
android:id="@+id/see_removed_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/see_removed_comment"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_preview_24dp" />
</LinearLayout>

View File

@ -76,16 +76,16 @@
android:visible="false" />
<item
android:id="@+id/action_edit_flair_view_post_detail_fragment"
android:id="@+id/action_block_user_view_post_detail_fragment"
android:orderInCategory="12"
android:title="@string/action_edit_flair"
android:title="@string/block_user"
app:showAsAction="never"
android:visible="false" />
android:visible="true" />
<item
android:id="@+id/action_give_award_view_post_detail_fragment"
android:id="@+id/action_block_community_view_post_detail_fragment"
android:orderInCategory="13"
android:title="@string/action_give_award"
android:title="@string/block_community"
app:showAsAction="never" />
<item

View File

@ -1347,4 +1347,6 @@
<string name="mentions">Mentions</string>
<string name="replies">Replies</string>
<string name="use_circular_fab">Use Circular FAB</string>
<string name="block_community">Block Community\n</string>
<string name="not_implemented">Feature not implemented yet :(</string>
</resources>