正在显示
100 个修改的文件
包含
498 行增加
和
542 行删除
MyApplication/XdyDemo/.gitignore
已删除
100644 → 0
| 1 | -/build |
MyApplication/XdyDemo/build.gradle
已删除
100644 → 0
| 1 | -apply plugin: 'com.android.application' | ||
| 2 | - | ||
| 3 | -android { | ||
| 4 | - compileSdkVersion 25 | ||
| 5 | - buildToolsVersion '25.0.2' | ||
| 6 | - aaptOptions.cruncherEnabled = false | ||
| 7 | - aaptOptions.useNewCruncher = false | ||
| 8 | - defaultConfig { | ||
| 9 | - applicationId "com.mang.xdy.demo" | ||
| 10 | - minSdkVersion 15 | ||
| 11 | - targetSdkVersion 22 | ||
| 12 | - versionCode 1 | ||
| 13 | - versionName "1.0" | ||
| 14 | - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
| 15 | - | ||
| 16 | - } | ||
| 17 | - buildTypes { | ||
| 18 | - release { | ||
| 19 | - //是否混淆 | ||
| 20 | - minifyEnabled false | ||
| 21 | - zipAlignEnabled true | ||
| 22 | -// shrinkResources true//去除无用的resource文件,第一次使用 | ||
| 23 | - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
| 24 | - } | ||
| 25 | - } | ||
| 26 | - repositories { | ||
| 27 | - flatDir { | ||
| 28 | - dirs 'libs' | ||
| 29 | - } | ||
| 30 | - } | ||
| 31 | -} | ||
| 32 | - | ||
| 33 | -dependencies { | ||
| 34 | - compile fileTree(include: ['*.jar'], dir: 'libs') | ||
| 35 | - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
| 36 | - exclude group: 'com.android.support', module: 'support-annotations' | ||
| 37 | - }) | ||
| 38 | - compile files('libs/pldroid-player-1.5.1.jar') | ||
| 39 | - compile 'com.android.support:appcompat-v7:25.3.1' | ||
| 40 | - compile 'com.jakewharton:butterknife:8.5.1' | ||
| 41 | - compile 'com.android.support:design:25.3.1' | ||
| 42 | - compile 'com.squareup.picasso:picasso:2.3.2' | ||
| 43 | - compile 'com.github.bumptech.glide:glide:3.7.0' | ||
| 44 | - compile 'com.rockerhieu.emojicon:library:1.3.1' | ||
| 45 | - compile 'org.kymjs.kjframe:kjframe:2.6' | ||
| 46 | - compile 'io.reactivex:rxjava:1.0.9' | ||
| 47 | - compile 'io.reactivex:rxandroid:0.24.0' | ||
| 48 | -// compile 'com.squareup.retrofit:retrofit:1.9.0' | ||
| 49 | - compile 'com.nineoldandroids:library:2.4.0' | ||
| 50 | - compile 'me.yokeyword:fragmentation:0.10.3' | ||
| 51 | - compile 'com.qiniu:happy-dns:0.2.+' | ||
| 52 | -// compile 'com.android.support:support-v4:25.3.1' | ||
| 53 | - testCompile 'junit:junit:4.12' | ||
| 54 | - annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' | ||
| 55 | - compile 'com.qiniu:happy-dns:0.2.+' | ||
| 56 | - compile 'org.greenrobot:eventbus:3.0.0' | ||
| 57 | - compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar' | ||
| 58 | - compile project(':iOS_Dialog_Library') | ||
| 59 | - compile project(':xdy') | ||
| 60 | -} |
MyApplication/XdyDemo/proguard-rules.pro
已删除
100644 → 0
| 1 | -# Add project specific ProGuard rules here. | ||
| 2 | -# By default, the flags in this file are appended to flags specified | ||
| 3 | -# in D:\sdk/tools/proguard/proguard-android.txt | ||
| 4 | -# You can edit the include path and order by changing the proguardFiles | ||
| 5 | -# directive in build.gradle. | ||
| 6 | -# | ||
| 7 | -# For more details, see | ||
| 8 | -# http://developer.android.com/guide/developing/tools/proguard.html | ||
| 9 | - | ||
| 10 | -# Add any project specific keep options here: | ||
| 11 | - | ||
| 12 | -# If your project uses WebView with JS, uncomment the following | ||
| 13 | -# and specify the fully qualified class name to the JavaScript interface | ||
| 14 | -# class: | ||
| 15 | -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
| 16 | -# public *; | ||
| 17 | -#} | ||
| 18 | - | ||
| 19 | --keep class com.eventhandle.**{*;} | ||
| 20 | --keep class com.ntjbase.**{*;} | ||
| 21 | --keep class com.videoengine.**{*;} | ||
| 22 | --keep class com.voiceengine.**{*;} | ||
| 23 | - | ||
| 24 | --keep class com.mang.xdy.**{*;} |
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | - android:layout_width="match_parent" | ||
| 4 | - android:layout_height="match_parent" | ||
| 5 | - android:paddingLeft="10dp" | ||
| 6 | - android:paddingRight="10dp"> | ||
| 7 | - | ||
| 8 | - <LinearLayout | ||
| 9 | - android:id="@+id/chat_menu_images" | ||
| 10 | - android:layout_width="wrap_content" | ||
| 11 | - android:layout_height="wrap_content" | ||
| 12 | - android:layout_marginLeft="10dp" | ||
| 13 | - android:layout_marginRight="10dp" | ||
| 14 | - android:layout_marginTop="10dp" | ||
| 15 | - android:clickable="true" | ||
| 16 | - android:focusable="false" | ||
| 17 | - android:orientation="vertical"> | ||
| 18 | - | ||
| 19 | - <ImageView | ||
| 20 | - android:layout_width="wrap_content" | ||
| 21 | - android:layout_height="wrap_content" | ||
| 22 | - /> | ||
| 23 | - | ||
| 24 | - <TextView | ||
| 25 | - android:layout_width="wrap_content" | ||
| 26 | - android:layout_height="wrap_content" | ||
| 27 | - android:layout_gravity="center_horizontal" | ||
| 28 | - android:layout_marginTop="5dp" | ||
| 29 | - android:text="图片"/> | ||
| 30 | - </LinearLayout> | ||
| 31 | - | ||
| 32 | - <LinearLayout | ||
| 33 | - android:id="@+id/chat_menu_photo" | ||
| 34 | - android:layout_width="wrap_content" | ||
| 35 | - android:layout_height="wrap_content" | ||
| 36 | - android:layout_marginLeft="10dp" | ||
| 37 | - android:layout_marginRight="10dp" | ||
| 38 | - android:layout_marginTop="10dp" | ||
| 39 | - android:layout_toRightOf="@id/chat_menu_images" | ||
| 40 | - android:clickable="true" | ||
| 41 | - android:focusable="false" | ||
| 42 | - android:orientation="vertical"> | ||
| 43 | - | ||
| 44 | - <ImageView | ||
| 45 | - android:layout_width="wrap_content" | ||
| 46 | - android:layout_height="wrap_content" | ||
| 47 | - /> | ||
| 48 | - | ||
| 49 | - <TextView | ||
| 50 | - android:layout_width="wrap_content" | ||
| 51 | - android:layout_height="wrap_content" | ||
| 52 | - android:layout_gravity="center_horizontal" | ||
| 53 | - android:layout_marginTop="5dp" | ||
| 54 | - android:text="拍照"/> | ||
| 55 | - </LinearLayout> | ||
| 56 | - | ||
| 57 | -</RelativeLayout> |
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | - android:layout_width="match_parent" | ||
| 4 | - android:layout_height="match_parent" | ||
| 5 | - android:orientation="vertical"> | ||
| 6 | - | ||
| 7 | - <LinearLayout | ||
| 8 | - android:layout_width="@dimen/ui_DIMEN_500.0PX" | ||
| 9 | - android:layout_height="wrap_content" | ||
| 10 | - android:layout_centerInParent="true" | ||
| 11 | - android:background="@drawable/radius_solid_white_stroke_999" | ||
| 12 | - android:gravity="center_horizontal" | ||
| 13 | - android:orientation="vertical" | ||
| 14 | - android:paddingBottom="@dimen/ui_DIMEN_20.0PX"> | ||
| 15 | - | ||
| 16 | - <EditText | ||
| 17 | - android:id="@+id/et_username" | ||
| 18 | - style="@style/home_login_edit_style" | ||
| 19 | - android:hint="@string/home_enter_username"/> | ||
| 20 | - | ||
| 21 | - <EditText | ||
| 22 | - android:id="@+id/et_password" | ||
| 23 | - style="@style/home_login_edit_style" | ||
| 24 | - android:hint="@string/home_enter_password" | ||
| 25 | - android:inputType="textPassword" | ||
| 26 | - android:visibility="gone"/> | ||
| 27 | - | ||
| 28 | - <Button | ||
| 29 | - android:id="@+id/btn_login" | ||
| 30 | - style="@style/home_site_btn_style" | ||
| 31 | - android:text="@string/home_enter_login" | ||
| 32 | - android:textColor="@color/white"/> | ||
| 33 | - </LinearLayout> | ||
| 34 | - | ||
| 35 | -</RelativeLayout> |
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | - xmlns:tools="http://schemas.android.com/tools" | ||
| 4 | - android:layout_width="match_parent" | ||
| 5 | - android:layout_height="wrap_content"> | ||
| 6 | - | ||
| 7 | - <ImageView | ||
| 8 | - android:layout_width="match_parent" | ||
| 9 | - android:layout_height="wrap_content" | ||
| 10 | - android:background="@mipmap/gradient_play"/> | ||
| 11 | - | ||
| 12 | - <RelativeLayout | ||
| 13 | - android:paddingLeft="@dimen/ui_DIMEN_20.0PX" | ||
| 14 | - android:id="@+id/rl_operation_play" | ||
| 15 | - android:layout_width="@dimen/ui_DIMEN_70.0PX" | ||
| 16 | - android:layout_centerVertical="true" | ||
| 17 | - android:layout_height="@dimen/ui_DIMEN_70.0PX"> | ||
| 18 | - | ||
| 19 | - <ImageButton | ||
| 20 | - android:layout_marginLeft="@dimen/ui_DIMEN_20.0PX" | ||
| 21 | - android:id="@+id/iv_operation_play" | ||
| 22 | - android:layout_width="wrap_content" | ||
| 23 | - android:layout_centerInParent="true" | ||
| 24 | - android:layout_height="wrap_content" | ||
| 25 | - android:background="@null" | ||
| 26 | - android:src="@mipmap/play"/> | ||
| 27 | - | ||
| 28 | - </RelativeLayout> | ||
| 29 | - <RelativeLayout | ||
| 30 | - android:id="@+id/rl_meadia_contriller_right" | ||
| 31 | - android:gravity="center" | ||
| 32 | - android:layout_toRightOf="@id/rl_operation_play" | ||
| 33 | - android:layout_width="match_parent" | ||
| 34 | - android:layout_marginTop="@dimen/ui_DIMEN_6.0PX" | ||
| 35 | - android:layout_height="@dimen/ui_DIMEN_70.0PX"> | ||
| 36 | - <TextView | ||
| 37 | - android:id="@+id/tv_current_time" | ||
| 38 | - style="@style/ui_wrapTvBaseStyle" | ||
| 39 | - android:minWidth="@dimen/ui_DIMEN_100.0PX" | ||
| 40 | - android:textColor="@color/white" | ||
| 41 | - android:gravity="end" | ||
| 42 | - tools:text="12:00:12"/> | ||
| 43 | - | ||
| 44 | - <TextView | ||
| 45 | - android:id="@+id/tv_end_time" | ||
| 46 | - style="@style/ui_wrapTvBaseStyle" | ||
| 47 | - android:layout_alignParentRight="true" | ||
| 48 | - android:layout_marginRight="@dimen/ui_DIMEN_30.0PX" | ||
| 49 | - android:textColor="@color/white" | ||
| 50 | - tools:text="12:00"/> | ||
| 51 | - | ||
| 52 | - <SeekBar | ||
| 53 | - android:id="@+id/sb_live" | ||
| 54 | - style="@style/home_seek_bar" | ||
| 55 | - android:layout_width="match_parent" | ||
| 56 | - android:layout_height="wrap_content" | ||
| 57 | - android:layout_toLeftOf="@id/tv_end_time" | ||
| 58 | - android:layout_toRightOf="@id/tv_current_time"/> | ||
| 59 | - </RelativeLayout> | ||
| 60 | - | ||
| 61 | - | ||
| 62 | -</RelativeLayout> |
2.2 KB
1.9 KB
1.4 KB
2.2 KB
3.5 KB
2.3 KB
3.0 KB
2.2 KB
2.1 KB
1.7 KB
3.2 KB
3.2 KB
2.7 KB
1.2 KB
5.5 KB
2.0 KB
1.2 KB
2.7 KB
| 1 | -<resources> | ||
| 2 | - <string name="app_name">学点云</string> | ||
| 3 | - | ||
| 4 | - <!-- TODO: Remove or change this placeholder text --> | ||
| 5 | - <string name="hello_blank_fragment">Hello blank fragment</string> | ||
| 6 | - | ||
| 7 | - <string name="home_classid_hint">classid</string> | ||
| 8 | - <string name="home_role_hint">userRole</string> | ||
| 9 | - <string name="home_userid_hint">userid</string> | ||
| 10 | - <string name="home_portal_hint">portal</string> | ||
| 11 | - <string name="home_enter_class">Enter the classroom</string> | ||
| 12 | - <string name="home_enter_replay">Enter the recording playback</string> | ||
| 13 | - <string name="home_enter_login">Sign in</string> | ||
| 14 | - <string name="home_enter_password">password</string> | ||
| 15 | - <string name="home_enter_username">username</string> | ||
| 16 | - <string name="home_content_doc">Document</string> | ||
| 17 | - <string name="home_content_chat">Chat</string> | ||
| 18 | - <string name="home_dialog_pushAudio">Push Audio</string> | ||
| 19 | - <string name="home_dialog_pushVideo">Push Video</string> | ||
| 20 | - <string name="home_dialog_selectList">Selective listing</string> | ||
| 21 | - <string name="home_msg_leave_character">Sign out</string> | ||
| 22 | - <string name="home_msg_leave_class_whether">Are you sure you want to end the current class?</string> | ||
| 23 | - <string name="home_msg_exit_class">Have dropped out of the classroom</string> | ||
| 24 | - <string name="home_msg_leave_no">NO</string> | ||
| 25 | - <string name="home_msg_leave_yes">YES</string> | ||
| 26 | - <string name="home_msg_loading">loading</string> | ||
| 27 | - <string name="home_msg_join_class_success">Joining classroom Success</string> | ||
| 28 | - <string name="home_msg_error_net_disconnection">The device network belongs to the off state, please re-enter</string> | ||
| 29 | - <string name="home_msg_verify">Determine</string> | ||
| 30 | - <string name="home_title_back">Back</string> | ||
| 31 | - <string name="home_msg_play_audio_init">Audio playback initialization</string> | ||
| 32 | - <string name="home_msg_play_video_init">Video playback initialization</string> | ||
| 33 | - | ||
| 34 | - <string name="imge_load_error">Pictures for failure</string> | ||
| 35 | - <!--登录--> | ||
| 36 | - <string name="main_login_error_classId">Please enter class number</string> | ||
| 37 | - <string name="main_login_error_portal">Please enter portal</string> | ||
| 38 | - <string name="main_login_error_role">Please enter role</string> | ||
| 39 | - <string name="main_login_error_userId">Please enter userId</string> | ||
| 40 | -</resources> |
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | -<resources> | ||
| 3 | - <declare-styleable name="home_PagerSlidingTabStrip"> | ||
| 4 | - <attr name="home_pstsIndicatorColor" format="color"/> | ||
| 5 | - <attr name="home_pstsUnderlineColor" format="color"/> | ||
| 6 | - <attr name="home_pstsDividerColor" format="color"/> | ||
| 7 | - <attr name="home_pstsIndicatorHeight" format="dimension"/> | ||
| 8 | - <attr name="home_pstsUnderlineHeight" format="dimension"/> | ||
| 9 | - <attr name="home_pstsDividerPadding" format="dimension"/> | ||
| 10 | - <attr name="home_pstsTabPaddingLeftRight" format="dimension"/> | ||
| 11 | - <attr name="home_pstsScrollOffset" format="dimension"/> | ||
| 12 | - <attr name="home_pstsTabBackground" format="reference"/> | ||
| 13 | - <attr name="home_pstsShouldExpand" format="boolean"/> | ||
| 14 | - <attr name="home_pstsTextAllCaps" format="boolean"/> | ||
| 15 | - </declare-styleable> | ||
| 16 | - | ||
| 17 | -</resources> |
| 1 | -<resources> | ||
| 2 | - <!-- Default screen margins, per the Android Design guidelines. --> | ||
| 3 | - <dimen name="activity_horizontal_margin">16dp</dimen> | ||
| 4 | - <dimen name="activity_vertical_margin">16dp</dimen> | ||
| 5 | - | ||
| 6 | - <!-- yalantis --> | ||
| 7 | - <dimen name="ui_refresh_header_height_yalantis">136dp</dimen> | ||
| 8 | - <!-- jd --> | ||
| 9 | - <dimen name="ui_refresh_header_height_jd">100dp</dimen> | ||
| 10 | - | ||
| 11 | - <!-- 标题栏高度 --> | ||
| 12 | - <dimen name="ui_titlebar_height">@dimen/ui_DIMEN_96.0PX</dimen> | ||
| 13 | - <!-- 默认内边距 --> | ||
| 14 | - <dimen name="ui_default_padding">@dimen/ui_DIMEN_20.0PX</dimen> | ||
| 15 | - <!-- 收货地址默认内边距 --> | ||
| 16 | - <dimen name="ui_address_padding">@dimen/ui_DIMEN_40.0PX</dimen> | ||
| 17 | - <!-- Navigator的高度 --> | ||
| 18 | - <dimen name="ui_navigator_height">@dimen/ui_DIMEN_98.0PX</dimen> | ||
| 19 | - <!-- 设置里每一个ITEM的高度 --> | ||
| 20 | - <dimen name="ui_setting_item_height">@dimen/ui_DIMEN_102.0PX</dimen> | ||
| 21 | - <!-- 边框的角度 --> | ||
| 22 | - <dimen name="ui_general_stroke_radius">8px</dimen> | ||
| 23 | - <!-- 边框的宽度 --> | ||
| 24 | - <dimen name="ui_general_stroke_width">1px</dimen> | ||
| 25 | - <dimen name="ui_xxs_font_size">@dimen/ui_DIMEN_20.0PX</dimen> | ||
| 26 | - <dimen name="ui_xs_font_size">@dimen/ui_DIMEN_22.0PX</dimen> | ||
| 27 | - <dimen name="ui_s_font_size">@dimen/ui_DIMEN_24.0PX</dimen> | ||
| 28 | - <dimen name="ui_m_font_size">@dimen/ui_DIMEN_26.0PX</dimen> | ||
| 29 | - <dimen name="ui_l_font_size">@dimen/ui_DIMEN_28.0PX</dimen> | ||
| 30 | - <dimen name="ui_xl_font_size">@dimen/ui_DIMEN_30.0PX</dimen> | ||
| 31 | - <dimen name="ui_xxl_font_size">@dimen/ui_DIMEN_32.0PX</dimen> | ||
| 32 | - <dimen name="ui_xxxl_font_size">@dimen/ui_DIMEN_34.0PX</dimen> | ||
| 33 | - <dimen name="ui_xxxxl_font_size">@dimen/ui_DIMEN_36.0PX</dimen> | ||
| 34 | - <dimen name="ui_primary_font_size">@dimen/ui_DIMEN_26.0PX</dimen> | ||
| 35 | - <dimen name="ui_second_font_size">@dimen/ui_DIMEN_24.0PX</dimen> | ||
| 36 | - | ||
| 37 | - <dimen name="home_avigator_height">@dimen/ui_DIMEN_60.0PX</dimen> | ||
| 38 | - <!-- BTN的高度 --> | ||
| 39 | - <dimen name="home_btn_height">@dimen/ui_DIMEN_88.0PX</dimen> | ||
| 40 | -</resources> |
| 1 | -<resources> | ||
| 2 | - <string name="app_name">学点云</string> | ||
| 3 | - | ||
| 4 | - <!-- TODO: Remove or change this placeholder text --> | ||
| 5 | - <string name="hello_blank_fragment">Hello blank fragment</string> | ||
| 6 | - | ||
| 7 | - <string name="home_classid_hint">classid</string> | ||
| 8 | - <string name="home_role_hint">userRole</string> | ||
| 9 | - <string name="home_userid_hint">userid</string> | ||
| 10 | - <string name="home_portal_hint">portal</string> | ||
| 11 | - <string name="home_enter_class">进入课堂</string> | ||
| 12 | - <string name="home_enter_replay">进入录制回放</string> | ||
| 13 | - <string name="home_enter_login">登录</string> | ||
| 14 | - <string name="home_enter_password">密码</string> | ||
| 15 | - <string name="home_enter_username">用户名</string> | ||
| 16 | - <string name="home_content_doc">文档</string> | ||
| 17 | - <string name="home_content_chat">聊天</string> | ||
| 18 | - <string name="home_dialog_pushAudio">推送音频</string> | ||
| 19 | - <string name="home_dialog_pushVideo">推送视频</string> | ||
| 20 | - <string name="home_dialog_selectList">选择列表</string> | ||
| 21 | - <string name="home_msg_leave_character">退出</string> | ||
| 22 | - <string name="home_msg_leave_class_whether">是否离开课堂</string> | ||
| 23 | - <string name="home_msg_exit_class">退出课堂</string> | ||
| 24 | - <string name="home_msg_leave_no">否</string> | ||
| 25 | - <string name="home_msg_leave_yes">是</string> | ||
| 26 | - <string name="home_msg_loading">加载中</string> | ||
| 27 | - <string name="home_msg_join_class_success">加入课堂成功</string> | ||
| 28 | - <string name="home_msg_error_net_disconnection">您设备的网络属于断开状态,请重新进入</string> | ||
| 29 | - <string name="home_msg_verify">确认</string> | ||
| 30 | - <string name="home_title_back">返回</string> | ||
| 31 | - <string name="home_msg_play_audio_init">音频播放初始化</string> | ||
| 32 | - <string name="home_msg_play_video_init">视频播放初始化</string> | ||
| 33 | - | ||
| 34 | - <string name="imge_load_error">图片获取失败</string> | ||
| 35 | - <!--登录--> | ||
| 36 | - <string name="main_login_error_classId">课堂Id不能为空</string> | ||
| 37 | - <string name="main_login_error_portal">服务器地址不能为空</string> | ||
| 38 | - <string name="main_login_error_role">角色不能为空</string> | ||
| 39 | - <string name="main_login_error_userId">用户id不能为空</string> | ||
| 40 | -</resources> |
| @@ -26,7 +26,7 @@ dependencies { | @@ -26,7 +26,7 @@ dependencies { | ||
| 26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | 26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { |
| 27 | exclude group: 'com.android.support', module: 'support-annotations' | 27 | exclude group: 'com.android.support', module: 'support-annotations' |
| 28 | }) | 28 | }) |
| 29 | - compile 'com.android.support:appcompat-v7:25.3.1' | 29 | + |
| 30 | testCompile 'junit:junit:4.12' | 30 | testCompile 'junit:junit:4.12' |
| 31 | compile files('src/main/jniLibs/smartavengine.jar') | 31 | compile files('src/main/jniLibs/smartavengine.jar') |
| 32 | compile 'com.google.code.gson:gson:2.7' | 32 | compile 'com.google.code.gson:gson:2.7' |
| 1 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mang.xdy"> | 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mang.xuedianyun"> |
| 2 | 2 | ||
| 3 | <application android:allowBackup="true" android:label="@string/app_name" | 3 | <application android:allowBackup="true" android:label="@string/app_name" |
| 4 | android:supportsRtl="true"> | 4 | android:supportsRtl="true"> |
| @@ -198,7 +198,7 @@ public class XdySdk implements SubjectListener { | @@ -198,7 +198,7 @@ public class XdySdk implements SubjectListener { | ||
| 198 | //如果是回放给出。m3u8的id用户 用户需要自己获取play_url_audio=audioPlayBean.getReplay(); | 198 | //如果是回放给出。m3u8的id用户 用户需要自己获取play_url_audio=audioPlayBean.getReplay(); |
| 199 | }else{ | 199 | }else{ |
| 200 | //如果是host权限的在播放,下次在播放必须是host | 200 | //如果是host权限的在播放,下次在播放必须是host |
| 201 | - if(isCurrentAudioHost){ | 201 | + if(isCurrentAudioHost||isCurrentVideoHost){ |
| 202 | if(!Constants.HOST.equals(audioPlayBean.getUserRole())){ | 202 | if(!Constants.HOST.equals(audioPlayBean.getUserRole())){ |
| 203 | return; | 203 | return; |
| 204 | } | 204 | } |
| @@ -237,7 +237,7 @@ public class XdySdk implements SubjectListener { | @@ -237,7 +237,7 @@ public class XdySdk implements SubjectListener { | ||
| 237 | // play_url_video=videoPlayBean.getReplay(); | 237 | // play_url_video=videoPlayBean.getReplay(); |
| 238 | }else{ | 238 | }else{ |
| 239 | //如果是host权限的在播放,下次在播放必须是host | 239 | //如果是host权限的在播放,下次在播放必须是host |
| 240 | - if(isCurrentVideoHost){ | 240 | + if(isCurrentVideoHost||isCurrentAudioHost){ |
| 241 | if(!Constants.HOST.equals(videoPlayBean.getUserRole())){ | 241 | if(!Constants.HOST.equals(videoPlayBean.getUserRole())){ |
| 242 | return; | 242 | return; |
| 243 | } | 243 | } |
| @@ -308,6 +308,7 @@ public class XdySdk implements SubjectListener { | @@ -308,6 +308,7 @@ public class XdySdk implements SubjectListener { | ||
| 308 | public static XdySdk getXdyInstance(){ | 308 | public static XdySdk getXdyInstance(){ |
| 309 | if(mXdySdk ==null){ | 309 | if(mXdySdk ==null){ |
| 310 | synchronized (XdySdk.class){ | 310 | synchronized (XdySdk.class){ |
| 311 | + if(mXdySdk==null) | ||
| 311 | mXdySdk =new XdySdk(); | 312 | mXdySdk =new XdySdk(); |
| 312 | } | 313 | } |
| 313 | } | 314 | } |
| @@ -469,9 +470,15 @@ public class XdySdk implements SubjectListener { | @@ -469,9 +470,15 @@ public class XdySdk implements SubjectListener { | ||
| 469 | if(videoPlayBean!=null) { | 470 | if(videoPlayBean!=null) { |
| 470 | // if(videoPlayBean.getMediaId()!=videoPlayBean.getFromNodeId()) { | 471 | // if(videoPlayBean.getMediaId()!=videoPlayBean.getFromNodeId()) { |
| 471 | if(mNodeId !=videoPlayBean.getFromNodeId()) { | 472 | if(mNodeId !=videoPlayBean.getFromNodeId()) { |
| 472 | - //过滤自己推送的video | 473 | + //过滤自己推送的video,如果当前正在播放教师,如果不是host就不推送,1v1 |
| 474 | + if(isCurrentAudioHost||isCurrentVideoHost){ | ||
| 475 | + if(Constants.HOST.equals(videoPlayBean.getUserRole())){ | ||
| 476 | + handleListener(type, videoPlayBean.getMediaId() + ""); | ||
| 477 | + } | ||
| 478 | + }else{ | ||
| 479 | + handleListener(type, videoPlayBean.getMediaId() + ""); | ||
| 480 | + } | ||
| 473 | aCache.put(videoPlayBean.getMediaId() + "", video); | 481 | aCache.put(videoPlayBean.getMediaId() + "", video); |
| 474 | - handleListener(type, videoPlayBean.getMediaId() + ""); | ||
| 475 | } | 482 | } |
| 476 | }else{ | 483 | }else{ |
| 477 | XdyLogUtil.e(TAG,"video play json error"); | 484 | XdyLogUtil.e(TAG,"video play json error"); |
| @@ -483,8 +490,16 @@ public class XdySdk implements SubjectListener { | @@ -483,8 +490,16 @@ public class XdySdk implements SubjectListener { | ||
| 483 | if(audioPlayBean!=null){ | 490 | if(audioPlayBean!=null){ |
| 484 | // if(audioPlayBean.getMediaId()!=audioPlayBean.getFromNodeId()) { | 491 | // if(audioPlayBean.getMediaId()!=audioPlayBean.getFromNodeId()) { |
| 485 | if(mNodeId !=audioPlayBean.getFromNodeId()) { | 492 | if(mNodeId !=audioPlayBean.getFromNodeId()) { |
| 493 | + | ||
| 494 | + if(isCurrentAudioHost||isCurrentVideoHost){ | ||
| 495 | + if(Constants.HOST.equals(audioPlayBean.getUserRole())){ | ||
| 496 | + handleListener(type, audioPlayBean.getMediaId() + ""); | ||
| 497 | + } | ||
| 498 | + }else{ | ||
| 499 | + handleListener(type, audioPlayBean.getMediaId() + ""); | ||
| 500 | + } | ||
| 486 | aCache.put(audioPlayBean.getMediaId() + "", audio); | 501 | aCache.put(audioPlayBean.getMediaId() + "", audio); |
| 487 | - handleListener(type, audioPlayBean.getMediaId() + ""); | 502 | + |
| 488 | } | 503 | } |
| 489 | } | 504 | } |
| 490 | break; | 505 | break; |
| @@ -17,7 +17,7 @@ public class PlayerUtils { | @@ -17,7 +17,7 @@ public class PlayerUtils { | ||
| 17 | * 这个地址的接收目前在同步的接口,后期做异步处理 | 17 | * 这个地址的接收目前在同步的接口,后期做异步处理 |
| 18 | * */ | 18 | * */ |
| 19 | public static void getPublishPathVideo() { | 19 | public static void getPublishPathVideo() { |
| 20 | - String tem = "{ \"type\": \"live\"}"; | 20 | + String tem = "{ \"type\": \"flash\"}"; |
| 21 | String s = XdyStringUtils.stringToJson(tem, true); | 21 | String s = XdyStringUtils.stringToJson(tem, true); |
| 22 | XdySdk.getXdyInstance().api(Constants.GET_VIDEO_PUBLISH_PATH, s); | 22 | XdySdk.getXdyInstance().api(Constants.GET_VIDEO_PUBLISH_PATH, s); |
| 23 | } | 23 | } |
| @@ -26,7 +26,7 @@ public class PlayerUtils { | @@ -26,7 +26,7 @@ public class PlayerUtils { | ||
| 26 | * 获取音频推流地址 | 26 | * 获取音频推流地址 |
| 27 | */ | 27 | */ |
| 28 | public static void getPublishPathAudio() { | 28 | public static void getPublishPathAudio() { |
| 29 | - String tem = "{ \"type\": \"live\"}"; | 29 | + String tem = "{ \"type\": \"flash\"}"; |
| 30 | String s = XdyStringUtils.stringToJson(tem, true); | 30 | String s = XdyStringUtils.stringToJson(tem, true); |
| 31 | XdySdk.getXdyInstance().api(Constants.GET_AUDIO_PUBLISH_PATH, s); | 31 | XdySdk.getXdyInstance().api(Constants.GET_AUDIO_PUBLISH_PATH, s); |
| 32 | } | 32 | } |
This file is too large to display.
This file is too large to display.
This file is too large to display.
This file is too large to display.
| @@ -15,23 +15,11 @@ | @@ -15,23 +15,11 @@ | ||
| 15 | <uses-feature android:name="android.hardware.camera.autofocus" /> | 15 | <uses-feature android:name="android.hardware.camera.autofocus" /> |
| 16 | 16 | ||
| 17 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | 17 | <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> |
| 18 | - <uses-permission android:name="android.permission.INTERNET" /> | ||
| 19 | - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| 20 | - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
| 21 | - <uses-permission android:name="android.permission.RECORD_AUDIO" /> | ||
| 22 | <uses-permission android:name="android.permission.WAKE_LOCK" /> | 18 | <uses-permission android:name="android.permission.WAKE_LOCK" /> |
| 23 | - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| 24 | <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> | 19 | <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> |
| 25 | - <uses-permission android:name="android.permission.CAMERA" /> | ||
| 26 | <uses-permission android:name="android.permission.VIBRATE" /> | 20 | <uses-permission android:name="android.permission.VIBRATE" /> |
| 27 | 21 | ||
| 28 | - <uses-permission android:name="android.permission.INTERNET" /> | ||
| 29 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 22 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
| 30 | - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
| 31 | - <uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
| 32 | - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| 33 | - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| 34 | - <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
| 35 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | 23 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> |
| 36 | 24 | ||
| 37 | 25 | ||
| @@ -54,6 +42,7 @@ | @@ -54,6 +42,7 @@ | ||
| 54 | <activity android:name="com.mang.xuedianyun.android.activity.VideoPlayActivity" | 42 | <activity android:name="com.mang.xuedianyun.android.activity.VideoPlayActivity" |
| 55 | android:configChanges="keyboardHidden|orientation|screenSize" | 43 | android:configChanges="keyboardHidden|orientation|screenSize" |
| 56 | android:screenOrientation="portrait" | 44 | android:screenOrientation="portrait" |
| 45 | + android:windowSoftInputMode="adjustResize|stateHidden" | ||
| 57 | > | 46 | > |
| 58 | </activity> | 47 | </activity> |
| 59 | </application> | 48 | </application> |
| @@ -8,16 +8,17 @@ import android.content.DialogInterface; | @@ -8,16 +8,17 @@ import android.content.DialogInterface; | ||
| 8 | import android.content.pm.ActivityInfo; | 8 | import android.content.pm.ActivityInfo; |
| 9 | import android.content.pm.PackageManager; | 9 | import android.content.pm.PackageManager; |
| 10 | import android.content.res.Configuration; | 10 | import android.content.res.Configuration; |
| 11 | +import android.os.Build; | ||
| 11 | import android.os.Bundle; | 12 | import android.os.Bundle; |
| 12 | import android.os.Handler; | 13 | import android.os.Handler; |
| 13 | import android.os.Message; | 14 | import android.os.Message; |
| 15 | +import android.support.annotation.NonNull; | ||
| 14 | import android.support.design.widget.TabLayout; | 16 | import android.support.design.widget.TabLayout; |
| 15 | import android.support.v4.app.ActivityCompat; | 17 | import android.support.v4.app.ActivityCompat; |
| 16 | import android.support.v4.app.FragmentActivity; | 18 | import android.support.v4.app.FragmentActivity; |
| 17 | import android.support.v4.app.FragmentManager; | 19 | import android.support.v4.app.FragmentManager; |
| 18 | import android.support.v4.app.FragmentTransaction; | 20 | import android.support.v4.app.FragmentTransaction; |
| 19 | import android.support.v4.content.ContextCompat; | 21 | import android.support.v4.content.ContextCompat; |
| 20 | -import android.support.v4.content.PermissionChecker; | ||
| 21 | import android.support.v7.app.AlertDialog; | 22 | import android.support.v7.app.AlertDialog; |
| 22 | import android.text.TextUtils; | 23 | import android.text.TextUtils; |
| 23 | import android.util.DisplayMetrics; | 24 | import android.util.DisplayMetrics; |
| @@ -26,7 +27,9 @@ import android.view.KeyEvent; | @@ -26,7 +27,9 @@ import android.view.KeyEvent; | ||
| 26 | import android.view.SurfaceHolder; | 27 | import android.view.SurfaceHolder; |
| 27 | import android.view.SurfaceView; | 28 | import android.view.SurfaceView; |
| 28 | import android.view.View; | 29 | import android.view.View; |
| 30 | +import android.view.ViewGroup; | ||
| 29 | import android.view.WindowManager; | 31 | import android.view.WindowManager; |
| 32 | +import android.view.inputmethod.InputMethodManager; | ||
| 30 | import android.widget.FrameLayout; | 33 | import android.widget.FrameLayout; |
| 31 | import android.widget.ImageButton; | 34 | import android.widget.ImageButton; |
| 32 | import android.widget.ImageView; | 35 | import android.widget.ImageView; |
| @@ -54,6 +57,8 @@ import com.mang.xuedianyun.android.bean.TimeEntity; | @@ -54,6 +57,8 @@ import com.mang.xuedianyun.android.bean.TimeEntity; | ||
| 54 | import com.mang.xuedianyun.android.bean.VideoOrAudioStopEntity; | 57 | import com.mang.xuedianyun.android.bean.VideoOrAudioStopEntity; |
| 55 | import com.mang.xuedianyun.android.fragment.ChatFragment; | 58 | import com.mang.xuedianyun.android.fragment.ChatFragment; |
| 56 | import com.mang.xuedianyun.android.fragment.DocFragment; | 59 | import com.mang.xuedianyun.android.fragment.DocFragment; |
| 60 | +import com.mang.xuedianyun.android.permission.PermissionFail; | ||
| 61 | +import com.mang.xuedianyun.android.permission.PermissionSuccess; | ||
| 57 | import com.mang.xuedianyun.android.utils.JsonUtil; | 62 | import com.mang.xuedianyun.android.utils.JsonUtil; |
| 58 | import com.mang.xuedianyun.android.utils.ToastUtil; | 63 | import com.mang.xuedianyun.android.utils.ToastUtil; |
| 59 | import com.mang.xuedianyun.android.widget.dialog.LoginDialog; | 64 | import com.mang.xuedianyun.android.widget.dialog.LoginDialog; |
| @@ -74,14 +79,12 @@ import org.greenrobot.eventbus.ThreadMode; | @@ -74,14 +79,12 @@ import org.greenrobot.eventbus.ThreadMode; | ||
| 74 | import org.json.JSONException; | 79 | import org.json.JSONException; |
| 75 | import org.json.JSONObject; | 80 | import org.json.JSONObject; |
| 76 | 81 | ||
| 77 | -import java.io.IOException; | ||
| 78 | import java.util.ArrayList; | 82 | import java.util.ArrayList; |
| 79 | import java.util.Locale; | 83 | import java.util.Locale; |
| 80 | 84 | ||
| 81 | import butterknife.BindView; | 85 | import butterknife.BindView; |
| 82 | import butterknife.ButterKnife; | 86 | import butterknife.ButterKnife; |
| 83 | import zhangphil.iosdialog.widget.ActionSheetDialog; | 87 | import zhangphil.iosdialog.widget.ActionSheetDialog; |
| 84 | -import com.mang.xuedianyun.android.widget.dialog.AnswerSheetDialog; | ||
| 85 | 88 | ||
| 86 | import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION; | 89 | import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION; |
| 87 | 90 | ||
| @@ -141,8 +144,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -141,8 +144,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 141 | SurfaceHolder sh; | 144 | SurfaceHolder sh; |
| 142 | /*课堂名字*/ | 145 | /*课堂名字*/ |
| 143 | private String className; | 146 | private String className; |
| 144 | - /*课堂类型*/ | ||
| 145 | - private int classType = 2; | 147 | + /*课堂类型 2,直播课堂,后续还会有更多课堂*/ |
| 148 | + private int classType = 1; | ||
| 146 | 149 | ||
| 147 | private String[] titles; | 150 | private String[] titles; |
| 148 | 151 | ||
| @@ -151,6 +154,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -151,6 +154,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 151 | private LinearLayout llVideo_table_chat; | 154 | private LinearLayout llVideo_table_chat; |
| 152 | 155 | ||
| 153 | private final int CAMERA_REQUEST_CODE = 1; | 156 | private final int CAMERA_REQUEST_CODE = 1; |
| 157 | + private final int AUDIO_REQUEST_CODE=2; | ||
| 154 | // private Fragment mFragment_Tablet_Chat; | 158 | // private Fragment mFragment_Tablet_Chat; |
| 155 | 159 | ||
| 156 | private Handler mmHandler = new Handler() { | 160 | private Handler mmHandler = new Handler() { |
| @@ -202,6 +206,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -202,6 +206,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 202 | fra_videoPlay_start.setVisibility(View.VISIBLE); | 206 | fra_videoPlay_start.setVisibility(View.VISIBLE); |
| 203 | } | 207 | } |
| 204 | } | 208 | } |
| 209 | + setTabletType(); | ||
| 205 | break; | 210 | break; |
| 206 | case Constants.VIDEO_PLAY: | 211 | case Constants.VIDEO_PLAY: |
| 207 | //播放视频 | 212 | //播放视频 |
| @@ -224,7 +229,11 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -224,7 +229,11 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 224 | break; | 229 | break; |
| 225 | case Constants.PLAY_SUCCESS: | 230 | case Constants.PLAY_SUCCESS: |
| 226 | //自定义消息 播放视频音频都通过这个来判断 | 231 | //自定义消息 播放视频音频都通过这个来判断 |
| 227 | - img_playVideo_novideo.setVisibility(View.GONE); | 232 | + if(isTablet(VideoPlayActivity.this)){ |
| 233 | + setTabletTeacherCover(false,false); | ||
| 234 | + }else { | ||
| 235 | + img_playVideo_novideo.setVisibility(View.GONE); | ||
| 236 | + } | ||
| 228 | break; | 237 | break; |
| 229 | case Constants.CLASS_UPDATE_TIMER: | 238 | case Constants.CLASS_UPDATE_TIMER: |
| 230 | if (replay && !mDragging) | 239 | if (replay && !mDragging) |
| @@ -270,7 +279,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -270,7 +279,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 270 | // setAnswerLayout(); | 279 | // setAnswerLayout(); |
| 271 | } | 280 | } |
| 272 | 281 | ||
| 273 | - public void init() { | 282 | + public void init() { |
| 274 | ArrayList<String> arrayList = getIntent().getStringArrayListExtra("init"); | 283 | ArrayList<String> arrayList = getIntent().getStringArrayListExtra("init"); |
| 275 | if (arrayList != null && arrayList.size() > 1) { | 284 | if (arrayList != null && arrayList.size() > 1) { |
| 276 | initClass = arrayList.get(0); | 285 | initClass = arrayList.get(0); |
| @@ -358,22 +367,22 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -358,22 +367,22 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 358 | publishAudio(); | 367 | publishAudio(); |
| 359 | } | 368 | } |
| 360 | }) | 369 | }) |
| 361 | - .addSheetItem("单选或者多选", ActionSheetDialog.SheetItemColor.Blue | ||
| 362 | - , new ActionSheetDialog.OnSheetItemClickListener() { | ||
| 363 | - @Override | ||
| 364 | - public void onClick(int which) { | ||
| 365 | - //填写事件 | ||
| 366 | -// mAnswerSheetView.selectAnswerSheetType(AnswerSheetView.ANSWER_TYPE_SINGLE_OR_MORE); | ||
| 367 | -// mAnswerSheetView.startCountTimerAndResizeLayout(22); | ||
| 368 | -// setAnswerSheetLayout_Nornal(53); | ||
| 369 | - | ||
| 370 | - AnswerSheetDialog answerSheetDialog= new AnswerSheetDialog(VideoPlayActivity.this); | ||
| 371 | - answerSheetDialog.builder().show(); | ||
| 372 | - answerSheetDialog.selectAnswerSheetType(1); | ||
| 373 | - answerSheetDialog.startCountTimerAndResizeLayout(30,50); | ||
| 374 | - | ||
| 375 | - } | ||
| 376 | - }) | 370 | +// .addSheetItem("单选或者多选", ActionSheetDialog.SheetItemColor.Blue |
| 371 | +// , new ActionSheetDialog.OnSheetItemClickListener() { | ||
| 372 | +// @Override | ||
| 373 | +// public void onClick(int which) { | ||
| 374 | +// //填写事件 | ||
| 375 | +//// mAnswerSheetView.selectAnswerSheetType(AnswerSheetView.ANSWER_TYPE_SINGLE_OR_MORE); | ||
| 376 | +//// mAnswerSheetView.startCountTimerAndResizeLayout(22); | ||
| 377 | +//// setAnswerSheetLayout_Nornal(53); | ||
| 378 | +// | ||
| 379 | +// AnswerSheetDialog answerSheetDialog= new AnswerSheetDialog(VideoPlayActivity.this); | ||
| 380 | +// answerSheetDialog.builder().show(); | ||
| 381 | +// answerSheetDialog.selectAnswerSheetType(1); | ||
| 382 | +// answerSheetDialog.startCountTimerAndResizeLayout(30,50); | ||
| 383 | +// | ||
| 384 | +// } | ||
| 385 | +// }) | ||
| 377 | // .addSheetItem("对错选择", ActionSheetDialog.SheetItemColor.Blue | 386 | // .addSheetItem("对错选择", ActionSheetDialog.SheetItemColor.Blue |
| 378 | // , new ActionSheetDialog.OnSheetItemClickListener() { | 387 | // , new ActionSheetDialog.OnSheetItemClickListener() { |
| 379 | // @Override | 388 | // @Override |
| @@ -504,7 +513,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -504,7 +513,7 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 504 | playRecord(response,false); | 513 | playRecord(response,false); |
| 505 | 514 | ||
| 506 | } else { | 515 | } else { |
| 507 | -// if (!checkPermission()) { | 516 | +// if (!checkPermissionVideo()) { |
| 508 | // return; | 517 | // return; |
| 509 | // } | 518 | // } |
| 510 | 519 | ||
| @@ -543,8 +552,13 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -543,8 +552,13 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 543 | // } | 552 | // } |
| 544 | xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this); | 553 | xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this); |
| 545 | // img_playVideo_novideo.setVisibility(View.GONE); | 554 | // img_playVideo_novideo.setVisibility(View.GONE); |
| 546 | - img_playVideo_novideo.setImageResource(R.mipmap.no_video); | ||
| 547 | - ToastUtil.showToastshort(getResources().getString(R.string.home_msg_play_video_init), VideoPlayActivity.this); | 555 | + if(isTablet(this)) { |
| 556 | + setTabletTeacherCover(true,false); | ||
| 557 | + }else { | ||
| 558 | + img_playVideo_novideo.setImageResource(R.mipmap.no_video); | ||
| 559 | + } | ||
| 560 | + //// TODO: 2017/5/18 tihsi | ||
| 561 | +// ToastUtil.showToastshort(getResources().getString(R.string.home_msg_play_video_init), VideoPlayActivity.this); | ||
| 548 | } | 562 | } |
| 549 | } | 563 | } |
| 550 | 564 | ||
| @@ -562,9 +576,15 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -562,9 +576,15 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 562 | } else { | 576 | } else { |
| 563 | 577 | ||
| 564 | xdySdk.api("playAudio", response, null, VideoPlayActivity.this); | 578 | xdySdk.api("playAudio", response, null, VideoPlayActivity.this); |
| 565 | - img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); | ||
| 566 | - img_playVideo_novideo.setVisibility(View.VISIBLE); | ||
| 567 | - ToastUtil.showToastshort(getResources().getString(R.string.home_msg_play_audio_init), VideoPlayActivity.this); | 579 | + if(isTablet(this)){ |
| 580 | + setTabletTeacherCover(true,true); | ||
| 581 | + }else{ | ||
| 582 | + img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); | ||
| 583 | + img_playVideo_novideo.setVisibility(View.VISIBLE); | ||
| 584 | + } | ||
| 585 | + | ||
| 586 | + //// TODO: 2017/5/18 提示 | ||
| 587 | +// ToastUtil.showToastshort(getResources().getString(R.string.home_msg_play_audio_init), VideoPlayActivity.this); | ||
| 568 | } | 588 | } |
| 569 | } | 589 | } |
| 570 | /*教师端主动开始视频,或关闭视频*/ | 590 | /*教师端主动开始视频,或关闭视频*/ |
| @@ -615,7 +635,15 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -615,7 +635,15 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 615 | 635 | ||
| 616 | //如果收到class_exit 就执行,退出界面 | 636 | //如果收到class_exit 就执行,退出界面 |
| 617 | UIUtils.closeDialog(mLoginDialog); | 637 | UIUtils.closeDialog(mLoginDialog); |
| 618 | - exit(); | 638 | + xdySdk.api("leaveClass", ""); |
| 639 | + mHandler.postDelayed(new Runnable() { | ||
| 640 | + @Override | ||
| 641 | + public void run() { | ||
| 642 | + exit(); | ||
| 643 | + } | ||
| 644 | + },100); | ||
| 645 | + | ||
| 646 | + | ||
| 619 | } | 647 | } |
| 620 | }) | 648 | }) |
| 621 | .create(); | 649 | .create(); |
| @@ -658,6 +686,11 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -658,6 +686,11 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 658 | case "301": | 686 | case "301": |
| 659 | progressDialogDismiss(); | 687 | progressDialogDismiss(); |
| 660 | break; | 688 | break; |
| 689 | + case "910": | ||
| 690 | + progressDialogDismiss(); | ||
| 691 | + exit(); | ||
| 692 | + ToastUtil.showToastshort(errorEntity.getReson(), this); | ||
| 693 | + break; | ||
| 661 | case "911": | 694 | case "911": |
| 662 | progressDialogDismiss(); | 695 | progressDialogDismiss(); |
| 663 | exit(); | 696 | exit(); |
| @@ -730,8 +763,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -730,8 +763,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 730 | public void exit() { | 763 | public void exit() { |
| 731 | progressDialogDismiss(); | 764 | progressDialogDismiss(); |
| 732 | isDefaultExit = true; | 765 | isDefaultExit = true; |
| 733 | - xdySdk.api("stopPublishVideo", ""); | ||
| 734 | - xdySdk.api("leaveClass", ""); | 766 | +// xdySdk.api("stopPublishVideo", ""); |
| 767 | +// xdySdk.api("leaveClass", ""); | ||
| 735 | xdySdk.remove(this); | 768 | xdySdk.remove(this); |
| 736 | mLoginDialog=null; | 769 | mLoginDialog=null; |
| 737 | xdySdk.onPublisherStop(); | 770 | xdySdk.onPublisherStop(); |
| @@ -794,8 +827,12 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -794,8 +827,12 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 794 | VideoOrAudioStopEntity entity = JsonUtil.parseJsonToBean(response, VideoOrAudioStopEntity.class); | 827 | VideoOrAudioStopEntity entity = JsonUtil.parseJsonToBean(response, VideoOrAudioStopEntity.class); |
| 795 | if (entity != null) { | 828 | if (entity != null) { |
| 796 | if (xdySdk.onPlayStop(entity.getMediaId() + "")) { | 829 | if (xdySdk.onPlayStop(entity.getMediaId() + "")) { |
| 797 | - img_playVideo_novideo.setImageResource(R.mipmap.no_video); | ||
| 798 | - img_playVideo_novideo.setVisibility(View.VISIBLE); | 830 | + if(isTablet(this)){ |
| 831 | + setTabletTeacherCover(true,false); | ||
| 832 | + }else { | ||
| 833 | + img_playVideo_novideo.setImageResource(R.mipmap.no_video); | ||
| 834 | + img_playVideo_novideo.setVisibility(View.VISIBLE); | ||
| 835 | + } | ||
| 799 | } | 836 | } |
| 800 | } | 837 | } |
| 801 | } | 838 | } |
| @@ -833,72 +870,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -833,72 +870,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 833 | private boolean isCameraCheckFirst = true; | 870 | private boolean isCameraCheckFirst = true; |
| 834 | private boolean isAudioCheckFirst = true; | 871 | private boolean isAudioCheckFirst = true; |
| 835 | 872 | ||
| 836 | - private boolean checkPermission() { | ||
| 837 | -// try { | ||
| 838 | -// int pRecordAudio = PermissionChecker.checkCallingOrSelfPermission(this, "android.permission.RECORD_AUDIO"); | ||
| 839 | -// int pCamera = PermissionChecker.checkCallingOrSelfPermission(this, "android.permission.CAMERA"); | ||
| 840 | -// if(pRecordAudio != PackageManager.PERMISSION_GRANTED) { | ||
| 841 | -// Log.e(TAG,"do not have AudioRecord permission, please check"); | ||
| 842 | -// Toast.makeText(this,"do not have AudioRecord permission, please check", Toast.LENGTH_LONG).show(); | ||
| 843 | -// if(isCameraCheckFirst){ | ||
| 844 | -// //settingPermission(); | ||
| 845 | -// isCameraCheckFirst=false; | ||
| 846 | -// } | ||
| 847 | -// ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, | ||
| 848 | -// 1); | ||
| 849 | -// return false; | ||
| 850 | -// } | ||
| 851 | -// if(pCamera != PackageManager.PERMISSION_GRANTED) { | ||
| 852 | -// Log.e(TAG,"do not have CAMERA permission, please check"); | ||
| 853 | -// Toast.makeText(this,"do not have CAMERA permission, please check", Toast.LENGTH_LONG).show(); | ||
| 854 | -// if(isAudioCheckFirst){ | ||
| 855 | -// //settingPermission(); | ||
| 856 | -// isAudioCheckFirst=false; | ||
| 857 | -// } | ||
| 858 | -// return false; | ||
| 859 | -// | ||
| 860 | -// } | ||
| 861 | -// } catch (Exception e) { | ||
| 862 | -// e.printStackTrace(); | ||
| 863 | -// } | ||
| 864 | - | ||
| 865 | 873 | ||
| 866 | -// try { | ||
| 867 | -// if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) | ||
| 868 | -// != PackageManager.PERMISSION_GRANTED) { | ||
| 869 | -// // 第一次请求权限时,用户如果拒绝,下一次请求shouldShowRequestPermissionRationale()返回true | ||
| 870 | -// // 向用户解释为什么需要这个权限 | ||
| 871 | -// if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) { | ||
| 872 | -// | ||
| 873 | -// } else { | ||
| 874 | -// //申请相机权限 | ||
| 875 | -// ActivityCompat.requestPermissions(this, | ||
| 876 | -// new String[]{Manifest.permission.CAMERA}, CAMERA_REQUEST_CODE); | ||
| 877 | -// } | ||
| 878 | -// } | ||
| 879 | -// }catch ( Exception e){ | ||
| 880 | -// | ||
| 881 | -// } | ||
| 882 | - return true; | ||
| 883 | - } | ||
| 884 | 874 | ||
| 885 | - private void requestPermission() { | ||
| 886 | - if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) | ||
| 887 | - != PackageManager.PERMISSION_GRANTED) { | ||
| 888 | - // 第一次请求权限时,用户如果拒绝,下一次请求shouldShowRequestPermissionRationale()返回true | ||
| 889 | - // 向用户解释为什么需要这个权限 | ||
| 890 | - if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) { | ||
| 891 | - | ||
| 892 | - } else { | ||
| 893 | - //申请相机权限 | ||
| 894 | - ActivityCompat.requestPermissions(this, | ||
| 895 | - new String[]{Manifest.permission.CAMERA}, CAMERA_REQUEST_CODE); | ||
| 896 | - } | ||
| 897 | - } else { | ||
| 898 | -// tvPermissionStatus.setTextColor(Color.GREEN); | ||
| 899 | -// tvPermissionStatus.setText("相机权限已申请"); | ||
| 900 | - } | ||
| 901 | - } | ||
| 902 | 875 | ||
| 903 | @Override | 876 | @Override |
| 904 | public void observerUpData(String type, String parameter) { | 877 | public void observerUpData(String type, String parameter) { |
| @@ -919,6 +892,10 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -919,6 +892,10 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 919 | 892 | ||
| 920 | private boolean pause = true; | 893 | private boolean pause = true; |
| 921 | /** | 894 | /** |
| 895 | + * 回放消失时间 | ||
| 896 | + */ | ||
| 897 | + int TIME_OUT = 3600; | ||
| 898 | + /** | ||
| 922 | * 退出标记 | 899 | * 退出标记 |
| 923 | */ | 900 | */ |
| 924 | private boolean quit; | 901 | private boolean quit; |
| @@ -1094,8 +1071,6 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1094,8 +1071,6 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1094 | } | 1071 | } |
| 1095 | }; | 1072 | }; |
| 1096 | 1073 | ||
| 1097 | - int TIME_OUT = 3600; | ||
| 1098 | - | ||
| 1099 | /** | 1074 | /** |
| 1100 | * @param timeout 单位秒 | 1075 | * @param timeout 单位秒 |
| 1101 | */ | 1076 | */ |
| @@ -1113,9 +1088,12 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1113,9 +1088,12 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1113 | mHandler.sendEmptyMessage(SHOW_PROGRESS); | 1088 | mHandler.sendEmptyMessage(SHOW_PROGRESS); |
| 1114 | mMediaContainer.setVisibility(View.VISIBLE); | 1089 | mMediaContainer.setVisibility(View.VISIBLE); |
| 1115 | if (timeout != 0) { | 1090 | if (timeout != 0) { |
| 1116 | - mHandler.removeMessages(FADE_OUT); | ||
| 1117 | - mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), | ||
| 1118 | - timeout); | 1091 | + //平板回放不让进度条消失 |
| 1092 | + if(!isTablet(this)) { | ||
| 1093 | + mHandler.removeMessages(FADE_OUT); | ||
| 1094 | + mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), | ||
| 1095 | + timeout); | ||
| 1096 | + } | ||
| 1119 | } | 1097 | } |
| 1120 | } | 1098 | } |
| 1121 | 1099 | ||
| @@ -1286,12 +1264,19 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1286,12 +1264,19 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1286 | VideoPlayBean videoPlayBean = JsonUtil.parseJsonToBean(json_video, VideoPlayBean.class); | 1264 | VideoPlayBean videoPlayBean = JsonUtil.parseJsonToBean(json_video, VideoPlayBean.class); |
| 1287 | if (videoPlayBean != null) { | 1265 | if (videoPlayBean != null) { |
| 1288 | //回放不会出现Constants.PLAY_SUCCESS: | 1266 | //回放不会出现Constants.PLAY_SUCCESS: |
| 1289 | - if(Constants.HOST.equals(videoPlayBean.getUserRole())) { | ||
| 1290 | - if (img_playVideo_novideo != null) | ||
| 1291 | - img_playVideo_novideo.setVisibility(View.GONE); | ||
| 1292 | - if(isAudio){ | ||
| 1293 | - img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); | ||
| 1294 | - img_playVideo_novideo.setVisibility(View.VISIBLE); | 1267 | + if(classType==2||Constants.HOST.equals(videoPlayBean.getUserRole())) { |
| 1268 | + if(isTablet(this)){ | ||
| 1269 | + setTabletTeacherCover(false,false); | ||
| 1270 | + if (isAudio) { | ||
| 1271 | + setTabletTeacherCover(true,true); | ||
| 1272 | + } | ||
| 1273 | + }else { | ||
| 1274 | + if (img_playVideo_novideo != null) | ||
| 1275 | + img_playVideo_novideo.setVisibility(View.GONE); | ||
| 1276 | + if (isAudio) { | ||
| 1277 | + img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); | ||
| 1278 | + img_playVideo_novideo.setVisibility(View.VISIBLE); | ||
| 1279 | + } | ||
| 1295 | } | 1280 | } |
| 1296 | if (mVideoView.isPlaying()) { | 1281 | if (mVideoView.isPlaying()) { |
| 1297 | mVideoView.stopPlayback(); | 1282 | mVideoView.stopPlayback(); |
| @@ -1302,11 +1287,12 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1302,11 +1287,12 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1302 | mVideoView.seekTo(videoPlayBean.getSeek() * 1000); | 1287 | mVideoView.seekTo(videoPlayBean.getSeek() * 1000); |
| 1303 | } | 1288 | } |
| 1304 | mVideoView.start(); | 1289 | mVideoView.start(); |
| 1305 | - }else{ | 1290 | + }else if(classType==1&&!Constants.HOST.equals(videoPlayBean.getUserRole())){ |
| 1306 | //推流 回放 | 1291 | //推流 回放 |
| 1307 | // if (img_playVideo_novideo != null) { | 1292 | // if (img_playVideo_novideo != null) { |
| 1308 | // img_playVideo_novideo.setVisibility(View.GONE); | 1293 | // img_playVideo_novideo.setVisibility(View.GONE); |
| 1309 | // } | 1294 | // } |
| 1295 | + coverStudent(false); | ||
| 1310 | if (mPushVideoView != null) { | 1296 | if (mPushVideoView != null) { |
| 1311 | mPushVideoView.setVisibility(View.VISIBLE); | 1297 | mPushVideoView.setVisibility(View.VISIBLE); |
| 1312 | } | 1298 | } |
| @@ -1316,7 +1302,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1316,7 +1302,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1316 | if (mPushVideoView.isPlaying()) { | 1302 | if (mPushVideoView.isPlaying()) { |
| 1317 | mPushVideoView.stopPlayback(); | 1303 | mPushVideoView.stopPlayback(); |
| 1318 | } | 1304 | } |
| 1319 | - mPushVideoView.setVideoPath("http://123.56.73.119:6001/live/h5dev_1992614331_980_983042_1494927366/total.m3u8"); | 1305 | +// mPushVideoView.setVideoPath("http://123.56.73.119:6001/live/h5dev_1992614331_980_983042_1494927366/total.m3u8"); |
| 1306 | + mPushVideoView.setVideoPath(videoPlayBean.getReplay()); | ||
| 1320 | if (replay && videoPlayBean.getSeek() > 0) { | 1307 | if (replay && videoPlayBean.getSeek() > 0) { |
| 1321 | 1308 | ||
| 1322 | mPushVideoView.seekTo(videoPlayBean.getSeek() * 1000); | 1309 | mPushVideoView.seekTo(videoPlayBean.getSeek() * 1000); |
| @@ -1330,13 +1317,18 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1330,13 +1317,18 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1330 | mHandler.post(new Runnable() { | 1317 | mHandler.post(new Runnable() { |
| 1331 | @Override | 1318 | @Override |
| 1332 | public void run() { | 1319 | public void run() { |
| 1333 | - img_playVideo_novideo.setImageResource(R.mipmap.no_video); | ||
| 1334 | - img_playVideo_novideo.setVisibility(View.VISIBLE); | 1320 | + if(isTablet(VideoPlayActivity.this)){ |
| 1321 | + setTabletTeacherCover(true,false); | ||
| 1322 | + }else { | ||
| 1323 | + img_playVideo_novideo.setImageResource(R.mipmap.no_video); | ||
| 1324 | + img_playVideo_novideo.setVisibility(View.VISIBLE); | ||
| 1325 | + } | ||
| 1335 | } | 1326 | } |
| 1336 | }); | 1327 | }); |
| 1337 | //隐藏直播回放 | 1328 | //隐藏直播回放 |
| 1338 | mPushVideoView.setVisibility(View.GONE); | 1329 | mPushVideoView.setVisibility(View.GONE); |
| 1339 | - | 1330 | + //显示学生标志 |
| 1331 | + coverStudent(true); | ||
| 1340 | if (isPlayVideoMode && mVideoView != null && mVideoView.isPlaying()) { | 1332 | if (isPlayVideoMode && mVideoView != null && mVideoView.isPlaying()) { |
| 1341 | mVideoView.stopPlayback(); | 1333 | mVideoView.stopPlayback(); |
| 1342 | } | 1334 | } |
| @@ -1347,18 +1339,25 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1347,18 +1339,25 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1347 | } | 1339 | } |
| 1348 | 1340 | ||
| 1349 | public void stopAudio() { | 1341 | public void stopAudio() { |
| 1350 | - img_playVideo_novideo.setImageResource(R.mipmap.no_video); | ||
| 1351 | - img_playVideo_novideo.setVisibility(View.VISIBLE); | 1342 | + if(isTablet(this)){ |
| 1343 | + setTabletTeacherCover(true,false); | ||
| 1344 | + }else{ | ||
| 1345 | + img_playVideo_novideo.setImageResource(R.mipmap.no_video); | ||
| 1346 | + img_playVideo_novideo.setVisibility(View.VISIBLE); | ||
| 1347 | + } | ||
| 1348 | + | ||
| 1349 | + | ||
| 1352 | 1350 | ||
| 1353 | //隐藏直播回放 | 1351 | //隐藏直播回放 |
| 1354 | mPushVideoView.setVisibility(View.GONE); | 1352 | mPushVideoView.setVisibility(View.GONE); |
| 1355 | mIamgeView_PublishAudio.setVisibility(View.GONE); | 1353 | mIamgeView_PublishAudio.setVisibility(View.GONE); |
| 1356 | - | ||
| 1357 | - if (isPlayVideoMode && mVideoView != null && mVideoView.isPlaying()) { | 1354 | + //显示学生标志 |
| 1355 | + coverStudent(true); | ||
| 1356 | + if (!isPlayVideoMode && mVideoView != null && mVideoView.isPlaying()) { | ||
| 1358 | mVideoView.stopPlayback(); | 1357 | mVideoView.stopPlayback(); |
| 1359 | } | 1358 | } |
| 1360 | 1359 | ||
| 1361 | - if (isPlayVideoMode && mPushVideoView != null && mPushVideoView.isPlaying()) { | 1360 | + if (!isPlayVideoMode && mPushVideoView != null && mPushVideoView.isPlaying()) { |
| 1362 | mPushVideoView.stopPlayback(); | 1361 | mPushVideoView.stopPlayback(); |
| 1363 | } | 1362 | } |
| 1364 | 1363 | ||
| @@ -1398,17 +1397,27 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1398,17 +1397,27 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1398 | } | 1397 | } |
| 1399 | 1398 | ||
| 1400 | 1399 | ||
| 1401 | - /********************************平板*********************************************************/ | 1400 | + /******************************* *********************平板*********************************************************/ |
| 1402 | private LinearLayout llvideoPlayright; | 1401 | private LinearLayout llvideoPlayright; |
| 1403 | private FrameLayout fra_videoPlay_student_cover; | 1402 | private FrameLayout fra_videoPlay_student_cover; |
| 1404 | /*打开音频*/ | 1403 | /*打开音频*/ |
| 1405 | private FrameLayout fra_videoPlay_start_audio; | 1404 | private FrameLayout fra_videoPlay_start_audio; |
| 1406 | - /*推流*/ | 1405 | + /*显示文档*/ |
| 1406 | + private LinearLayout ll_videoPlay_tablet_doc; | ||
| 1407 | + /*tablet 老师视频播放遮盖*/ | ||
| 1408 | + private FrameLayout fra_playVideo_novideo_tablet; | ||
| 1409 | + /*tablet 老师视频播放遮盖图片*/ | ||
| 1410 | + private ImageView img_playVideo_novideo_tablet; | ||
| 1411 | + | ||
| 1412 | + /*教师播放窗口*/ | ||
| 1413 | + private RelativeLayout rel_videoPlay_play; | ||
| 1414 | + /*推流端窗口*/ | ||
| 1407 | private RelativeLayout rel_videoPlay_publish; | 1415 | private RelativeLayout rel_videoPlay_publish; |
| 1408 | public void initTablet(){ | 1416 | public void initTablet(){ |
| 1409 | if(!isTablet(this)){ | 1417 | if(!isTablet(this)){ |
| 1410 | return; | 1418 | return; |
| 1411 | } | 1419 | } |
| 1420 | + XdyLogUtil.e("classType: ","课堂类型:"+classType); | ||
| 1412 | //如果是横排,则改为竖排 | 1421 | //如果是横排,则改为竖排 |
| 1413 | if(getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) | 1422 | if(getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) |
| 1414 | { | 1423 | { |
| @@ -1421,16 +1430,17 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1421,16 +1430,17 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1421 | int offset=30;//默认偏移 | 1430 | int offset=30;//默认偏移 |
| 1422 | double ratio_tablet=(winWidth*1.0)/winHeight; | 1431 | double ratio_tablet=(winWidth*1.0)/winHeight; |
| 1423 | double ratio_width=4; | 1432 | double ratio_width=4; |
| 1433 | + | ||
| 1424 | llVideo_table_chat= (LinearLayout) findViewById(R.id.ll_videoPlay_tablet_chat); | 1434 | llVideo_table_chat= (LinearLayout) findViewById(R.id.ll_videoPlay_tablet_chat); |
| 1425 | llvideoPlayright= (LinearLayout) findViewById(R.id.ll_videoPlay_right); | 1435 | llvideoPlayright= (LinearLayout) findViewById(R.id.ll_videoPlay_right); |
| 1426 | fra_videoPlay_student_cover= (FrameLayout) findViewById(R.id.fra_videoPlay_student_cover); | 1436 | fra_videoPlay_student_cover= (FrameLayout) findViewById(R.id.fra_videoPlay_student_cover); |
| 1427 | fra_videoPlay_start_audio= (FrameLayout) findViewById(R.id.fra_videoPlay_start_audio); | 1437 | fra_videoPlay_start_audio= (FrameLayout) findViewById(R.id.fra_videoPlay_start_audio); |
| 1428 | rel_videoPlay_publish= (RelativeLayout) findViewById(R.id.rel_videoPlay_publish); | 1438 | rel_videoPlay_publish= (RelativeLayout) findViewById(R.id.rel_videoPlay_publish); |
| 1429 | - if(replay){ | ||
| 1430 | - rel_videoPlay_publish.setVisibility(View.GONE); | ||
| 1431 | - }else { | ||
| 1432 | - rel_videoPlay_publish.setVisibility(View.VISIBLE); | ||
| 1433 | - } | 1439 | + ll_videoPlay_tablet_doc= (LinearLayout) findViewById(R.id.ll_videoPlay_tablet_doc); |
| 1440 | + fra_playVideo_novideo_tablet= (FrameLayout) findViewById(R.id.fra_playVideo_novideo_tablet); | ||
| 1441 | + img_playVideo_novideo_tablet= (ImageView) findViewById(R.id.img_playVideo_novideo_tablet); | ||
| 1442 | + rel_videoPlay_play= (RelativeLayout) findViewById(R.id.rel_videoPlay_play); | ||
| 1443 | + rel_videoPlay_publish= (RelativeLayout) findViewById(R.id.rel_videoPlay_publish); | ||
| 1434 | if(ratio_tablet>1.4){ | 1444 | if(ratio_tablet>1.4){ |
| 1435 | //偏移尽量小,或者偏移不 | 1445 | //偏移尽量小,或者偏移不 |
| 1436 | offset=30; | 1446 | offset=30; |
| @@ -1439,13 +1449,27 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1439,13 +1449,27 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1439 | offset=75; | 1449 | offset=75; |
| 1440 | ratio_width=4; | 1450 | ratio_width=4; |
| 1441 | } | 1451 | } |
| 1442 | - XdyLogUtil.e("学点云Tablet:",""+winWidth/4+"::"+(5*winWidth)/(16)+":"+winWidth+"offset:"+offset+"ratio_width:"+ratio_width); | 1452 | + XdyLogUtil.e("学点云Tablet:",winWidth/(ratio_width*(4/5))+":"+(int)((winWidth/ratio_width)*(4/5))+""+winWidth/4+"::"+(5*winWidth)/(16)+":"+winWidth+"offset:"+offset+"ratio_width:"+ratio_width); |
| 1443 | RelativeLayout.LayoutParams layoutParams_right=new RelativeLayout.LayoutParams((int) (winWidth/ratio_width), RelativeLayout.LayoutParams.MATCH_PARENT); | 1453 | RelativeLayout.LayoutParams layoutParams_right=new RelativeLayout.LayoutParams((int) (winWidth/ratio_width), RelativeLayout.LayoutParams.MATCH_PARENT); |
| 1444 | layoutParams_right.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); | 1454 | layoutParams_right.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); |
| 1445 | layoutParams_right.setMargins(0,0,XdyStringUtils.dp2px(this,5),0); | 1455 | layoutParams_right.setMargins(0,0,XdyStringUtils.dp2px(this,5),0); |
| 1446 | llvideoPlayright.setLayoutParams(layoutParams_right); | 1456 | llvideoPlayright.setLayoutParams(layoutParams_right); |
| 1447 | 1457 | ||
| 1448 | - LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams((int)(winWidth/ratio_width),(int)(winWidth/ratio_width+offset)); | 1458 | + //教师播放界面设置 |
| 1459 | + LinearLayout.LayoutParams layoutParams_teacher=new LinearLayout.LayoutParams((int) (winWidth/ratio_width), (int)(winWidth/(ratio_width+1.1))); | ||
| 1460 | +// layoutParams_teacher.setMargins(0,XdyStringUtils.dp2px(this,8),0,0); | ||
| 1461 | + rel_videoPlay_play.setLayoutParams(layoutParams_teacher); | ||
| 1462 | + | ||
| 1463 | + if(classType==1) { | ||
| 1464 | + //学生推流播放界面设置 | ||
| 1465 | + LinearLayout.LayoutParams layoutParams_student = new LinearLayout.LayoutParams((int) (winWidth / ratio_width), (int) (winWidth / (ratio_width + 1.1))); | ||
| 1466 | + layoutParams_student.setMargins(0, XdyStringUtils.dp2px(this, 8), 0, 0); | ||
| 1467 | + rel_videoPlay_publish.setLayoutParams(layoutParams_student); | ||
| 1468 | + }else{ | ||
| 1469 | + rel_videoPlay_publish.setVisibility(View.GONE); | ||
| 1470 | + } | ||
| 1471 | + | ||
| 1472 | + LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams((int)(winWidth/ratio_width), ViewGroup.LayoutParams.MATCH_PARENT); | ||
| 1449 | layoutParams.setMargins(0,XdyStringUtils.dp2px(this,8),0,0); | 1473 | layoutParams.setMargins(0,XdyStringUtils.dp2px(this,8),0,0); |
| 1450 | llVideo_table_chat.setLayoutParams(layoutParams); | 1474 | llVideo_table_chat.setLayoutParams(layoutParams); |
| 1451 | 1475 | ||
| @@ -1453,8 +1477,47 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1453,8 +1477,47 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1453 | FragmentTransaction transaction = fm.beginTransaction(); | 1477 | FragmentTransaction transaction = fm.beginTransaction(); |
| 1454 | transaction.add(R.id.ll_videoPlay_tablet_chat,ChatFragment.newInstance(replay),"tag"); | 1478 | transaction.add(R.id.ll_videoPlay_tablet_chat,ChatFragment.newInstance(replay),"tag"); |
| 1455 | transaction.commit(); | 1479 | transaction.commit(); |
| 1480 | + hideKeyboard(); | ||
| 1481 | + setTabletTeacherCover(true,false); | ||
| 1456 | setListenerPublishAudio(); | 1482 | setListenerPublishAudio(); |
| 1457 | } | 1483 | } |
| 1484 | + /*Tablet 设置类型*/ | ||
| 1485 | + public void setTabletType(){ | ||
| 1486 | + if(!isTablet(this)){ | ||
| 1487 | + return; | ||
| 1488 | + } | ||
| 1489 | + if(replay){ | ||
| 1490 | + //直播课堂隐藏这个推流界面, 1v1 回放隐藏推流按钮 | ||
| 1491 | + tabletShowAudio(false); | ||
| 1492 | + if(classType==2) { | ||
| 1493 | + rel_videoPlay_publish.setVisibility(View.GONE); | ||
| 1494 | + }else if(classType==1){ | ||
| 1495 | + rel_videoPlay_publish.setVisibility(View.VISIBLE); | ||
| 1496 | + fra_videoPlay_start.setVisibility(View.GONE); | ||
| 1497 | + } | ||
| 1498 | + }else { | ||
| 1499 | + if(classType==2) { | ||
| 1500 | + rel_videoPlay_publish.setVisibility(View.GONE); | ||
| 1501 | + }else if(classType==1) { | ||
| 1502 | + rel_videoPlay_publish.setVisibility(View.VISIBLE); | ||
| 1503 | + } | ||
| 1504 | + } | ||
| 1505 | + } | ||
| 1506 | + | ||
| 1507 | + public void setTabletTeacherCover(boolean isShow,boolean iaAudio){ | ||
| 1508 | + if(isShow){ | ||
| 1509 | + //显示对 | ||
| 1510 | + img_playVideo_novideo.setVisibility(View.GONE); | ||
| 1511 | + fra_playVideo_novideo_tablet.setVisibility(View.VISIBLE); | ||
| 1512 | + if(iaAudio){ | ||
| 1513 | + img_playVideo_novideo_tablet.setImageResource(R.mipmap.audio_icon_tablet); | ||
| 1514 | + }else{ | ||
| 1515 | + img_playVideo_novideo_tablet.setImageResource(R.mipmap.video_teacher_icon); | ||
| 1516 | + } | ||
| 1517 | + }else{ | ||
| 1518 | + fra_playVideo_novideo_tablet.setVisibility(View.GONE); | ||
| 1519 | + } | ||
| 1520 | + } | ||
| 1458 | /*打开音频*/ | 1521 | /*打开音频*/ |
| 1459 | public void setListenerPublishAudio(){ | 1522 | public void setListenerPublishAudio(){ |
| 1460 | fra_videoPlay_start_audio.setOnClickListener(new View.OnClickListener() { | 1523 | fra_videoPlay_start_audio.setOnClickListener(new View.OnClickListener() { |
| @@ -1470,9 +1533,9 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1470,9 +1533,9 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1470 | return; | 1533 | return; |
| 1471 | } | 1534 | } |
| 1472 | if(show){ | 1535 | if(show){ |
| 1473 | - fra_videoPlay_start_audio.setVisibility(View.GONE); | ||
| 1474 | - }else{ | ||
| 1475 | fra_videoPlay_start_audio.setVisibility(View.VISIBLE); | 1536 | fra_videoPlay_start_audio.setVisibility(View.VISIBLE); |
| 1537 | + }else{ | ||
| 1538 | + fra_videoPlay_start_audio.setVisibility(View.GONE); | ||
| 1476 | } | 1539 | } |
| 1477 | } | 1540 | } |
| 1478 | 1541 | ||
| @@ -1483,9 +1546,9 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1483,9 +1546,9 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1483 | return; | 1546 | return; |
| 1484 | } | 1547 | } |
| 1485 | if(show) { | 1548 | if(show) { |
| 1486 | - fra_videoPlay_student_cover.setVisibility(View.GONE); | ||
| 1487 | - }else{ | ||
| 1488 | fra_videoPlay_student_cover.setVisibility(View.VISIBLE); | 1549 | fra_videoPlay_student_cover.setVisibility(View.VISIBLE); |
| 1550 | + }else{ | ||
| 1551 | + fra_videoPlay_student_cover.setVisibility(View.GONE); | ||
| 1489 | } | 1552 | } |
| 1490 | } | 1553 | } |
| 1491 | /** | 1554 | /** |
| @@ -1498,15 +1561,23 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1498,15 +1561,23 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1498 | } | 1561 | } |
| 1499 | /******************************************************公共**********************************/ | 1562 | /******************************************************公共**********************************/ |
| 1500 | 1563 | ||
| 1501 | - | ||
| 1502 | /*推送视频*/ | 1564 | /*推送视频*/ |
| 1503 | public void publishVideo(){ | 1565 | public void publishVideo(){ |
| 1504 | //填写事件 | 1566 | //填写事件 |
| 1505 | - if (!checkPermission()) { | ||
| 1506 | - return; | 1567 | + isPublsishVideoMode = true; |
| 1568 | + if(!isPushVideoPermission) { | ||
| 1569 | + if (!checkPermissionVideo()) { | ||
| 1570 | + return; | ||
| 1571 | + } | ||
| 1507 | } | 1572 | } |
| 1508 | - coverStudent(true); | ||
| 1509 | - tabletShowAudio(true); | 1573 | + |
| 1574 | + if(!isPushAudioPermission){ | ||
| 1575 | + if(!checkAudioPermission()){ | ||
| 1576 | + return; | ||
| 1577 | + } | ||
| 1578 | + } | ||
| 1579 | + coverStudent(false); | ||
| 1580 | + tabletShowAudio(false); | ||
| 1510 | mFramenLayout_stopPublish.setVisibility(View.VISIBLE); | 1581 | mFramenLayout_stopPublish.setVisibility(View.VISIBLE); |
| 1511 | fra_videoPlay_start.setVisibility(View.GONE); | 1582 | fra_videoPlay_start.setVisibility(View.GONE); |
| 1512 | surfaceView_publish.setVisibility(View.VISIBLE); | 1583 | surfaceView_publish.setVisibility(View.VISIBLE); |
| @@ -1516,15 +1587,23 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1516,15 +1587,23 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1516 | sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); | 1587 | sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); |
| 1517 | surfaceView_publish.setZOrderMediaOverlay(true); | 1588 | surfaceView_publish.setZOrderMediaOverlay(true); |
| 1518 | xdySdk.api("publishVideo", "", surfaceView_publish, VideoPlayActivity.this); | 1589 | xdySdk.api("publishVideo", "", surfaceView_publish, VideoPlayActivity.this); |
| 1519 | - isPublsishVideoMode = true; | 1590 | + |
| 1591 | + isPushVideoPermission=false; | ||
| 1592 | + isPushAudioPermission=false; | ||
| 1520 | } | 1593 | } |
| 1594 | + | ||
| 1595 | + public boolean isPushVideoPermission =false; | ||
| 1596 | + private boolean isPushAudioPermission=false; | ||
| 1521 | /*推送音频*/ | 1597 | /*推送音频*/ |
| 1522 | public void publishAudio(){ | 1598 | public void publishAudio(){ |
| 1523 | - if (!checkPermission()) { | ||
| 1524 | - return; | 1599 | + isPublsishVideoMode = false; |
| 1600 | + if(!isPushAudioPermission){ | ||
| 1601 | + if(!checkAudioPermission()){ | ||
| 1602 | + return; | ||
| 1603 | + } | ||
| 1525 | } | 1604 | } |
| 1526 | - coverStudent(true); | ||
| 1527 | - tabletShowAudio(true); | 1605 | + coverStudent(false); |
| 1606 | + tabletShowAudio(false); | ||
| 1528 | mFramenLayout_stopPublish.setVisibility(View.VISIBLE); | 1607 | mFramenLayout_stopPublish.setVisibility(View.VISIBLE); |
| 1529 | fra_videoPlay_start.setVisibility(View.GONE); | 1608 | fra_videoPlay_start.setVisibility(View.GONE); |
| 1530 | surfaceView_publish.setVisibility(View.GONE); | 1609 | surfaceView_publish.setVisibility(View.GONE); |
| @@ -1532,7 +1611,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1532,7 +1611,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1532 | fra_videoPlay_start.setEnabled(false); | 1611 | fra_videoPlay_start.setEnabled(false); |
| 1533 | mFramenLayout_stopPublish.setEnabled(true); | 1612 | mFramenLayout_stopPublish.setEnabled(true); |
| 1534 | xdySdk.api(Constants.PUBLISH_AUDIO, "", null, VideoPlayActivity.this); | 1613 | xdySdk.api(Constants.PUBLISH_AUDIO, "", null, VideoPlayActivity.this); |
| 1535 | - isPublsishVideoMode = false; | 1614 | + |
| 1615 | + isPushAudioPermission=false; | ||
| 1536 | } | 1616 | } |
| 1537 | /*停止推流*/ | 1617 | /*停止推流*/ |
| 1538 | public void stopPublish(){ | 1618 | public void stopPublish(){ |
| @@ -1541,13 +1621,116 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | @@ -1541,13 +1621,116 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe | ||
| 1541 | } else { | 1621 | } else { |
| 1542 | xdySdk.api("stopPublishAudio", ""); | 1622 | xdySdk.api("stopPublishAudio", ""); |
| 1543 | } | 1623 | } |
| 1544 | - coverStudent(false); | 1624 | + coverStudent(true); |
| 1545 | fra_videoPlay_start.setEnabled(true); | 1625 | fra_videoPlay_start.setEnabled(true); |
| 1546 | mFramenLayout_stopPublish.setEnabled(false); | 1626 | mFramenLayout_stopPublish.setEnabled(false); |
| 1547 | mFramenLayout_stopPublish.setVisibility(View.GONE); | 1627 | mFramenLayout_stopPublish.setVisibility(View.GONE); |
| 1548 | fra_videoPlay_start.setVisibility(View.VISIBLE); | 1628 | fra_videoPlay_start.setVisibility(View.VISIBLE); |
| 1549 | surfaceView_publish.setVisibility(View.GONE); | 1629 | surfaceView_publish.setVisibility(View.GONE); |
| 1550 | mIamgeView_PublishAudio.setVisibility(View.GONE); | 1630 | mIamgeView_PublishAudio.setVisibility(View.GONE); |
| 1551 | - tabletShowAudio(false); | 1631 | + tabletShowAudio(true); |
| 1552 | } | 1632 | } |
| 1633 | + /** | ||
| 1634 | + * 隐藏软键盘 | ||
| 1635 | + */ | ||
| 1636 | + public void hideKeyboard() { | ||
| 1637 | + InputMethodManager imm = (InputMethodManager) this | ||
| 1638 | + .getSystemService(Context.INPUT_METHOD_SERVICE); | ||
| 1639 | + if (imm.isActive() && this.getCurrentFocus() != null) { | ||
| 1640 | + imm.hideSoftInputFromWindow(this.getCurrentFocus() | ||
| 1641 | + .getWindowToken(), 0); | ||
| 1642 | + } | ||
| 1643 | + | ||
| 1644 | + } | ||
| 1645 | + | ||
| 1646 | + @Override | ||
| 1647 | + public void onConfigurationChanged(Configuration newConfig) { | ||
| 1648 | + super.onConfigurationChanged(newConfig); | ||
| 1649 | +// getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);//不自动弹出软键盘 | ||
| 1650 | + } | ||
| 1651 | + @PermissionSuccess(requestCode = PER_CAMERA) | ||
| 1652 | + private void grantPermissionSuccess(){ | ||
| 1653 | + Toast.makeText(this,"已获照相机得权限",Toast.LENGTH_SHORT).show(); | ||
| 1654 | + } | ||
| 1655 | + private final int PER_CAMERA = 3; | ||
| 1656 | + @PermissionFail(requestCode = PER_CAMERA) | ||
| 1657 | + private void grantPersmissionFail(){ | ||
| 1658 | + Toast.makeText(this,"照相机权限被拒绝",Toast.LENGTH_SHORT).show(); | ||
| 1659 | + } | ||
| 1660 | + | ||
| 1661 | + /*获取Video*/ | ||
| 1662 | + private boolean checkPermissionVideo() { | ||
| 1663 | + boolean isCreame=true; | ||
| 1664 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
| 1665 | + if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) | ||
| 1666 | + != PackageManager.PERMISSION_GRANTED) { | ||
| 1667 | + // 第一次请求权限时,用户如果拒绝,下一次请求shouldShowRequestPermissionRationale()返回true | ||
| 1668 | + // 向用户解释为什么需要这个权限 | ||
| 1669 | + if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) { | ||
| 1670 | + isCreame=false; | ||
| 1671 | + ToastUtil.showToastshort(getResources().getString(R.string.request_permission_video), VideoPlayActivity.this); | ||
| 1672 | + } else { | ||
| 1673 | + //申请相机权限 | ||
| 1674 | + isCreame=false; | ||
| 1675 | + ActivityCompat.requestPermissions(this, | ||
| 1676 | + new String[]{Manifest.permission.CAMERA}, CAMERA_REQUEST_CODE); | ||
| 1677 | + } | ||
| 1678 | + } | ||
| 1679 | + } | ||
| 1680 | + return isCreame; | ||
| 1681 | + } | ||
| 1682 | + /*检查音频权限*/ | ||
| 1683 | + private boolean checkAudioPermission() { | ||
| 1684 | + boolean isCreame=true; | ||
| 1685 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
| 1686 | + if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) | ||
| 1687 | + != PackageManager.PERMISSION_GRANTED) { | ||
| 1688 | + // 第一次请求权限时,用户如果拒绝,下一次请求shouldShowRequestPermissionRationale()返回true | ||
| 1689 | + // 向用户解释为什么需要这个权限 | ||
| 1690 | + if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.RECORD_AUDIO)) { | ||
| 1691 | + isCreame=false; | ||
| 1692 | + ToastUtil.showToastshort(getResources().getString(R.string.rquest_permission_audio), VideoPlayActivity.this); | ||
| 1693 | + } else { | ||
| 1694 | + //申请相机权限 | ||
| 1695 | + isCreame=false; | ||
| 1696 | + ActivityCompat.requestPermissions(this, | ||
| 1697 | + new String[]{Manifest.permission.RECORD_AUDIO}, AUDIO_REQUEST_CODE); | ||
| 1698 | + } | ||
| 1699 | + } | ||
| 1700 | + } | ||
| 1701 | + return isCreame; | ||
| 1702 | + } | ||
| 1703 | + @Override | ||
| 1704 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||
| 1705 | + switch (requestCode){ | ||
| 1706 | + case CAMERA_REQUEST_CODE: | ||
| 1707 | + if(grantResults[0] == PackageManager.PERMISSION_GRANTED){ | ||
| 1708 | + //去播流 | ||
| 1709 | + isPushVideoPermission =true; | ||
| 1710 | + publishVideo(); | ||
| 1711 | + }else{ | ||
| 1712 | + //啥也不做 | ||
| 1713 | + ToastUtil.showToastshort(getResources().getString(R.string.request_permission_video),this); | ||
| 1714 | + } | ||
| 1715 | + break; | ||
| 1716 | + | ||
| 1717 | + case AUDIO_REQUEST_CODE: | ||
| 1718 | + if(grantResults[0] == PackageManager.PERMISSION_GRANTED){ | ||
| 1719 | + //去播流 | ||
| 1720 | + isPushAudioPermission=true; | ||
| 1721 | + if(isPublsishVideoMode) { | ||
| 1722 | + publishVideo(); | ||
| 1723 | + }else{ | ||
| 1724 | + publishAudio(); | ||
| 1725 | + } | ||
| 1726 | + }else{ | ||
| 1727 | + //啥也不做 | ||
| 1728 | + ToastUtil.showToastshort(getResources().getString(R.string.rquest_permission_audio),this); | ||
| 1729 | + } | ||
| 1730 | + break; | ||
| 1731 | + | ||
| 1732 | + } | ||
| 1733 | + } | ||
| 1734 | + | ||
| 1735 | + | ||
| 1553 | } | 1736 | } |
MyApplication/xuedianyun/src/main/java/com/mang/xuedianyun/android/permission/PermissionFail.java
0 → 100644
| 1 | +package com.mang.xuedianyun.android.permission; | ||
| 2 | + | ||
| 3 | +import java.lang.annotation.ElementType; | ||
| 4 | +import java.lang.annotation.Retention; | ||
| 5 | +import java.lang.annotation.RetentionPolicy; | ||
| 6 | +import java.lang.annotation.Target; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 标识权限获取失败 | ||
| 10 | + */ | ||
| 11 | +@Target(ElementType.METHOD) | ||
| 12 | +@Retention(RetentionPolicy.RUNTIME) | ||
| 13 | +public @interface PermissionFail { | ||
| 14 | + int requestCode(); | ||
| 15 | +} |
MyApplication/xuedianyun/src/main/java/com/mang/xuedianyun/android/permission/PermissionSuccess.java
0 → 100644
| 1 | +package com.mang.xuedianyun.android.permission; | ||
| 2 | + | ||
| 3 | +import java.lang.annotation.ElementType; | ||
| 4 | +import java.lang.annotation.Retention; | ||
| 5 | +import java.lang.annotation.RetentionPolicy; | ||
| 6 | +import java.lang.annotation.Target; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 标识权限获取成功 | ||
| 10 | + */ | ||
| 11 | +@Retention(RetentionPolicy.RUNTIME) | ||
| 12 | +@Target(ElementType.METHOD) | ||
| 13 | +public @interface PermissionSuccess { | ||
| 14 | + int requestCode(); | ||
| 15 | +} |
MyApplication/xuedianyun/src/main/java/com/mang/xuedianyun/android/permission/PermissionUtil.java
0 → 100644
| 1 | +package com.mang.xuedianyun.android.permission; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.content.pm.PackageManager; | ||
| 6 | +import android.os.Build; | ||
| 7 | +import android.support.annotation.NonNull; | ||
| 8 | +import android.support.v4.app.ActivityCompat; | ||
| 9 | +import android.support.v4.app.Fragment; | ||
| 10 | +import android.support.v4.content.ContextCompat; | ||
| 11 | + | ||
| 12 | +import java.lang.reflect.Method; | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 权限工具类 | ||
| 17 | + */ | ||
| 18 | +public class PermissionUtil { | ||
| 19 | + | ||
| 20 | + public static void needPermission(Fragment context, int reqCode, String... permissions) { | ||
| 21 | + needPermission(context.getActivity(), reqCode, permissions); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public static void needPermission(Activity context, int reqCode, String... permissions) { | ||
| 25 | + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { | ||
| 26 | + //6.0以下版本不需要代码申请权限 | ||
| 27 | + executeSuccessResult(context, reqCode); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + boolean granted = hasPermission(context, permissions);//检查权限 | ||
| 31 | + if (granted) { | ||
| 32 | + //已获得权限 | ||
| 33 | + executeSuccessResult(context, reqCode); | ||
| 34 | + } else { | ||
| 35 | + //申请权限 | ||
| 36 | + ActivityCompat.requestPermissions(context, permissions, reqCode); | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + private static void executeSuccessResult(Object context, int reqCode) { | ||
| 41 | + Method successMethod = getTargetMethod(context, reqCode,PermissionSuccess.class); | ||
| 42 | + try { | ||
| 43 | + successMethod.invoke(context); | ||
| 44 | + } catch (Exception e) { | ||
| 45 | + e.printStackTrace(); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + private static void executeFailResult(Object context, int reqCode) { | ||
| 50 | + Method successMethod = getTargetMethod(context, reqCode,PermissionFail.class); | ||
| 51 | + try { | ||
| 52 | + successMethod.invoke(context); | ||
| 53 | + } catch (Exception e) { | ||
| 54 | + e.printStackTrace(); | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + private static Method getTargetMethod(Object context, int reqCode, Class annotation) { | ||
| 59 | + Method[] declaredMethods = context.getClass().getDeclaredMethods(); | ||
| 60 | + for (Method method : declaredMethods) { | ||
| 61 | + if (!method.isAccessible()) { | ||
| 62 | + method.setAccessible(true); //私有的方法必须强制 | ||
| 63 | + } | ||
| 64 | + //判断方法上是否使用了目标注解 | ||
| 65 | + boolean annotationPresent = method.isAnnotationPresent(annotation); | ||
| 66 | + if (annotationPresent) { | ||
| 67 | + if (isTargetMethod(method,reqCode,annotation)) { //比较requestCode是否相等 | ||
| 68 | + return method; | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + return null; | ||
| 73 | + } | ||
| 74 | + private static boolean isTargetMethod(Method method, int reqCode, Class cls){ | ||
| 75 | + if(cls.equals(PermissionSuccess.class)){ | ||
| 76 | + return reqCode == method.getAnnotation(PermissionSuccess.class).requestCode(); | ||
| 77 | + }else if(cls.equals(PermissionFail.class)){ | ||
| 78 | + return reqCode == method.getAnnotation(PermissionFail.class).requestCode(); | ||
| 79 | + } | ||
| 80 | + return false; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + private static boolean hasPermission(Context context, String... permissions) { | ||
| 85 | + for (String permission : permissions) { | ||
| 86 | + int granted = ContextCompat.checkSelfPermission(context, permission); | ||
| 87 | + if (granted == PackageManager.PERMISSION_DENIED) { | ||
| 88 | + return false; | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + return true; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + | ||
| 95 | + public static void onRequestPermissionsResult(Fragment context, int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||
| 96 | + onRequestPermissionsResult(context, requestCode, permissions, grantResults); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public static void onRequestPermissionsResult(Activity context, int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||
| 100 | + boolean permissionGranted = true; | ||
| 101 | + for (int grant : grantResults) { | ||
| 102 | + if (grant == PackageManager.PERMISSION_DENIED) { | ||
| 103 | + permissionGranted = false; | ||
| 104 | + break; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + if (permissionGranted) { | ||
| 108 | + //获得权限 | ||
| 109 | + executeSuccessResult(context, requestCode); | ||
| 110 | + } else { | ||
| 111 | + //权限被用户拒绝 | ||
| 112 | + executeFailResult(context, requestCode); | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | +} |
-
请 注册 或 登录 后发表评论