mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Add support for soft keyboard 'enter' key.
This commit is contained in:
parent
7f532fc37f
commit
4977092f7a
@ -17,10 +17,6 @@
|
||||
android:summary="@string/preferences__request_a_delivery_report_for_each_sms_message_you_send"
|
||||
android:title="@string/preferences__sms_delivery_reports" />
|
||||
|
||||
<CheckBoxPreference android:defaultValue="false"
|
||||
android:key="pref_enter_sends"
|
||||
android:summary="@string/preferences__pressing_the_enter_key_will_send_text_messages"
|
||||
android:title="@string/preferences__pref_enter_sends_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/preferences__notifications">
|
||||
<CheckBoxPreference android:key="pref_key_enable_notifications"
|
||||
@ -62,6 +58,19 @@
|
||||
android:summary="@string/preferences__also_vibrate_when_notified" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="Input Settings">
|
||||
<CheckBoxPreference android:defaultValue="false"
|
||||
android:key="pref_enter_key"
|
||||
android:title="Enable enter key"
|
||||
android:summary="Replace the smiley key with an enter key"/>
|
||||
|
||||
<CheckBoxPreference android:defaultValue="false"
|
||||
android:key="pref_enter_sends"
|
||||
android:summary="@string/preferences__pressing_the_enter_key_will_send_text_messages"
|
||||
android:title="@string/preferences__pref_enter_sends_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/preferences__appearance">
|
||||
<ListPreference android:key="pref_theme"
|
||||
android:title="@string/preferences__theme"
|
||||
|
@ -72,12 +72,12 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
||||
public static final String PASSPHRASE_TIMEOUT_PREF = "pref_timeout_passphrase";
|
||||
public static final String AUTO_KEY_EXCHANGE_PREF = "pref_auto_complete_key_exchange";
|
||||
public static final String THEME_PREF = "pref_theme";
|
||||
public static final String ENTER_SENDS_PREF = "pref_enter_sends";
|
||||
public static final String ENTER_PRESENT_PREF = "pref_enter_key";
|
||||
|
||||
private static final String DISPLAY_CATEGORY_PREF = "pref_display_category";
|
||||
|
||||
private static final String VIEW_MY_IDENTITY_PREF = "pref_view_identity";
|
||||
private static final String EXPORT_MY_IDENTITY_PREF = "pref_export_identity";
|
||||
private static final String IMPORT_CONTACT_IDENTITY_PREF = "pref_import_identity";
|
||||
private static final String MANAGE_IDENTITIES_PREF = "pref_manage_identity";
|
||||
private static final String CHANGE_PASSPHRASE_PREF = "pref_change_passphrase";
|
||||
|
||||
|
@ -32,6 +32,7 @@ import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
@ -168,6 +169,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
initializeSecurity();
|
||||
initializeTitleBar();
|
||||
initializeMmsEnabledCheck();
|
||||
initializeIme();
|
||||
calculateCharactersRemaining();
|
||||
|
||||
MessageNotifier.setVisibleThread(threadId);
|
||||
@ -570,6 +572,16 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void initializeIme() {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.getBoolean(ApplicationPreferencesActivity.ENTER_PRESENT_PREF, false))
|
||||
{
|
||||
composeText.setInputType(composeText.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
|
||||
} else {
|
||||
composeText.setInputType(composeText.getInputType() | (InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeResources() {
|
||||
recipientsPanel = (RecipientsPanel)findViewById(R.id.recipients);
|
||||
recipients = getIntent().getParcelableExtra(RECIPIENTS_EXTRA);
|
||||
@ -607,8 +619,10 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
||||
}
|
||||
|
||||
if (getIntent().getStringExtra("forwarded_message") != null)
|
||||
composeText.setText(getString(R.string.ConversationActivity_forward_message_prefix)+": " + getIntent().getStringExtra("forwarded_message"));
|
||||
if (getIntent().getStringExtra("forwarded_message") != null) {
|
||||
composeText.setText(getString(R.string.ConversationActivity_forward_message_prefix) + ": " +
|
||||
getIntent().getStringExtra("forwarded_message"));
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeRecipientsInput() {
|
||||
@ -931,7 +945,9 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(ConversationActivity.this).getBoolean("pref_enter_sends", false)) {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(ConversationActivity.this)
|
||||
.getBoolean(ApplicationPreferencesActivity.ENTER_SENDS_PREF, false))
|
||||
{
|
||||
sendButton.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
|
||||
sendButton.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER));
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user