diff --git a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java index e5a0fbb99..89ce85398 100644 --- a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java @@ -612,6 +612,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct boolean new_badge = sharedpreferences.getBoolean(Helper.SET_DISPLAY_NEW_BADGE, true); boolean bot_icon = sharedpreferences.getBoolean(Helper.SET_DISPLAY_BOT_ICON, true); + boolean quick_reply = sharedpreferences.getBoolean(Helper.SET_QUICK_REPLY, true); + int translator = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX); int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS); @@ -2197,30 +2199,46 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct holder.status_reply.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - boolean shown = status.isShortReply(); - if( !shown){ - for(Status s: statuses){ - if(s.isShortReply() && !s.getId().equals(status.getId())){ - s.setShortReply(false); - notifyStatusChanged(s); + if (quick_reply) { + boolean shown = status.isShortReply(); + if (!shown) { + for (Status s : statuses) { + if (s.isShortReply() && !s.getId().equals(status.getId())) { + s.setShortReply(false); + notifyStatusChanged(s); + } } + status.setShortReply(true); + holder.quick_reply_container.setVisibility(View.VISIBLE); + InputMethodManager inputMethodManager = + (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + inputMethodManager.toggleSoftInputFromWindow( + holder.quick_reply_text.getApplicationWindowToken(), + InputMethodManager.SHOW_FORCED, 0); + holder.quick_reply_text.requestFocus(); + } else { + status.setShortReply(false); + holder.quick_reply_container.setVisibility(View.GONE); + InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(holder.quick_reply_text.getWindowToken(), 0); + } + holder.quick_reply_switch_to_full.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CrossActions.doCrossReply(context, status, type, true); + status.setShortReply(false); + holder.quick_reply_container.setVisibility(View.GONE); + } + }); + } else { + CrossActions.doCrossReply(context, status, type, true); + if (status.isShortReply()) { + status.setShortReply(false); + holder.quick_reply_container.setVisibility(View.GONE); + InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(holder.quick_reply_text.getWindowToken(), 0); } - status.setShortReply(true); - holder.quick_reply_container.setVisibility(View.VISIBLE); - InputMethodManager inputMethodManager = - (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE); - inputMethodManager.toggleSoftInputFromWindow( - holder.quick_reply_text.getApplicationWindowToken(), - InputMethodManager.SHOW_FORCED, 0); - holder.quick_reply_text.requestFocus(); - }else{ - - status.setShortReply(false); - holder.quick_reply_container.setVisibility(View.GONE); - InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow(holder.quick_reply_text.getWindowToken(), 0); } - } }); diff --git a/app/src/main/java/app/fedilab/android/fragments/SettingsFragment.java b/app/src/main/java/app/fedilab/android/fragments/SettingsFragment.java index 333f7e44e..e7ebc04ed 100644 --- a/app/src/main/java/app/fedilab/android/fragments/SettingsFragment.java +++ b/app/src/main/java/app/fedilab/android/fragments/SettingsFragment.java @@ -699,6 +699,19 @@ public class SettingsFragment extends Fragment { } }); + boolean quick_reply = sharedpreferences.getBoolean(Helper.SET_QUICK_REPLY, true); + final CheckBox set_quick_reply = rootView.findViewById(R.id.set_quick_reply); + set_quick_reply.setChecked(quick_reply); + + set_quick_reply.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putBoolean(Helper.SET_QUICK_REPLY, set_quick_reply.isChecked()); + editor.apply(); + } + }); + boolean fit_preview = sharedpreferences.getBoolean(Helper.SET_FULL_PREVIEW, false); final CheckBox set_fit_preview = rootView.findViewById(R.id.set_fit_preview); set_fit_preview.setChecked(fit_preview); diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java index 81d753395..7d8ee4da0 100644 --- a/app/src/main/java/app/fedilab/android/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/helper/Helper.java @@ -412,6 +412,7 @@ public class Helper { public static final String SET_DISPLAY_FOLLOW_INSTANCE = "set_display_follow_instance"; public static final String SET_DISPLAY_NEW_BADGE = "set_display_new_badge"; public static final String SET_DISPLAY_BOT_ICON = "set_display_bot_icon"; + public static final String SET_QUICK_REPLY = "set_quick_reply"; public static final String SET_EMBEDDED_BROWSER = "set_embedded_browser"; public static final String SET_CUSTOM_TABS = "set_custom_tabs"; public static final String SET_JAVASCRIPT = "set_javascript"; diff --git a/app/src/main/res/layout-sw600dp/fragment_settings.xml b/app/src/main/res/layout-sw600dp/fragment_settings.xml index 6d07073d5..6b5154d1b 100644 --- a/app/src/main/res/layout-sw600dp/fragment_settings.xml +++ b/app/src/main/res/layout-sw600dp/fragment_settings.xml @@ -333,6 +333,15 @@ android:text="@string/set_display_bot_icon" android:layout_height="wrap_content" /> + + + + + + Mark as unresolved Empty content! Display Fedilab features button + Enable quick reply %d vote %d votes