Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
R
RoomDemo
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ubains-android-demo
RoomDemo
Commits
352a6c39
提交
352a6c39
authored
6月 24, 2019
作者:
汪显鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
瞩目SDK 第二次提交
上级
47b14e56
流水线
#229
已失败 于阶段
变更
1
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
242 行增加
和
242 行删除
+242
-242
MainActivity.java
...2/src/main/java/com/android/sdkexample2/MainActivity.java
+242
-242
没有找到文件。
example2/src/main/java/com/android/sdkexample2/MainActivity.java
浏览文件 @
352a6c39
...
...
@@ -29,250 +29,250 @@ import us.zoom.sdk.MeetingStatus;
public
class
MainActivity
extends
Activity
implements
Constants
,
ZHUMUMeetingServiceListener
,
ZHUMUSdkInitializeListener
{
private
final
static
String
TAG
=
MainActivity
.
class
.
getName
();
Logs
log
=
new
Logs
(
TAG
);
public
final
static
String
ACTION_RETURN_FROM_MEETING
=
"com.android.sdkexample2.action.ReturnFromMeeting"
;
public
final
static
String
EXTRA_TAB_ID
=
"tabId"
;
public
final
static
int
TAB_WELCOME
=
1
;
public
final
static
int
TAB_MEETING
=
2
;
public
final
static
int
TAB_PAGE_2
=
3
;
private
final
static
int
STYPE
=
ZHUMUMeetingService
.
USER_TYPE_API_USER
;
private
final
static
String
DISPLAY_NAME
=
"ZHUMU SDK"
;
private
View
viewTabWelcome
;
private
View
viewTabMeeting
;
private
View
viewTabPage2
;
private
Button
btnTabWelcome
;
private
Button
btnTabMeeting
;
private
Button
btnTabPage2
;
public
static
String
user_id
=
""
;
public
static
String
token
=
""
;
public
static
String
user_name
=
""
;
public
static
String
meet_num
=
""
;
Meeting
mMeeting
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
main
);
setupTabs
();
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
private
final
static
String
TAG
=
MainActivity
.
class
.
getName
();
Logs
log
=
new
Logs
(
TAG
);
public
final
static
String
ACTION_RETURN_FROM_MEETING
=
"com.android.sdkexample2.action.ReturnFromMeeting"
;
public
final
static
String
EXTRA_TAB_ID
=
"tabId"
;
public
final
static
int
TAB_WELCOME
=
1
;
public
final
static
int
TAB_MEETING
=
2
;
public
final
static
int
TAB_PAGE_2
=
3
;
private
final
static
int
STYPE
=
ZHUMUMeetingService
.
USER_TYPE_API_USER
;
private
final
static
String
DISPLAY_NAME
=
"ZHUMU SDK"
;
private
View
viewTabWelcome
;
private
View
viewTabMeeting
;
private
View
viewTabPage2
;
private
Button
btnTabWelcome
;
private
Button
btnTabMeeting
;
private
Button
btnTabPage2
;
public
static
String
user_id
=
""
;
public
static
String
token
=
""
;
public
static
String
user_name
=
""
;
public
static
String
meet_num
=
""
;
Meeting
mMeeting
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
main
);
setupTabs
();
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
// if(savedInstanceState == null) {
sdk
.
initSDK
(
this
,
APP_KEY
,
APP_SECRET
,
WEB_DOMAIN
,
this
);
sdk
.
initSDK
(
this
,
APP_KEY
,
APP_SECRET
,
WEB_DOMAIN
,
this
);
// }
if
(
sdk
.
isInitialized
())
{
registerMeetingServiceListener
();
}
}
private
void
setupTabs
()
{
viewTabWelcome
=
findViewById
(
R
.
id
.
viewTabWelcome
);
viewTabMeeting
=
findViewById
(
R
.
id
.
viewTabMeeting
);
viewTabPage2
=
findViewById
(
R
.
id
.
viewTabPage2
);
btnTabWelcome
=
(
Button
)
findViewById
(
R
.
id
.
btnTabWelcome
);
btnTabMeeting
=
(
Button
)
findViewById
(
R
.
id
.
btnTabMeeting
);
btnTabPage2
=
(
Button
)
findViewById
(
R
.
id
.
btnTabPage2
);
selectTab
(
TAB_WELCOME
);
btnTabMeeting
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
selectTab
(
TAB_MEETING
);
}
});
btnTabWelcome
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
selectTab
(
TAB_WELCOME
);
}
});
btnTabPage2
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
selectTab
(
TAB_PAGE_2
);
}
});
}
private
void
selectTab
(
int
tabId
)
{
if
(
tabId
==
TAB_WELCOME
)
{
viewTabWelcome
.
setVisibility
(
View
.
VISIBLE
);
viewTabMeeting
.
setVisibility
(
View
.
GONE
);
viewTabPage2
.
setVisibility
(
View
.
GONE
);
btnTabWelcome
.
setSelected
(
true
);
btnTabMeeting
.
setSelected
(
false
);
btnTabPage2
.
setSelected
(
false
);
}
else
if
(
tabId
==
TAB_PAGE_2
)
{
viewTabWelcome
.
setVisibility
(
View
.
GONE
);
viewTabMeeting
.
setVisibility
(
View
.
GONE
);
viewTabPage2
.
setVisibility
(
View
.
VISIBLE
);
btnTabWelcome
.
setSelected
(
false
);
btnTabMeeting
.
setSelected
(
false
);
btnTabPage2
.
setSelected
(
true
);
}
else
if
(
tabId
==
TAB_MEETING
)
{
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
if
(!
sdk
.
isInitialized
())
{
Toast
.
makeText
(
this
,
"ZHUMUSDK has not been initialized successfully"
,
Toast
.
LENGTH_LONG
).
show
();
return
;
}
ZHUMUMeetingService
meetingService
=
sdk
.
getMeetingService
();
if
(
meetingService
==
null
)
return
;
if
(
meetingService
.
getMeetingStatus
()
.
equals
(
ZHUMUMeetingStatus
.
MEETING_STATUS_IDLE
)
)
{
viewTabWelcome
.
setVisibility
(
View
.
GONE
);
viewTabPage2
.
setVisibility
(
View
.
GONE
);
viewTabMeeting
.
setVisibility
(
View
.
VISIBLE
);
btnTabWelcome
.
setSelected
(
false
);
btnTabPage2
.
setSelected
(
false
);
btnTabMeeting
.
setSelected
(
true
);
startMeeting
();
}
else
{
meetingService
.
returnToMeeting
(
this
);
}
overridePendingTransition
(
0
,
0
);
}
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
// disable animation
overridePendingTransition
(
0
,
0
);
String
action
=
intent
.
getAction
();
if
(
ACTION_RETURN_FROM_MEETING
.
equals
(
action
))
{
int
tabId
=
intent
.
getIntExtra
(
EXTRA_TAB_ID
,
TAB_WELCOME
);
selectTab
(
tabId
);
}
}
@Override
public
void
onZHUMUSdkInitializeResult
(
int
errorCode
,
int
internalErrorCode
)
{
Log
.
i
(
TAG
,
"onZHUMUSdkInitializeResult, errorCode="
+
errorCode
+
", internalErrorCode="
+
internalErrorCode
);
if
(
errorCode
!=
ZHUMUError
.
ERROR_SUCCESS
)
{
Toast
.
makeText
(
this
,
"Failed to initialize ZHUMUSDK. Error: "
+
errorCode
+
", internalErrorCode="
+
internalErrorCode
,
Toast
.
LENGTH_LONG
);
}
else
{
Toast
.
makeText
(
this
,
"Initialize ZHUMUSDK successfully."
,
Toast
.
LENGTH_LONG
).
show
();
registerMeetingServiceListener
();
}
}
private
void
registerMeetingServiceListener
()
{
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
ZHUMUMeetingService
meetingService
=
sdk
.
getMeetingService
();
if
(
meetingService
!=
null
)
{
meetingService
.
addListener
(
this
);
}
}
@Override
protected
void
onDestroy
()
{
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
if
(
sdk
.
isInitialized
())
{
ZHUMUMeetingService
meetingService
=
sdk
.
getMeetingService
();
meetingService
.
removeListener
(
this
);
}
super
.
onDestroy
();
}
public
void
startMeeting
()
{
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
if
(!
sdk
.
isInitialized
())
{
Toast
.
makeText
(
this
,
"ZHUMUSDK has not been initialized successfully"
,
Toast
.
LENGTH_LONG
).
show
();
return
;
}
if
(
meet_num
==
null
)
{
Toast
.
makeText
(
this
,
"MEETING_ID in Constants can not be NULL"
,
Toast
.
LENGTH_LONG
).
show
();
return
;
}
ZHUMUMeetingService
meetingService
=
sdk
.
getMeetingService
();
ZHUMUStartMeetingOptions
opts
=
new
ZHUMUStartMeetingOptions
();
if
(
sdk
.
isInitialized
())
{
registerMeetingServiceListener
();
}
}
private
void
setupTabs
()
{
viewTabWelcome
=
findViewById
(
R
.
id
.
viewTabWelcome
);
viewTabMeeting
=
findViewById
(
R
.
id
.
viewTabMeeting
);
viewTabPage2
=
findViewById
(
R
.
id
.
viewTabPage2
);
btnTabWelcome
=
(
Button
)
findViewById
(
R
.
id
.
btnTabWelcome
);
btnTabMeeting
=
(
Button
)
findViewById
(
R
.
id
.
btnTabMeeting
);
btnTabPage2
=
(
Button
)
findViewById
(
R
.
id
.
btnTabPage2
);
selectTab
(
TAB_WELCOME
);
btnTabMeeting
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
selectTab
(
TAB_MEETING
);
}
});
btnTabWelcome
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
selectTab
(
TAB_WELCOME
);
}
});
btnTabPage2
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
selectTab
(
TAB_PAGE_2
);
}
});
}
private
void
selectTab
(
int
tabId
)
{
if
(
tabId
==
TAB_WELCOME
)
{
viewTabWelcome
.
setVisibility
(
View
.
VISIBLE
);
viewTabMeeting
.
setVisibility
(
View
.
GONE
);
viewTabPage2
.
setVisibility
(
View
.
GONE
);
btnTabWelcome
.
setSelected
(
true
);
btnTabMeeting
.
setSelected
(
false
);
btnTabPage2
.
setSelected
(
false
);
}
else
if
(
tabId
==
TAB_PAGE_2
)
{
viewTabWelcome
.
setVisibility
(
View
.
GONE
);
viewTabMeeting
.
setVisibility
(
View
.
GONE
);
viewTabPage2
.
setVisibility
(
View
.
VISIBLE
);
btnTabWelcome
.
setSelected
(
false
);
btnTabMeeting
.
setSelected
(
false
);
btnTabPage2
.
setSelected
(
true
);
}
else
if
(
tabId
==
TAB_MEETING
)
{
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
if
(!
sdk
.
isInitialized
())
{
Toast
.
makeText
(
this
,
"ZHUMUSDK has not been initialized successfully"
,
Toast
.
LENGTH_LONG
).
show
();
return
;
}
ZHUMUMeetingService
meetingService
=
sdk
.
getMeetingService
();
if
(
meetingService
==
null
)
return
;
if
(
meetingService
.
getMeetingStatus
().
equals
(
ZHUMUMeetingStatus
.
MEETING_STATUS_IDLE
))
{
viewTabWelcome
.
setVisibility
(
View
.
GONE
);
viewTabPage2
.
setVisibility
(
View
.
GONE
);
viewTabMeeting
.
setVisibility
(
View
.
VISIBLE
);
btnTabWelcome
.
setSelected
(
false
);
btnTabPage2
.
setSelected
(
false
);
btnTabMeeting
.
setSelected
(
true
);
startMeeting
();
}
else
{
meetingService
.
returnToMeeting
(
this
);
}
overridePendingTransition
(
0
,
0
);
}
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
// disable animation
overridePendingTransition
(
0
,
0
);
String
action
=
intent
.
getAction
();
if
(
ACTION_RETURN_FROM_MEETING
.
equals
(
action
))
{
int
tabId
=
intent
.
getIntExtra
(
EXTRA_TAB_ID
,
TAB_WELCOME
);
selectTab
(
tabId
);
}
}
@Override
public
void
onZHUMUSdkInitializeResult
(
int
errorCode
,
int
internalErrorCode
)
{
Log
.
i
(
TAG
,
"onZHUMUSdkInitializeResult, errorCode="
+
errorCode
+
", internalErrorCode="
+
internalErrorCode
);
if
(
errorCode
!=
ZHUMUError
.
ERROR_SUCCESS
)
{
Toast
.
makeText
(
this
,
"Failed to initialize ZHUMUSDK. Error: "
+
errorCode
+
", internalErrorCode="
+
internalErrorCode
,
Toast
.
LENGTH_LONG
);
}
else
{
Toast
.
makeText
(
this
,
"Initialize ZHUMUSDK successfully."
,
Toast
.
LENGTH_LONG
).
show
();
registerMeetingServiceListener
();
}
}
private
void
registerMeetingServiceListener
()
{
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
ZHUMUMeetingService
meetingService
=
sdk
.
getMeetingService
();
if
(
meetingService
!=
null
)
{
meetingService
.
addListener
(
this
);
}
}
@Override
protected
void
onDestroy
()
{
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
if
(
sdk
.
isInitialized
())
{
ZHUMUMeetingService
meetingService
=
sdk
.
getMeetingService
();
meetingService
.
removeListener
(
this
);
}
super
.
onDestroy
();
}
public
void
startMeeting
()
{
ZHUMUSdk
sdk
=
ZHUMUSdk
.
getInstance
();
if
(!
sdk
.
isInitialized
())
{
Toast
.
makeText
(
this
,
"ZHUMUSDK has not been initialized successfully"
,
Toast
.
LENGTH_LONG
).
show
();
return
;
}
if
(
meet_num
==
null
)
{
Toast
.
makeText
(
this
,
"MEETING_ID in Constants can not be NULL"
,
Toast
.
LENGTH_LONG
).
show
();
return
;
}
ZHUMUMeetingService
meetingService
=
sdk
.
getMeetingService
();
ZHUMUStartMeetingOptions
opts
=
new
ZHUMUStartMeetingOptions
();
// opts.no_meeting_end_message = true;
// opts.no_titlebar = true;
opts
.
no_bottom_toolbar
=
true
;
opts
.
no_invite
=
true
;
int
ret
=
meetingService
.
startMeeting
(
this
,
user_id
,
token
,
STYPE
,
meet_num
,
DISPLAY_NAME
,
opts
);
Log
.
i
(
TAG
,
"onClickBtnStartMeeting, ret="
+
ret
);
}
private
Meeting
getMeeting
(
String
strResult
)
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
strResult
.
toString
());
int
code
=
jsonObject
.
getInt
(
"code"
);
int
zcode
=
jsonObject
.
getInt
(
"zcode"
);
String
id
=
jsonObject
.
getString
(
"id"
);
// User_id
String
username
=
jsonObject
.
getString
(
"username"
);
String
mobile
=
jsonObject
.
getString
(
"mobile"
);
int
usertype
=
jsonObject
.
getInt
(
"usertype"
);
String
det
=
jsonObject
.
getString
(
"det"
);
String
createtime
=
jsonObject
.
getString
(
"createtime"
);
String
createby
=
jsonObject
.
getString
(
"createby"
);
String
pmi
=
jsonObject
.
getString
(
"pmi"
);
int
role
=
jsonObject
.
getInt
(
"role"
);
String
email
=
jsonObject
.
getString
(
"email"
);
int
isowner
=
jsonObject
.
getInt
(
"isowner"
);
int
accounttype
=
jsonObject
.
getInt
(
"accounttype"
);
String
token
=
jsonObject
.
getString
(
"token"
);
Meeting
meet
=
new
Meeting
();
meet
.
setCode
(
code
);
meet
.
setZcode
(
zcode
);
meet
.
setId
(
id
);
meet
.
setUsername
(
username
);
meet
.
setMobile
(
mobile
);
meet
.
setUsertype
(
usertype
);
meet
.
setDet
(
det
);
meet
.
setCreatetime
(
createtime
);
meet
.
setCreateby
(
createby
);
meet
.
setPmi
(
pmi
);
meet
.
setRole
(
role
);
meet
.
setEmail
(
email
);
meet
.
setIsowner
(
isowner
);
meet
.
setAccounttype
(
accounttype
);
meet
.
setToken
(
token
);
return
meet
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@Override
public
void
onMeetingStatusChanged
(
MeetingStatus
meetingStatus
,
int
i
,
int
i1
)
{
}
opts
.
no_bottom_toolbar
=
true
;
opts
.
no_invite
=
true
;
int
ret
=
meetingService
.
startMeeting
(
this
,
user_id
,
token
,
STYPE
,
meet_num
,
DISPLAY_NAME
,
opts
);
Log
.
i
(
TAG
,
"onClickBtnStartMeeting, ret="
+
ret
);
}
private
Meeting
getMeeting
(
String
strResult
)
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
strResult
.
toString
());
int
code
=
jsonObject
.
getInt
(
"code"
);
int
zcode
=
jsonObject
.
getInt
(
"zcode"
);
String
id
=
jsonObject
.
getString
(
"id"
);
// User_id
String
username
=
jsonObject
.
getString
(
"username"
);
String
mobile
=
jsonObject
.
getString
(
"mobile"
);
int
usertype
=
jsonObject
.
getInt
(
"usertype"
);
String
det
=
jsonObject
.
getString
(
"det"
);
String
createtime
=
jsonObject
.
getString
(
"createtime"
);
String
createby
=
jsonObject
.
getString
(
"createby"
);
String
pmi
=
jsonObject
.
getString
(
"pmi"
);
int
role
=
jsonObject
.
getInt
(
"role"
);
String
email
=
jsonObject
.
getString
(
"email"
);
int
isowner
=
jsonObject
.
getInt
(
"isowner"
);
int
accounttype
=
jsonObject
.
getInt
(
"accounttype"
);
String
token
=
jsonObject
.
getString
(
"token"
);
Meeting
meet
=
new
Meeting
();
meet
.
setCode
(
code
);
meet
.
setZcode
(
zcode
);
meet
.
setId
(
id
);
meet
.
setUsername
(
username
);
meet
.
setMobile
(
mobile
);
meet
.
setUsertype
(
usertype
);
meet
.
setDet
(
det
);
meet
.
setCreatetime
(
createtime
);
meet
.
setCreateby
(
createby
);
meet
.
setPmi
(
pmi
);
meet
.
setRole
(
role
);
meet
.
setEmail
(
email
);
meet
.
setIsowner
(
isowner
);
meet
.
setAccounttype
(
accounttype
);
meet
.
setToken
(
token
);
return
meet
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@Override
public
void
onMeetingStatusChanged
(
MeetingStatus
meetingStatus
,
int
i
,
int
i1
)
{
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论