From d59188aa7e047b2ca3a2f1dd32fd0c0add22a4c1 Mon Sep 17 00:00:00 2001 From: tmexcept <200809201230_2008@163.com> Date: Tue, 12 Dec 2017 16:58:10 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E2=80=9C=E6=8C=89=E4=BD=8F=E8=AF=B4?= =?UTF-8?q?=E8=AF=9D=E2=80=9D=E7=9A=84=E5=AE=9E=E8=AF=9D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=95=E9=9F=B3=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “按住说话”的实话获取录音权限的时候,点击授权之后自动弹出语音录制状态,没有自动取消问题修改 --- .../src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java b/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java index 6fb693a..1bbfeaf 100644 --- a/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java +++ b/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java @@ -555,6 +555,10 @@ public boolean onTouch(View view, MotionEvent motionEvent) { btnRecording.setText(getResources().getString(R.string.recording_end)); isCanceled = false; } + } else if(motionEvent.getAction() == MotionEvent.ACTION_CANCEL){ + btnRecording.setBackgroundResource(R.drawable.recording_n); + btnRecording.setText(getResources().getString(R.string.recording_start)); + mOnChatKeyBoardListener.onRecordingAction(RecordingAction.CANCELED); } return false; } From e7f597b4b00790a49849588fa97710dcebb26c8b Mon Sep 17 00:00:00 2001 From: tmexcept <200809201230_2008@163.com> Date: Wed, 13 Dec 2017 15:44:40 +0800 Subject: [PATCH 2/4] =?UTF-8?q?ChatKeyboardLayout=20=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=B1=82=E7=BA=A7=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ChatKeyboardLayout 布局层级优化 --- .../cn/hadcn/keyboard/ChatKeyboardLayout.java | 8 +- .../main/res/layout/keyboard_bar_layout.xml | 153 +++++++++--------- .../res/layout/keyboard_emoticon_layout.xml | 7 +- .../res/layout/keyboard_emoticon_tabbar.xml | 1 - .../main/res/layout/keyboard_media_layout.xml | 7 +- 5 files changed, 82 insertions(+), 94 deletions(-) diff --git a/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java b/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java index 1bbfeaf..4efe847 100644 --- a/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java +++ b/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java @@ -20,7 +20,6 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.RelativeLayout; import org.xmlpull.v1.XmlPullParserException; @@ -73,7 +72,6 @@ private Style() { private int mLayoutOrderCount = 0; private int mChildViewPosition = -1; private HadEditText etInputArea; - private RelativeLayout rlInput; private LinearLayout lyBottomLayout; private ImageView btnEmoticon; private Button btnSend; @@ -142,7 +140,6 @@ private void initView(Context context) { EmoticonHandler.getInstance(context).loadEmoticonsToMemory(); LayoutInflater.from(context).inflate(R.layout.keyboard_bar_layout, this); - rlInput = (RelativeLayout) findViewById(R.id.view_keyboard_input_layout); lyBottomLayout = (LinearLayout) findViewById(R.id.view_keyboard_bottom); btnEmoticon = (ImageView) findViewById(R.id.view_keyboard_face_icon); leftIconView = (ImageView) findViewById(R.id.view_keyboard_left_icon); @@ -390,11 +387,10 @@ public boolean dispatchKeyEvent(KeyEvent event) { * @param view view */ protected void leftIconClicked(View view) { - if (rlInput.isShown()) { + if (!btnRecording.isShown()) { // switch to voice recording bar hideAutoView(); closeSoftKeyboard(etInputArea); - rlInput.setVisibility(INVISIBLE); btnRecording.setVisibility(VISIBLE); leftIconView.setImageDrawable(mLeftSecondIcon); btnSend.setVisibility(GONE); @@ -403,7 +399,6 @@ protected void leftIconClicked(View view) { } } else { // switch to text input bar - rlInput.setVisibility(VISIBLE); btnRecording.setVisibility(GONE); setEditableState(true); openSoftKeyboard(etInputArea); @@ -433,7 +428,6 @@ protected void rightIconClicked(View view) { break; case KEYBOARD_STATE_NONE: btnEmoticon.setSelected(false); - rlInput.setVisibility(VISIBLE); btnRecording.setVisibility(GONE); leftIconView.setImageDrawable(mLeftDefaultIcon); setEditableState(true); diff --git a/keyboard/src/main/res/layout/keyboard_bar_layout.xml b/keyboard/src/main/res/layout/keyboard_bar_layout.xml index a3d8af3..30719f1 100644 --- a/keyboard/src/main/res/layout/keyboard_bar_layout.xml +++ b/keyboard/src/main/res/layout/keyboard_bar_layout.xml @@ -19,91 +19,88 @@ android:layout_width="34dp" android:layout_height="34dp" android:layout_centerVertical="true" - android:layout_marginLeft="12dp" - android:layout_marginStart="12dp" + android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:scaleType="centerInside" android:src="@drawable/default_record_icon" /> - + - -