蒋洪波

修改画板BUG

... ... @@ -15,3 +15,7 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep class com.eventhandle.**{*;}
-keep class com.ntjbase.**{*;}
-keep class com.videoengine.**{*;}
-keep class com.voiceengine.**{*;}
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@ import android.text.Spannable;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.xdy.commonlibrary.core.AppBaseFragment;
... ... @@ -25,6 +26,7 @@ import com.xdy.home.widget.chat.KJChatKeyboard;
import com.xdy.home.widget.chat.OnOperationListener;
import com.xdy.home.widget.emoji.DisplayRules;
import com.xdy.util.LogUtil;
import com.xdy.util.ResUtil;
import org.kymjs.kjframe.ui.ViewInject;
import org.kymjs.kjframe.utils.KJLoger;
... ... @@ -68,6 +70,11 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
protected void setupFragmentComponent(AppComponent appComponent) {
Bundle arguments = getArguments();
replay = arguments.getBoolean("replay");
... ... @@ -76,13 +83,13 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
@Override
protected void initView(View v, Bundle savedInstanceState) {
this.mContext = getActivity();
box = (KJChatKeyboard) v.findViewById(R.id.chat_msg_input_box);
mRealListView = (ListView) v.findViewById(R.id.chat_listview);
mRealListView.setSelector(android.R.color.transparent);
initMessageInputToolBox();
}
private void initMessageInputToolBox() {
box.setToolBoxIsClick(replay);
box.setOnOperationListener(new OnOperationListener() {
... ... @@ -107,7 +114,7 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
@Override
public void selectedEmoji(String emoji) {
if (!TextUtils.isEmpty(emoji)){
if (!TextUtils.isEmpty(emoji)) {
int start = box.getEditTextBox().getSelectionStart();
CharSequence content = box.getEditTextBox().getText().insert(start, emoji);
box.getEditTextBox().setText(content);
... ... @@ -209,7 +216,7 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
if (entity.fromNodeId.equals(AccountUtils.getUser().getNodeId().toString())) {
message = new Message(Message.MSG_TYPE_TEXT, Message.MSG_STATE_SUCCESS, entity.fromRole,
entity.fromName, "", "",
"", entity.message, true, true, replay?null:new Date());
"", entity.message, true, true, replay ? null : new Date());
datas.add(message);
adapter.refresh(datas);
mRealListView.setSelection(adapter.getCount() - 1);
... ... @@ -217,7 +224,7 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
LogUtil.i("返回的聊天内容===" + entity.message);
message = new Message(Message.MSG_TYPE_TEXT, Message.MSG_STATE_SUCCESS, entity.fromRole, "",
"", entity.fromName, "", entity.message, false,
true, replay?null:new Date());
true, replay ? null : new Date());
datas.add(message);
adapter.refresh(datas);
mRealListView.setSelection(adapter.getCount() - 1);
... ... @@ -228,8 +235,8 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
}
@Override
public void clearChatHistory(){
if (adapter!=null){
public void clearChatHistory() {
if (adapter != null) {
datas.clear();
adapter.refresh(datas);
}
... ...
... ... @@ -41,21 +41,26 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
int winWidth;
int winHeight;
CanvasView mCanvasView;
private CanvasView mCanvasView;
private UpdateDoc mUpdateDoc;
private boolean replay;
public void setPresenter(LivePresenter presenter) {
mPresenter = presenter;
}
public static DocFragment newInstance() {
public static DocFragment newInstance(boolean replay) {
DocFragment docFragment = new DocFragment();
Bundle bundle = new Bundle();
bundle.putBoolean("replay", replay);
docFragment.setArguments(bundle);
return docFragment;
}
@Override
protected void setupFragmentComponent(AppComponent appComponent) {
Bundle arguments = getArguments();
replay = arguments.getBoolean("replay");
}
@Override
... ... @@ -63,7 +68,9 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
DisplayMetrics metric = new DisplayMetrics();
getWindowWith(metric);
mCanvasView = (CanvasView) v.findViewById(R.id.cv);
if (replay) {
mCanvasView.setZOrderMediaOverlay(true);
}
//展示没有文档图片
docUrlTransformBitmap(null);
}
... ... @@ -115,7 +122,9 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
}
if (entity.annotaionItems != null) {
mCanvasView.drawLine(entity.annotaionItems);
if (mCanvasView != null) {
mCanvasView.drawLine(entity.annotaionItems);
}
}
}
}
... ...
... ... @@ -13,7 +13,6 @@ import android.view.MotionEvent;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.ConsoleMessage;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
... ... @@ -27,6 +26,7 @@ import android.widget.SeekBar;
import android.widget.TextView;
import com.flyco.tablayout.SlidingTabLayout;
import com.flyco.tablayout.listener.OnTabSelectListener;
import com.pili.pldroid.player.AVOptions;
import com.pili.pldroid.player.PLMediaPlayer;
import com.pili.pldroid.player.widget.PLVideoTextureView;
... ... @@ -159,7 +159,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
mClassName = (TextView) v.findViewById(R.id.tv_classname);
mMediaContainer = (FrameLayout) v.findViewById(R.id.fl_media);
mMeadiaContrillerRight = (RelativeLayout) v.findViewById(R.id.rl_meadia_contriller_right);
mMediaControllerRight = (RelativeLayout) v.findViewById(R.id.rl_meadia_contriller_right);
mPauseButton = (ImageButton) v.findViewById(R.id.iv_operation_play);
mPauseContainer = (RelativeLayout) v.findViewById(R.id.rl_operation_play);
mEndTime = (TextView) v.findViewById(R.id.tv_end_time);
... ... @@ -192,7 +192,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
mPresenter.pauseAndStart(!pause);
}
});
mMeadiaContrillerRight.setOnTouchListener(new View.OnTouchListener() {
mMediaControllerRight.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mPauseContainer != null) {
... ... @@ -219,6 +219,21 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
mAdapter = new HomeAdapter(getChildFragmentManager(), mFragments);
viewPager.setAdapter(mAdapter);
slidingTab.setViewPager(viewPager, titles);
slidingTab.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelect(int position) {
if (1 == position && replay) {
//为了避免回访时切换界面出现桌面 暂时先这样写了
showMediaContainer(TIME_OUT);
}
}
@Override
public void onTabReselect(int position) {
}
});
}
}
... ... @@ -298,7 +313,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
// codec=AVOptions.MEDIA_CODEC_SW_DECODE, 软解
// codec=AVOptions.MEDIA_CODEC_AUTO, 硬解优先,失败后自动切换到软解
// 默认值是:MEDIA_CODEC_SW_DECODE
options.setInteger(AVOptions.KEY_MEDIACODEC, AVOptions.MEDIA_CODEC_HW_DECODE);
options.setInteger(AVOptions.KEY_MEDIACODEC, AVOptions.MEDIA_CODEC_AUTO);
// 准备超时时间,包括创建资源、建立连接、请求码流等,单位是 ms
// 默认值是:无
... ... @@ -328,12 +343,12 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
options.setInteger(AVOptions.KEY_MAX_CACHE_BUFFER_DURATION, 300);
// 是否自动启动播放,如果设置为 1,则在调用 `prepareAsync` 或者 `setVideoPath` 之后自动启动播放,无需调用 `start()`
// 默认值是:1
options.setInteger(AVOptions.KEY_START_ON_PREPARED, 1);
options.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);
// 播放前最大探测流的字节数,单位是 byte
// 默认值是:128 * 1024
options.setInteger(AVOptions.KEY_PROBESIZE, 128 * 1024);
options.setInteger(AVOptions.KEY_BUFFER_TIME, 100);
options.setInteger(AVOptions.KEY_BUFFER_TIME, 300);
// 请在开始播放之前配置
mVideoView.setAVOptions(options);
... ... @@ -349,7 +364,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
String doc = ResUtil.get().getString(R.string.home_doc);
String chat = ResUtil.get().getString(R.string.home_chat);
docFragment = DocFragment.newInstance();
docFragment = DocFragment.newInstance(replay);
docFragment.setTitle(doc);
chatFragment = ChatFragment.newInstance(replay);
... ... @@ -416,18 +431,6 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
}
@Override
public void addSurfaceView(SurfaceView surfaceview, boolean show) {
if (show) {
ViewParent parent = surfaceview.getParent();
if (parent == null) {
videoContainer.addView(surfaceview);
}
} else {
videoContainer.removeView(surfaceview);
}
}
@Override
public void playAudio(VideoEntity rtmpUrl) {
initPic.setImageResource(R.mipmap.audio_mode);
initPic.setVisibility(View.VISIBLE);
... ... @@ -441,12 +444,10 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
}
mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
mVideoView.start();
if (replay) {
mVideoView.seekTo(rtmpUrl.getSeek());
if (replay && rtmpUrl.getSeek() > 0) {
mVideoView.seekTo(rtmpUrl.getSeek() * 1000);
}
mVideoView.start();
}
}
... ... @@ -468,7 +469,6 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
initPic.setImageResource(R.mipmap.no_video);
initPic.setVisibility(View.VISIBLE);
if (!replay) {
// addSurfaceView(surfaceView, false);
mPresenter.close();
} else {
if (mPresenter.isVideoMode() && mVideoView != null)
... ... @@ -483,17 +483,15 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
operationIcon.setImageResource(R.mipmap.video_close);
if (!replay) {
mPresenter.start(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
// SurfaceView surfaceView = mPresenter.getsSurfaceView();
// addSurfaceView(surfaceView, true);
} else {
if (mVideoView.isPlaying()) {
mVideoView.stopPlayback();
}
mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
if (replay && rtmpUrl.getSeek() > 0) {
mVideoView.seekTo(rtmpUrl.getSeek() * 1000);
}
mVideoView.start();
if (replay)
mVideoView.seekTo(rtmpUrl.getSeek());
}
}
... ... @@ -632,8 +630,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
private TextView mEndTime, mCurrentTime;
private boolean mShowing;
private boolean mDragging;
private RelativeLayout mMeadiaContrillerRight;
private RelativeLayout mMediaControllerRight;
@SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() {
... ...
... ... @@ -92,13 +92,6 @@ public interface LiveContract {
void showOperation(boolean b);
/**
* 添加surfaceview
* @param surfaceview
* @param show
*/
void addSurfaceView(SurfaceView surfaceview, boolean show);
/**
* 刷新按钮
*/
void updatePausePlay();
... ...
... ... @@ -312,8 +312,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
case Constants.RECORD_SEEK:
isOver = false;
pause = false;
int keyFrameSeek = jsonObject.optInt("keyFrameSeekTime");
mRootView.seek(keyFrameSeek);
// int keyFrameSeek = jsonObject.optInt("keyFrameSeekTime");
// mRootView.seek(keyFrameSeek);
break;
case Constants.RECORD_STOP:
pause = true;
... ... @@ -787,6 +787,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
public void seekRecordPlay(long b) {
chatView.clearChatHistory();
docView.clear();
mModel.seekRecordPlayback(b);
}
... ...
... ... @@ -59,6 +59,10 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
private int screenWidth;
private int currentTop;
private boolean adjust;
/**
* 图片在拖动后的偏移量
*/
private int currentOffsetY;
private void initRect() {
mCurrentMaxScale = Math.max(
... ... @@ -172,6 +176,11 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
}
public void setBitmap(Bitmap b, boolean adjust) {
//重置数据
finalHeight = 0;
finalWidth = 0;
currentTop = 0;
currentOffsetY = 0;
this.adjust = adjust;
if (b == null) {
return;
... ... @@ -182,8 +191,8 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
|| mImageWidth != mBitmap.getWidth()) {
mImageWidth = mBitmap.getWidth();
mImageHeight = mBitmap.getHeight();
calcRect();
}
calcRect();
drawSurface();
}
}
... ... @@ -200,7 +209,10 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
mCenterX -= offsetX;
mCenterY -= offsetY;
if (adjust) {
if (finalHeight > mSurfaceHeight) {
int tempTop = mRectDes.top + offsetY;
... ... @@ -244,7 +256,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
}
private void adjustPath(int offsetY) {
currentOffsetY += offsetY;
pathLists.clear();
historyPointer = 0;
//提取原始坐标点
... ... @@ -327,6 +339,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
synchronized (CanvasView.class) {
mSurfaceHeight = height;
mSurfaceWidth = width;
currentOffsetY = 0;
calcRect();
operatePoints.clear();
... ... @@ -436,7 +449,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
this.setOnTouchListener(this);
// 设置背景为透明 否则是黑色
this.setZOrderOnTop(true);
this.setZOrderMediaOverlay(true);
// this.setZOrderMediaOverlay(true);
this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
// this.pathLists.add(new Path());
... ... @@ -513,6 +526,25 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
int color = Color.parseColor(annotation.color);
setPaintFillColor(color);
copyArr(pointXies);
// adjustPath(mRectDes.top);
// for (int j = 0; j < pointXies.size(); j++) {
// PointGroupEntity pointGroupEntity = pointXies.get(j);
// Path path = this.getCurrentPath();
// float w2 = pointGroupEntity.w;
// float h2 = pointGroupEntity.h + (FLOAT_TYPE * mRectDes.top) / (FLOAT_TYPE * finalWidth) * 100f;
// pointGroupEntity.h = h2;
// path.lineTo(w2 / 100 * finalWidth, h2 / 100 * finalWidth);
// }
for (PointGroupEntity pointXy : pointXies) {
float w = pointXy.w;
float h = pointXy.h + (FLOAT_TYPE * currentOffsetY) / (FLOAT_TYPE * finalWidth) * 100f;
pointXy.h =h;
}
//操作一下這個點
operatePoints.add(pointXies);
pathLists.add(createPath(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop));
paintLists.add(this.createPaint(color));
... ...
... ... @@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/ll_chat_fragment_parent"
android:background="@color/COLOR_EBEBEB"
android:orientation="vertical">
... ...
... ... @@ -13,13 +13,13 @@
style="@style/home_site_input_style"
android:layout_marginTop="@dimen/ui_DIMEN_20.0PX">
<!-- 709902904 472732494 -->
<!-- 709902904 472732494 2067973545-->
<android.support.v7.widget.AppCompatEditText
android:id="@+id/acet_classid"
style="@style/ui_match_wrap"
android:hint="@string/home_classid_hint"
android:inputType="number"
android:text="472732494"/>
android:text="2067973545"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
... ...
... ... @@ -356,4 +356,9 @@ public static java.lang.String TABLENAME;
-keep class com.pili.pldroid.player.** { *; }
-keep class tv.danmaku.ijk.media.player.** {*;}
-keep class com.daniulive.smartplayer.**{*;}
\ No newline at end of file
-keep class com.daniulive.smartplayer.**{*;}
-keep class com.eventhandle.**{*;}
-keep class com.ntjbase.**{*;}
-keep class com.videoengine.**{*;}
-keep class com.voiceengine.**{*;}
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="@color/home_background"
android:layout_height="match_parent"
tools:context="com.xdy.componentpractice.MainActivity">
... ...