huangxinbao

add for Tablet layout

@@ -6,20 +6,6 @@ @@ -6,20 +6,6 @@
6 <option name="distributionType" value="LOCAL" /> 6 <option name="distributionType" value="LOCAL" />
7 <option name="externalProjectPath" value="$PROJECT_DIR$" /> 7 <option name="externalProjectPath" value="$PROJECT_DIR$" />
8 <option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" /> 8 <option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" />
9 - <option name="modules">  
10 - <set>  
11 - <option value="$PROJECT_DIR$" />  
12 - <option value="$PROJECT_DIR$/XdyDemo" />  
13 - <option value="$PROJECT_DIR$/app" />  
14 - <option value="$PROJECT_DIR$/easeUI_CN" />  
15 - <option value="$PROJECT_DIR$/iOS_Dialog_Library" />  
16 - <option value="$PROJECT_DIR$/myapplication2" />  
17 - <option value="$PROJECT_DIR$/mylibrary" />  
18 - <option value="$PROJECT_DIR$/sdklibraryssss" />  
19 - <option value="$PROJECT_DIR$/smartPlayer" />  
20 - <option value="$PROJECT_DIR$/xdy" />  
21 - </set>  
22 - </option>  
23 <option name="resolveModulePerSourceSet" value="false" /> 9 <option name="resolveModulePerSourceSet" value="false" />
24 </GradleProjectSettings> 10 </GradleProjectSettings>
25 </option> 11 </option>
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 <ConfirmationsSetting value="0" id="Add" /> 10 <ConfirmationsSetting value="0" id="Add" />
11 <ConfirmationsSetting value="0" id="Remove" /> 11 <ConfirmationsSetting value="0" id="Remove" />
12 </component> 12 </component>
13 - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> 13 + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="true" assert-keyword="false" jdk-15="false">
14 <output url="file://$PROJECT_DIR$/build/classes" /> 14 <output url="file://$PROJECT_DIR$/build/classes" />
15 </component> 15 </component>
16 <component name="ProjectType"> 16 <component name="ProjectType">
@@ -3,15 +3,6 @@ @@ -3,15 +3,6 @@
3 <component name="ProjectModuleManager"> 3 <component name="ProjectModuleManager">
4 <modules> 4 <modules>
5 <module fileurl="file://$PROJECT_DIR$/MyApplication.iml" filepath="$PROJECT_DIR$/MyApplication.iml" /> 5 <module fileurl="file://$PROJECT_DIR$/MyApplication.iml" filepath="$PROJECT_DIR$/MyApplication.iml" />
6 - <module fileurl="file://$PROJECT_DIR$/XdyDemo/XdyDemo.iml" filepath="$PROJECT_DIR$/XdyDemo/XdyDemo.iml" />  
7 - <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />  
8 - <module fileurl="file://$PROJECT_DIR$/easeUI_CN/easeUI_CN.iml" filepath="$PROJECT_DIR$/easeUI_CN/easeUI_CN.iml" />  
9 - <module fileurl="file://$PROJECT_DIR$/iOS_Dialog_Library/iOS_Dialog_Library.iml" filepath="$PROJECT_DIR$/iOS_Dialog_Library/iOS_Dialog_Library.iml" />  
10 - <module fileurl="file://$PROJECT_DIR$/myapplication2/myapplication2.iml" filepath="$PROJECT_DIR$/myapplication2/myapplication2.iml" />  
11 - <module fileurl="file://$PROJECT_DIR$/mylibrary/mylibrary.iml" filepath="$PROJECT_DIR$/mylibrary/mylibrary.iml" />  
12 - <module fileurl="file://$PROJECT_DIR$/sdklibraryssss/sdklibraryssss.iml" filepath="$PROJECT_DIR$/sdklibraryssss/sdklibraryssss.iml" />  
13 - <module fileurl="file://$PROJECT_DIR$/smartPlayer/smartPlayer.iml" filepath="$PROJECT_DIR$/smartPlayer/smartPlayer.iml" />  
14 - <module fileurl="file://$PROJECT_DIR$/xdy/xdy.iml" filepath="$PROJECT_DIR$/xdy/xdy.iml" />  
15 </modules> 6 </modules>
16 </component> 7 </component>
17 </project> 8 </project>
@@ -42,7 +42,9 @@ @@ -42,7 +42,9 @@
42 android:label="@string/app_name" 42 android:label="@string/app_name"
43 android:supportsRtl="true" 43 android:supportsRtl="true"
44 android:theme="@style/AppTheme"> 44 android:theme="@style/AppTheme">
45 - <activity android:name=".MainActivity"> 45 + <activity android:name=".MainActivity"
  46 +
  47 + android:screenOrientation="portrait">
46 <intent-filter> 48 <intent-filter>
47 <action android:name="android.intent.action.MAIN" /> 49 <action android:name="android.intent.action.MAIN" />
48 50
@@ -50,13 +52,9 @@ @@ -50,13 +52,9 @@
50 </intent-filter> 52 </intent-filter>
51 </activity> 53 </activity>
52 <activity android:name=".activity.VideoPlayActivity" 54 <activity android:name=".activity.VideoPlayActivity"
53 - android:screenOrientation="portrait" 55 + android:screenOrientation="landscape"
54 > 56 >
55 </activity> 57 </activity>
56 - <activity android:name=".activity.VideoPublisherActivity"  
57 - android:screenOrientation="portrait"></activity>  
58 - <activity android:name=".activity.AudioPublisherActivity"  
59 - android:screenOrientation="portrait"/>  
60 </application> 58 </application>
61 59
62 </manifest> 60 </manifest>
1 package com.mang.xdy.demo; 1 package com.mang.xdy.demo;
2 2
  3 +import android.content.Context;
3 import android.content.Intent; 4 import android.content.Intent;
  5 +import android.content.res.Configuration;
4 import android.os.Bundle; 6 import android.os.Bundle;
5 import android.support.v7.app.AppCompatActivity; 7 import android.support.v7.app.AppCompatActivity;
6 import android.text.TextUtils; 8 import android.text.TextUtils;
@@ -88,19 +90,19 @@ public class MainActivity extends AppCompatActivity { @@ -88,19 +90,19 @@ public class MainActivity extends AppCompatActivity {
88 serviceIp=edtHomeServiceIp.getText().toString(); 90 serviceIp=edtHomeServiceIp.getText().toString();
89 userId=edtHomeUserId.getText().toString(); 91 userId=edtHomeUserId.getText().toString();
90 if(TextUtils.isEmpty(classId)){ 92 if(TextUtils.isEmpty(classId)){
91 - ToastUtil.showToast("课堂Id不能为空",this); 93 + ToastUtil.showToast(getResources().getString(R.string.main_login_error_classId),this);
92 return false; 94 return false;
93 } 95 }
94 if(TextUtils.isEmpty(serviceIp)){ 96 if(TextUtils.isEmpty(serviceIp)){
95 - ToastUtil.showToast("服务器地址不能为空",this); 97 + ToastUtil.showToast(getResources().getString(R.string.main_login_error_portal),this);
96 return false; 98 return false;
97 } 99 }
98 if(TextUtils.isEmpty(userRole)){ 100 if(TextUtils.isEmpty(userRole)){
99 - ToastUtil.showToast("角色不能为空",this); 101 + ToastUtil.showToast(getResources().getString(R.string.main_login_error_role),this);
100 return false; 102 return false;
101 } 103 }
102 if(TextUtils.isEmpty(userId)){ 104 if(TextUtils.isEmpty(userId)){
103 - ToastUtil.showToast("用户id不能为空",this); 105 + ToastUtil.showToast(getResources().getString(R.string.main_login_error_userId),this);
104 return false; 106 return false;
105 } 107 }
106 return true; 108 return true;
@@ -121,4 +123,7 @@ public class MainActivity extends AppCompatActivity { @@ -121,4 +123,7 @@ public class MainActivity extends AppCompatActivity {
121 } 123 }
122 124
123 } 125 }
  126 +
  127 +
  128 +
124 } 129 }
@@ -2,16 +2,23 @@ package com.mang.xdy.demo.activity; @@ -2,16 +2,23 @@ package com.mang.xdy.demo.activity;
2 2
3 import android.annotation.SuppressLint; 3 import android.annotation.SuppressLint;
4 import android.app.ProgressDialog; 4 import android.app.ProgressDialog;
  5 +import android.content.Context;
5 import android.content.DialogInterface; 6 import android.content.DialogInterface;
  7 +import android.content.pm.ActivityInfo;
  8 +import android.content.res.Configuration;
6 import android.os.Bundle; 9 import android.os.Bundle;
7 import android.os.Handler; 10 import android.os.Handler;
8 import android.os.Message; 11 import android.os.Message;
9 import android.support.design.widget.TabLayout; 12 import android.support.design.widget.TabLayout;
  13 +import android.support.v4.app.FragmentActivity;
  14 +import android.support.v4.app.FragmentManager;
  15 +import android.support.v4.app.FragmentTransaction;
10 import android.support.v7.app.AlertDialog; 16 import android.support.v7.app.AlertDialog;
11 import android.support.v7.app.AppCompatActivity; 17 import android.support.v7.app.AppCompatActivity;
12 import android.text.TextUtils; 18 import android.text.TextUtils;
13 import android.util.DisplayMetrics; 19 import android.util.DisplayMetrics;
14 import android.util.Log; 20 import android.util.Log;
  21 +import android.view.KeyEvent;
15 import android.view.SurfaceHolder; 22 import android.view.SurfaceHolder;
16 import android.view.SurfaceView; 23 import android.view.SurfaceView;
17 import android.view.View; 24 import android.view.View;
@@ -19,6 +26,7 @@ import android.view.WindowManager; @@ -19,6 +26,7 @@ import android.view.WindowManager;
19 import android.widget.FrameLayout; 26 import android.widget.FrameLayout;
20 import android.widget.ImageButton; 27 import android.widget.ImageButton;
21 import android.widget.ImageView; 28 import android.widget.ImageView;
  29 +import android.widget.LinearLayout;
22 import android.widget.RelativeLayout; 30 import android.widget.RelativeLayout;
23 import android.widget.SeekBar; 31 import android.widget.SeekBar;
24 import android.widget.TextView; 32 import android.widget.TextView;
@@ -38,6 +46,8 @@ import com.mang.xdy.demo.bean.JoinClass; @@ -38,6 +46,8 @@ import com.mang.xdy.demo.bean.JoinClass;
38 import com.mang.xdy.demo.bean.ResponseEntity; 46 import com.mang.xdy.demo.bean.ResponseEntity;
39 import com.mang.xdy.demo.bean.TimeEntity; 47 import com.mang.xdy.demo.bean.TimeEntity;
40 import com.mang.xdy.demo.bean.VideoOrAudioStopEntity; 48 import com.mang.xdy.demo.bean.VideoOrAudioStopEntity;
  49 +import com.mang.xdy.demo.fragment.ChatFragment;
  50 +import com.mang.xdy.demo.fragment.DocFragment;
41 import com.mang.xdy.demo.utils.JsonUtil; 51 import com.mang.xdy.demo.utils.JsonUtil;
42 import com.mang.xdy.demo.utils.ToastUtil; 52 import com.mang.xdy.demo.utils.ToastUtil;
43 import com.mang.xdy.demo.widget.answersheet.AnswerSheetView; 53 import com.mang.xdy.demo.widget.answersheet.AnswerSheetView;
@@ -71,7 +81,7 @@ import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION; @@ -71,7 +81,7 @@ import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION;
71 81
72 ; 82 ;
73 83
74 -public class VideoPlayActivity extends AppCompatActivity implements ObserverListener, PLMediaPlayer.OnErrorListener, PLMediaPlayer.OnInfoListener, NoScrollViewPager.OnRplayTouchListener { 84 +public class VideoPlayActivity extends FragmentActivity implements ObserverListener, PLMediaPlayer.OnErrorListener, PLMediaPlayer.OnInfoListener, NoScrollViewPager.OnRplayTouchListener {
75 private final static String TAG = "VideoPlayActivity"; 85 private final static String TAG = "VideoPlayActivity";
76 @BindView(R.id.img_playVideo_novideo) 86 @BindView(R.id.img_playVideo_novideo)
77 ImageView img_playVideo_novideo; 87 ImageView img_playVideo_novideo;
@@ -98,8 +108,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -98,8 +108,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
98 SlidingTabLayout mSlidingTab; 108 SlidingTabLayout mSlidingTab;
99 @BindView(R.id.img_playVideo_publishAudio) 109 @BindView(R.id.img_playVideo_publishAudio)
100 ImageView mIamgeView_PublishAudio; 110 ImageView mIamgeView_PublishAudio;
101 - @BindView(R.id.asv_videoPlay_answer)  
102 - AnswerSheetView mAnswerSheetView; 111 +// @BindView(R.id.asv_videoPlay_answer)
  112 +// AnswerSheetView mAnswerSheetView;
103 private String username = ""; 113 private String username = "";
104 private String userpwd = ""; 114 private String userpwd = "";
105 private SimpleFragmentPagerAdapter pagerAdapter; 115 private SimpleFragmentPagerAdapter pagerAdapter;
@@ -125,6 +135,14 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -125,6 +135,14 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
125 /*课堂类型*/ 135 /*课堂类型*/
126 private int classType = 2; 136 private int classType = 2;
127 private String[] titles; 137 private String[] titles;
  138 +
  139 + private long loging_upload=0;
  140 +
  141 + private LinearLayout llVideo_table_chat;
  142 +
  143 +
  144 +// private Fragment mFragment_Tablet_Chat;
  145 +
128 private Handler mmHandler = new Handler() { 146 private Handler mmHandler = new Handler() {
129 @Override 147 @Override
130 public void handleMessage(Message msg) { 148 public void handleMessage(Message msg) {
@@ -132,7 +150,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -132,7 +150,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
132 ResponseEntity responseEntity = (ResponseEntity) msg.obj; 150 ResponseEntity responseEntity = (ResponseEntity) msg.obj;
133 switch (responseEntity.getType()) { 151 switch (responseEntity.getType()) {
134 case Constants.CLASS_EXIT: 152 case Constants.CLASS_EXIT:
135 - ToastUtil.showToast("退出课堂", VideoPlayActivity.this); 153 + ToastUtil.showToast(getResources().getString(R.string.home_msg_exit_class), VideoPlayActivity.this);
136 progressDialogDismiss(); 154 progressDialogDismiss();
137 exit(); 155 exit();
138 break; 156 break;
@@ -142,13 +160,13 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -142,13 +160,13 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
142 case Constants.CLASS_INIT_SUCCESS: 160 case Constants.CLASS_INIT_SUCCESS:
143 String login = responseEntity.getParam(); 161 String login = responseEntity.getParam();
144 parseJoinClass(login, true); 162 parseJoinClass(login, true);
145 - ToastUtil.showToastshort("初始化课堂成功", VideoPlayActivity.this); 163 +// ToastUtil.showToastshort("初始化课堂成功", VideoPlayActivity.this);
146 break; 164 break;
147 case Constants.CLASS_JOIN_SUCCESS: 165 case Constants.CLASS_JOIN_SUCCESS:
148 //加入课堂成功 166 //加入课堂成功
149 progressDialogDismiss(); 167 progressDialogDismiss();
150 UIUtils.closeDialog(mLoginDialog); 168 UIUtils.closeDialog(mLoginDialog);
151 - ToastUtil.showToastshort("加入课堂成功", VideoPlayActivity.this); 169 + ToastUtil.showToastshort(getResources().getString(R.string.home_msg_join_class_success), VideoPlayActivity.this);
152 String userJson = responseEntity.getParam(); 170 String userJson = responseEntity.getParam();
153 SPUtil.putString(VideoPlayActivity.this, Constants.CLASS_JOIN_SUCCESS, userJson); 171 SPUtil.putString(VideoPlayActivity.this, Constants.CLASS_JOIN_SUCCESS, userJson);
154 JSONObject jsonObject = null; 172 JSONObject jsonObject = null;
@@ -217,13 +235,15 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -217,13 +235,15 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
217 super.onCreate(savedInstanceState); 235 super.onCreate(savedInstanceState);
218 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); //屏幕常亮 236 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); //屏幕常亮
219 setContentView(R.layout.activity_video_play); 237 setContentView(R.layout.activity_video_play);
  238 +
220 EventBus.getDefault().register(this); 239 EventBus.getDefault().register(this);
221 ButterKnife.bind(this); 240 ButterKnife.bind(this);
222 aCache = ACache.get(this); 241 aCache = ACache.get(this);
223 xdySdk = XdySdk.getXdyInstance(); 242 xdySdk = XdySdk.getXdyInstance();
224 xdySdk.add(this); 243 xdySdk.add(this);
225 init(); 244 init();
226 - 245 + initTablet();
  246 + loging_upload=System.currentTimeMillis();
227 progressDialogShow(); 247 progressDialogShow();
228 setTablayout(); 248 setTablayout();
229 249
@@ -358,7 +378,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -358,7 +378,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
358 isPublsishVideoMode = false; 378 isPublsishVideoMode = false;
359 } 379 }
360 }) 380 })
361 - .addSheetItem("开始答题", ActionSheetDialog.SheetItemColor.Blue 381 + .addSheetItem("单选或者多选", ActionSheetDialog.SheetItemColor.Blue
362 , new ActionSheetDialog.OnSheetItemClickListener() { 382 , new ActionSheetDialog.OnSheetItemClickListener() {
363 @Override 383 @Override
364 public void onClick(int which) { 384 public void onClick(int which) {
@@ -390,47 +410,58 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -390,47 +410,58 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
390 410
391 } 411 }
392 }) 412 })
393 - .addSheetItem("填空题", ActionSheetDialog.SheetItemColor.Blue  
394 - , new ActionSheetDialog.OnSheetItemClickListener() {  
395 - @Override  
396 - public void onClick(int which) {  
397 - //填写事件  
398 -// mAnswerSheetView.selectAnswerSheetType(AnswerSheetView.ANSWER_TYPE_FILLING);  
399 -// mAnswerSheetView.startCountTimerAndResizeLayout(15);  
400 -// setAnswerSheetLayout_Nornal(53);  
401 - AnswerSheetDialog answerSheetDialog= new AnswerSheetDialog(VideoPlayActivity.this);  
402 - answerSheetDialog.builder().show();  
403 - answerSheetDialog.selectAnswerSheetType(3);  
404 - answerSheetDialog.startCountTimerAndResizeLayout(15,40);  
405 -  
406 -  
407 -  
408 - }  
409 - }).show(); 413 +// .addSheetItem("填空题", ActionSheetDialog.SheetItemColor.Blue
  414 +// , new ActionSheetDialog.OnSheetItemClickListener() {
  415 +// @Override
  416 +// public void onClick(int which) {
  417 +// //填写事件
  418 +//// mAnswerSheetView.selectAnswerSheetType(AnswerSheetView.ANSWER_TYPE_FILLING);
  419 +//// mAnswerSheetView.startCountTimerAndResizeLayout(15);
  420 +//// setAnswerSheetLayout_Nornal(53);
  421 +// AnswerSheetDialog answerSheetDialog= new AnswerSheetDialog(VideoPlayActivity.this);
  422 +// answerSheetDialog.builder().show();
  423 +// answerSheetDialog.selectAnswerSheetType(3);
  424 +// answerSheetDialog.startCountTimerAndResizeLayout(15,40);
  425 +//
  426 +//
  427 +//
  428 +// }
  429 +// })
  430 + .show();
410 } 431 }
411 432
412 public void setTablayout() { 433 public void setTablayout() {
413 - titles = new String[]{getResources().getString(R.string.home_content_doc),getResources().getString(R.string.home_content_chat)};  
414 - pagerAdapter = new SimpleFragmentPagerAdapter(getSupportFragmentManager(), this, replay);  
415 - viewPager.setAdapter(pagerAdapter);  
416 - viewPager.setOnRplayTouchListener(this);  
417 -// viewPager.setPagingEnabled(false); 434 +
  435 + if (isTablet(this)) {
  436 + mSlidingTab.setVisibility(View.GONE);
  437 + viewPager.setVisibility(View.GONE);
  438 + FragmentManager fm = getSupportFragmentManager();
  439 + FragmentTransaction transaction = fm.beginTransaction();
  440 + transaction.add(R.id.ll_videoPlay_tablet_doc, DocFragment.newInstance(replay),"tag");
  441 + transaction.commit();
  442 + } else {
  443 + titles = new String[]{getResources().getString(R.string.home_content_doc), getResources().getString(R.string.home_content_chat)};
  444 + pagerAdapter = new SimpleFragmentPagerAdapter(getSupportFragmentManager(), this, replay);
  445 + viewPager.setAdapter(pagerAdapter);
  446 + viewPager.setOnRplayTouchListener(this);
  447 + viewPager.setPagingEnabled(false);
418 // viewPager.setOffscreenPageLimit(0); 448 // viewPager.setOffscreenPageLimit(0);
419 - mSlidingTab.setViewPager(viewPager, titles);  
420 - mSlidingTab.setOnTabSelectListener(new OnTabSelectListener() {  
421 - @Override  
422 - public void onTabSelect(int position) {  
423 - if (1 == position && replay) {  
424 - //为了避免回访时切换界面出现桌面 暂时先这样写了  
425 - showMediaContainer(TIME_OUT); 449 + mSlidingTab.setViewPager(viewPager, titles);
  450 + mSlidingTab.setOnTabSelectListener(new OnTabSelectListener() {
  451 + @Override
  452 + public void onTabSelect(int position) {
  453 + if (1 == position && replay) {
  454 + //为了避免回访时切换界面出现桌面 暂时先这样写了
  455 + showMediaContainer(TIME_OUT);
  456 + }
426 } 457 }
427 - }  
428 458
429 - @Override  
430 - public void onTabReselect(int position) { 459 + @Override
  460 + public void onTabReselect(int position) {
431 461
432 - }  
433 - }); 462 + }
  463 + });
  464 + }
434 } 465 }
435 466
436 //判断解析是否有密码 467 //判断解析是否有密码
@@ -501,37 +532,39 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -501,37 +532,39 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
501 getWindowManager().getDefaultDisplay().getMetrics(dm); 532 getWindowManager().getDefaultDisplay().getMetrics(dm);
502 int widthPixels = dm.widthPixels; 533 int widthPixels = dm.widthPixels;
503 int heightPixels = dm.heightPixels; 534 int heightPixels = dm.heightPixels;
504 - if (surfaceviewPlayVideo != null) {  
505 -// int margin = (mSurfaceViewWidth - w) / 2;  
506 - SurfaceHolder surfaceHolder = surfaceviewPlayVideo.getHolder();  
507 - RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(  
508 - RelativeLayout.LayoutParams.MATCH_PARENT,  
509 - RelativeLayout.LayoutParams.MATCH_PARENT);  
510 - int setWidth = 640;  
511 - int setHeight = 480;  
512 - int leftW = 0;  
513 - int leftH = 0;  
514 - int width = surfaceviewPlayVideo.getWidth();  
515 - int height = surfaceviewPlayVideo.getHeight();  
516 - if (width > height) {  
517 - setWidth = width;  
518 - setHeight = height * (4 / 3);  
519 - leftH = 0;  
520 - leftW = (widthPixels - setHeight) / 2;  
521 - } else {  
522 -  
523 - }  
524 - lp.setMargins(leftW, 0, leftW, 0);  
525 -// surfaceHolder.setFixedSize(640,480);  
526 - XdyLogUtil.e("surface 高度计算:", surfaceviewPlayVideo.getWidth() + "高:" + surfaceviewPlayVideo.getHeight());  
527 - surfaceviewPlayVideo.setLayoutParams(lp);  
528 - XdyLogUtil.e("surface 设置后的高度的高度计算:", surfaceviewPlayVideo.getWidth() + "高:" + surfaceviewPlayVideo.getHeight());  
529 535
530 - } 536 + //TODO surfaceview 高度设置
  537 +// if (surfaceviewPlayVideo != null) {
  538 +//// int margin = (mSurfaceViewWidth - w) / 2;
  539 +// SurfaceHolder surfaceHolder = surfaceviewPlayVideo.getHolder();
  540 +// RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
  541 +// RelativeLayout.LayoutParams.MATCH_PARENT,
  542 +// RelativeLayout.LayoutParams.MATCH_PARENT);
  543 +// int setWidth = 640;
  544 +// int setHeight = 480;
  545 +// int leftW = 0;
  546 +// int leftH = 0;
  547 +// int width = surfaceviewPlayVideo.getWidth();
  548 +// int height = surfaceviewPlayVideo.getHeight();
  549 +// if (width > height) {
  550 +// setWidth = width;
  551 +// setHeight = height * (4 / 3);
  552 +// leftH = 0;
  553 +// leftW = (widthPixels - setHeight) / 2;
  554 +// } else {
  555 +//
  556 +// }
  557 +// lp.setMargins(leftW, 0, leftW, 0);
  558 +//// surfaceHolder.setFixedSize(640,480);
  559 +// XdyLogUtil.e("surface 高度计算:", surfaceviewPlayVideo.getWidth() + "高:" + surfaceviewPlayVideo.getHeight());
  560 +// surfaceviewPlayVideo.setLayoutParams(lp);
  561 +// XdyLogUtil.e("surface 设置后的高度的高度计算:", surfaceviewPlayVideo.getWidth() + "高:" + surfaceviewPlayVideo.getHeight());
  562 +//
  563 +// }
531 xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this); 564 xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this);
532 // img_playVideo_novideo.setVisibility(View.GONE); 565 // img_playVideo_novideo.setVisibility(View.GONE);
533 img_playVideo_novideo.setImageResource(R.mipmap.no_video); 566 img_playVideo_novideo.setImageResource(R.mipmap.no_video);
534 - ToastUtil.showToastshort("视频播放初始化", VideoPlayActivity.this); 567 + ToastUtil.showToastshort(getResources().getString(R.string.home_msg_play_video_init), VideoPlayActivity.this);
535 } 568 }
536 } 569 }
537 570
@@ -553,7 +586,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -553,7 +586,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
553 xdySdk.api("playAudio", response, null, VideoPlayActivity.this); 586 xdySdk.api("playAudio", response, null, VideoPlayActivity.this);
554 img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); 587 img_playVideo_novideo.setImageResource(R.mipmap.audio_mode);
555 img_playVideo_novideo.setVisibility(View.VISIBLE); 588 img_playVideo_novideo.setVisibility(View.VISIBLE);
556 - ToastUtil.showToastshort("音频播放初始化", VideoPlayActivity.this); 589 + ToastUtil.showToastshort(getResources().getString(R.string.home_msg_play_audio_init), VideoPlayActivity.this);
557 } 590 }
558 } 591 }
559 592
@@ -561,19 +594,22 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -561,19 +594,22 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
561 public void onBackPressed() { 594 public void onBackPressed() {
562 UIUtils.closeDialog(mLoginDialog); 595 UIUtils.closeDialog(mLoginDialog);
563 exit_dialog(); 596 exit_dialog();
  597 +// if(System.currentTimeMillis()-loging_upload>8*1000) {
  598 +// progressDialogDismiss();
  599 +// }
564 } 600 }
565 601
566 public void exit_dialog() { 602 public void exit_dialog() {
567 final AlertDialog alertDialog = new AlertDialog.Builder(this) 603 final AlertDialog alertDialog = new AlertDialog.Builder(this)
568 - .setTitle("退出")  
569 - .setMessage("是否离开课堂")  
570 - .setNegativeButton("在看看", new DialogInterface.OnClickListener() { 604 + .setTitle(getResources().getString(R.string.home_msg_leave_character))
  605 + .setMessage(getResources().getString(R.string.home_msg_leave_class_whether))
  606 + .setNegativeButton(getResources().getString(R.string.home_msg_leave_no), new DialogInterface.OnClickListener() {
571 @Override 607 @Override
572 public void onClick(DialogInterface dialogInterface, int i) { 608 public void onClick(DialogInterface dialogInterface, int i) {
573 dialogInterface.dismiss(); 609 dialogInterface.dismiss();
574 } 610 }
575 }) 611 })
576 - .setPositiveButton("确认", new DialogInterface.OnClickListener() { 612 + .setPositiveButton(getResources().getString(R.string.home_msg_leave_yes), new DialogInterface.OnClickListener() {
577 @Override 613 @Override
578 public void onClick(DialogInterface dialogInterface, int i) { 614 public void onClick(DialogInterface dialogInterface, int i) {
579 615
@@ -698,6 +734,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -698,6 +734,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
698 xdySdk.api("stopPublishVideo", ""); 734 xdySdk.api("stopPublishVideo", "");
699 xdySdk.api("leaveClass", ""); 735 xdySdk.api("leaveClass", "");
700 xdySdk.remove(this); 736 xdySdk.remove(this);
  737 + mLoginDialog=null;
701 xdySdk.onPublisherStop(); 738 xdySdk.onPublisherStop();
702 if (mVideoView != null) { 739 if (mVideoView != null) {
703 mVideoView.stopPlayback(); 740 mVideoView.stopPlayback();
@@ -719,8 +756,21 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -719,8 +756,21 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
719 756
720 public void progressDialogShow() { 757 public void progressDialogShow() {
721 if (mProgressDialog == null) { 758 if (mProgressDialog == null) {
722 - mProgressDialog = ProgressDialog.show(VideoPlayActivity.this, "", "加载中"); 759 + mProgressDialog = ProgressDialog.show(VideoPlayActivity.this, "", getResources().getString(R.string.home_msg_loading));
  760 +// mProgressDialog.setOnCancelListener(new);
  761 + mProgressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
  762 + @Override
  763 + public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
  764 +
  765 + if (keyCode == KeyEvent.KEYCODE_BACK) {
  766 + exit();
  767 + }
  768 + return false;
  769 +
  770 + }
  771 + });
723 } else { 772 } else {
  773 +
724 mProgressDialog.show(); 774 mProgressDialog.show();
725 } 775 }
726 } 776 }
@@ -758,9 +808,9 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -758,9 +808,9 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
758 return; 808 return;
759 progressDialogDismiss(); 809 progressDialogDismiss();
760 mErrorDialog = new AlertDialog.Builder(this) 810 mErrorDialog = new AlertDialog.Builder(this)
761 - .setTitle("退出")  
762 - .setMessage("您设备的网络属于断开状态,请重新进入")  
763 - .setPositiveButton("确认", new DialogInterface.OnClickListener() { 811 + .setTitle(getResources().getString(R.string.home_msg_leave_character))
  812 + .setMessage(getResources().getString(R.string.home_msg_error_net_disconnection))
  813 + .setPositiveButton(getResources().getString(R.string.home_msg_verify), new DialogInterface.OnClickListener() {
764 @Override 814 @Override
765 public void onClick(DialogInterface dialogInterface, int i) { 815 public void onClick(DialogInterface dialogInterface, int i) {
766 dialogInterface.dismiss(); 816 dialogInterface.dismiss();
@@ -770,7 +820,11 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -770,7 +820,11 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
770 }) 820 })
771 .create(); 821 .create();
772 mErrorDialog.setCanceledOnTouchOutside(false); 822 mErrorDialog.setCanceledOnTouchOutside(false);
773 - mErrorDialog.show(); 823 + try {
  824 + mErrorDialog.show();
  825 + }catch (Exception e){
  826 +
  827 + }
774 828
775 } 829 }
776 830
@@ -1250,34 +1304,38 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList @@ -1250,34 +1304,38 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList
1250 } 1304 }
1251 1305
1252 1306
1253 - /********************************答题卡*********************************************************/ 1307 + /********************************平板*********************************************************/
1254 1308
1255 -// public void setAnswerLayout(){  
1256 -// mAnswerSheetView.setOnAnswerLayoutChangeListener(new AnswerSheetView.OnAnswerLayoutChangeListener()  
1257 -// {  
1258 -// @Override  
1259 -// public void setAnswerSheetFramLayout(int num) {  
1260 -// RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,XdyStringUtils.dp2px(VideoPlayActivity.this,num));  
1261 -//// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {  
1262 -//// layoutParams.setLayoutDirection(RelativeLayout.ALIGN_PARENT_BOTTOM);  
1263 -//// }  
1264 -// fraVideoPlayAnswer.setLayoutParams(layoutParams);  
1265 -// }  
1266 -//  
1267 -// @Override  
1268 -// public void setAnswerSheetNormal(int num) {  
1269 -// setAnswerSheetLayout_Nornal(num);  
1270 -// }  
1271 -// });  
1272 -// } 1309 + public void initTablet(){
  1310 + if(!isTablet(this)){
  1311 + return;
  1312 + }
  1313 + DisplayMetrics metric = new DisplayMetrics();
  1314 + this.getWindowManager().getDefaultDisplay().getMetrics(metric);
  1315 + int winWidth = metric.widthPixels; // 屏幕宽度(像素)
  1316 + int winHeight = metric.heightPixels; // 屏幕高度(像素)
  1317 + llVideo_table_chat= (LinearLayout) findViewById(R.id.ll_videoPlay_tablet_chat);
  1318 + LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(winWidth/4,winWidth/3);
  1319 + XdyLogUtil.e("学点云Tablet:",""+winWidth/3+"::"+winWidth/4+":"+winWidth);
  1320 + llVideo_table_chat.setLayoutParams(layoutParams);
  1321 + //如果是横排,则改为竖排
  1322 + if(getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
  1323 + {
  1324 + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  1325 + }
  1326 + FragmentManager fm = getSupportFragmentManager();
  1327 + FragmentTransaction transaction = fm.beginTransaction();
  1328 + transaction.add(R.id.ll_videoPlay_tablet_chat,ChatFragment.newInstance(replay),"tag");
  1329 + transaction.commit();
1273 1330
  1331 + }
  1332 + /**
  1333 + * 判断当前设备是手机还是平板,代码来自 Google I/O App for Android
  1334 + * @param context
  1335 + * @return 平板返回 True,手机返回 False
  1336 + */
  1337 + public static boolean isTablet(Context context) {
  1338 + return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
  1339 + }
1274 1340
1275 -// public void setAnswerSheetLayout_Nornal(int num){  
1276 -// fraVideoPlayAnswer.setVisibility(View.VISIBLE);  
1277 -// RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,XdyStringUtils.dp2px(VideoPlayActivity.this,num));  
1278 -//// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {  
1279 -//// layoutParams.setLayoutDirection(RelativeLayout.ALIGN_PARENT_BOTTOM);  
1280 -//// }  
1281 -// fraVideoPlayAnswer.setLayoutParams(layoutParams);  
1282 -// }  
1283 } 1341 }
@@ -64,17 +64,26 @@ @@ -64,17 +64,26 @@
64 android:id="@+id/img_videoPlay_back" 64 android:id="@+id/img_videoPlay_back"
65 android:layout_width="wrap_content" 65 android:layout_width="wrap_content"
66 android:layout_height="@dimen/ui_titlebar_height" 66 android:layout_height="@dimen/ui_titlebar_height"
67 - android:paddingRight="20dp" 67 + android:paddingRight="10dp"
68 android:paddingLeft="15dp" 68 android:paddingLeft="15dp"
69 android:src="@mipmap/back"/> 69 android:src="@mipmap/back"/>
70 <TextView 70 <TextView
  71 + android:layout_toRightOf="@+id/img_videoPlay_back"
  72 + android:layout_width="wrap_content"
  73 + style="@style/ui_wrapTvBaseStyle"
  74 + android:layout_height="@dimen/ui_titlebar_height"
  75 + android:text="@string/home_title_back"
  76 + android:gravity="center"
  77 + android:textColor="@color/white"
  78 + />
  79 + <TextView
71 android:id="@+id/tv_videoPlay_className" 80 android:id="@+id/tv_videoPlay_className"
72 style="@style/ui_wrapTvBaseStyle" 81 style="@style/ui_wrapTvBaseStyle"
73 android:layout_height="@dimen/ui_titlebar_height" 82 android:layout_height="@dimen/ui_titlebar_height"
74 android:layout_centerHorizontal="true" 83 android:layout_centerHorizontal="true"
75 android:gravity="center" 84 android:gravity="center"
76 android:textColor="@color/white" 85 android:textColor="@color/white"
77 - tools:text="hahaha" 86 + tools:text=""
78 android:textSize="@dimen/ui_DIMEN_34.0PX"/> 87 android:textSize="@dimen/ui_DIMEN_34.0PX"/>
79 </RelativeLayout> 88 </RelativeLayout>
80 <SurfaceView 89 <SurfaceView
@@ -178,22 +187,5 @@ @@ -178,22 +187,5 @@
178 android:layout_height="wrap_content"/> 187 android:layout_height="wrap_content"/>
179 </FrameLayout> 188 </FrameLayout>
180 189
181 - <FrameLayout  
182 - android:id="@+id/fra_videoPlay_answer"  
183 - android:layout_width="match_parent"  
184 - android:layout_height="match_parent"  
185 - android:layout_alignParentBottom="true"  
186 - android:layout_marginBottom="10dp"  
187 -  
188 - >  
189 - <com.mang.xdy.demo.widget.answersheet.AnswerSheetView  
190 - android:id="@+id/asv_videoPlay_answer"  
191 - android:layout_width="match_parent"  
192 - android:layout_height="90dp"  
193 - android:layout_gravity="bottom"  
194 -  
195 - >  
196 - </com.mang.xdy.demo.widget.answersheet.AnswerSheetView>  
197 - </FrameLayout>  
198 190
199 </RelativeLayout> 191 </RelativeLayout>
@@ -18,5 +18,21 @@ @@ -18,5 +18,21 @@
18 <string name="home_dialog_pushAudio">推送音频</string> 18 <string name="home_dialog_pushAudio">推送音频</string>
19 <string name="home_dialog_pushVideo">推送视频</string> 19 <string name="home_dialog_pushVideo">推送视频</string>
20 <string name="home_dialog_selectList">选择列表</string> 20 <string name="home_dialog_selectList">选择列表</string>
21 - 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="main_login_error_classId">课堂Id不能为空</string>
  35 + <string name="main_login_error_portal">服务器地址不能为空</string>
  36 + <string name="main_login_error_role">角色不能为空</string>
  37 + <string name="main_login_error_userId">用户id不能为空</string>
22 </resources> 38 </resources>
1 -#Wed May 10 11:45:01 CST 2017 1 +#Fri May 12 10:52:43 CST 2017
2 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_bottom_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_bottom_pressed.9.png 2 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_bottom_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_bottom_pressed.9.png
3 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_single_normal.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_single_normal.9.png 3 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_single_normal.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_single_normal.9.png
4 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\anim\\actionsheet_dialog_out.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\anim\\actionsheet_dialog_out.xml 4 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\anim\\actionsheet_dialog_out.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\anim\\actionsheet_dialog_out.xml
1 -#Wed May 10 11:43:51 CST 2017 1 +#Fri May 12 10:51:43 CST 2017
2 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_bottom_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\actionsheet_bottom_pressed.9.png 2 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_bottom_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\actionsheet_bottom_pressed.9.png
3 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_single_normal.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\actionsheet_single_normal.9.png 3 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_single_normal.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\actionsheet_single_normal.9.png
4 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\anim\\actionsheet_dialog_out.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\anim\\actionsheet_dialog_out.xml 4 D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\anim\\actionsheet_dialog_out.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\anim\\actionsheet_dialog_out.xml