




下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第Android基于agora开发视频会议的代码参照官方demo,基于agora开发,输入会议号(频道)和显示名称参会,可设置参会选项。
支持用户注册和登录。
支持多人参会。
packageio.agora.openvcall.ui;
importandroid.content.Intent;
importandroid.os.Bundle;
importandroid.support.v7.app.ActionBar;
importandroid.text.Editable;
importandroid.text.TextUtils;
importandroid.text.TextWatcher;
importandroid.view.Menu;
importandroid.view.MenuInflater;
importandroid.view.MenuItem;
importandroid.view.View;
importandroid.widget.AdapterView;
importandroid.widget.ArrayAdapter;
importandroid.widget.EditText;
importandroid.widget.Spinner;
importandroid.widget.Switch;
importorg.slf4j.Logger;
importorg.slf4j.LoggerFactory;
importio.agora.openvcall.R;
importio.agora.openvcall.model.ConstantApp;
importmon;
publicclassMainActivityextendsBaseActivity{
privatefinalstaticLoggerlog=LoggerFactory.getLogger(MainActivity.class);
privateStringusername;
privateStringpassword;
privateStringname;
privateintuser_id;
privateStringshow_name;
privatebooleanvideomute;
privatebooleanaudiomute;
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBarab=getSupportActionBar();
if(ab!=null){
ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ab.setCustomView(R.layout.ard_agora_actionbar);
initP();
privatevoidinitP(){
Stringshow_name=common.getName();
if(!TextUtils.isEmpty(show_name)){
=show_name;
this.show_name=show_name;
common.setName(show_name);
EditTextet=findViewById(R.id.user_name);
et.setText(show_name);
String_username=common.getUsername();
if(!TextUtils.isEmpty(_username)){
username=_username;
String_password=common.getPassword();
if(!TextUtils.isEmpty(_password)){
password=_password;
user_id=common.getUser_id();
publicvoidonBackPressed(Viewview){
onBackPressed();
@Override
protectedvoidinitUIandEvent(){
EditTextv_channel=(EditText)findViewById(R.id.channel_name);
v_channel.addTextChangedListener(newTextWatcher(){
@Override
publicvoidbeforeTextChanged(CharSequences,intstart,intcount,intafter){
@Override
publicvoidonTextChanged(CharSequences,intstart,intbefore,intcount){
@Override
publicvoidafterTextChanged(Editables){
StringlastChannelName=vSettings().mChannelName;
if(!TextUtils.isEmpty(lastChannelName)){
v_channel.setText(lastChannelName);
v_channel.setSelection(lastChannelName.length());
@Override
protectedvoiddeInitUIandEvent(){
@Override
publicbooleanonCreateOptionsMenu(finalMenumenu){
MenuInflaterinflater=getMenuInflater();
inflater.inflate(R.menu.menu_main,menu);
returntrue;
@Override
publicbooleanonOptionsItemSelected(MenuItemitem){
//Handlepressesontheactionbaritems
switch(item.getItemId()){
caseR.id.action_settings:
forwardToSettings();
returntrue;
default:
returnsuper.onOptionsItemSelected(item);
publicvoidonClickJoin(Viewview){
forwardToRoom();
publicvoidforwardToRoom(){
EditTextv_channel=(EditText)findViewById(R.id.channel_name);
Stringchannel=v_channel.getText().toString();
if(TextUtils.isEmpty(channel)){
showLongToast(请输入会议号!
return;
vSettings().mChannelName=channel;
Intenti=newIntent(MainActivity.this,CallActivity.class);
i.putExtra(ConstantApp.ACTION_KEY_CHANNEL_NAME,channel);
//i.putExtra(ConstantApp.ACTION_KEY_ENCRYPTION_KEY,encryption);
i.putExtra(ConstantApp.ACTION_KEY_ENCRYPTION_MODE,getResources().getStringArray(R.array.encryption_mode_values)[vSettings().mEncryptionModeIndex]);
i.putExtra(username,username);
i.putExtra(password,password);
i.putExtra(name,name);
i.putExtra(user_id,user_id);
i.putExtra(videomute,videomute);
i.putExtra(audiomute,audiomute);
EditTextshow_name_E=(EditText)findViewById(R.id.user_name);
String_show_name=show_name_E.getText().toStr
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 品质基础方面知识
- 2025年沈从文散文试题及答案
- 2025年肋骨骨折多选试题及答案
- 2025年溺水的试题及答案
- 2025年非法集资知识竞赛题库
- 2025年nba球迷测试题及答案
- 机动车检测维修士职业资格考试真题及答案
- 2025年全国汽车修理工(中级)职业技能考试题库(含答案)
- 2025年战伤与创伤试题及答案
- 2025年春晓考试题及答案
- 2025中山辅警考试题库
- 配网培训课件
- T-CESA 1281-2023 制造业企业质量管理能力评估规范
- 深入浅出:2025年HTRI培训教程解读
- Q-CSG1204079-2020-10kV~110kV线路保护技术规范(试行)
- 自动化电气元器件介绍与使用
- 节假日金融服务应急预案
- UL1059标准中文版-2020接线端子UL标准中文版
- HRSSC组织架构搭建方案
- 人教版2024-2025学年七年级数学上册教学计划(及进度表)
- 湖北省新高考联考协作体2024-2025学年高一上学期9月月考数学试题
评论
0/150
提交评论