aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-01 14:22:34 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-01 14:22:34 +0200
commit725b1a7406a06584e1b15a1cc273e926ec9e6804 (patch)
tree89b4e5aae652fb54da89d41c794cbcafac8a7f39 /src/main
parentcec483b70d6bd480ee6b3fa1be2fd2432a8d2ae6 (diff)
introduced setting to not scroll down after sending a message
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java12
-rw-r--r--src/main/res/values/defaults.xml1
-rw-r--r--src/main/res/values/strings.xml2
-rw-r--r--src/main/res/xml/preferences.xml5
4 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 749d6a408..c0ebb1338 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -2198,10 +2198,14 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
activity.xmppConnectionService.updateConversation(conversation);
}
updateChatMsgHint();
- new Handler().post(() -> {
- int size = messageList.size();
- this.binding.messagesView.setSelection(size - 1);
- });
+ 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() {
diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml
index 67545e6a9..425e397c9 100644
--- a/src/main/res/values/defaults.xml
+++ b/src/main/res/values/defaults.xml
@@ -101,5 +101,6 @@
<bool name="use_bundled_emoji">true</bool>
<bool name="enable_multi_accounts">false</bool>
<bool name="show_qr_code_scan">true</bool>
+ <bool name="scroll_to_bottom">true</bool>
</resources>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 5e7ac836e..d0432d342 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -767,4 +767,6 @@
<string name="once">Once</string>
<string name="theme">Theme</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_summary">Scroll down after sending a message</string>
+ <string name="pref_scroll_to_bottom">Scroll to bottom</string>
</resources>
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index 830d0607f..27e188c7f 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -45,6 +45,11 @@
android:key="use_auto_rotate"
android:summary="@string/pref_use_auto_rotate_summary"
android:title="@string/pref_use_auto_rotate" />
+ <CheckBoxPreference
+ android:defaultValue="@bool/scroll_to_bottom"
+ android:key="scroll_to_bottom"
+ android:summary="@string/pref_scroll_to_bottom_summary"
+ android:title="@string/pref_scroll_to_bottom" />
</PreferenceScreen>
<!--Notifications-->
<PreferenceScreen