蒋洪波

fix bugs.1.optimize drawline method. 2.inputView request focus after choose emoji

@@ -32,6 +32,7 @@ public abstract class AppBaseFragment<P extends BasePresenter> extends BaseFragm @@ -32,6 +32,7 @@ public abstract class AppBaseFragment<P extends BasePresenter> extends BaseFragm
32 protected BaseActivity mActivity; 32 protected BaseActivity mActivity;
33 protected CodeMultipleStatusView mRootView; 33 protected CodeMultipleStatusView mRootView;
34 protected final String TAG = this.getClass().getSimpleName(); 34 protected final String TAG = this.getClass().getSimpleName();
  35 +
35 @Inject 36 @Inject
36 protected P mPresenter; 37 protected P mPresenter;
37 38
@@ -64,12 +65,22 @@ public abstract class AppBaseFragment<P extends BasePresenter> extends BaseFragm @@ -64,12 +65,22 @@ public abstract class AppBaseFragment<P extends BasePresenter> extends BaseFragm
64 mActivity = (BaseActivity) getActivity(); 65 mActivity = (BaseActivity) getActivity();
65 initComponent(); 66 initComponent();
66 super.onActivityCreated(savedInstanceState); 67 super.onActivityCreated(savedInstanceState);
  68 +
  69 + if (!isLazyInflate()) {
  70 + inflate(savedInstanceState);
  71 + }
67 } 72 }
68 73
69 @Override 74 @Override
70 public void onLazyInitView(@Nullable Bundle savedInstanceState) { 75 public void onLazyInitView(@Nullable Bundle savedInstanceState) {
71 super.onLazyInitView(savedInstanceState); 76 super.onLazyInitView(savedInstanceState);
72 - //加载我们自己的布局 77 + if (isLazyInflate()) {
  78 + //加载我们自己的布局
  79 + inflate(savedInstanceState);
  80 + }
  81 + }
  82 +
  83 + private void inflate(@Nullable Bundle savedInstanceState) {
73 View view = View.inflate(getContext(), this.getLayoutId(), null); 84 View view = View.inflate(getContext(), this.getLayoutId(), null);
74 mRootView.setContentView(view); 85 mRootView.setContentView(view);
75 mRootView.showContent(); 86 mRootView.showContent();
@@ -190,4 +201,11 @@ public abstract class AppBaseFragment<P extends BasePresenter> extends BaseFragm @@ -190,4 +201,11 @@ public abstract class AppBaseFragment<P extends BasePresenter> extends BaseFragm
190 */ 201 */
191 protected void retry() { 202 protected void retry() {
192 } 203 }
  204 +
  205 + /**
  206 + * 是否需要懒加载
  207 + */
  208 + protected boolean isLazyInflate() {
  209 + return true;
  210 + }
193 } 211 }
@@ -8,7 +8,7 @@ ext { @@ -8,7 +8,7 @@ ext {
8 compileSdkVersion : 25, 8 compileSdkVersion : 25,
9 buildToolsVersion : "25.0.0", 9 buildToolsVersion : "25.0.0",
10 minSdkVersion : 15, 10 minSdkVersion : 15,
11 - targetSdkVersion : 23, 11 + targetSdkVersion : 22,
12 versionCode : 1, 12 versionCode : 1,
13 versionName : "1.0.0", 13 versionName : "1.0.0",
14 androidSupportSdkVersion: "25.0.0", 14 androidSupportSdkVersion: "25.0.0",
@@ -46,7 +46,6 @@ public class Message { @@ -46,7 +46,6 @@ public class Message {
46 private Boolean isSend; 46 private Boolean isSend;
47 private Boolean sendSucces; 47 private Boolean sendSucces;
48 private String time; 48 private String time;
49 - public boolean TimeIsShow;  
50 49
51 public Message(int type, int state, String userRole,String fromUserName, 50 public Message(int type, int state, String userRole,String fromUserName,
52 String fromUserAvatar, String toUserName, String toUserAvatar, 51 String fromUserAvatar, String toUserName, String toUserAvatar,
@@ -8,7 +8,6 @@ import android.text.Spannable; @@ -8,7 +8,6 @@ import android.text.Spannable;
8 import android.text.TextUtils; 8 import android.text.TextUtils;
9 import android.view.MotionEvent; 9 import android.view.MotionEvent;
10 import android.view.View; 10 import android.view.View;
11 -import android.widget.LinearLayout;  
12 import android.widget.ListView; 11 import android.widget.ListView;
13 12
14 import com.xdy.commonlibrary.core.AppBaseFragment; 13 import com.xdy.commonlibrary.core.AppBaseFragment;
@@ -16,7 +15,6 @@ import com.xdy.commonlibrary.core.di.AppComponent; @@ -16,7 +15,6 @@ import com.xdy.commonlibrary.core.di.AppComponent;
16 import com.xdy.home.R; 15 import com.xdy.home.R;
17 import com.xdy.home.adapter.ChatAdapter; 16 import com.xdy.home.adapter.ChatAdapter;
18 import com.xdy.home.entity.ChatMsgEntity; 17 import com.xdy.home.entity.ChatMsgEntity;
19 -import com.xdy.home.entity.Emojicon;  
20 import com.xdy.home.entity.Faceicon; 18 import com.xdy.home.entity.Faceicon;
21 import com.xdy.home.entity.Message; 19 import com.xdy.home.entity.Message;
22 import com.xdy.home.util.AccountUtils; 20 import com.xdy.home.util.AccountUtils;
@@ -26,7 +24,6 @@ import com.xdy.home.widget.chat.KJChatKeyboard; @@ -26,7 +24,6 @@ import com.xdy.home.widget.chat.KJChatKeyboard;
26 import com.xdy.home.widget.chat.OnOperationListener; 24 import com.xdy.home.widget.chat.OnOperationListener;
27 import com.xdy.home.widget.emoji.DisplayRules; 25 import com.xdy.home.widget.emoji.DisplayRules;
28 import com.xdy.util.LogUtil; 26 import com.xdy.util.LogUtil;
29 -import com.xdy.util.ResUtil;  
30 27
31 import org.kymjs.kjframe.ui.ViewInject; 28 import org.kymjs.kjframe.ui.ViewInject;
32 import org.kymjs.kjframe.utils.KJLoger; 29 import org.kymjs.kjframe.utils.KJLoger;
@@ -34,7 +31,6 @@ import org.kymjs.kjframe.utils.StringUtils; @@ -34,7 +31,6 @@ import org.kymjs.kjframe.utils.StringUtils;
34 31
35 import java.io.File; 32 import java.io.File;
36 import java.util.ArrayList; 33 import java.util.ArrayList;
37 -import java.util.Date;  
38 import java.util.List; 34 import java.util.List;
39 35
40 /** 36 /**
@@ -54,6 +50,11 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live @@ -54,6 +50,11 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
54 mPresenter = presenter; 50 mPresenter = presenter;
55 } 51 }
56 52
  53 + @Override
  54 + protected boolean isLazyInflate() {
  55 + return false;
  56 + }
  57 +
57 private KJChatKeyboard box; 58 private KJChatKeyboard box;
58 private ListView mRealListView; 59 private ListView mRealListView;
59 private Context mContext; 60 private Context mContext;
@@ -125,6 +126,7 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live @@ -125,6 +126,7 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
125 Spannable spanText = (Spannable) info; 126 Spannable spanText = (Spannable) info;
126 Selection.setSelection(spanText, start + emoji.length()); 127 Selection.setSelection(spanText, start + emoji.length());
127 } 128 }
  129 + box.setEditTextFocus();
128 } 130 }
129 } 131 }
130 132
@@ -3,6 +3,8 @@ package com.xdy.home.ui; @@ -3,6 +3,8 @@ package com.xdy.home.ui;
3 import android.graphics.Bitmap; 3 import android.graphics.Bitmap;
4 import android.graphics.BitmapFactory; 4 import android.graphics.BitmapFactory;
5 import android.os.Bundle; 5 import android.os.Bundle;
  6 +import android.os.Handler;
  7 +import android.os.Message;
6 import android.support.annotation.NonNull; 8 import android.support.annotation.NonNull;
7 import android.text.TextUtils; 9 import android.text.TextUtils;
8 import android.util.DisplayMetrics; 10 import android.util.DisplayMetrics;
@@ -10,6 +12,7 @@ import android.view.View; @@ -10,6 +12,7 @@ import android.view.View;
10 12
11 import com.bumptech.glide.Glide; 13 import com.bumptech.glide.Glide;
12 import com.xdy.commonlibrary.core.AppBaseFragment; 14 import com.xdy.commonlibrary.core.AppBaseFragment;
  15 +import com.xdy.commonlibrary.core.BaseRunnable;
13 import com.xdy.commonlibrary.core.di.AppComponent; 16 import com.xdy.commonlibrary.core.di.AppComponent;
14 import com.xdy.home.R; 17 import com.xdy.home.R;
15 import com.xdy.home.entity.UpdateDoc; 18 import com.xdy.home.entity.UpdateDoc;
@@ -44,6 +47,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -44,6 +47,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
44 private CanvasView mCanvasView; 47 private CanvasView mCanvasView;
45 private UpdateDoc mUpdateDoc; 48 private UpdateDoc mUpdateDoc;
46 private boolean replay; 49 private boolean replay;
  50 + private long intervalTime;
47 51
48 public void setPresenter(LivePresenter presenter) { 52 public void setPresenter(LivePresenter presenter) {
49 mPresenter = presenter; 53 mPresenter = presenter;
@@ -109,21 +113,60 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -109,21 +113,60 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
109 } 113 }
110 } 114 }
111 115
  116 + public final static int SEND = 0;
  117 +
  118 + Handler handler = new Handler() {
  119 + @Override
  120 + public void handleMessage(Message msg) {
  121 + int what = msg.what;
  122 + WhiteboardUpdateEntity obj = (WhiteboardUpdateEntity) msg.obj;
  123 + switch (what) {
  124 + case SEND:
  125 + mCanvasView.drawLine(obj.annotaionItems);
  126 + break;
  127 + }
  128 + }
  129 + };
  130 +
112 /** 131 /**
113 * @param entity 132 * @param entity
114 */ 133 */
115 @Override 134 @Override
116 public void renderUpdateAnnotation(WhiteboardUpdateEntity entity) { 135 public void renderUpdateAnnotation(WhiteboardUpdateEntity entity) {
117 - if (entity != null) {  
118 - if (entity.isFresh) { 136 +
  137 + if (intervalTime != 0) {
  138 + intervalTime = System.currentTimeMillis() - intervalTime;
  139 + if (intervalTime < 150) {//小于100毫秒 不执行?
  140 + handler.removeCallbacksAndMessages(null);
  141 + }
  142 + delayDraw(entity);
  143 + } else {
  144 + delayDraw(entity);
  145 + }
  146 + intervalTime = System.currentTimeMillis();
  147 + }
  148 +
  149 + private void delayDraw(final WhiteboardUpdateEntity entity) {
  150 + handler.postDelayed(new BaseRunnable<WhiteboardUpdateEntity>(entity) {
  151 +
  152 + @Override
  153 + protected void handle(WhiteboardUpdateEntity o) {
  154 + drawline(entity);
  155 + }
  156 + }, 200);
  157 + }
  158 +
  159 + private void drawline(WhiteboardUpdateEntity o) {
  160 + if (o != null) {
  161 + if (o.isFresh) {
119 if (mCanvasView != null) { 162 if (mCanvasView != null) {
120 mCanvasView.clear(); 163 mCanvasView.clear();
121 } 164 }
122 } 165 }
123 166
124 - if (entity.annotaionItems != null) { 167 + if (o.annotaionItems != null) {
125 if (mCanvasView != null) { 168 if (mCanvasView != null) {
126 - mCanvasView.drawLine(entity.annotaionItems); 169 + mCanvasView.drawLine(o.annotaionItems);
127 } 170 }
128 } 171 }
129 } 172 }
@@ -157,6 +200,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -157,6 +200,7 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
157 .get(); 200 .get();
158 wrapDocBitMapEntity.setNoDoc(false); 201 wrapDocBitMapEntity.setNoDoc(false);
159 wrapDocBitMapEntity.setBitmap(bitmap); 202 wrapDocBitMapEntity.setBitmap(bitmap);
  203 +
160 } 204 }
161 return wrapDocBitMapEntity; 205 return wrapDocBitMapEntity;
162 } catch (InterruptedException e) { 206 } catch (InterruptedException e) {
@@ -174,13 +218,20 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -174,13 +218,20 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
174 @Override 218 @Override
175 public void call(WrapDocBitMapEntity resource) { 219 public void call(WrapDocBitMapEntity resource) {
176 220
177 - if (resource.getBitmap() == null) {  
178 - showMessage("图片获取失败");  
179 - Bitmap bitmap = getNoDocBitmap();  
180 - mCanvasView.setBitmap(bitmap, false);  
181 - } else {  
182 - mCanvasView.setBitmap(resource.getBitmap(), !resource.showNoDoc());  
183 - } 221 + //用handler发送 跟drawline在一个队列里执行,否则顺序乱了导致切换图片的时候还有上一个画面的标注
  222 + handler.post(new BaseRunnable<WrapDocBitMapEntity>(resource) {
  223 + @Override
  224 + protected void handle(WrapDocBitMapEntity wrapDocBitMapEntity) {
  225 +
  226 + if (wrapDocBitMapEntity.getBitmap() == null) {
  227 + showMessage("图片获取失败");
  228 + Bitmap bitmap = getNoDocBitmap();
  229 + mCanvasView.setBitmap(bitmap, false);
  230 + } else {
  231 + mCanvasView.setBitmap(wrapDocBitMapEntity.getBitmap(), !wrapDocBitMapEntity.showNoDoc());
  232 + }
  233 + }
  234 + });
184 } 235 }
185 }); 236 });
186 } 237 }
@@ -62,6 +62,7 @@ import java.util.Random; @@ -62,6 +62,7 @@ import java.util.Random;
62 import me.yokeyword.fragmentation.SupportFragment; 62 import me.yokeyword.fragmentation.SupportFragment;
63 63
64 import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION; 64 import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION;
  65 +import static com.xdy.home.R.mipmap.play;
65 66
66 /** 67 /**
67 * @author Administrator 68 * @author Administrator
@@ -218,6 +219,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -218,6 +219,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
218 } 219 }
219 }); 220 });
220 viewPager.setPagingEnabled(false); 221 viewPager.setPagingEnabled(false);
  222 + viewPager.setOffscreenPageLimit(3);
221 mAdapter = new HomeAdapter(getChildFragmentManager(), mFragments); 223 mAdapter = new HomeAdapter(getChildFragmentManager(), mFragments);
222 viewPager.setAdapter(mAdapter); 224 viewPager.setAdapter(mAdapter);
223 slidingTab.setViewPager(viewPager, titles); 225 slidingTab.setViewPager(viewPager, titles);
@@ -433,6 +435,29 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -433,6 +435,29 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
433 } 435 }
434 436
435 @Override 437 @Override
  438 + public void onPause() {
  439 + super.onPause();
  440 + if (!replay) {
  441 + if (mPresenter.isVideoMode())
  442 + stopVideo();
  443 + else
  444 + stopAudio();
  445 + } else {
  446 + mPresenter.pauseAndStart(true);
  447 + }
  448 + }
  449 +
  450 + @Override
  451 + public void onResume() {
  452 + super.onResume();
  453 + if (!replay) {
  454 + mPresenter.restart();
  455 + } else {
  456 + mPresenter.pauseAndStart(false);
  457 + }
  458 + }
  459 +
  460 + @Override
436 public void showOperation(boolean b) { 461 public void showOperation(boolean b) {
437 if (b) 462 if (b)
438 operation.setVisibility(View.VISIBLE); 463 operation.setVisibility(View.VISIBLE);
@@ -469,7 +494,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -469,7 +494,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
469 if (!replay) { 494 if (!replay) {
470 mPresenter.close(); 495 mPresenter.close();
471 } else { 496 } else {
472 - if (!mPresenter.isVideoMode() && mVideoView != null) 497 + if (!mPresenter.isVideoMode() && mVideoView != null && mVideoView.isPlaying())
473 mVideoView.stopPlayback(); 498 mVideoView.stopPlayback();
474 } 499 }
475 } 500 }
@@ -487,7 +512,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -487,7 +512,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
487 if (!replay) { 512 if (!replay) {
488 mPresenter.close(); 513 mPresenter.close();
489 } else { 514 } else {
490 - if (mPresenter.isVideoMode() && mVideoView != null) 515 + if (mPresenter.isVideoMode() && mVideoView != null && mVideoView.isPlaying())
491 mVideoView.stopPlayback(); 516 mVideoView.stopPlayback();
492 } 517 }
493 } 518 }
@@ -697,7 +722,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -697,7 +722,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
697 @Override 722 @Override
698 public void updatePausePlay() { 723 public void updatePausePlay() {
699 if (mPresenter.getRecordStatus()) 724 if (mPresenter.getRecordStatus())
700 - mPauseButton.setImageResource(R.mipmap.play); 725 + mPauseButton.setImageResource(play);
701 else 726 else
702 mPauseButton.setImageResource(R.mipmap.stop); 727 mPauseButton.setImageResource(R.mipmap.stop);
703 } 728 }
@@ -339,6 +339,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -339,6 +339,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
339 mRootView.resetSeekBar(); 339 mRootView.resetSeekBar();
340 docView.clear(); 340 docView.clear();
341 chatView.clearChatHistory(); 341 chatView.clearChatHistory();
  342 + currentPlayAudio = null;
  343 + currentPlayVideo = null;
342 } 344 }
343 break; 345 break;
344 case Constants.RECORD_PAUSE: 346 case Constants.RECORD_PAUSE:
@@ -372,6 +374,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -372,6 +374,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
372 currentPlayAudio.getMediaId() == audio.getMediaId()) { 374 currentPlayAudio.getMediaId() == audio.getMediaId()) {
373 mRootView.showOperation(false); 375 mRootView.showOperation(false);
374 mRootView.stopAudio(); 376 mRootView.stopAudio();
  377 + currentPlayAudio = null;
375 } 378 }
376 } 379 }
377 380
@@ -391,6 +394,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -391,6 +394,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
391 currentPlayVideo.getMediaId() == videoEntity.getMediaId()) { 394 currentPlayVideo.getMediaId() == videoEntity.getMediaId()) {
392 mRootView.stopVideo(); 395 mRootView.stopVideo();
393 mRootView.showOperation(false); 396 mRootView.showOperation(false);
  397 + currentPlayVideo = null;
394 } 398 }
395 } 399 }
396 400
@@ -835,6 +839,14 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -835,6 +839,14 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
835 return connceted; 839 return connceted;
836 } 840 }
837 841
  842 + public void restart() {
  843 + if (isVideoMode() && currentPlayVideo != null) {
  844 + mRootView.playVideo(currentPlayVideo);
  845 + } else if (currentPlayAudio != null) {
  846 + mRootView.playAudio(currentPlayAudio);
  847 + }
  848 + }
  849 +
838 850
839 class EventHande implements SmartEventCallback { 851 class EventHande implements SmartEventCallback {
840 @Override 852 @Override
@@ -449,7 +449,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -449,7 +449,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
449 this.setOnTouchListener(this); 449 this.setOnTouchListener(this);
450 // 设置背景为透明 否则是黑色 450 // 设置背景为透明 否则是黑色
451 this.setZOrderOnTop(true); 451 this.setZOrderOnTop(true);
452 - // this.setZOrderMediaOverlay(true); 452 + // this.setZOrderMediaOverlay(true);
453 this.getHolder().setFormat(PixelFormat.TRANSLUCENT); 453 this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
454 454
455 // this.pathLists.add(new Path()); 455 // this.pathLists.add(new Path());
@@ -541,7 +541,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -541,7 +541,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
541 for (PointGroupEntity pointXy : pointXies) { 541 for (PointGroupEntity pointXy : pointXies) {
542 float w = pointXy.w; 542 float w = pointXy.w;
543 float h = pointXy.h + (FLOAT_TYPE * currentOffsetY) / (FLOAT_TYPE * finalWidth) * 100f; 543 float h = pointXy.h + (FLOAT_TYPE * currentOffsetY) / (FLOAT_TYPE * finalWidth) * 100f;
544 - pointXy.h =h; 544 + pointXy.h = h;
545 } 545 }
546 546
547 //操作一下這個點 547 //操作一下這個點
@@ -155,6 +155,7 @@ public class KJChatKeyboard extends RelativeLayout implements @@ -155,6 +155,7 @@ public class KJChatKeyboard extends RelativeLayout implements
155 return new OnClickListener() { 155 return new OnClickListener() {
156 @Override 156 @Override
157 public void onClick(View v) { 157 public void onClick(View v) {
  158 + setEditTextFocus();
158 if (isShow() && which == layoutType) { 159 if (isShow() && which == layoutType) {
159 hideLayout(); 160 hideLayout();
160 showKeyboard(context); 161 showKeyboard(context);
@@ -168,6 +169,17 @@ public class KJChatKeyboard extends RelativeLayout implements @@ -168,6 +169,17 @@ public class KJChatKeyboard extends RelativeLayout implements
168 }; 169 };
169 } 170 }
170 171
  172 + public void setEditTextFocus(){
  173 + if (mEtMsg!=null){
  174 + mEtMsg.setFocusable(true);
  175 + mEtMsg.setFocusableInTouchMode(true);
  176 + mEtMsg.requestFocus();
  177 + mEtMsg.findFocus();
  178 + mEtMsg.invalidate();
  179 + }
  180 +
  181 + }
  182 +
171 private void changeLayout(int mode) { 183 private void changeLayout(int mode) {
172 adapter = new FaceCategroyAdapter(((FragmentActivity) getContext()) 184 adapter = new FaceCategroyAdapter(((FragmentActivity) getContext())
173 .getSupportFragmentManager(), mode); 185 .getSupportFragmentManager(), mode);
@@ -215,6 +227,8 @@ public class KJChatKeyboard extends RelativeLayout implements @@ -215,6 +227,8 @@ public class KJChatKeyboard extends RelativeLayout implements
215 public void showLayout() { 227 public void showLayout() {
216 hideKeyboard(this.context); 228 hideKeyboard(this.context);
217 // 延迟一会,让键盘先隐藏再显示表情键盘,否则会有一瞬间表情键盘和软键盘同时显示 229 // 延迟一会,让键盘先隐藏再显示表情键盘,否则会有一瞬间表情键盘和软键盘同时显示
  230 +
  231 +
218 postDelayed(new Runnable() { 232 postDelayed(new Runnable() {
219 @Override 233 @Override
220 public void run() { 234 public void run() {
@@ -268,6 +282,8 @@ public class KJChatKeyboard extends RelativeLayout implements @@ -268,6 +282,8 @@ public class KJChatKeyboard extends RelativeLayout implements
268 .getWindowToken(), 0); 282 .getWindowToken(), 0);
269 imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); 283 imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
270 } 284 }
  285 +
  286 +
271 } 287 }
272 288
273 289
@@ -139,5 +139,10 @@ public enum DisplayRules { @@ -139,5 +139,10 @@ public enum DisplayRules {
139 KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 139 KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0,
140 0, KeyEvent.KEYCODE_ENDCALL); 140 0, KeyEvent.KEYCODE_ENDCALL);
141 editText.dispatchKeyEvent(event); 141 editText.dispatchKeyEvent(event);
  142 + editText.setFocusable(true);
  143 + editText.setFocusableInTouchMode(true);
  144 + editText.requestFocus();
  145 + editText.findFocus();
  146 + editText.invalidate();
142 } 147 }
143 } 148 }
@@ -51,6 +51,11 @@ public class EmoticonsEditText extends EditText { @@ -51,6 +51,11 @@ public class EmoticonsEditText extends EditText {
51 public void setText(CharSequence text, BufferType type) { 51 public void setText(CharSequence text, BufferType type) {
52 if (!TextUtils.isEmpty(text)) { 52 if (!TextUtils.isEmpty(text)) {
53 super.setText(replace(text), type); 53 super.setText(replace(text), type);
  54 + /*setFocusable(true);
  55 + setFocusableInTouchMode(true);
  56 + requestFocus();
  57 + findFocus();
  58 + invalidate();*/
54 } else { 59 } else {
55 super.setText(text, type); 60 super.setText(text, type);
56 } 61 }