diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-08-30 21:47:15 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-08-30 21:47:15 +0200 |
commit | 86bf53d3e3519784f9497ccabf797883f4ed60ca (patch) | |
tree | 02d58f2d0f4e14506c2b4f59589e5efbc4231fef | |
parent | 9542a43df80aa6863c3efedf0e486b122ad0f684 (diff) |
Revert "hide record voice button if keyboard is open"
because it crashes during screen rotation.
This reverts commit 18cf7c40c27fdd255ed8b71dd49343438982024e.
-rw-r--r-- | build.gradle | 1 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 25 | ||||
-rw-r--r-- | src/main/res/layout/fragment_conversation.xml | 2 | ||||
-rw-r--r-- | src/main/res/values/defaults.xml | 1 |
4 files changed, 10 insertions, 19 deletions
diff --git a/build.gradle b/build.gradle index 4e89fb79e..aa6c0a122 100644 --- a/build.gradle +++ b/build.gradle @@ -76,7 +76,6 @@ dependencies { implementation 'in.championswimmer:SimpleFingerGestures_Android_Library:1.2' implementation 'rocks.xmpp:xmpp-addr:0.8.0' implementation 'org.hsluv:hsluv:0.2' - implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0' } ext { diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 14a2f4608..ec9dcf8f0 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -60,7 +60,6 @@ import android.widget.TextView.OnEditorActionListener; import android.widget.Toast; import net.java.otr4j.session.SessionStatus; -import net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent; import java.io.File; import java.io.IOException; @@ -177,7 +176,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke private Toast messageLoaderToast; private ConversationsActivity activity; private boolean reInitRequiredOnStart = true; - private boolean KeyboardOpen = false; private SimpleFingerGestures gesturesDetector = new SimpleFingerGestures(); @@ -447,7 +445,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } }; - private OnClickListener mRecordVoiceButtonListener = v -> attachFile(ATTACHMENT_CHOICE_RECORD_VOICE); + private OnClickListener mRecordVoiceButtonListener = new OnClickListener() { + + @Override + public void onClick(View v) { + attachFile(ATTACHMENT_CHOICE_RECORD_VOICE); + } + }; private OnClickListener mSendButtonListener = new OnClickListener() { @@ -1163,13 +1167,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); - KeyboardVisibilityEvent.setEventListener( - getActivity(), - isOpen -> { - Log.d(Config.LOGTAG, "Keyboard open " + isOpen); - KeyboardOpen = isOpen; - showRecordVoiceButton(); - }); } @Override @@ -1305,15 +1302,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } private void showRecordVoiceButton() { - if (!isAdded()) { - return; - } SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(activity); final boolean ShowRecordVoiceButton = p.getBoolean("show_record_voice_btn", activity.getResources().getBoolean(R.bool.show_record_voice_btn)); - if (ShowRecordVoiceButton && !KeyboardOpen) { + Log.d(Config.LOGTAG, "Recorder " + ShowRecordVoiceButton); + if (ShowRecordVoiceButton) { binding.recordVoiceButton.setVisibility(View.VISIBLE); - } else if (KeyboardOpen) { - binding.recordVoiceButton.setVisibility(View.GONE); } else { binding.recordVoiceButton.setVisibility(View.GONE); } diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml index 4bec6d9e1..d081b6543 100644 --- a/src/main/res/layout/fragment_conversation.xml +++ b/src/main/res/layout/fragment_conversation.xml @@ -57,7 +57,7 @@ <RelativeLayout android:id="@+id/textsend" - android:animateLayoutChanges="true" + android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml index e766d101c..214dbe642 100644 --- a/src/main/res/values/defaults.xml +++ b/src/main/res/values/defaults.xml @@ -52,7 +52,6 @@ \n\nhttps://www.openstreetmap.org/\n(Open Database License) \n\nhttp://xmpp.rocks/\n(The MIT License (MIT)) \n\nhttps://github.com/championswimmer/SimpleFingerGestures_Android_Library/\n(Apache License, Version 2.0) - \n\nhttps://github.com/yshrsmz/KeyboardVisibilityEvent/\n(Apache License, Version 2.0) </string> <string name="default_resource" translatable="false">Phone</string> |