mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-30 11:34:43 +01:00
Giving awards to comments. Fix some bugs.
This commit is contained in:
parent
6710c44ff9
commit
e1b0b568ec
@ -139,7 +139,7 @@ public class GiveAwardActivity extends BaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void success(String awardsHTML, int awardCount) {
|
public void success(String awardsHTML, int awardCount) {
|
||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
data.putExtra(EXTRA_ITEM_POSITION, itemPosition);
|
data.putExtra(EXTRA_RETURN_ITEM_POSITION, itemPosition);
|
||||||
data.putExtra(EXTRA_RETURN_NEW_AWARDS, awardsHTML);
|
data.putExtra(EXTRA_RETURN_NEW_AWARDS, awardsHTML);
|
||||||
data.putExtra(EXTRA_RETURN_NEW_AWARDS_COUNT, awardCount);
|
data.putExtra(EXTRA_RETURN_NEW_AWARDS_COUNT, awardCount);
|
||||||
setResult(RESULT_OK, data);
|
setResult(RESULT_OK, data);
|
||||||
|
@ -1228,7 +1228,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||||
}
|
}
|
||||||
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
|
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
|
||||||
.setTitle(R.string.go_to_user)
|
.setTitle(R.string.go_to_subreddit)
|
||||||
.setView(thingEditText)
|
.setView(thingEditText)
|
||||||
.setPositiveButton(R.string.ok, (dialogInterface, i)
|
.setPositiveButton(R.string.ok, (dialogInterface, i)
|
||||||
-> {
|
-> {
|
||||||
|
@ -124,8 +124,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
|||||||
public static final String EXTRA_MESSAGE_FULLNAME = "ENI";
|
public static final String EXTRA_MESSAGE_FULLNAME = "ENI";
|
||||||
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
|
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
|
||||||
public static final int EDIT_COMMENT_REQUEST_CODE = 3;
|
public static final int EDIT_COMMENT_REQUEST_CODE = 3;
|
||||||
|
public static final int GIVE_AWARD_REQUEST_CODE = 100;
|
||||||
private static final int EDIT_POST_REQUEST_CODE = 2;
|
private static final int EDIT_POST_REQUEST_CODE = 2;
|
||||||
private static final int GIVE_AWARD_REQUEST_CODE = 100;
|
|
||||||
@State
|
@State
|
||||||
boolean mNullAccessToken = false;
|
boolean mNullAccessToken = false;
|
||||||
@State
|
@State
|
||||||
|
@ -1112,7 +1112,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||||
}
|
}
|
||||||
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
|
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
|
||||||
.setTitle(R.string.go_to_user)
|
.setTitle(R.string.go_to_subreddit)
|
||||||
.setView(thingEditText)
|
.setView(thingEditText)
|
||||||
.setPositiveButton(R.string.ok, (dialogInterface, i)
|
.setPositiveButton(R.string.ok, (dialogInterface, i)
|
||||||
-> {
|
-> {
|
||||||
|
@ -94,6 +94,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
public static final String EXTRA_USER_NAME_KEY = "EUNK";
|
public static final String EXTRA_USER_NAME_KEY = "EUNK";
|
||||||
public static final String EXTRA_MESSAGE_FULLNAME = "ENF";
|
public static final String EXTRA_MESSAGE_FULLNAME = "ENF";
|
||||||
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
|
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
|
||||||
|
public static final int GIVE_AWARD_REQUEST_CODE = 200;
|
||||||
|
public static final int EDIT_COMMENT_REQUEST_CODE = 300;
|
||||||
|
|
||||||
private static final String FETCH_USER_INFO_STATE = "FSIS";
|
private static final String FETCH_USER_INFO_STATE = "FSIS";
|
||||||
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
|
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
|
||||||
@ -580,7 +582,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
FetchUserData.fetchUserData(mRetrofit, username, new FetchUserData.FetchUserDataListener() {
|
FetchUserData.fetchUserData(mRetrofit, username, new FetchUserData.FetchUserDataListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFetchUserDataSuccess(UserData userData) {
|
public void onFetchUserDataSuccess(UserData userData) {
|
||||||
new InsertUserDataAsyncTask(mRedditDataRoomDatabase.userDao(), userData,
|
new ViewUserDetailActivity.InsertUserDataAsyncTask(mRedditDataRoomDatabase.userDao(), userData,
|
||||||
() -> mFetchUserInfoSuccess = true).execute();
|
() -> mFetchUserInfoSuccess = true).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,6 +735,29 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
|
if (requestCode == GIVE_AWARD_REQUEST_CODE) {
|
||||||
|
Toast.makeText(this, R.string.give_award_success, Toast.LENGTH_SHORT).show();
|
||||||
|
int position = data.getIntExtra(GiveAwardActivity.EXTRA_RETURN_ITEM_POSITION, 0);
|
||||||
|
String newAwardsHTML = data.getStringExtra(GiveAwardActivity.EXTRA_RETURN_NEW_AWARDS);
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.giveAward(newAwardsHTML, position);
|
||||||
|
}
|
||||||
|
} else if (requestCode == EDIT_COMMENT_REQUEST_CODE) {
|
||||||
|
if (data != null) {
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.editComment(
|
||||||
|
data.getStringExtra(EditCommentActivity.EXTRA_EDITED_COMMENT_CONTENT),
|
||||||
|
data.getExtras().getInt(EditCommentActivity.EXTRA_EDITED_COMMENT_POSITION));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
@ -964,6 +989,24 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void giveAward(String awardsHTML, int position) {
|
||||||
|
if (fragmentManager != null) {
|
||||||
|
Fragment fragment = fragmentManager.findFragmentByTag("f1");
|
||||||
|
if (fragment instanceof CommentsListingFragment) {
|
||||||
|
((CommentsListingFragment) fragment).giveAward(awardsHTML, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void editComment(String commentMarkdown, int position) {
|
||||||
|
if (fragmentManager != null) {
|
||||||
|
Fragment fragment = fragmentManager.findFragmentByTag("f1");
|
||||||
|
if (fragment instanceof CommentsListingFragment) {
|
||||||
|
((CommentsListingFragment) fragment).editComment(commentMarkdown, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lockSwipeRightToGoBack() {
|
private void lockSwipeRightToGoBack() {
|
||||||
|
@ -1878,6 +1878,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
notifyItemChanged(0);
|
notifyItemChanged(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
position = mIsSingleCommentThreadMode ? position + 2 : position + 1;
|
||||||
Comment comment = getCurrentComment(position);
|
Comment comment = getCurrentComment(position);
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
comment.addAwards(awardsHTML);
|
comment.addAwards(awardsHTML);
|
||||||
@ -3300,8 +3301,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
|
||||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_EDIT_AND_DELETE_AVAILABLE, true);
|
||||||
}
|
}
|
||||||
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||||
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
||||||
if (mIsSingleCommentThreadMode) {
|
if (mIsSingleCommentThreadMode) {
|
||||||
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, getAdapterPosition() - 2);
|
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, getAdapterPosition() - 2);
|
||||||
|
@ -265,6 +265,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (comment.getAwards() != null && !comment.getAwards().equals("")) {
|
if (comment.getAwards() != null && !comment.getAwards().equals("")) {
|
||||||
|
((CommentViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
|
||||||
Utils.setHTMLWithImageToTextView(((CommentViewHolder) holder).awardsTextView, comment.getAwards());
|
Utils.setHTMLWithImageToTextView(((CommentViewHolder) holder).awardsTextView, comment.getAwards());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,6 +363,24 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void giveAward(String awardsHTML, int position) {
|
||||||
|
if (position >= 0 && position < getItemCount()) {
|
||||||
|
Comment comment = getItem(position);
|
||||||
|
if (comment != null) {
|
||||||
|
comment.addAwards(awardsHTML);
|
||||||
|
notifyItemChanged(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void editComment(String commentContentMarkdown, int position) {
|
||||||
|
Comment comment = getItem(position);
|
||||||
|
if (comment != null) {
|
||||||
|
comment.setCommentMarkdown(commentContentMarkdown);
|
||||||
|
notifyItemChanged(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public interface RetryLoadingMoreCallback {
|
public interface RetryLoadingMoreCallback {
|
||||||
void retryLoadingMore();
|
void retryLoadingMore();
|
||||||
}
|
}
|
||||||
@ -475,10 +494,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
if (comment.getAuthor().equals(mAccountName)) {
|
if (comment.getAuthor().equals(mAccountName)) {
|
||||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
bundle.putBoolean(CommentMoreBottomSheetFragment.EXTRA_EDIT_AND_DELETE_AVAILABLE, true);
|
||||||
}
|
}
|
||||||
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||||
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
bundle.putParcelable(CommentMoreBottomSheetFragment.EXTRA_COMMENT, comment);
|
||||||
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, getAdapterPosition() - 1);
|
bundle.putInt(CommentMoreBottomSheetFragment.EXTRA_POSITION, getAdapterPosition());
|
||||||
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_COMMENT_MARKDOWN, comment.getCommentMarkdown());
|
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_COMMENT_MARKDOWN, comment.getCommentMarkdown());
|
||||||
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
CommentMoreBottomSheetFragment commentMoreBottomSheetFragment = new CommentMoreBottomSheetFragment();
|
||||||
commentMoreBottomSheetFragment.setArguments(bundle);
|
commentMoreBottomSheetFragment.setArguments(bundle);
|
||||||
|
@ -23,6 +23,7 @@ import butterknife.BindView;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.CommentFullMarkdownActivity;
|
import ml.docilealligator.infinityforreddit.Activity.CommentFullMarkdownActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
|
import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
|
||||||
|
import ml.docilealligator.infinityforreddit.Activity.GiveAwardActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.ReportActivity;
|
import ml.docilealligator.infinityforreddit.Activity.ReportActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
|
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
|
||||||
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
|
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
|
||||||
@ -37,6 +38,7 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
|||||||
|
|
||||||
public static final String EXTRA_COMMENT = "ECF";
|
public static final String EXTRA_COMMENT = "ECF";
|
||||||
public static final String EXTRA_ACCESS_TOKEN = "EAT";
|
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_POSITION = "EP";
|
||||||
public static final String EXTRA_COMMENT_MARKDOWN = "ECM";
|
public static final String EXTRA_COMMENT_MARKDOWN = "ECM";
|
||||||
public static final String EXTRA_IS_NSFW = "EIN";
|
public static final String EXTRA_IS_NSFW = "EIN";
|
||||||
@ -48,6 +50,8 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
|||||||
TextView shareTextView;
|
TextView shareTextView;
|
||||||
@BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
|
@BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
|
||||||
TextView copyTextView;
|
TextView copyTextView;
|
||||||
|
@BindView(R.id.give_award_text_view_comment_more_bottom_sheet_fragment)
|
||||||
|
TextView giveAwardTextView;
|
||||||
@BindView(R.id.view_full_markdown_text_view_comment_more_bottom_sheet_fragment)
|
@BindView(R.id.view_full_markdown_text_view_comment_more_bottom_sheet_fragment)
|
||||||
TextView viewFullMarkdownTextView;
|
TextView viewFullMarkdownTextView;
|
||||||
@BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
|
@BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
|
||||||
@ -82,34 +86,50 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
|
|||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
String accessToken = bundle.getString(EXTRA_ACCESS_TOKEN);
|
String accessToken = bundle.getString(EXTRA_ACCESS_TOKEN);
|
||||||
|
boolean editAndDeleteAvailable = bundle.getBoolean(EXTRA_EDIT_AND_DELETE_AVAILABLE, false);
|
||||||
|
|
||||||
if (accessToken != null && !accessToken.equals("")) {
|
if (accessToken != null && !accessToken.equals("")) {
|
||||||
editTextView.setVisibility(View.VISIBLE);
|
giveAwardTextView.setVisibility(View.VISIBLE);
|
||||||
deleteTextView.setVisibility(View.VISIBLE);
|
giveAwardTextView.setOnClickListener(view -> {
|
||||||
|
Intent intent = new Intent(activity, GiveAwardActivity.class);
|
||||||
editTextView.setOnClickListener(view -> {
|
intent.putExtra(GiveAwardActivity.EXTRA_THING_FULLNAME, comment.getFullName());
|
||||||
Intent intent = new Intent(activity, EditCommentActivity.class);
|
intent.putExtra(GiveAwardActivity.EXTRA_ITEM_POSITION, bundle.getInt(EXTRA_POSITION));
|
||||||
intent.putExtra(EditCommentActivity.EXTRA_ACCESS_TOKEN, accessToken);
|
|
||||||
intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, comment.getFullName());
|
|
||||||
intent.putExtra(EditCommentActivity.EXTRA_CONTENT, comment.getCommentMarkdown());
|
|
||||||
intent.putExtra(EditCommentActivity.EXTRA_POSITION, bundle.getInt(EXTRA_POSITION));
|
|
||||||
if (activity instanceof ViewPostDetailActivity) {
|
if (activity instanceof ViewPostDetailActivity) {
|
||||||
activity.startActivityForResult(intent, ViewPostDetailActivity.EDIT_COMMENT_REQUEST_CODE);
|
activity.startActivityForResult(intent, ViewPostDetailActivity.GIVE_AWARD_REQUEST_CODE);
|
||||||
} else {
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
deleteTextView.setOnClickListener(view -> {
|
|
||||||
dismiss();
|
|
||||||
if (activity instanceof ViewPostDetailActivity) {
|
|
||||||
((ViewPostDetailActivity) activity).deleteComment(comment.getFullName(), bundle.getInt(EXTRA_POSITION));
|
|
||||||
} else if (activity instanceof ViewUserDetailActivity) {
|
} else if (activity instanceof ViewUserDetailActivity) {
|
||||||
((ViewUserDetailActivity) activity).deleteComment(comment.getFullName());
|
activity.startActivityForResult(intent, ViewUserDetailActivity.GIVE_AWARD_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (editAndDeleteAvailable) {
|
||||||
|
editTextView.setVisibility(View.VISIBLE);
|
||||||
|
deleteTextView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
editTextView.setOnClickListener(view -> {
|
||||||
|
Intent intent = new Intent(activity, EditCommentActivity.class);
|
||||||
|
intent.putExtra(EditCommentActivity.EXTRA_ACCESS_TOKEN, accessToken);
|
||||||
|
intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, comment.getFullName());
|
||||||
|
intent.putExtra(EditCommentActivity.EXTRA_CONTENT, comment.getCommentMarkdown());
|
||||||
|
intent.putExtra(EditCommentActivity.EXTRA_POSITION, bundle.getInt(EXTRA_POSITION));
|
||||||
|
if (activity instanceof ViewPostDetailActivity) {
|
||||||
|
activity.startActivityForResult(intent, ViewPostDetailActivity.EDIT_COMMENT_REQUEST_CODE);
|
||||||
|
} else {
|
||||||
|
activity.startActivityForResult(intent, ViewUserDetailActivity.EDIT_COMMENT_REQUEST_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteTextView.setOnClickListener(view -> {
|
||||||
|
dismiss();
|
||||||
|
if (activity instanceof ViewPostDetailActivity) {
|
||||||
|
((ViewPostDetailActivity) activity).deleteComment(comment.getFullName(), bundle.getInt(EXTRA_POSITION));
|
||||||
|
} else if (activity instanceof ViewUserDetailActivity) {
|
||||||
|
((ViewUserDetailActivity) activity).deleteComment(comment.getFullName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shareTextView.setOnClickListener(view -> {
|
shareTextView.setOnClickListener(view -> {
|
||||||
|
@ -391,4 +391,16 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
|
|||||||
public SortType getSortType() {
|
public SortType getSortType() {
|
||||||
return sortType;
|
return sortType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void giveAward(String awardsHTML, int position) {
|
||||||
|
if (mAdapter != null) {
|
||||||
|
mAdapter.giveAward(awardsHTML, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void editComment(String commentMarkdown, int position) {
|
||||||
|
if (mAdapter != null) {
|
||||||
|
mAdapter.editComment(commentMarkdown, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ml.docilealligator.infinityforreddit.Post;
|
package ml.docilealligator.infinityforreddit.Post;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -60,7 +58,6 @@ public class FetchPost {
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
|
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
Log.i("asdasdf", "s " + response.body());
|
|
||||||
new ParsePost.ParseRandomPostAsyncTask(response.body(), isNSFW, new ParsePost.ParseRandomPostListener() {
|
new ParsePost.ParseRandomPostAsyncTask(response.body(), isNSFW, new ParsePost.ParseRandomPostListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
9
app/src/main/res/drawable-night/ic_give_award_24dp.xml
Normal file
9
app/src/main/res/drawable-night/ic_give_award_24dp.xml
Normal file
@ -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="M22,10L22,6c0,-1.1 -0.9,-2 -2,-2L4,4c-1.1,0 -1.99,0.9 -1.99,2v4c1.1,0 1.99,0.9 1.99,2s-0.89,2 -2,2v4c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2v-4c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2zM20,8.54c-1.19,0.69 -2,1.99 -2,3.46s0.81,2.77 2,3.46L20,18L4,18v-2.54c1.19,-0.69 2,-1.99 2,-3.46 0,-1.48 -0.8,-2.77 -1.99,-3.46L4,6h16v2.54zM9.07,16L12,14.12 14.93,16l-0.89,-3.36 2.69,-2.2 -3.47,-0.21L12,7l-1.27,3.22 -3.47,0.21 2.69,2.2z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_give_award_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_give_award_24dp.xml
Normal file
@ -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="M22,10L22,6c0,-1.1 -0.9,-2 -2,-2L4,4c-1.1,0 -1.99,0.9 -1.99,2v4c1.1,0 1.99,0.9 1.99,2s-0.89,2 -2,2v4c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2v-4c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2zM20,8.54c-1.19,0.69 -2,1.99 -2,3.46s0.81,2.77 2,3.46L20,18L4,18v-2.54c1.19,-0.69 2,-1.99 2,-3.46 0,-1.48 -0.8,-2.77 -1.99,-3.46L4,6h16v2.54zM9.07,16L12,14.12 14.93,16l-0.89,-3.36 2.69,-2.2 -3.47,-0.21L12,7l-1.27,3.22 -3.47,0.21 2.69,2.2z"/>
|
||||||
|
</vector>
|
@ -1,4 +1,5 @@
|
|||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
@ -15,7 +16,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:drawableStart="@drawable/ic_edit_24dp"
|
|
||||||
android:drawablePadding="48dp"
|
android:drawablePadding="48dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:paddingStart="32dp"
|
android:paddingStart="32dp"
|
||||||
@ -26,7 +26,8 @@
|
|||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:fontFamily="?attr/font_family"
|
android:fontFamily="?attr/font_family"
|
||||||
android:visibility="gone" />
|
android:visibility="gone"
|
||||||
|
app:drawableStartCompat="@drawable/ic_edit_24dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/delete_text_view_comment_more_bottom_sheet_fragment"
|
android:id="@+id/delete_text_view_comment_more_bottom_sheet_fragment"
|
||||||
@ -34,7 +35,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:drawableStart="@drawable/ic_delete_24dp"
|
|
||||||
android:drawablePadding="48dp"
|
android:drawablePadding="48dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:paddingStart="32dp"
|
android:paddingStart="32dp"
|
||||||
@ -45,7 +45,8 @@
|
|||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:fontFamily="?attr/font_family"
|
android:fontFamily="?attr/font_family"
|
||||||
android:visibility="gone" />
|
android:visibility="gone"
|
||||||
|
app:drawableStartCompat="@drawable/ic_delete_24dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/save_text_view_comment_more_bottom_sheet_fragment"
|
android:id="@+id/save_text_view_comment_more_bottom_sheet_fragment"
|
||||||
@ -53,7 +54,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:drawableStart="@drawable/ic_share_24dp"
|
|
||||||
android:drawablePadding="48dp"
|
android:drawablePadding="48dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@ -64,7 +64,8 @@
|
|||||||
android:text="@string/share"
|
android:text="@string/share"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:fontFamily="?attr/font_family" />
|
android:fontFamily="?attr/font_family"
|
||||||
|
app:drawableStartCompat="@drawable/ic_share_24dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/copy_text_view_comment_more_bottom_sheet_fragment"
|
android:id="@+id/copy_text_view_comment_more_bottom_sheet_fragment"
|
||||||
@ -72,7 +73,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:drawableStart="@drawable/ic_copy_24dp"
|
|
||||||
android:drawablePadding="48dp"
|
android:drawablePadding="48dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@ -83,7 +83,28 @@
|
|||||||
android:text="@string/copy_text"
|
android:text="@string/copy_text"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:fontFamily="?attr/font_family" />
|
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
|
<TextView
|
||||||
android:id="@+id/view_full_markdown_text_view_comment_more_bottom_sheet_fragment"
|
android:id="@+id/view_full_markdown_text_view_comment_more_bottom_sheet_fragment"
|
||||||
@ -91,7 +112,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:drawableStart="@drawable/ic_full_markdown_24dp"
|
|
||||||
android:drawablePadding="48dp"
|
android:drawablePadding="48dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@ -102,7 +122,8 @@
|
|||||||
android:text="@string/view_full_comment_markdown"
|
android:text="@string/view_full_comment_markdown"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:fontFamily="?attr/font_family" />
|
android:fontFamily="?attr/font_family"
|
||||||
|
app:drawableStartCompat="@drawable/ic_full_markdown_24dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/report_view_comment_more_bottom_sheet_fragment"
|
android:id="@+id/report_view_comment_more_bottom_sheet_fragment"
|
||||||
@ -110,7 +131,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:drawableStart="@drawable/ic_report_24dp"
|
|
||||||
android:drawablePadding="48dp"
|
android:drawablePadding="48dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@ -121,7 +141,8 @@
|
|||||||
android:text="@string/report"
|
android:text="@string/report"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:fontFamily="?attr/font_family" />
|
android:fontFamily="?attr/font_family"
|
||||||
|
app:drawableStartCompat="@drawable/ic_report_24dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/see_removed_view_comment_more_bottom_sheet_fragment"
|
android:id="@+id/see_removed_view_comment_more_bottom_sheet_fragment"
|
||||||
@ -129,7 +150,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:drawableStart="@drawable/ic_preview_24dp"
|
|
||||||
android:drawablePadding="48dp"
|
android:drawablePadding="48dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@ -141,7 +161,8 @@
|
|||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:fontFamily="?attr/font_family"
|
android:fontFamily="?attr/font_family"
|
||||||
android:visibility="gone" />
|
android:visibility="gone"
|
||||||
|
app:drawableStartCompat="@drawable/ic_preview_24dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user