Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
蒋洪波
/
XDYAndroidLive
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
蒋洪波
2017-04-05 23:02:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e0ed12914683de5cdf174ab45b25a65a829b11f1
e0ed1291
1 parent
647583a2
fix bug
隐藏空白字符变更
内嵌
并排对比
正在显示
14 个修改的文件
包含
246 行增加
和
73 行删除
CommonLib/src/main/java/com/xdy/commonlibrary/core/AppConfig.java
CommonLib/src/main/java/com/xdy/commonlibrary/core/CrashHandler.java
home/src/main/java/com/xdy/home/adapter/ChatAdapter.java
home/src/main/java/com/xdy/home/entity/Message.java
home/src/main/java/com/xdy/home/ui/ChatFragment.java
home/src/main/java/com/xdy/home/ui/DocFragment.java
home/src/main/java/com/xdy/home/ui/LiveFragment.java
home/src/main/java/com/xdy/home/util/Constants.java
home/src/main/java/com/xdy/home/vp/LiveContract.java
home/src/main/java/com/xdy/home/vp/LivePresenter.java
home/src/main/res/layout/home_chat_item_list_left.xml
home/src/main/res/layout/home_chat_item_list_right.xml
home/src/main/res/layout/home_fragment_site.xml
home/src/main/res/values/strings.xml
CommonLib/src/main/java/com/xdy/commonlibrary/core/AppConfig.java
查看文件 @
e0ed129
...
...
@@ -36,9 +36,9 @@ public class AppConfig {
//SD卡 统一文件夹名称
public
static
final
String
SHOPIN_DIR
=
"shopin
"
;
public
static
final
String
XDY_DIR
=
"xdy
"
;
//本地文件夹位置
public
static
final
File
LOCAL_FILE_DIR
=
new
File
(
Environment
.
getExternalStorageDirectory
(),
SHOPIN
_DIR
);
public
static
final
File
LOCAL_FILE_DIR
=
new
File
(
Environment
.
getExternalStorageDirectory
(),
XDY
_DIR
);
//辨识系统常量,在某些页面需要针对
public
static
final
CharSequence
SAMSUNG_BRAND
=
"samsung"
;
...
...
CommonLib/src/main/java/com/xdy/commonlibrary/core/CrashHandler.java
查看文件 @
e0ed129
...
...
@@ -2,9 +2,12 @@ package com.xdy.commonlibrary.core;
import
com.xdy.util.AppUtil
;
import
com.xdy.util.DateUtils
;
import
com.xdy.util.LogUtil
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.PrintStream
;
...
...
@@ -50,6 +53,22 @@ public class CrashHandler extends AbsCrashHandler {
// entity.setErrorMsg(errorMessage);
// instance.insertOrUpdateData(entity);
LogUtil
.
e
(
TAG
,
errorMessage
);
File
sdCard
=
AppConfig
.
LOCAL_FILE_DIR
;
if
(!
sdCard
.
exists
())
sdCard
.
mkdirs
();
File
txt
=
new
File
(
AppConfig
.
LOCAL_FILE_DIR
,
DateUtils
.
getTimeWithSec
()
+
".txt"
);
if
(!
txt
.
exists
())
{
boolean
newFile
=
txt
.
createNewFile
();
if
(
newFile
)
{
FileWriter
writer
=
new
FileWriter
(
txt
);
writer
.
write
(
errorMessage
);
writer
.
flush
();
writer
.
close
();
}
}
baos
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
home/src/main/java/com/xdy/home/adapter/ChatAdapter.java
查看文件 @
e0ed129
...
...
@@ -46,6 +46,7 @@ public class ChatAdapter extends BaseAdapter {
private
List
<
Message
>
datas
=
null
;
private
KJBitmap
kjb
;
private
ChatFragment
.
OnChatItemClickListener
listener
;
String
oldTime
;
public
ChatAdapter
(
Context
cxt
,
List
<
Message
>
datas
,
ChatFragment
.
OnChatItemClickListener
listener
)
{
this
.
cxt
=
cxt
;
...
...
@@ -109,17 +110,20 @@ public class ChatAdapter extends BaseAdapter {
holder
.
tv_chatcontent
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
chat_item_content_text
);
holder
.
tv_date
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
chat_item_date
);
holder
.
tv_name
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
chat_item_name
);
holder
.
tv_teacher_bg
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
chat_item_taacher_bg
);
holder
.
tv_teacher_bg
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
chat_item_taacher_bg
);
v
.
setTag
(
holder
);
}
else
{
holder
=
(
ViewHolder
)
v
.
getTag
();
}
if
(
data
.
getTime
()!=
null
){
holder
.
tv_date
.
setText
(
StringUtils
.
getDataTime
(
"HH:mm"
));
if
(
data
.
getTime
()
!=
null
)
{
String
dataTime
=
data
.
getTime
();
holder
.
tv_date
.
setText
(
dataTime
);
holder
.
tv_date
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
holder
.
tv_date
.
setVisibility
(
View
.
GONE
);
}
//如果是文本类型,则隐藏图片,如果是图片则隐藏文本
if
(
data
.
getType
()
==
Message
.
MSG_TYPE_TEXT
)
{
holder
.
img_chatimage
.
setVisibility
(
View
.
GONE
);
...
...
@@ -161,6 +165,7 @@ public class ChatAdapter extends BaseAdapter {
}
else
{
holder
.
tv_name
.
setText
(
"学生"
);
}
holder
.
tv_teacher_bg
.
setVisibility
(
View
.
GONE
);
holder
.
img_avatar
.
setImageResource
(
R
.
mipmap
.
student
);
break
;
case
"host"
:
//主持人/老师
...
...
@@ -177,6 +182,7 @@ public class ChatAdapter extends BaseAdapter {
}
else
{
holder
.
tv_name
.
setText
(
"主讲人"
);
}
holder
.
tv_teacher_bg
.
setVisibility
(
View
.
GONE
);
holder
.
img_avatar
.
setImageResource
(
R
.
mipmap
.
student
);
break
;
case
"assistant"
:
//助教
...
...
@@ -185,6 +191,7 @@ public class ChatAdapter extends BaseAdapter {
}
else
{
holder
.
tv_name
.
setText
(
"助教"
);
}
holder
.
tv_teacher_bg
.
setVisibility
(
View
.
GONE
);
holder
.
img_avatar
.
setImageResource
(
R
.
mipmap
.
student
);
break
;
case
"record"
:
// 暂时没用
...
...
@@ -193,6 +200,7 @@ public class ChatAdapter extends BaseAdapter {
}
else
{
holder
.
tv_name
.
setText
(
"学生"
);
}
holder
.
tv_teacher_bg
.
setVisibility
(
View
.
GONE
);
holder
.
img_avatar
.
setImageResource
(
R
.
mipmap
.
student
);
break
;
}
...
...
@@ -204,6 +212,7 @@ public class ChatAdapter extends BaseAdapter {
}
else
{
holder
.
tv_name
.
setText
(
"学生"
);
}
holder
.
tv_teacher_bg
.
setVisibility
(
View
.
GONE
);
holder
.
img_avatar
.
setImageResource
(
R
.
mipmap
.
student
);
break
;
case
"host"
:
//主持人/老师
...
...
@@ -220,6 +229,7 @@ public class ChatAdapter extends BaseAdapter {
}
else
{
holder
.
tv_name
.
setText
(
"主讲人"
);
}
holder
.
tv_teacher_bg
.
setVisibility
(
View
.
GONE
);
holder
.
img_avatar
.
setImageResource
(
R
.
mipmap
.
student
);
break
;
case
"assistant"
:
//助教
...
...
@@ -228,6 +238,7 @@ public class ChatAdapter extends BaseAdapter {
}
else
{
holder
.
tv_name
.
setText
(
"助教"
);
}
holder
.
tv_teacher_bg
.
setVisibility
(
View
.
GONE
);
holder
.
img_avatar
.
setImageResource
(
R
.
mipmap
.
student
);
break
;
case
"record"
:
// 暂时没用
...
...
@@ -236,6 +247,7 @@ public class ChatAdapter extends BaseAdapter {
}
else
{
holder
.
tv_name
.
setText
(
"学生"
);
}
holder
.
tv_teacher_bg
.
setVisibility
(
View
.
GONE
);
holder
.
img_avatar
.
setImageResource
(
R
.
mipmap
.
student
);
break
;
}
...
...
home/src/main/java/com/xdy/home/entity/Message.java
查看文件 @
e0ed129
...
...
@@ -45,11 +45,12 @@ public class Message {
private
Boolean
isSend
;
private
Boolean
sendSucces
;
private
Date
time
;
private
String
time
;
public
boolean
TimeIsShow
;
public
Message
(
int
type
,
int
state
,
String
userRole
,
String
fromUserName
,
String
fromUserAvatar
,
String
toUserName
,
String
toUserAvatar
,
String
content
,
Boolean
isSend
,
Boolean
sendSucces
,
Date
time
)
{
String
content
,
Boolean
isSend
,
Boolean
sendSucces
,
String
time
)
{
super
();
this
.
type
=
type
;
this
.
state
=
state
;
...
...
@@ -62,6 +63,7 @@ public class Message {
this
.
isSend
=
isSend
;
this
.
sendSucces
=
sendSucces
;
this
.
time
=
time
;
}
public
Long
getId
()
{
...
...
@@ -144,11 +146,11 @@ public class Message {
this
.
sendSucces
=
sendSucces
;
}
public
Date
getTime
()
{
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
Date
time
)
{
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
...
...
@@ -161,4 +163,6 @@ public class Message {
}
}
...
...
home/src/main/java/com/xdy/home/ui/ChatFragment.java
查看文件 @
e0ed129
...
...
@@ -30,6 +30,7 @@ import com.xdy.util.ResUtil;
import
org.kymjs.kjframe.ui.ViewInject
;
import
org.kymjs.kjframe.utils.KJLoger
;
import
org.kymjs.kjframe.utils.StringUtils
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -209,22 +210,41 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
};
}
private
String
oldTime
;
private
String
time
;
@Override
public
void
renderChatMsg
(
ChatMsgEntity
entity
)
{
if
(
entity
!=
null
&&
adapter
!=
null
)
{
Message
message
;
String
dataTime
=
StringUtils
.
getDataTime
(
"HH:mm"
);
if
(
entity
.
fromNodeId
.
equals
(
AccountUtils
.
getUser
().
getNodeId
().
toString
()))
{
if
(
TextUtils
.
isEmpty
(
oldTime
))
{
time
=
oldTime
=
dataTime
;
}
else
if
(
dataTime
.
equals
(
oldTime
))
{
time
=
null
;
}
else
{
time
=
oldTime
=
dataTime
;
}
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
:
time
);
datas
.
add
(
message
);
adapter
.
refresh
(
datas
);
mRealListView
.
setSelection
(
adapter
.
getCount
()
-
1
);
}
else
{
LogUtil
.
i
(
"返回的聊天内容==="
+
entity
.
message
);
if
(
TextUtils
.
isEmpty
(
oldTime
))
{
time
=
oldTime
=
dataTime
;
}
else
if
(
dataTime
.
equals
(
oldTime
))
{
time
=
null
;
}
else
{
time
=
oldTime
=
dataTime
;
}
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
:
time
);
datas
.
add
(
message
);
adapter
.
refresh
(
datas
);
mRealListView
.
setSelection
(
adapter
.
getCount
()
-
1
);
...
...
home/src/main/java/com/xdy/home/ui/DocFragment.java
查看文件 @
e0ed129
...
...
@@ -143,8 +143,8 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
@Override
public
WrapDocBitMapEntity
call
(
String
s
)
{
WrapDocBitMapEntity
wrapDocBitMapEntity
=
new
WrapDocBitMapEntity
();
try
{
WrapDocBitMapEntity
wrapDocBitMapEntity
=
new
WrapDocBitMapEntity
();
if
(
s
==
null
)
{
wrapDocBitMapEntity
.
setNoDoc
(
true
);
wrapDocBitMapEntity
.
setBitmap
(
getNoDocBitmap
());
...
...
@@ -164,7 +164,8 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
}
catch
(
ExecutionException
e
)
{
e
.
printStackTrace
();
}
return
null
;
wrapDocBitMapEntity
.
setNoDoc
(
true
);
return
wrapDocBitMapEntity
;
}
})
.
subscribeOn
(
Schedulers
.
io
())
...
...
home/src/main/java/com/xdy/home/ui/LiveFragment.java
查看文件 @
e0ed129
...
...
@@ -49,6 +49,7 @@ import com.xdy.home.widget.dialog.LoginDialog;
import
com.xdy.hybird.BridgeWebView
;
import
com.xdy.ui.viewgroup.NoScrollViewPager
;
import
com.xdy.util.LogUtil
;
import
com.xdy.util.NetUtil
;
import
com.xdy.util.ResUtil
;
import
com.xdy.util.StringUtils
;
import
com.xdy.util.UIUtils
;
...
...
@@ -100,7 +101,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
private
ImageView
initPic
;
private
boolean
sdkIsOk
;
private
XDYJsInterface
xdyJsInterface
;
LoginDialog
d
ialog
;
LoginDialog
mLoginD
ialog
;
private
boolean
replay
;
private
PLVideoTextureView
mVideoView
;
private
long
classId
;
...
...
@@ -115,6 +116,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
private
RelativeLayout
mPauseContainer
;
private
TextView
mClassName
;
private
SurfaceView
mSurfaceView
=
null
;
private
AlertDialog
mErrorDialog
;
public
static
LiveFragment
newInstance
(
boolean
replay
,
@NonNull
long
classId
,
@NonNull
String
portal
,
String
role
,
String
userId
)
{
LiveFragment
liveFragment
=
new
LiveFragment
();
...
...
@@ -241,13 +243,9 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
private
boolean
createView
()
{
if
(
mSurfaceView
==
null
)
{
/*
* useOpenGLES2:
* If with true: Check if system supports openGLES, if supported, it will choose openGLES.
* If with false: it will set with default surfaceView;
*/
mSurfaceView
=
NTRenderer
.
CreateRenderer
(
mRootView
.
getContext
(),
true
);
mSurfaceView
=
NTRenderer
.
CreateRenderer
(
mRootView
.
getContext
(),
false
);
}
mSurfaceView
.
setZOrderMediaOverlay
(
true
);
if
(
mSurfaceView
==
null
)
{
Log
.
i
(
TAG
,
"Create render failed.."
);
...
...
@@ -261,6 +259,12 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
protected
void
initData
()
{
if
(
first
)
{
boolean
b
=
NetUtil
.
checkNetwork
(
getContext
());
if
(!
b
)
{
showErrorDialog
(
R
.
string
.
home_net_unconnected
);
return
;
}
showLoading
();
chatFragment
.
setPresenter
(
mPresenter
);
docFragment
.
setPresenter
(
mPresenter
);
...
...
@@ -388,7 +392,8 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
xdyJsInterface
.
onDestroy
();
xdyJsInterface
=
null
;
}
UIUtils
.
closeDialog
(
dialog
);
UIUtils
.
closeDialog
(
mLoginDialog
);
UIUtils
.
closeDialog
(
mErrorDialog
);
super
.
onDestroyView
();
}
...
...
@@ -397,28 +402,33 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
pop
();
}
boolean
firstReplay
=
true
;
@Override
public
void
renderLogin
(
boolean
show
,
final
boolean
passwordRequired
)
{
if
(
replay
)
{
if
(
replay
&&
firstReplay
)
{
firstReplay
=
false
;
//要重置进度条
if
(
mSeekBar
!=
null
)
mSeekBar
.
setMax
((
int
)
mPresenter
.
getRecordPlaybackMaxTime
());
boolean
pause
=
mPresenter
.
getRecordStatus
();
mPresenter
.
pauseAndStart
(!
pause
);
showMediaContainer
(
TIME_OUT
);
}
if
(
show
)
{
if
(
dialog
==
null
)
dialog
=
new
LoginDialog
(
getActivity
(),
passwordRequired
,
this
);
dialog
.
show
();
dialog
.
setCanceledOnTouchOutside
(
false
);
dialog
.
setBtnClick
(
new
View
.
OnClickListener
()
{
if
(
mLoginDialog
==
null
)
mLoginDialog
=
new
LoginDialog
(
getActivity
(),
passwordRequired
,
this
);
mLoginDialog
.
show
();
mLoginDialog
.
setCanceledOnTouchOutside
(
false
);
mLoginDialog
.
setBtnClick
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
String
[]
nameAndPwd
=
d
ialog
.
getNameAndPwd
();
String
[]
nameAndPwd
=
mLoginD
ialog
.
getNameAndPwd
();
mPresenter
.
joinClass
(
passwordRequired
,
nameAndPwd
[
0
],
nameAndPwd
[
1
],
false
,
false
);
}
});
}
else
if
(
dialog
!=
null
)
{
UIUtils
.
closeDialog
(
dialog
);
}
else
if
(
mLoginDialog
!=
null
)
{
UIUtils
.
closeDialog
(
mLoginDialog
);
}
}
...
...
@@ -466,8 +476,14 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
@Override
public
void
stopVideo
()
{
initPic
.
setImageResource
(
R
.
mipmap
.
no_video
);
initPic
.
setVisibility
(
View
.
VISIBLE
);
getBaseActivity
().
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
initPic
.
setImageResource
(
R
.
mipmap
.
no_video
);
initPic
.
setVisibility
(
View
.
VISIBLE
);
}
});
if
(!
replay
)
{
mPresenter
.
close
();
}
else
{
...
...
@@ -595,8 +611,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
@Override
public
boolean
onBackPressedSupport
()
{
if
(
sdkIsOk
)
{
if
(
sdkIsOk
&&
mPresenter
.
sdkIsConnected
())
{
final
AlertDialog
alertDialog
=
new
AlertDialog
.
Builder
(
getContext
())
.
setTitle
(
R
.
string
.
home_quit
)
.
setMessage
(
R
.
string
.
home_leave_class
)
...
...
@@ -733,6 +748,56 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
return
mSurfaceView
;
}
@Override
public
void
showErrorDialog
(
int
reason
)
{
if
(
mErrorDialog
!=
null
)
return
;
mErrorDialog
=
new
AlertDialog
.
Builder
(
getContext
())
.
setTitle
(
R
.
string
.
home_quit
)
.
setMessage
(
reason
)
.
setPositiveButton
(
R
.
string
.
home_confirm
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
dialogInterface
.
dismiss
();
quit
();
}
})
.
create
();
mErrorDialog
.
show
();
mErrorDialog
.
setCanceledOnTouchOutside
(
false
);
}
@Override
public
void
showErrorDialog
(
String
reason
)
{
if
(
mErrorDialog
!=
null
)
return
;
mErrorDialog
=
new
AlertDialog
.
Builder
(
getContext
())
.
setTitle
(
R
.
string
.
home_quit
)
.
setMessage
(
reason
)
.
setPositiveButton
(
R
.
string
.
home_confirm
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
dialogInterface
.
dismiss
();
quit
();
}
})
.
create
();
mErrorDialog
.
show
();
mErrorDialog
.
setCanceledOnTouchOutside
(
false
);
}
@Override
public
void
resetSeekBar
()
{
if
(
mSeekBar
!=
null
)
{
setProgress
();
}
}
private
SeekBar
.
OnSeekBarChangeListener
mSeekListener
=
new
SeekBar
.
OnSeekBarChangeListener
()
{
public
void
onStartTrackingTouch
(
SeekBar
bar
)
{
...
...
home/src/main/java/com/xdy/home/util/Constants.java
查看文件 @
e0ed129
...
...
@@ -19,20 +19,26 @@ public interface Constants {
*/
String
CLASS_INIT_SUCCESS
=
"class_init_success"
;
/**
* 接收聊天
*/
String
CHAT_RECEIVE_MESSAGE
=
"chat_receive_message"
;
/**
* 课堂加入成功
*/
String
CLASS_JOIN_SUCCESS
=
"class_join_success"
;
// 接收聊天
String
CHAT_RECEIVE_MESSAGE
=
"chat_receive_message"
;
/**
* 课堂时间更新
*/
String
CLASS_UPDATE_TIMER
=
"class_update_timer"
;
/**
* 课堂状态更新
* 课堂状态更新
2是暂停1是开始
*/
String
CLASS_UPDATE_STATUS
=
"class_update_status"
;
/**
* 结束课堂
*/
String
CLASS_EXIT
=
"class_exit"
;
/**
* 视频停止
*/
String
VIDEO_STOP
=
"video_stop"
;
...
...
@@ -82,7 +88,7 @@ public interface Constants {
/**
* 录制未开始
*/
int
RECORD_PLAYING
=
1
;
int
RECORD_PLAYING
=
1
;
/**
* 录制暂停
*/
...
...
@@ -97,11 +103,10 @@ public interface Constants {
int
RECORD_STOP
=
4
;
/**
* 错误标记
*/
String
LEAVE_CLASS_CODE
=
"20000"
;
int
LEAVE_CLASS_CODE
=
20000
;
/**
* 获取录制回放数据失败
*/
...
...
home/src/main/java/com/xdy/home/vp/LiveContract.java
查看文件 @
e0ed129
...
...
@@ -117,6 +117,22 @@ public interface LiveContract {
* @return
*/
SurfaceView
getSurfaceView
();
/**
* 展示错误界面
* @param reson
*/
void
showErrorDialog
(
int
reson
);
/**
* 展示错误界面
* @param reson
*/
void
showErrorDialog
(
String
reson
);
/**
* 重置SEEKBAR
*/
void
resetSeekBar
();
}
interface
ChatView
extends
BaseView
{
...
...
home/src/main/java/com/xdy/home/vp/LivePresenter.java
查看文件 @
e0ed129
...
...
@@ -93,6 +93,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
* 是否结束了
*/
private
boolean
isOver
;
/**
* SDK是否处于连接状态
*/
private
boolean
connceted
;
@Inject
public
LivePresenter
(
LiveContract
.
Model
model
,
...
...
@@ -206,6 +210,9 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
String
pa
=
responseEntity
.
getParam
();
switch
(
msg
)
{
case
Constants
.
CLASS_EXIT
:
mRootView
.
showErrorDialog
(
R
.
string
.
home_class_is_over
);
break
;
case
Constants
.
CLASS_UPDATE_TIMER
:
handleTime
(
pa
);
break
;
...
...
@@ -233,6 +240,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
case
Constants
.
CLASS_INIT_SUCCESS
:
//课堂初始化成功
InitResponseEntity
initRes
=
GsonUtil
.
json2Bean
(
pa
,
InitResponseEntity
.
class
);
if
(
initRes
!=
null
)
{
connceted
=
true
;
mRootView
.
renderLogin
(
true
,
initRes
.
isPasswordRequired
());
}
else
{
mRootView
.
quit
();
...
...
@@ -241,6 +249,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
case
Constants
.
CLASS_JOIN_SUCCESS
:
UserEntity
user
=
GsonUtil
.
json2Bean
(
pa
,
UserEntity
.
class
);
if
(
user
!=
null
)
{
connceted
=
true
;
AccountUtils
.
saveUser
(
user
);
recordPlaybackMaxTime
=
user
.
getRecordPlaybackMaxTime
();
String
className
=
user
.
getClassName
();
...
...
@@ -326,6 +335,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
mModel
.
initRecordPlayback
(
classId
,
portal
,
userRole
,
userId
);
//停止视频
mRootView
.
stopVideo
();
currentTime
=
0
;
mRootView
.
resetSeekBar
();
docView
.
clear
();
chatView
.
clearChatHistory
();
}
break
;
case
Constants
.
RECORD_PAUSE
:
...
...
@@ -433,12 +446,22 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
private
void
handleError
(
String
param
)
{
ErrorEvent
errorEvent
=
GsonUtil
.
json2Bean
(
param
,
ErrorEvent
.
class
);
if
(
errorEvent
!=
null
)
{
String
reson
=
errorEvent
.
getReson
();
if
(!
TextUtils
.
isEmpty
(
reson
))
{
mRootView
.
showMessage
(
reson
);
String
reason
=
errorEvent
.
getReson
();
if
(!
TextUtils
.
isEmpty
(
reason
)
&&
!(
Constants
.
LEAVE_CLASS_CODE
==
errorEvent
.
getCode
()))
{
connceted
=
false
;
mRootView
.
showMessage
(
reason
);
mRootView
.
quit
();
}
else
{
if
(!
quit
)
{
connceted
=
false
;
//MCU因非人为断开了链接(网络原因),提示框提示。如果是结束课堂,class_exit会提前收到,所以会先提示那个框
mRootView
.
showErrorDialog
(
R
.
string
.
home_net_unconnected
);
}
else
{
//手动退出课堂
mRootView
.
quit
();
}
}
mRootView
.
quit
();
}
}
...
...
@@ -774,13 +797,9 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
private
boolean
pause
=
true
;
public
void
pauseAndStart
(
boolean
b
)
{
if
(
b
)
if
(
b
)
{
mModel
.
pauseRecordPlayback
();
else
{
if
(
isOver
)
{
docView
.
clear
();
chatView
.
clearChatHistory
();
}
}
else
{
mModel
.
startRecordPlayback
();
}
}
...
...
@@ -811,6 +830,11 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
this
.
currentTime
=
currentTime
;
}
public
boolean
sdkIsConnected
()
{
return
connceted
;
}
class
EventHande
implements
SmartEventCallback
{
@Override
...
...
@@ -818,8 +842,6 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
switch
(
code
)
{
case
EVENTID
.
EVENT_DANIULIVE_ERC_PLAYER_STARTED
:
Log
.
i
(
TAG
,
"开始。。"
);
if
(
videoMode
)
mRootView
.
hideInitPic
();
break
;
case
EVENTID
.
EVENT_DANIULIVE_ERC_PLAYER_CONNECTING
:
Log
.
i
(
TAG
,
"连接中。。"
);
...
...
@@ -838,6 +860,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
break
;
case
EVENTID
.
EVENT_DANIULIVE_ERC_PLAYER_RESOLUTION_INFO
:
Log
.
i
(
TAG
,
"分辨率信息: width: "
+
param1
+
", height: "
+
param2
);
if
(
videoMode
)
mRootView
.
hideInitPic
();
break
;
case
EVENTID
.
EVENT_DANIULIVE_ERC_PLAYER_NO_MEDIADATA_RECEIVED
:
Log
.
i
(
TAG
,
"收不到媒体数据,可能是url错误。。"
);
...
...
home/src/main/res/layout/home_chat_item_list_left.xml
查看文件 @
e0ed129
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:my=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
...
...
@@ -29,26 +30,29 @@
android:id=
"@+id/chat_item_avatar"
style=
"@style/home_chat_item_avatar"
android:layout_alignParentLeft=
"true"
/>
<LinearLayout
android:layout_marginLeft=
"@dimen/ui_DIMEN_20.0PX"
android:id=
"@+id/ll_item_name_parent"
android:orientation=
"horizontal"
android:layout_toRightOf=
"@id/chat_item_avatar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/ui_DIMEN_20.0PX"
android:layout_toRightOf=
"@id/chat_item_avatar"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/chat_item_taacher_bg"
android:textColor=
"@color/white"
android:text=
"老师"
android:visibility=
"gone"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/ui_DIMEN_8.0PX"
android:background=
"@drawable/home_chat_teacher_bg"
android:gravity=
"center"
android:paddingLeft=
"@dimen/ui_DIMEN_10.0PX"
android:paddingRight=
"@dimen/ui_DIMEN_10.0PX"
android:gravity=
"center"
android:layout_marginRight=
"@dimen/ui_DIMEN_8.0PX"
android:text=
"老师"
android:textColor=
"@color/white"
android:textSize=
"@dimen/ui_DIMEN_20.0PX"
android:background=
"@drawable/home_chat_teacher_bg"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:visibility=
"gone"
/>
<TextView
android:id=
"@+id/chat_item_name"
android:layout_width=
"wrap_content"
...
...
@@ -59,7 +63,6 @@
</LinearLayout>
<RelativeLayout
android:id=
"@+id/chat_item_layout_content"
style=
"@style/home_chat_item_content"
...
...
@@ -72,12 +75,12 @@
android:id=
"@+id/chat_item_content_text"
style=
"@style/home_chat_item_text_content"
android:layout_centerInParent=
"true"
android:background=
"@drawable/chat_pop_receive"
android:gravity=
"start|center_vertical"
android:paddingLeft=
"@dimen/ui_DIMEN_30.0PX"
android:paddingRight=
"@dimen/ui_DIMEN_10.0PX"
android:background=
"@drawable/chat_pop_receive"
my:emojiconSize=
"@dimen/ui_DIMEN_40.0PX"
/>
my:emojiconSize=
"@dimen/ui_DIMEN_40.0PX"
tools:text=
"fasdfasdfasdfasdfasdfasdfasdfasddfasdfasdfasdfasdffasdfasdfsadfsadfasddfasdfasfdasdfasdfsafasdfadf"
/>
<ImageView
android:id=
"@+id/chat_item_content_image"
...
...
home/src/main/res/layout/home_chat_item_list_right.xml
查看文件 @
e0ed129
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:my=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
...
...
@@ -71,11 +72,12 @@
style=
"@style/home_chat_item_text_content"
android:layout_centerVertical=
"true"
android:background=
"@drawable/chat_pop_send"
android:gravity=
"
end
|center_vertical"
android:gravity=
"
start
|center_vertical"
android:textColor=
"@color/white"
android:includeFontPadding=
"false"
android:paddingLeft=
"@dimen/ui_DIMEN_10.0PX"
android:paddingRight=
"@dimen/ui_DIMEN_30.0PX"
tools:text=
"fasdfasdfasdfasdfasdfasdfasdfasddfasdfasdfasdfsadfsadfasddfasdfasfdasdfasdfsafasdfadf"
my:emojiconSize=
"@dimen/ui_DIMEN_40.0PX"
/>
<ImageView
...
...
home/src/main/res/layout/home_fragment_site.xml
查看文件 @
e0ed129
...
...
@@ -13,13 +13,13 @@
style=
"@style/home_site_input_style"
android:layout_marginTop=
"@dimen/ui_DIMEN_20.0PX"
>
<!-- 709902904 472732494 2067973545-->
<!-- 709902904 472732494 2067973545
1895498438
-->
<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=
"
2067973545
"
/>
android:text=
"
472732494
"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
...
...
home/src/main/res/values/strings.xml
查看文件 @
e0ed129
...
...
@@ -17,11 +17,13 @@
<string
name=
"home_password_cannot_be_null"
>
密码不能为空
</string>
<string
name=
"home_confirm"
>
确认
</string>
<string
name=
"home_quit"
>
退出
</string>
<string
name=
"home_leave_class"
>
是否离开课堂
</string>
<string
name=
"home_leave_class"
>
您确定要退出课堂吗?
</string>
<string
name=
"home_net_unconnected"
>
您的设备网络断开状态,请重新进入
</string>
<string
name=
"home_cancel"
>
取消
</string>
<string
name=
"home_no_stream"
>
暂无推流可用
</string>
<string
name=
"home_parse_error"
>
解析出错
</string>
<string
name=
"home_cannot_push_no_camere"
>
无法获取摄像头权限,不能推流
</string>
<string
name=
"home_no_audio_permission"
>
无法传输音频,请检查你的麦克风权限
</string>
<string
name=
"home_no_resouce_to_open"
>
暂无可用音视频
</string>
<string
name=
"home_class_is_over"
>
课堂已结束
</string>
</resources>
...
...
请
注册
或
登录
后发表评论