Add some colors

This commit is contained in:
tom79 2019-11-29 18:56:38 +01:00
parent d825f24731
commit 25e931d992
1 changed files with 30 additions and 11 deletions

View File

@ -133,9 +133,6 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
private MastalabAutoCompleteTextView comment_content;
private String in_reply_to_status;
private String visibility;
private int theme;
private long currentToId = -1;
private Status tootReply;
private boolean redraft = false;
private Status toot;
@ -204,8 +201,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
comment_content = null;
tootReply = null;
currentToId = -1;
long currentToId = -1;
if (apiResponse.getError() == null) {
boolean display_confirm = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CONFIRM, true);
if (display_confirm) {
@ -434,14 +430,32 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
iconColor = ThemeHelper.getAttColor(context, R.attr.iconColor);
}
int reblogColor = prefs.getInt("theme_boost_header_color", -1);
holder.pf_likes.setTextColor(iconColor);
int statusColor = prefs.getInt("theme_statuses_color", -1);
if (holder.pf_cardview != null && statusColor != -1) {
holder.pf_cardview.setCardBackgroundColor(statusColor);
} else if (holder.pf_cardview != null) {
holder.pf_cardview.setCardBackgroundColor(ThemeHelper.getAttColor(context, R.attr.cardviewColor));
}
int theme_text_color = prefs.getInt("theme_text_color", -1);
if (holder.pf_description != null && theme_text_color != -1) {
holder.pf_description.setTextColor(theme_text_color);
}
int theme_text_header_2_line = prefs.getInt("theme_text_header_2_line", -1);
if (theme_text_header_2_line == -1) {
theme_text_header_2_line = ThemeHelper.getAttColor(context, R.attr.textHeader);
}
holder.pf_username.setTextColor(theme_text_header_2_line);
holder.pf_date.setTextColor(theme_text_header_2_line);
if (statusColor != -1) {
holder.quick_reply_container.setBackgroundColor(statusColor);
}
holder.quick_reply_switch_to_full.setVisibility(View.GONE);
int theme;
if (status.isShortReply()) {
holder.quick_reply_container.setVisibility(View.VISIBLE);
holder.pixelfed_comments.setVisibility(View.VISIBLE);
@ -457,7 +471,11 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
status.setCommentsFetched(true);
new RetrieveContextAsyncTask(context, false, false, status.getId(), PixelfedListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
InputMethodManager inputMethodManager =
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(
holder.quick_reply_text.getApplicationWindowToken(),
InputMethodManager.SHOW_FORCED, 0);
EditText content_cw = new EditText(context);
content_cw.setText(status.getReblog() != null ? status.getReblog().getSpoiler_text() : status.getSpoiler_text());
String content = TootActivity.manageMentions(context, userId, status.getReblog() != null ? status.getReblog() : status);
@ -471,7 +489,6 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
int newInputType = comment_content.getInputType() & (comment_content.getInputType() ^ InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
comment_content.setInputType(newInputType);
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
tootReply = status;
theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
@ -596,12 +613,12 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
holder.quick_reply_privacy.setVisibility(View.GONE);
holder.quick_reply_button.setOnClickListener(view -> {
sendToot();
//status.setShortReply(false);
sendToot(status);
status.setShortReply(false);
holder.quick_reply_container.setVisibility(View.GONE);
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
assert imm != null;
imm.hideSoftInputFromWindow(holder.quick_reply_button.getWindowToken(), 0);
notifyStatusChanged(status);
});
holder.pf_description.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
@ -1132,7 +1149,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
context.startActivity(intent);
}
private void sendToot() {
private void sendToot(Status status) {
if (comment_content.getText() == null) {
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
@ -1155,6 +1172,8 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
toot.setIn_reply_to_id(in_reply_to_status);
toot.setContent(tootContent);
new PostStatusAsyncTask(context, social, account, toot, PixelfedListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
status.setQuickReplyPrivacy(null);
status.setQuickReplyContent(null);
}