introduced expert setting to not scroll down after sending a message

This commit is contained in:
Daniel Gultsch 2018-02-28 10:51:44 +01:00
parent ac22007e28
commit 9d15d3b408
4 changed files with 16 additions and 4 deletions

View File

@ -1904,11 +1904,15 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
activity.xmppConnectionService.updateConversation(conversation);
}
updateChatMsgHint();
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(activity);
final boolean prefScrollToBottom = p.getBoolean("scroll_to_bottom", activity.getResources().getBoolean(R.bool.scroll_to_bottom));
if (prefScrollToBottom || scrolledToBottom()) {
new Handler().post(() -> {
int size = messageList.size();
this.binding.messagesView.setSelection(size - 1);
});
}
}
public void setFocusOnInputField() {
this.binding.textinput.requestFocus();

View File

@ -41,4 +41,5 @@
<bool name="return_to_previous">false</bool>
<bool name="validate_hostname">false</bool>
<bool name="show_qr_code_scan">true</bool>
<bool name="scroll_to_bottom">true</bool>
</resources>

View File

@ -709,4 +709,6 @@
<string name="mtm_notification">Certificate Verification</string>
<string name="once">Once</string>
<string name="qr_code_scanner_needs_access_to_camera">The QR code scanner needs access to the camera</string>
<string name="pref_scroll_to_bottom">Scroll to bottom</string>
<string name="pref_scroll_to_bottom_summary">Scroll down after sending a message</string>
</resources>

View File

@ -257,6 +257,11 @@
android:key="display_enter_key"
android:summary="@string/pref_display_enter_key_summary"
android:title="@string/pref_display_enter_key"/>
<CheckBoxPreference
android:defaultValue="@bool/scroll_to_bottom"
android:key="scroll_to_bottom"
android:title="@string/pref_scroll_to_bottom"
android:summary="@string/pref_scroll_to_bottom_summary"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_presence_settings">
<CheckBoxPreference