diff options
author | Sam Whited <sam@samwhited.com> | 2015-01-14 15:28:27 -0500 |
---|---|---|
committer | Sam Whited <sam@samwhited.com> | 2015-01-14 16:14:14 -0500 |
commit | 0a96bec3c1d65c0d3da22511f3b92a21fd94ad0f (patch) | |
tree | 333ff6fc12a07aa87d60f9711466510671e58b0c /src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | |
parent | a88824bb1d40f1373b22639815ed673c134f6777 (diff) |
Add option to swap enter/emoticon key
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/ConversationFragment.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 4d4ee4830..0a38daee7 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -9,6 +9,7 @@ import android.content.Intent; import android.content.IntentSender; import android.content.IntentSender.SendIntentException; import android.os.Bundle; +import android.text.InputType; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Gravity; @@ -300,12 +301,21 @@ public class ConversationFragment extends Fragment { } } + private void setupIme() { + if (((ConversationActivity)getActivity()).usingEnterKey()) { + mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE)); + } else { + mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE); + } + } + @Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_conversation, container, false); mEditMessage = (EditMessage) view.findViewById(R.id.textinput); + setupIme(); mEditMessage.setOnClickListener(new OnClickListener() { @Override @@ -421,24 +431,24 @@ public class ConversationFragment extends Fragment { || m.getType() == Message.TYPE_PRIVATE || m.getDownloadable() != null) { shareWith.setVisible(false); - } + } if (m.getStatus() != Message.STATUS_SEND_FAILED) { sendAgain.setVisible(false); } if ((m.getType() != Message.TYPE_IMAGE && m.getDownloadable() == null) || m.getImageParams().url == null) { copyUrl.setVisible(false); - } + } if (m.getType() != Message.TYPE_TEXT || m.getDownloadable() != null || !m.bodyContainsDownloadable()) { downloadImage.setVisible(false); - } + } if (!((m.getDownloadable() != null && !(m.getDownloadable() instanceof DownloadablePlaceholder)) || (m.isFileOrImage() && (m.getStatus() == Message.STATUS_WAITING - || m.getStatus() == Message.STATUS_OFFERED)))) { + || m.getStatus() == Message.STATUS_OFFERED)))) { cancelTransmission.setVisible(false); - } + } } } |