diff --git a/build.gradle b/build.gradle index ea48235..71c11e3 100644 --- a/build.gradle +++ b/build.gradle @@ -2,10 +2,12 @@ buildscript { repositories { +// maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'} + google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.novoda:bintray-release:0.8.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -14,6 +16,8 @@ buildscript { allprojects { repositories { +// maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'} + google() jcenter() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1eead4c..6952f80 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java b/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java index dbf1e36..5365445 100644 --- a/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java +++ b/keyboard/src/main/java/cn/hadcn/keyboard/ChatKeyboardLayout.java @@ -72,7 +72,7 @@ private Style() { private int mLayoutOrderCount = 0; private int mChildViewPosition = -1; private HadEditText etInputArea; - private ViewGroup rlInput; +// private ViewGroup rlInput; private LinearLayout lyBottomLayout; private ImageView btnEmoticon; private Button btnSend; @@ -141,7 +141,7 @@ private void initView(Context context) { EmoticonHandler.getInstance(context).loadEmoticonsToMemory(); LayoutInflater.from(context).inflate(R.layout.keyboard_bar_layout, this); - rlInput = (ViewGroup) findViewById(R.id.view_keyboard_input_layout); +// rlInput = (ViewGroup) 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); @@ -389,11 +389,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); @@ -402,7 +401,6 @@ protected void leftIconClicked(View view) { } } else { // switch to text input bar - rlInput.setVisibility(VISIBLE); btnRecording.setVisibility(GONE); setEditableState(true); openSoftKeyboard(etInputArea); @@ -432,7 +430,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); @@ -554,6 +551,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; } @@ -722,8 +723,8 @@ private EmoticonsKeyboardBuilder getBuilder(Context context) { } @Override - protected void onSoftKeyboardPop(int height) { - super.onSoftKeyboardPop(height); + protected void OnSoftKeyboardPop(int height) { + super.OnSoftKeyboardPop(height); btnEmoticon.setSelected(false); } diff --git a/keyboard/src/main/java/cn/hadcn/keyboard/emoticon/view/EmoticonsPageView.java b/keyboard/src/main/java/cn/hadcn/keyboard/emoticon/view/EmoticonsPageView.java index c116cc4..1e97154 100644 --- a/keyboard/src/main/java/cn/hadcn/keyboard/emoticon/view/EmoticonsPageView.java +++ b/keyboard/src/main/java/cn/hadcn/keyboard/emoticon/view/EmoticonsPageView.java @@ -10,7 +10,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.GridView; -import android.widget.RelativeLayout; import java.util.ArrayList; import java.util.List; @@ -20,7 +19,6 @@ import cn.hadcn.keyboard.emoticon.util.EmoticonsKeyboardBuilder; import cn.hadcn.keyboard.emoticon.view.EmoticonsAdapter.EmoticonsListener; import cn.hadcn.keyboard.utils.Utils; -import cn.hadcn.keyboard.view.SoftListenLayout; /** * @author chris @@ -79,11 +77,6 @@ private void updateView() { int start = 0; int end = everyPageMaxSum > emoticonSetSum ? emoticonSetSum : everyPageMaxSum; - RelativeLayout.LayoutParams gridParams = new RelativeLayout.LayoutParams - (RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams - .WRAP_CONTENT); - gridParams.addRule(SoftListenLayout.CENTER_VERTICAL); - int horizontalSpacing = Utils.dip2px(mContext, bean.getHorizontalSpacing()); int verticalSpacing = Utils.dip2px(mContext, bean.getVerticalSpacing()); int itemHeight = Math.min( @@ -91,9 +84,9 @@ private void updateView() { (bean.getRow() - 1) * horizontalSpacing) / bean.getRow(), (mPageHeight - getPaddingTop() - getPaddingBottom() - (bean.getLine() - 1) * verticalSpacing) / bean.getLine()); + int paddingTop = (mPageHeight-itemHeight*line-verticalSpacing*line)/2; for (int i = 0; i < pageCount; i++) { - RelativeLayout rl = new RelativeLayout(mContext); GridView gridView = new GridView(mContext); gridView.setNumColumns(bean.getRow()); gridView.setBackgroundColor(Color.TRANSPARENT); @@ -127,9 +120,9 @@ private void updateView() { EmoticonsAdapter adapter = new EmoticonsAdapter(mContext, list, bean .isShownName()); adapter.setHeight(itemHeight, Utils.dip2px(mContext, bean.getItemPadding())); + gridView.setPadding(0, paddingTop, 0, 0); gridView.setAdapter(adapter); - rl.addView(gridView, gridParams); - emoticonPageViews.add(rl); + emoticonPageViews.add(gridView); adapter.setOnItemListener(this); start = everyPageMaxSum + i * everyPageMaxSum; diff --git a/keyboard/src/main/java/cn/hadcn/keyboard/view/SoftHandleLayout.java b/keyboard/src/main/java/cn/hadcn/keyboard/view/SoftHandleLayout.java index 396d8ba..2c71fd5 100644 --- a/keyboard/src/main/java/cn/hadcn/keyboard/view/SoftHandleLayout.java +++ b/keyboard/src/main/java/cn/hadcn/keyboard/view/SoftHandleLayout.java @@ -114,7 +114,7 @@ protected void autoViewHeightChanged(final int height) { } @Override - protected void onSoftKeyboardPop(int height) { + protected void OnSoftKeyboardPop(int height) { if (height > 0 && height != mAutoViewHeight) { mAutoViewHeight = height; Utils.setDefKeyboardHeight(mContext, mAutoViewHeight); @@ -135,7 +135,7 @@ public void run() { } @Override - protected void onSoftKeyboardClose() { + protected void OnSoftKeyboardClose() { mKeyboardState = mKeyboardState == KEYBOARD_STATE_BOTH ? KEYBOARD_STATE_FUNC : KEYBOARD_STATE_NONE; diff --git a/keyboard/src/main/res/layout/keyboard_bar_layout.xml b/keyboard/src/main/res/layout/keyboard_bar_layout.xml index ec74f53..30719f1 100644 --- a/keyboard/src/main/res/layout/keyboard_bar_layout.xml +++ b/keyboard/src/main/res/layout/keyboard_bar_layout.xml @@ -1,5 +1,6 @@ - + - -