Introduced expert options to control enter-is-send
(default == off)
This commit is contained in:
parent
0a48f777ac
commit
06eae476ee
|
@ -1058,4 +1058,8 @@ public class ConversationActivity extends XmppActivity
|
||||||
public void blockConversation(final Blockable conversation) {
|
public void blockConversation(final Blockable conversation) {
|
||||||
xmppConnectionService.sendBlockRequest(conversation);
|
xmppConnectionService.sendBlockRequest(conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean enterIsSend() {
|
||||||
|
return getPreferences().getBoolean("enter_is_send",false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,8 +316,13 @@ public class ConversationFragment extends Fragment {
|
||||||
mEditMessage.setOnEnterPressedListener(new OnEnterPressed() {
|
mEditMessage.setOnEnterPressedListener(new OnEnterPressed() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnterPressed() {
|
public boolean onEnterPressed() {
|
||||||
sendMessage();
|
if (activity.enterIsSend()) {
|
||||||
|
sendMessage();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,12 @@ public class EditMessage extends EditText {
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||||
if (mOnEnterPressed != null) {
|
if (mOnEnterPressed != null) {
|
||||||
mOnEnterPressed.onEnterPressed();
|
if (mOnEnterPressed.onEnterPressed()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +36,7 @@ public class EditMessage extends EditText {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnEnterPressed {
|
public interface OnEnterPressed {
|
||||||
public void onEnterPressed();
|
public boolean onEnterPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,4 +434,7 @@
|
||||||
<string name="two_hours">2 hours</string>
|
<string name="two_hours">2 hours</string>
|
||||||
<string name="eight_hours">8 hours</string>
|
<string name="eight_hours">8 hours</string>
|
||||||
<string name="until_further_notice">Until further notice</string>
|
<string name="until_further_notice">Until further notice</string>
|
||||||
|
<string name="pref_input_options">Input options</string>
|
||||||
|
<string name="pref_enter_is_send">Enter is send</string>
|
||||||
|
<string name="pref_enter_is_send_summary">Use enter key to send message</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -122,6 +122,13 @@
|
||||||
android:summary="@string/pref_enable_legacy_ssl_summary"
|
android:summary="@string/pref_enable_legacy_ssl_summary"
|
||||||
android:title="@string/pref_enable_legacy_ssl" />
|
android:title="@string/pref_enable_legacy_ssl" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory android:title="@string/pref_input_options">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="enter_is_send"
|
||||||
|
android:title="@string/pref_enter_is_send"
|
||||||
|
android:summary="@string/pref_enter_is_send_summary" />
|
||||||
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/pref_expert_options_other" >
|
<PreferenceCategory android:title="@string/pref_expert_options_other" >
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
|
|
Loading…
Reference in New Issue