正在显示
8 个修改的文件
包含
234 行增加
和
288 行删除
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | <ConfirmationsSetting value="0" id="Add" /> | 37 | <ConfirmationsSetting value="0" id="Add" /> |
| 38 | <ConfirmationsSetting value="0" id="Remove" /> | 38 | <ConfirmationsSetting value="0" id="Remove" /> |
| 39 | </component> | 39 | </component> |
| 40 | - <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"> | 40 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
| 41 | <output url="file://$PROJECT_DIR$/build/classes" /> | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
| 42 | </component> | 42 | </component> |
| 43 | <component name="ProjectType"> | 43 | <component name="ProjectType"> |
| 1 | package com.mang.xdy.demo.activity; | 1 | 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.DialogInterface; | 5 | import android.content.DialogInterface; |
| @@ -15,10 +15,12 @@ import android.util.Log; | @@ -15,10 +15,12 @@ import android.util.Log; | ||
| 15 | import android.view.SurfaceHolder; | 15 | import android.view.SurfaceHolder; |
| 16 | import android.view.SurfaceView; | 16 | import android.view.SurfaceView; |
| 17 | import android.view.View; | 17 | import android.view.View; |
| 18 | +import android.view.ViewGroup; | ||
| 18 | import android.view.WindowManager; | 19 | import android.view.WindowManager; |
| 19 | import android.widget.FrameLayout; | 20 | import android.widget.FrameLayout; |
| 20 | import android.widget.ImageButton; | 21 | import android.widget.ImageButton; |
| 21 | import android.widget.ImageView; | 22 | import android.widget.ImageView; |
| 23 | +import android.widget.LinearLayout; | ||
| 22 | import android.widget.RelativeLayout; | 24 | import android.widget.RelativeLayout; |
| 23 | import android.widget.SeekBar; | 25 | import android.widget.SeekBar; |
| 24 | import android.widget.TextView; | 26 | import android.widget.TextView; |
| @@ -29,7 +31,6 @@ import com.google.gson.Gson; | @@ -29,7 +31,6 @@ import com.google.gson.Gson; | ||
| 29 | import com.mang.xdy.bean.VideoPlayBean; | 31 | import com.mang.xdy.bean.VideoPlayBean; |
| 30 | import com.mang.xdy.cache.ACache; | 32 | import com.mang.xdy.cache.ACache; |
| 31 | import com.mang.xdy.common.Constants; | 33 | import com.mang.xdy.common.Constants; |
| 32 | -import com.mang.xdy.utils.SPUtil; | ||
| 33 | import com.mang.xdy.core.XdySdk; | 34 | import com.mang.xdy.core.XdySdk; |
| 34 | import com.mang.xdy.demo.R; | 35 | import com.mang.xdy.demo.R; |
| 35 | import com.mang.xdy.demo.adapter.SimpleFragmentPagerAdapter; | 36 | import com.mang.xdy.demo.adapter.SimpleFragmentPagerAdapter; |
| @@ -41,9 +42,11 @@ import com.mang.xdy.demo.bean.TimeEntity; | @@ -41,9 +42,11 @@ import com.mang.xdy.demo.bean.TimeEntity; | ||
| 41 | import com.mang.xdy.demo.bean.VideoOrAudioStopEntity; | 42 | import com.mang.xdy.demo.bean.VideoOrAudioStopEntity; |
| 42 | import com.mang.xdy.demo.utils.JsonUtil; | 43 | import com.mang.xdy.demo.utils.JsonUtil; |
| 43 | import com.mang.xdy.demo.utils.ToastUtil; | 44 | import com.mang.xdy.demo.utils.ToastUtil; |
| 45 | +import com.mang.xdy.demo.widget.answersheet.AnswerSheetView; | ||
| 44 | import com.mang.xdy.demo.widget.dialog.LoginDialog; | 46 | import com.mang.xdy.demo.widget.dialog.LoginDialog; |
| 45 | import com.mang.xdy.demo.widget.view.NoScrollViewPager; | 47 | import com.mang.xdy.demo.widget.view.NoScrollViewPager; |
| 46 | import com.mang.xdy.listener.ObserverListener; | 48 | import com.mang.xdy.listener.ObserverListener; |
| 49 | +import com.mang.xdy.utils.SPUtil; | ||
| 47 | import com.mang.xdy.utils.UIUtils; | 50 | import com.mang.xdy.utils.UIUtils; |
| 48 | import com.mang.xdy.utils.XdyLogUtil; | 51 | import com.mang.xdy.utils.XdyLogUtil; |
| 49 | import com.mang.xdy.utils.XdyStringUtils; | 52 | import com.mang.xdy.utils.XdyStringUtils; |
| @@ -51,6 +54,7 @@ import com.pili.pldroid.player.AVOptions; | @@ -51,6 +54,7 @@ import com.pili.pldroid.player.AVOptions; | ||
| 51 | import com.pili.pldroid.player.PLMediaPlayer; | 54 | import com.pili.pldroid.player.PLMediaPlayer; |
| 52 | import com.pili.pldroid.player.widget.PLVideoTextureView; | 55 | import com.pili.pldroid.player.widget.PLVideoTextureView; |
| 53 | import com.pili.pldroid.player.widget.PLVideoView; | 56 | import com.pili.pldroid.player.widget.PLVideoView; |
| 57 | + | ||
| 54 | import org.greenrobot.eventbus.EventBus; | 58 | import org.greenrobot.eventbus.EventBus; |
| 55 | import org.greenrobot.eventbus.Subscribe; | 59 | import org.greenrobot.eventbus.Subscribe; |
| 56 | import org.greenrobot.eventbus.ThreadMode; | 60 | import org.greenrobot.eventbus.ThreadMode; |
| @@ -66,7 +70,9 @@ import zhangphil.iosdialog.widget.ActionSheetDialog; | @@ -66,7 +70,9 @@ import zhangphil.iosdialog.widget.ActionSheetDialog; | ||
| 66 | 70 | ||
| 67 | import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION; | 71 | import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION; |
| 68 | 72 | ||
| 69 | -public class VideoPlayActivity extends AppCompatActivity implements ObserverListener, PLMediaPlayer.OnErrorListener, PLMediaPlayer.OnInfoListener,NoScrollViewPager.OnRplayTouchListener { | 73 | +; |
| 74 | + | ||
| 75 | +public class VideoPlayActivity extends AppCompatActivity implements ObserverListener, PLMediaPlayer.OnErrorListener, PLMediaPlayer.OnInfoListener, NoScrollViewPager.OnRplayTouchListener { | ||
| 70 | private final static String TAG = "VideoPlayActivity"; | 76 | private final static String TAG = "VideoPlayActivity"; |
| 71 | @BindView(R.id.img_playVideo_novideo) | 77 | @BindView(R.id.img_playVideo_novideo) |
| 72 | ImageView img_playVideo_novideo; | 78 | ImageView img_playVideo_novideo; |
| @@ -74,6 +80,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -74,6 +80,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 74 | FrameLayout fra_videoPlay_start; | 80 | FrameLayout fra_videoPlay_start; |
| 75 | @BindView(R.id.viewpager) | 81 | @BindView(R.id.viewpager) |
| 76 | NoScrollViewPager viewPager; | 82 | NoScrollViewPager viewPager; |
| 83 | + @BindView(R.id.fra_videoPlay_answer) | ||
| 84 | + FrameLayout fraVideoPlayAnswer; | ||
| 77 | private TabLayout tabLayout; | 85 | private TabLayout tabLayout; |
| 78 | @BindView(R.id.surfaceview_playVideo) | 86 | @BindView(R.id.surfaceview_playVideo) |
| 79 | SurfaceView surfaceviewPlayVideo; | 87 | SurfaceView surfaceviewPlayVideo; |
| @@ -91,6 +99,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -91,6 +99,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 91 | SlidingTabLayout mSlidingTab; | 99 | SlidingTabLayout mSlidingTab; |
| 92 | @BindView(R.id.img_playVideo_publishAudio) | 100 | @BindView(R.id.img_playVideo_publishAudio) |
| 93 | ImageView mIamgeView_PublishAudio; | 101 | ImageView mIamgeView_PublishAudio; |
| 102 | + @BindView(R.id.asv_videoPlay_answer) | ||
| 103 | + AnswerSheetView mAnswerSheetView; | ||
| 94 | private String username = ""; | 104 | private String username = ""; |
| 95 | private String userpwd = ""; | 105 | private String userpwd = ""; |
| 96 | private SimpleFragmentPagerAdapter pagerAdapter; | 106 | private SimpleFragmentPagerAdapter pagerAdapter; |
| @@ -99,13 +109,13 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -99,13 +109,13 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 99 | private LoginDialog mLoginDialog; | 109 | private LoginDialog mLoginDialog; |
| 100 | private ProgressDialog mProgressDialog; | 110 | private ProgressDialog mProgressDialog; |
| 101 | 111 | ||
| 102 | - private String playVideoOrAudioId=""; | 112 | + private String playVideoOrAudioId = ""; |
| 103 | //播放视频模式还是音频模式 | 113 | //播放视频模式还是音频模式 |
| 104 | - private boolean isPlayVideoMode =true; | 114 | + private boolean isPlayVideoMode = true; |
| 105 | /*推流视频模式还是音频模式*/ | 115 | /*推流视频模式还是音频模式*/ |
| 106 | - private boolean isPublsishVideoMode=true; | 116 | + private boolean isPublsishVideoMode = true; |
| 107 | /*mcu断开或者网络原因为false*/ | 117 | /*mcu断开或者网络原因为false*/ |
| 108 | - private boolean isDefaultExit=true; | 118 | + private boolean isDefaultExit = true; |
| 109 | private AlertDialog mErrorDialog; | 119 | private AlertDialog mErrorDialog; |
| 110 | private ACache aCache; | 120 | private ACache aCache; |
| 111 | //是否是回放状态, | 121 | //是否是回放状态, |
| @@ -114,7 +124,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -114,7 +124,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 114 | /*课堂名字*/ | 124 | /*课堂名字*/ |
| 115 | private String className; | 125 | private String className; |
| 116 | /*课堂类型*/ | 126 | /*课堂类型*/ |
| 117 | - private int classType=2; | 127 | + private int classType = 2; |
| 118 | private String[] titles; | 128 | private String[] titles; |
| 119 | private Handler mmHandler = new Handler() { | 129 | private Handler mmHandler = new Handler() { |
| 120 | @Override | 130 | @Override |
| @@ -123,7 +133,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -123,7 +133,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 123 | ResponseEntity responseEntity = (ResponseEntity) msg.obj; | 133 | ResponseEntity responseEntity = (ResponseEntity) msg.obj; |
| 124 | switch (responseEntity.getType()) { | 134 | switch (responseEntity.getType()) { |
| 125 | case Constants.CLASS_EXIT: | 135 | case Constants.CLASS_EXIT: |
| 126 | - ToastUtil.showToast("退出课堂",VideoPlayActivity.this); | 136 | + ToastUtil.showToast("退出课堂", VideoPlayActivity.this); |
| 127 | progressDialogDismiss(); | 137 | progressDialogDismiss(); |
| 128 | exit(); | 138 | exit(); |
| 129 | break; | 139 | break; |
| @@ -146,20 +156,20 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -146,20 +156,20 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 146 | 156 | ||
| 147 | try { | 157 | try { |
| 148 | jsonObject = new JSONObject(userJson); | 158 | jsonObject = new JSONObject(userJson); |
| 149 | - seek = jsonObject.optLong("recordPlaybackMaxTime"); | ||
| 150 | - className=jsonObject.optString("className"); | ||
| 151 | - classType=jsonObject.optInt("classType"); | ||
| 152 | - XdyLogUtil.i("课堂类型",""+classType); | 159 | + seek = jsonObject.optLong("recordPlaybackMaxTime"); |
| 160 | + className = jsonObject.optString("className"); | ||
| 161 | + classType = jsonObject.optInt("classType"); | ||
| 162 | + XdyLogUtil.i("课堂类型", "" + classType); | ||
| 153 | 163 | ||
| 154 | } catch (JSONException e) { | 164 | } catch (JSONException e) { |
| 155 | e.printStackTrace(); | 165 | e.printStackTrace(); |
| 156 | } | 166 | } |
| 157 | - if(!TextUtils.isEmpty(className)){ | 167 | + if (!TextUtils.isEmpty(className)) { |
| 158 | mTextView_ClassName.setText(className); | 168 | mTextView_ClassName.setText(className); |
| 159 | } | 169 | } |
| 160 | - if(replay) { | 170 | + if (replay) { |
| 161 | initRecordSeek(userJson); | 171 | initRecordSeek(userJson); |
| 162 | - }else { | 172 | + } else { |
| 163 | if (classType == 2) { | 173 | if (classType == 2) { |
| 164 | fra_videoPlay_start.setVisibility(View.GONE); | 174 | fra_videoPlay_start.setVisibility(View.GONE); |
| 165 | } else { | 175 | } else { |
| @@ -169,21 +179,21 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -169,21 +179,21 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 169 | break; | 179 | break; |
| 170 | case Constants.VIDEO_PLAY: | 180 | case Constants.VIDEO_PLAY: |
| 171 | //播放视频 | 181 | //播放视频 |
| 172 | - playVideoOrAudioId=responseEntity.getParam(); | ||
| 173 | - isPlayVideoMode =true; | 182 | + playVideoOrAudioId = responseEntity.getParam(); |
| 183 | + isPlayVideoMode = true; | ||
| 174 | playVideo(responseEntity.getParam()); | 184 | playVideo(responseEntity.getParam()); |
| 175 | break; | 185 | break; |
| 176 | case Constants.AUDIO_PLAY: | 186 | case Constants.AUDIO_PLAY: |
| 177 | //播放音频 | 187 | //播放音频 |
| 178 | - isPlayVideoMode =false; | ||
| 179 | - playVideoOrAudioId=responseEntity.getParam(); | 188 | + isPlayVideoMode = false; |
| 189 | + playVideoOrAudioId = responseEntity.getParam(); | ||
| 180 | playAudio(responseEntity.getParam()); | 190 | playAudio(responseEntity.getParam()); |
| 181 | break; | 191 | break; |
| 182 | case Constants.VIDEO_STOP: | 192 | case Constants.VIDEO_STOP: |
| 183 | //停止播放 | 193 | //停止播放 |
| 184 | case Constants.AUDIO_STOP: | 194 | case Constants.AUDIO_STOP: |
| 185 | //停止播放 | 195 | //停止播放 |
| 186 | - playVideoOrAudioId=""; | 196 | + playVideoOrAudioId = ""; |
| 187 | stopPlay(responseEntity.getParam()); | 197 | stopPlay(responseEntity.getParam()); |
| 188 | break; | 198 | break; |
| 189 | case Constants.PLAY_SUCCESS: | 199 | case Constants.PLAY_SUCCESS: |
| @@ -191,8 +201,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -191,8 +201,8 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 191 | img_playVideo_novideo.setVisibility(View.GONE); | 201 | img_playVideo_novideo.setVisibility(View.GONE); |
| 192 | break; | 202 | break; |
| 193 | case Constants.CLASS_UPDATE_TIMER: | 203 | case Constants.CLASS_UPDATE_TIMER: |
| 194 | - if(replay&&!mDragging) | ||
| 195 | - handleTime(responseEntity.getParam()); | 204 | + if (replay && !mDragging) |
| 205 | + handleTime(responseEntity.getParam()); | ||
| 196 | break; | 206 | break; |
| 197 | case Constants.RECORD_PLAYBACK_UPDATE: | 207 | case Constants.RECORD_PLAYBACK_UPDATE: |
| 198 | handleRecord(responseEntity.getParam()); | 208 | handleRecord(responseEntity.getParam()); |
| @@ -210,47 +220,49 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -210,47 +220,49 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 210 | setContentView(R.layout.activity_video_play); | 220 | setContentView(R.layout.activity_video_play); |
| 211 | EventBus.getDefault().register(this); | 221 | EventBus.getDefault().register(this); |
| 212 | ButterKnife.bind(this); | 222 | ButterKnife.bind(this); |
| 213 | - aCache=ACache.get(this); | 223 | + aCache = ACache.get(this); |
| 214 | xdySdk = XdySdk.getXdyInstance(); | 224 | xdySdk = XdySdk.getXdyInstance(); |
| 215 | xdySdk.add(this); | 225 | xdySdk.add(this); |
| 216 | init(); | 226 | init(); |
| 217 | 227 | ||
| 218 | progressDialogShow(); | 228 | progressDialogShow(); |
| 219 | setTablayout(); | 229 | setTablayout(); |
| 230 | + | ||
| 231 | + setAnswerLayout(); | ||
| 220 | } | 232 | } |
| 221 | 233 | ||
| 222 | public void init() { | 234 | public void init() { |
| 223 | - ArrayList<String> arrayList=getIntent().getStringArrayListExtra("init"); | ||
| 224 | - if(arrayList!=null&&arrayList.size()>1){ | ||
| 225 | - initClass= arrayList.get(0); | ||
| 226 | - if(TextUtils.isEmpty(arrayList.get(1))){ | ||
| 227 | - replay=true; | ||
| 228 | - }else { | ||
| 229 | - replay=false; | 235 | + ArrayList<String> arrayList = getIntent().getStringArrayListExtra("init"); |
| 236 | + if (arrayList != null && arrayList.size() > 1) { | ||
| 237 | + initClass = arrayList.get(0); | ||
| 238 | + if (TextUtils.isEmpty(arrayList.get(1))) { | ||
| 239 | + replay = true; | ||
| 240 | + } else { | ||
| 241 | + replay = false; | ||
| 230 | } | 242 | } |
| 231 | } | 243 | } |
| 232 | 244 | ||
| 233 | - if(!replay){ | 245 | + if (!replay) { |
| 234 | mVideoView.setVisibility(View.GONE); | 246 | mVideoView.setVisibility(View.GONE); |
| 235 | mMediaContainer.setVisibility(View.GONE); | 247 | mMediaContainer.setVisibility(View.GONE); |
| 236 | // mFramenLayout_stopPublish.setVisibility(View.VISIBLE); | 248 | // mFramenLayout_stopPublish.setVisibility(View.VISIBLE); |
| 237 | - }else{ | 249 | + } else { |
| 238 | surfaceviewPlayVideo.setVisibility(View.GONE); | 250 | surfaceviewPlayVideo.setVisibility(View.GONE); |
| 239 | initReplay(); | 251 | initReplay(); |
| 240 | 252 | ||
| 241 | } | 253 | } |
| 242 | - if(!replay){ | 254 | + if (!replay) { |
| 243 | xdySdk.api("init", initClass); | 255 | xdySdk.api("init", initClass); |
| 244 | - }else{ | 256 | + } else { |
| 245 | xdySdk.api("initRecordPlayback", initClass); | 257 | xdySdk.api("initRecordPlayback", initClass); |
| 246 | } | 258 | } |
| 247 | - currentTime=0; | 259 | + currentTime = 0; |
| 248 | mFramenLayout_stopPublish.setOnClickListener(new View.OnClickListener() { | 260 | mFramenLayout_stopPublish.setOnClickListener(new View.OnClickListener() { |
| 249 | @Override | 261 | @Override |
| 250 | public void onClick(View v) { | 262 | public void onClick(View v) { |
| 251 | - if(isPublsishVideoMode) { | 263 | + if (isPublsishVideoMode) { |
| 252 | xdySdk.api("stopPublishVideo", ""); | 264 | xdySdk.api("stopPublishVideo", ""); |
| 253 | - }else{ | 265 | + } else { |
| 254 | xdySdk.api("stopPublishAudio", ""); | 266 | xdySdk.api("stopPublishAudio", ""); |
| 255 | } | 267 | } |
| 256 | 268 | ||
| @@ -299,7 +311,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -299,7 +311,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 299 | // tabLayout.setTabMode(TabLayout.MODE_FIXED); | 311 | // tabLayout.setTabMode(TabLayout.MODE_FIXED); |
| 300 | // } | 312 | // } |
| 301 | 313 | ||
| 302 | - public void showSelectPublishMode(){ | 314 | + public void showSelectPublishMode() { |
| 303 | new ActionSheetDialog(VideoPlayActivity.this) | 315 | new ActionSheetDialog(VideoPlayActivity.this) |
| 304 | .builder() | 316 | .builder() |
| 305 | .setTitle("选择列表") | 317 | .setTitle("选择列表") |
| @@ -319,7 +331,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -319,7 +331,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 319 | sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); | 331 | sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); |
| 320 | surfaceView_publish.setZOrderMediaOverlay(true); | 332 | surfaceView_publish.setZOrderMediaOverlay(true); |
| 321 | xdySdk.api("publishVideo", "", surfaceView_publish, VideoPlayActivity.this); | 333 | xdySdk.api("publishVideo", "", surfaceView_publish, VideoPlayActivity.this); |
| 322 | - isPublsishVideoMode =true; | 334 | + isPublsishVideoMode = true; |
| 323 | } | 335 | } |
| 324 | }) | 336 | }) |
| 325 | .addSheetItem("推送音频", ActionSheetDialog.SheetItemColor.Blue | 337 | .addSheetItem("推送音频", ActionSheetDialog.SheetItemColor.Blue |
| @@ -334,14 +346,44 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -334,14 +346,44 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 334 | fra_videoPlay_start.setEnabled(false); | 346 | fra_videoPlay_start.setEnabled(false); |
| 335 | mFramenLayout_stopPublish.setEnabled(true); | 347 | mFramenLayout_stopPublish.setEnabled(true); |
| 336 | xdySdk.api(Constants.PUBLISH_AUDIO, "", null, VideoPlayActivity.this); | 348 | xdySdk.api(Constants.PUBLISH_AUDIO, "", null, VideoPlayActivity.this); |
| 337 | - isPublsishVideoMode =false; | 349 | + isPublsishVideoMode = false; |
| 350 | + } | ||
| 351 | + }) | ||
| 352 | + .addSheetItem("开始答题", ActionSheetDialog.SheetItemColor.Blue | ||
| 353 | + , new ActionSheetDialog.OnSheetItemClickListener() { | ||
| 354 | + @Override | ||
| 355 | + public void onClick(int which) { | ||
| 356 | + //填写事件 | ||
| 357 | + mAnswerSheetView.selectAnswerSheetType(AnswerSheetView.ANSWER_TYPE_SINGLE_OR_MORE); | ||
| 358 | + mAnswerSheetView.startCountTimer(22); | ||
| 359 | + setAnswerSheetLayout_Nornal(53); | ||
| 360 | + } | ||
| 361 | + }) | ||
| 362 | + .addSheetItem("对错选择", ActionSheetDialog.SheetItemColor.Blue | ||
| 363 | + , new ActionSheetDialog.OnSheetItemClickListener() { | ||
| 364 | + @Override | ||
| 365 | + public void onClick(int which) { | ||
| 366 | + //填写事件 | ||
| 367 | + mAnswerSheetView.selectAnswerSheetType(AnswerSheetView.ANSWER_TYPE_RIGHT_OR_WRONG); | ||
| 368 | + mAnswerSheetView.startCountTimer(15); | ||
| 369 | + setAnswerSheetLayout_Nornal(53); | ||
| 370 | + } | ||
| 371 | + }) | ||
| 372 | + .addSheetItem("填空题", ActionSheetDialog.SheetItemColor.Blue | ||
| 373 | + , new ActionSheetDialog.OnSheetItemClickListener() { | ||
| 374 | + @Override | ||
| 375 | + public void onClick(int which) { | ||
| 376 | + //填写事件 | ||
| 377 | + mAnswerSheetView.selectAnswerSheetType(AnswerSheetView.ANSWER_TYPE_FILLING); | ||
| 378 | + mAnswerSheetView.startCountTimer(15); | ||
| 379 | + setAnswerSheetLayout_Nornal(53); | ||
| 338 | } | 380 | } |
| 339 | }).show(); | 381 | }).show(); |
| 340 | } | 382 | } |
| 341 | 383 | ||
| 342 | - public void setTablayout(){ | 384 | + public void setTablayout() { |
| 343 | titles = new String[]{"文档", "聊天"}; | 385 | titles = new String[]{"文档", "聊天"}; |
| 344 | - pagerAdapter = new SimpleFragmentPagerAdapter(getSupportFragmentManager(), this,replay); | 386 | + pagerAdapter = new SimpleFragmentPagerAdapter(getSupportFragmentManager(), this, replay); |
| 345 | viewPager.setAdapter(pagerAdapter); | 387 | viewPager.setAdapter(pagerAdapter); |
| 346 | viewPager.setOnRplayTouchListener(this); | 388 | viewPager.setOnRplayTouchListener(this); |
| 347 | viewPager.setPagingEnabled(false); | 389 | viewPager.setPagingEnabled(false); |
| @@ -418,11 +460,11 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -418,11 +460,11 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 418 | 460 | ||
| 419 | // progressDialogDismiss(); | 461 | // progressDialogDismiss(); |
| 420 | 462 | ||
| 421 | - if(replay){ | 463 | + if (replay) { |
| 422 | playRecord(response); | 464 | playRecord(response); |
| 423 | 465 | ||
| 424 | - }else { | ||
| 425 | - if(!checkPermission()){ | 466 | + } else { |
| 467 | + if (!checkPermission()) { | ||
| 426 | return; | 468 | return; |
| 427 | } | 469 | } |
| 428 | 470 | ||
| @@ -430,31 +472,31 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -430,31 +472,31 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 430 | getWindowManager().getDefaultDisplay().getMetrics(dm); | 472 | getWindowManager().getDefaultDisplay().getMetrics(dm); |
| 431 | int widthPixels = dm.widthPixels; | 473 | int widthPixels = dm.widthPixels; |
| 432 | int heightPixels = dm.heightPixels; | 474 | int heightPixels = dm.heightPixels; |
| 433 | - if(surfaceviewPlayVideo!=null){ | 475 | + if (surfaceviewPlayVideo != null) { |
| 434 | // int margin = (mSurfaceViewWidth - w) / 2; | 476 | // int margin = (mSurfaceViewWidth - w) / 2; |
| 435 | - SurfaceHolder surfaceHolder=surfaceviewPlayVideo.getHolder(); | 477 | + SurfaceHolder surfaceHolder = surfaceviewPlayVideo.getHolder(); |
| 436 | RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( | 478 | RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( |
| 437 | RelativeLayout.LayoutParams.MATCH_PARENT, | 479 | RelativeLayout.LayoutParams.MATCH_PARENT, |
| 438 | RelativeLayout.LayoutParams.MATCH_PARENT); | 480 | RelativeLayout.LayoutParams.MATCH_PARENT); |
| 439 | - int setWidth=640; | ||
| 440 | - int setHeight=480; | ||
| 441 | - int leftW=0; | ||
| 442 | - int leftH=0; | ||
| 443 | - int width=surfaceviewPlayVideo.getWidth(); | ||
| 444 | - int height=surfaceviewPlayVideo.getHeight(); | ||
| 445 | - if(width>height){ | ||
| 446 | - setWidth=width; | ||
| 447 | - setHeight=height*(4/3); | ||
| 448 | - leftH=0; | ||
| 449 | - leftW=(widthPixels-setHeight)/2; | ||
| 450 | - }else{ | 481 | + int setWidth = 640; |
| 482 | + int setHeight = 480; | ||
| 483 | + int leftW = 0; | ||
| 484 | + int leftH = 0; | ||
| 485 | + int width = surfaceviewPlayVideo.getWidth(); | ||
| 486 | + int height = surfaceviewPlayVideo.getHeight(); | ||
| 487 | + if (width > height) { | ||
| 488 | + setWidth = width; | ||
| 489 | + setHeight = height * (4 / 3); | ||
| 490 | + leftH = 0; | ||
| 491 | + leftW = (widthPixels - setHeight) / 2; | ||
| 492 | + } else { | ||
| 451 | 493 | ||
| 452 | } | 494 | } |
| 453 | lp.setMargins(leftW, 0, leftW, 0); | 495 | lp.setMargins(leftW, 0, leftW, 0); |
| 454 | // surfaceHolder.setFixedSize(640,480); | 496 | // surfaceHolder.setFixedSize(640,480); |
| 455 | - XdyLogUtil.e("surface 高度计算:",surfaceviewPlayVideo.getWidth()+"高:"+surfaceviewPlayVideo.getHeight()); | 497 | + XdyLogUtil.e("surface 高度计算:", surfaceviewPlayVideo.getWidth() + "高:" + surfaceviewPlayVideo.getHeight()); |
| 456 | surfaceviewPlayVideo.setLayoutParams(lp); | 498 | surfaceviewPlayVideo.setLayoutParams(lp); |
| 457 | - XdyLogUtil.e("surface 设置后的高度的高度计算:",surfaceviewPlayVideo.getWidth()+"高:"+surfaceviewPlayVideo.getHeight()); | 499 | + XdyLogUtil.e("surface 设置后的高度的高度计算:", surfaceviewPlayVideo.getWidth() + "高:" + surfaceviewPlayVideo.getHeight()); |
| 458 | 500 | ||
| 459 | } | 501 | } |
| 460 | xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this); | 502 | xdySdk.api("playVideo", response + "", surfaceviewPlayVideo, VideoPlayActivity.this); |
| @@ -463,6 +505,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -463,6 +505,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 463 | ToastUtil.showToastshort("视频播放初始化", VideoPlayActivity.this); | 505 | ToastUtil.showToastshort("视频播放初始化", VideoPlayActivity.this); |
| 464 | } | 506 | } |
| 465 | } | 507 | } |
| 508 | + | ||
| 466 | /** | 509 | /** |
| 467 | * 播放音频 | 510 | * 播放音频 |
| 468 | * | 511 | * |
| @@ -470,12 +513,12 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -470,12 +513,12 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 470 | */ | 513 | */ |
| 471 | public void playAudio(String response) { | 514 | public void playAudio(String response) { |
| 472 | 515 | ||
| 473 | - if(replay){ | 516 | + if (replay) { |
| 474 | playRecord(response); | 517 | playRecord(response); |
| 475 | img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); | 518 | img_playVideo_novideo.setImageResource(R.mipmap.audio_mode); |
| 476 | img_playVideo_novideo.setVisibility(View.VISIBLE); | 519 | img_playVideo_novideo.setVisibility(View.VISIBLE); |
| 477 | - }else { | ||
| 478 | - if(!checkPermission()){ | 520 | + } else { |
| 521 | + if (!checkPermission()) { | ||
| 479 | return; | 522 | return; |
| 480 | } | 523 | } |
| 481 | xdySdk.api("playAudio", response, null, VideoPlayActivity.this); | 524 | xdySdk.api("playAudio", response, null, VideoPlayActivity.this); |
| @@ -491,7 +534,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -491,7 +534,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 491 | exit_dialog(); | 534 | exit_dialog(); |
| 492 | } | 535 | } |
| 493 | 536 | ||
| 494 | - public void exit_dialog(){ | 537 | + public void exit_dialog() { |
| 495 | final AlertDialog alertDialog = new AlertDialog.Builder(this) | 538 | final AlertDialog alertDialog = new AlertDialog.Builder(this) |
| 496 | .setTitle("退出") | 539 | .setTitle("退出") |
| 497 | .setMessage("是否离开课堂") | 540 | .setMessage("是否离开课堂") |
| @@ -554,7 +597,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -554,7 +597,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 554 | case "911": | 597 | case "911": |
| 555 | progressDialogDismiss(); | 598 | progressDialogDismiss(); |
| 556 | exit(); | 599 | exit(); |
| 557 | - ToastUtil.showToastshort(errorEntity.getReson(),this); | 600 | + ToastUtil.showToastshort(errorEntity.getReson(), this); |
| 558 | break; | 601 | break; |
| 559 | case "10000": | 602 | case "10000": |
| 560 | ToastUtil.showToastshort(errorEntity.getReson(), this); | 603 | ToastUtil.showToastshort(errorEntity.getReson(), this); |
| @@ -563,7 +606,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -563,7 +606,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 563 | ToastUtil.showToastshort(errorEntity.getReson(), this); | 606 | ToastUtil.showToastshort(errorEntity.getReson(), this); |
| 564 | break; | 607 | break; |
| 565 | case "20000": | 608 | case "20000": |
| 566 | - isDefaultExit=false; | 609 | + isDefaultExit = false; |
| 567 | showErrorDialog(); | 610 | showErrorDialog(); |
| 568 | ToastUtil.showToastshort(errorEntity.getReson(), this); | 611 | ToastUtil.showToastshort(errorEntity.getReson(), this); |
| 569 | break; | 612 | break; |
| @@ -571,10 +614,11 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -571,10 +614,11 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 571 | 614 | ||
| 572 | 615 | ||
| 573 | } | 616 | } |
| 617 | + | ||
| 574 | @Subscribe(threadMode = ThreadMode.POSTING) | 618 | @Subscribe(threadMode = ThreadMode.POSTING) |
| 575 | - public void finishActivity(String res){ | ||
| 576 | - if("home".equals(res)) { | ||
| 577 | - this.finish(); | 619 | + public void finishActivity(String res) { |
| 620 | + if ("home".equals(res)) { | ||
| 621 | + this.finish(); | ||
| 578 | } | 622 | } |
| 579 | 623 | ||
| 580 | } | 624 | } |
| @@ -589,12 +633,12 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -589,12 +633,12 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 589 | protected void onPause() { | 633 | protected void onPause() { |
| 590 | super.onPause(); | 634 | super.onPause(); |
| 591 | xdySdk.onPlayStop(playVideoOrAudioId); | 635 | xdySdk.onPlayStop(playVideoOrAudioId); |
| 592 | - if(isPlayVideoMode){ | 636 | + if (isPlayVideoMode) { |
| 593 | stopVideo(); | 637 | stopVideo(); |
| 594 | - }else{ | 638 | + } else { |
| 595 | stopAudio(); | 639 | stopAudio(); |
| 596 | } | 640 | } |
| 597 | - if(replay) { | 641 | + if (replay) { |
| 598 | xdySdk.api("pauseRecordPlayback", ""); | 642 | xdySdk.api("pauseRecordPlayback", ""); |
| 599 | } | 643 | } |
| 600 | xdySdk.onPublisherPause(); | 644 | xdySdk.onPublisherPause(); |
| @@ -603,14 +647,14 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -603,14 +647,14 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 603 | @Override | 647 | @Override |
| 604 | protected void onResume() { | 648 | protected void onResume() { |
| 605 | super.onResume(); | 649 | super.onResume(); |
| 606 | - if (isPlayVideoMode) { | ||
| 607 | - if(!TextUtils.isEmpty(playVideoOrAudioId)) | 650 | + if (isPlayVideoMode) { |
| 651 | + if (!TextUtils.isEmpty(playVideoOrAudioId)) | ||
| 608 | playVideo(playVideoOrAudioId); | 652 | playVideo(playVideoOrAudioId); |
| 609 | - } else { | ||
| 610 | - if(!TextUtils.isEmpty(playVideoOrAudioId)) | 653 | + } else { |
| 654 | + if (!TextUtils.isEmpty(playVideoOrAudioId)) | ||
| 611 | playAudio(playVideoOrAudioId); | 655 | playAudio(playVideoOrAudioId); |
| 612 | - } | ||
| 613 | - if(replay) { | 656 | + } |
| 657 | + if (replay) { | ||
| 614 | xdySdk.api("startRecordPlayback", ""); | 658 | xdySdk.api("startRecordPlayback", ""); |
| 615 | } | 659 | } |
| 616 | xdySdk.onPublisherResume(); | 660 | xdySdk.onPublisherResume(); |
| @@ -621,16 +665,16 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -621,16 +665,16 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 621 | */ | 665 | */ |
| 622 | public void exit() { | 666 | public void exit() { |
| 623 | progressDialogDismiss(); | 667 | progressDialogDismiss(); |
| 624 | - isDefaultExit=true; | ||
| 625 | - xdySdk.api("stopPublishVideo",""); | 668 | + isDefaultExit = true; |
| 669 | + xdySdk.api("stopPublishVideo", ""); | ||
| 626 | xdySdk.api("leaveClass", ""); | 670 | xdySdk.api("leaveClass", ""); |
| 627 | xdySdk.remove(this); | 671 | xdySdk.remove(this); |
| 628 | xdySdk.onPublisherStop(); | 672 | xdySdk.onPublisherStop(); |
| 629 | - if (mVideoView != null ){ | 673 | + if (mVideoView != null) { |
| 630 | mVideoView.stopPlayback(); | 674 | mVideoView.stopPlayback(); |
| 631 | } | 675 | } |
| 632 | UIUtils.closeDialog(mLoginDialog); | 676 | UIUtils.closeDialog(mLoginDialog); |
| 633 | - if(!replay) { | 677 | + if (!replay) { |
| 634 | xdySdk.removeAll(); | 678 | xdySdk.removeAll(); |
| 635 | } | 679 | } |
| 636 | 680 | ||
| @@ -659,13 +703,13 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -659,13 +703,13 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 659 | */ | 703 | */ |
| 660 | public void stopPlay(String response) { | 704 | public void stopPlay(String response) { |
| 661 | 705 | ||
| 662 | - if(replay){ | ||
| 663 | - if(isPlayVideoMode){ | 706 | + if (replay) { |
| 707 | + if (isPlayVideoMode) { | ||
| 664 | stopVideo(); | 708 | stopVideo(); |
| 665 | - }else{ | 709 | + } else { |
| 666 | stopAudio(); | 710 | stopAudio(); |
| 667 | } | 711 | } |
| 668 | - }else{ | 712 | + } else { |
| 669 | VideoOrAudioStopEntity entity = JsonUtil.parseJsonToBean(response, VideoOrAudioStopEntity.class); | 713 | VideoOrAudioStopEntity entity = JsonUtil.parseJsonToBean(response, VideoOrAudioStopEntity.class); |
| 670 | if (entity != null) { | 714 | if (entity != null) { |
| 671 | if (xdySdk.onPlayStop(entity.getMediaId() + "")) { | 715 | if (xdySdk.onPlayStop(entity.getMediaId() + "")) { |
| @@ -676,13 +720,14 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -676,13 +720,14 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 676 | } | 720 | } |
| 677 | 721 | ||
| 678 | } | 722 | } |
| 723 | + | ||
| 679 | public void showErrorDialog() { | 724 | public void showErrorDialog() { |
| 680 | - if(isDefaultExit){ | 725 | + if (isDefaultExit) { |
| 681 | return; | 726 | return; |
| 682 | } | 727 | } |
| 683 | if (mErrorDialog != null) | 728 | if (mErrorDialog != null) |
| 684 | return; | 729 | return; |
| 685 | - progressDialogDismiss(); | 730 | + progressDialogDismiss(); |
| 686 | mErrorDialog = new AlertDialog.Builder(this) | 731 | mErrorDialog = new AlertDialog.Builder(this) |
| 687 | .setTitle("退出") | 732 | .setTitle("退出") |
| 688 | .setMessage("您设备的网络属于断开状态,请重新进入") | 733 | .setMessage("您设备的网络属于断开状态,请重新进入") |
| @@ -699,8 +744,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -699,8 +744,10 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 699 | mErrorDialog.show(); | 744 | mErrorDialog.show(); |
| 700 | 745 | ||
| 701 | } | 746 | } |
| 702 | - private boolean isCameraCheckFirst=true; | ||
| 703 | - private boolean isAudioCheckFirst=true; | 747 | + |
| 748 | + private boolean isCameraCheckFirst = true; | ||
| 749 | + private boolean isAudioCheckFirst = true; | ||
| 750 | + | ||
| 704 | private boolean checkPermission() { | 751 | private boolean checkPermission() { |
| 705 | // try { | 752 | // try { |
| 706 | // int pRecordAudio = PermissionChecker.checkCallingOrSelfPermission(this, "android.permission.RECORD_AUDIO"); | 753 | // int pRecordAudio = PermissionChecker.checkCallingOrSelfPermission(this, "android.permission.RECORD_AUDIO"); |
| @@ -731,37 +778,40 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -731,37 +778,40 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 731 | // } | 778 | // } |
| 732 | return true; | 779 | return true; |
| 733 | } | 780 | } |
| 781 | + | ||
| 734 | @Override | 782 | @Override |
| 735 | public void observerUpData(String type, String parameter) { | 783 | public void observerUpData(String type, String parameter) { |
| 736 | - XdyLogUtil.e(TAG + "observer:", Thread.currentThread().getId() + "type:"+type); | 784 | + XdyLogUtil.e(TAG + "observer:", Thread.currentThread().getId() + "type:" + type); |
| 737 | ResponseEntity responseEntity = new ResponseEntity(type, parameter); | 785 | ResponseEntity responseEntity = new ResponseEntity(type, parameter); |
| 738 | Message message = Message.obtain(); | 786 | Message message = Message.obtain(); |
| 739 | message.obj = responseEntity; | 787 | message.obj = responseEntity; |
| 740 | mmHandler.sendMessage(message); | 788 | mmHandler.sendMessage(message); |
| 741 | } | 789 | } |
| 742 | - | ||
| 743 | 790 | ||
| 744 | - /*************************************** 回放***************************************************/ | 791 | + |
| 792 | + /*************************************** | ||
| 793 | + * 回放 | ||
| 794 | + ***************************************************/ | ||
| 745 | private static final int FADE_OUT = 1; | 795 | private static final int FADE_OUT = 1; |
| 746 | private static final int SHOW_PROGRESS = 2; | 796 | private static final int SHOW_PROGRESS = 2; |
| 747 | private boolean mShowing; | 797 | private boolean mShowing; |
| 748 | private boolean mDragging; | 798 | private boolean mDragging; |
| 749 | private RelativeLayout mMediaControllerRight; | 799 | private RelativeLayout mMediaControllerRight; |
| 750 | 800 | ||
| 751 | - private boolean pause=true; | 801 | + private boolean pause = true; |
| 752 | /** | 802 | /** |
| 753 | * 退出标记 | 803 | * 退出标记 |
| 754 | */ | 804 | */ |
| 755 | private boolean quit; | 805 | private boolean quit; |
| 756 | private boolean isOver; | 806 | private boolean isOver; |
| 757 | @BindView(R.id.fl_media) | 807 | @BindView(R.id.fl_media) |
| 758 | - FrameLayout mMediaContainer; | 808 | + FrameLayout mMediaContainer; |
| 759 | @BindView(R.id.iv_operation_play) | 809 | @BindView(R.id.iv_operation_play) |
| 760 | ImageButton mPauseButton; | 810 | ImageButton mPauseButton; |
| 761 | @BindView(R.id.sb_live) | 811 | @BindView(R.id.sb_live) |
| 762 | SeekBar mSeekBar; | 812 | SeekBar mSeekBar; |
| 763 | @BindView(R.id.rl_operation_play) | 813 | @BindView(R.id.rl_operation_play) |
| 764 | - RelativeLayout mPauseContainer; | 814 | + RelativeLayout mPauseContainer; |
| 765 | private TextView mClassName; | 815 | private TextView mClassName; |
| 766 | @BindView(R.id.tv_end_time) | 816 | @BindView(R.id.tv_end_time) |
| 767 | TextView mEndTime; | 817 | TextView mEndTime; |
| @@ -786,6 +836,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -786,6 +836,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 786 | } | 836 | } |
| 787 | } | 837 | } |
| 788 | }; | 838 | }; |
| 839 | + | ||
| 789 | public void initReplay() { | 840 | public void initReplay() { |
| 790 | mVideoView.setOnInfoListener(this); | 841 | mVideoView.setOnInfoListener(this); |
| 791 | mVideoView.setOnErrorListener(this); | 842 | mVideoView.setOnErrorListener(this); |
| @@ -845,7 +896,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -845,7 +896,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 845 | public void onClick(View v) { | 896 | public void onClick(View v) { |
| 846 | //开启或暂停回放 | 897 | //开启或暂停回放 |
| 847 | boolean pause = getRecordStatus(); | 898 | boolean pause = getRecordStatus(); |
| 848 | - pauseAndStart(!pause); | 899 | + pauseAndStart(!pause); |
| 849 | } | 900 | } |
| 850 | }); | 901 | }); |
| 851 | } | 902 | } |
| @@ -876,6 +927,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -876,6 +927,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 876 | public void setCurrentTime(int currentTime) { | 927 | public void setCurrentTime(int currentTime) { |
| 877 | this.currentTime = currentTime; | 928 | this.currentTime = currentTime; |
| 878 | } | 929 | } |
| 930 | + | ||
| 879 | public void seekRecordPlay(long b) { | 931 | public void seekRecordPlay(long b) { |
| 880 | //TODO 清除以前的数据 | 932 | //TODO 清除以前的数据 |
| 881 | // chatView.clearChatHistory(); | 933 | // chatView.clearChatHistory(); |
| @@ -884,6 +936,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -884,6 +936,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 884 | EventBus.getDefault().post("chat"); | 936 | EventBus.getDefault().post("chat"); |
| 885 | seekRecordPlayback(b); | 937 | seekRecordPlayback(b); |
| 886 | } | 938 | } |
| 939 | + | ||
| 887 | private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() { | 940 | private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() { |
| 888 | 941 | ||
| 889 | public void onStartTrackingTouch(SeekBar bar) { | 942 | public void onStartTrackingTouch(SeekBar bar) { |
| @@ -900,15 +953,15 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -900,15 +953,15 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 900 | public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) { | 953 | public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) { |
| 901 | if (!fromuser) | 954 | if (!fromuser) |
| 902 | return; | 955 | return; |
| 903 | - setCurrentTime((int) (progress*(seek/100))); | 956 | + setCurrentTime((int) (progress * (seek / 100))); |
| 904 | String time = generateTime(currentTime); | 957 | String time = generateTime(currentTime); |
| 905 | if (mCurrentTime != null) | 958 | if (mCurrentTime != null) |
| 906 | mCurrentTime.setText(time); | 959 | mCurrentTime.setText(time); |
| 907 | } | 960 | } |
| 908 | 961 | ||
| 909 | public void onStopTrackingTouch(SeekBar bar) { | 962 | public void onStopTrackingTouch(SeekBar bar) { |
| 910 | - XdyLogUtil.i("视频播放:",""+bar.getProgress()*bar.getProgress()*(seek/100)); | ||
| 911 | - seekRecordPlay(bar.getProgress() == 0 ? 1 : bar.getProgress()*(seek/100)); | 963 | + XdyLogUtil.i("视频播放:", "" + bar.getProgress() * bar.getProgress() * (seek / 100)); |
| 964 | + seekRecordPlay(bar.getProgress() == 0 ? 1 : bar.getProgress() * (seek / 100)); | ||
| 912 | showMediaContainer(TIME_OUT); | 965 | showMediaContainer(TIME_OUT); |
| 913 | mHandler.removeMessages(SHOW_PROGRESS); | 966 | mHandler.removeMessages(SHOW_PROGRESS); |
| 914 | mDragging = false; | 967 | mDragging = false; |
| @@ -949,11 +1002,11 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -949,11 +1002,11 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 949 | if (mCurrentTime != null) { | 1002 | if (mCurrentTime != null) { |
| 950 | mCurrentTime.setText(generateTime(currentTime)); | 1003 | mCurrentTime.setText(generateTime(currentTime)); |
| 951 | } | 1004 | } |
| 952 | - if (mSeekBar != null&&seek!=0) { | 1005 | + if (mSeekBar != null && seek != 0) { |
| 953 | // mSeekBar.setProgress(currentTime); | 1006 | // mSeekBar.setProgress(currentTime); |
| 954 | // XdyLogUtil.e("视频播放进度:seek:"+seek+" Currentime:"+currentTime); | 1007 | // XdyLogUtil.e("视频播放进度:seek:"+seek+" Currentime:"+currentTime); |
| 955 | // XdyLogUtil.e("视频播放进度:setProgress:"+ ((currentTime*1.0)/(seek))+":"+(int) (currentTime/seek*100)+":"+ ((currentTime/seek))*100); | 1008 | // XdyLogUtil.e("视频播放进度:setProgress:"+ ((currentTime*1.0)/(seek))+":"+(int) (currentTime/seek*100)+":"+ ((currentTime/seek))*100); |
| 956 | - mSeekBar.setProgress((int) (((currentTime*1.0)/seek)*100)); | 1009 | + mSeekBar.setProgress((int) (((currentTime * 1.0) / seek) * 100)); |
| 957 | } | 1010 | } |
| 958 | } | 1011 | } |
| 959 | } | 1012 | } |
| @@ -985,6 +1038,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -985,6 +1038,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 985 | mShowing = false; | 1038 | mShowing = false; |
| 986 | } | 1039 | } |
| 987 | } | 1040 | } |
| 1041 | + | ||
| 988 | public void updatePausePlay() { | 1042 | public void updatePausePlay() { |
| 989 | if (pause) | 1043 | if (pause) |
| 990 | mPauseButton.setImageResource(R.mipmap.play); | 1044 | mPauseButton.setImageResource(R.mipmap.play); |
| @@ -1005,7 +1059,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -1005,7 +1059,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 1005 | case Constants.RECORD_PLAYING: | 1059 | case Constants.RECORD_PLAYING: |
| 1006 | pause = false; | 1060 | pause = false; |
| 1007 | isOver = false; | 1061 | isOver = false; |
| 1008 | - pauseOrStartEverything(); | 1062 | + pauseOrStartEverything(); |
| 1009 | break; | 1063 | break; |
| 1010 | case Constants.RECORD_SEEK: | 1064 | case Constants.RECORD_SEEK: |
| 1011 | isOver = false; | 1065 | isOver = false; |
| @@ -1026,7 +1080,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -1026,7 +1080,7 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 1026 | case Constants.RECORD_PAUSE: | 1080 | case Constants.RECORD_PAUSE: |
| 1027 | isOver = false; | 1081 | isOver = false; |
| 1028 | pause = true; | 1082 | pause = true; |
| 1029 | - pauseOrStartEverything(); | 1083 | + pauseOrStartEverything(); |
| 1030 | break; | 1084 | break; |
| 1031 | } | 1085 | } |
| 1032 | updatePausePlay(); | 1086 | updatePausePlay(); |
| @@ -1034,12 +1088,14 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -1034,12 +1088,14 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 1034 | e.printStackTrace(); | 1088 | e.printStackTrace(); |
| 1035 | } | 1089 | } |
| 1036 | } | 1090 | } |
| 1037 | - long seek=1; | 1091 | + |
| 1092 | + long seek = 1; | ||
| 1038 | int currentTime; | 1093 | int currentTime; |
| 1094 | + | ||
| 1039 | /** | 1095 | /** |
| 1040 | * 录制回放初始化 seek长度等信息 | 1096 | * 录制回放初始化 seek长度等信息 |
| 1041 | */ | 1097 | */ |
| 1042 | - public void initRecordSeek(String response){ | 1098 | + public void initRecordSeek(String response) { |
| 1043 | 1099 | ||
| 1044 | setProgress(); | 1100 | setProgress(); |
| 1045 | mHandler.postDelayed(new Runnable() { | 1101 | mHandler.postDelayed(new Runnable() { |
| @@ -1054,18 +1110,20 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -1054,18 +1110,20 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 1054 | private void handleTime(String pa) { | 1110 | private void handleTime(String pa) { |
| 1055 | try { | 1111 | try { |
| 1056 | JSONObject jsonObject = new JSONObject(pa); | 1112 | JSONObject jsonObject = new JSONObject(pa); |
| 1057 | - //防止时间超了 | ||
| 1058 | - currentTime = jsonObject.optInt("classTimestamp"); | ||
| 1059 | - boolean isRe = jsonObject.optBoolean("recordStatus"); | 1113 | + //防止时间超了 |
| 1114 | + currentTime = jsonObject.optInt("classTimestamp"); | ||
| 1115 | + boolean isRe = jsonObject.optBoolean("recordStatus"); | ||
| 1060 | 1116 | ||
| 1061 | } catch (JSONException e) { | 1117 | } catch (JSONException e) { |
| 1062 | e.printStackTrace(); | 1118 | e.printStackTrace(); |
| 1063 | } | 1119 | } |
| 1064 | - setProgress(); | 1120 | + setProgress(); |
| 1065 | } | 1121 | } |
| 1122 | + | ||
| 1066 | public boolean getRecordStatus() { | 1123 | public boolean getRecordStatus() { |
| 1067 | return pause; | 1124 | return pause; |
| 1068 | } | 1125 | } |
| 1126 | + | ||
| 1069 | public void pauseOrStartEverything() { | 1127 | public void pauseOrStartEverything() { |
| 1070 | boolean isPause = getRecordStatus(); | 1128 | boolean isPause = getRecordStatus(); |
| 1071 | if (isPause && mVideoView != null && mVideoView.isPlaying()) { | 1129 | if (isPause && mVideoView != null && mVideoView.isPlaying()) { |
| @@ -1076,22 +1134,24 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -1076,22 +1134,24 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 1076 | XdyLogUtil.i(TAG, "视频开始"); | 1134 | XdyLogUtil.i(TAG, "视频开始"); |
| 1077 | } | 1135 | } |
| 1078 | } | 1136 | } |
| 1137 | + | ||
| 1079 | /** | 1138 | /** |
| 1080 | * 回放 播放 音视频 | 1139 | * 回放 播放 音视频 |
| 1140 | + * | ||
| 1081 | * @param response | 1141 | * @param response |
| 1082 | */ | 1142 | */ |
| 1083 | - public void playRecord(String response){ | ||
| 1084 | - String json_video= aCache.getAsString(response); | ||
| 1085 | - if(TextUtils.isEmpty(json_video)){ | 1143 | + public void playRecord(String response) { |
| 1144 | + String json_video = aCache.getAsString(response); | ||
| 1145 | + if (TextUtils.isEmpty(json_video)) { | ||
| 1086 | ///给出相应的提示表示没有 这个id | 1146 | ///给出相应的提示表示没有 这个id |
| 1087 | - XdyLogUtil.e(TAG,"Play Video Can not find this VideoId"); | 1147 | + XdyLogUtil.e(TAG, "Play Video Can not find this VideoId"); |
| 1088 | return; | 1148 | return; |
| 1089 | } | 1149 | } |
| 1090 | - VideoPlayBean videoPlayBean= JsonUtil.parseJsonToBean(json_video,VideoPlayBean.class); | ||
| 1091 | - if(videoPlayBean!=null){ | 1150 | + VideoPlayBean videoPlayBean = JsonUtil.parseJsonToBean(json_video, VideoPlayBean.class); |
| 1151 | + if (videoPlayBean != null) { | ||
| 1092 | //回放不会出现Constants.PLAY_SUCCESS: | 1152 | //回放不会出现Constants.PLAY_SUCCESS: |
| 1093 | - if(img_playVideo_novideo!=null) | ||
| 1094 | - img_playVideo_novideo.setVisibility(View.GONE); | 1153 | + if (img_playVideo_novideo != null) |
| 1154 | + img_playVideo_novideo.setVisibility(View.GONE); | ||
| 1095 | if (mVideoView.isPlaying()) { | 1155 | if (mVideoView.isPlaying()) { |
| 1096 | mVideoView.stopPlayback(); | 1156 | mVideoView.stopPlayback(); |
| 1097 | } | 1157 | } |
| @@ -1114,16 +1174,16 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -1114,16 +1174,16 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 1114 | }); | 1174 | }); |
| 1115 | 1175 | ||
| 1116 | 1176 | ||
| 1117 | - if (isPlayVideoMode && mVideoView != null && mVideoView.isPlaying()) | ||
| 1118 | - mVideoView.stopPlayback(); | 1177 | + if (isPlayVideoMode && mVideoView != null && mVideoView.isPlaying()) |
| 1178 | + mVideoView.stopPlayback(); | ||
| 1119 | } | 1179 | } |
| 1120 | 1180 | ||
| 1121 | public void stopAudio() { | 1181 | public void stopAudio() { |
| 1122 | img_playVideo_novideo.setImageResource(R.mipmap.no_video); | 1182 | img_playVideo_novideo.setImageResource(R.mipmap.no_video); |
| 1123 | img_playVideo_novideo.setVisibility(View.VISIBLE); | 1183 | img_playVideo_novideo.setVisibility(View.VISIBLE); |
| 1124 | 1184 | ||
| 1125 | - if (isPlayVideoMode && mVideoView != null && mVideoView.isPlaying()) | ||
| 1126 | - mVideoView.stopPlayback(); | 1185 | + if (isPlayVideoMode && mVideoView != null && mVideoView.isPlaying()) |
| 1186 | + mVideoView.stopPlayback(); | ||
| 1127 | 1187 | ||
| 1128 | } | 1188 | } |
| 1129 | 1189 | ||
| @@ -1141,20 +1201,47 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | @@ -1141,20 +1201,47 @@ public class VideoPlayActivity extends AppCompatActivity implements ObserverList | ||
| 1141 | 1201 | ||
| 1142 | public void pauseAndStart(boolean b) { | 1202 | public void pauseAndStart(boolean b) { |
| 1143 | if (b) { | 1203 | if (b) { |
| 1144 | - pauseRecordPlayback(); | 1204 | + pauseRecordPlayback(); |
| 1145 | } else { | 1205 | } else { |
| 1146 | startRecordPlayback(); | 1206 | startRecordPlayback(); |
| 1147 | } | 1207 | } |
| 1148 | } | 1208 | } |
| 1209 | + | ||
| 1149 | public void pauseRecordPlayback() { | 1210 | public void pauseRecordPlayback() { |
| 1150 | - xdySdk.api("pauseRecordPlayback",""); | 1211 | + xdySdk.api("pauseRecordPlayback", ""); |
| 1151 | } | 1212 | } |
| 1152 | 1213 | ||
| 1153 | public void startRecordPlayback() { | 1214 | public void startRecordPlayback() { |
| 1154 | - xdySdk.api("startRecordPlayback",""); | 1215 | + xdySdk.api("startRecordPlayback", ""); |
| 1155 | } | 1216 | } |
| 1217 | + | ||
| 1156 | public void seekRecordPlayback(long time) { | 1218 | public void seekRecordPlayback(long time) { |
| 1157 | - TimeEntity timeEntity=new TimeEntity(time); | 1219 | + TimeEntity timeEntity = new TimeEntity(time); |
| 1158 | xdySdk.api("seekRecordPlayback", new Gson().toJson(timeEntity)); | 1220 | xdySdk.api("seekRecordPlayback", new Gson().toJson(timeEntity)); |
| 1159 | } | 1221 | } |
| 1222 | + | ||
| 1223 | + | ||
| 1224 | + /********************************答题卡*********************************************************/ | ||
| 1225 | + | ||
| 1226 | + public void setAnswerLayout(){ | ||
| 1227 | + mAnswerSheetView.setOnAnswerLayoutChangeListener(new AnswerSheetView.OnAnswerLayoutChangeListener() | ||
| 1228 | + { | ||
| 1229 | + @Override | ||
| 1230 | + public void setAnswerSheetFramLayout(int num) { | ||
| 1231 | + LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,XdyStringUtils.dp2px(VideoPlayActivity.this,num)); | ||
| 1232 | + fraVideoPlayAnswer.setLayoutParams(layoutParams); | ||
| 1233 | + } | ||
| 1234 | + | ||
| 1235 | + @Override | ||
| 1236 | + public void setAnswerSheetNormal(int num) { | ||
| 1237 | + setAnswerSheetLayout_Nornal(num); | ||
| 1238 | + } | ||
| 1239 | + }); | ||
| 1240 | + } | ||
| 1241 | + | ||
| 1242 | + public void setAnswerSheetLayout_Nornal(int num){ | ||
| 1243 | + fraVideoPlayAnswer.setVisibility(View.VISIBLE); | ||
| 1244 | + LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,XdyStringUtils.dp2px(VideoPlayActivity.this,num)); | ||
| 1245 | + fraVideoPlayAnswer.setLayoutParams(layoutParams); | ||
| 1246 | + } | ||
| 1160 | } | 1247 | } |
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | style="@style/home_input_edit_style" | 44 | style="@style/home_input_edit_style" |
| 45 | android:hint="请输入课堂号" | 45 | android:hint="请输入课堂号" |
| 46 | android:inputType="number" | 46 | android:inputType="number" |
| 47 | - android:text="763307927"/> | 47 | + android:text="124709334"/> |
| 48 | 48 | ||
| 49 | <View | 49 | <View |
| 50 | style="@style/ui_divider_line_horizontal" | 50 | style="@style/ui_divider_line_horizontal" |
| @@ -137,17 +137,7 @@ | @@ -137,17 +137,7 @@ | ||
| 137 | </FrameLayout> | 137 | </FrameLayout> |
| 138 | </RelativeLayout> | 138 | </RelativeLayout> |
| 139 | </RelativeLayout> | 139 | </RelativeLayout> |
| 140 | - <SurfaceView | ||
| 141 | - android:id="@+id/surfaceview_playVideo_text" | ||
| 142 | - android:layout_width="150dp" | ||
| 143 | - android:layout_height="200dp" | ||
| 144 | - android:visibility="gone"/> | ||
| 145 | - <FrameLayout | ||
| 146 | - android:layout_width="wrap_content" | ||
| 147 | - android:layout_height="wrap_content" | ||
| 148 | - android:orientation="horizontal" | ||
| 149 | - > | ||
| 150 | - </FrameLayout> | 140 | + |
| 151 | <android.support.design.widget.TabLayout | 141 | <android.support.design.widget.TabLayout |
| 152 | android:id="@+id/sliding_tabs" | 142 | android:id="@+id/sliding_tabs" |
| 153 | android:layout_width="match_parent" | 143 | android:layout_width="match_parent" |
| @@ -176,7 +166,9 @@ | @@ -176,7 +166,9 @@ | ||
| 176 | android:layout_width="match_parent" | 166 | android:layout_width="match_parent" |
| 177 | android:layout_height="0px" | 167 | android:layout_height="0px" |
| 178 | android:layout_weight="1" | 168 | android:layout_weight="1" |
| 179 | - android:background="@android:color/white" /> | 169 | + android:background="@android:color/white" > |
| 170 | + | ||
| 171 | + </com.mang.xdy.demo.widget.view.NoScrollViewPager> | ||
| 180 | <FrameLayout | 172 | <FrameLayout |
| 181 | android:id="@+id/fl_media" | 173 | android:id="@+id/fl_media" |
| 182 | android:layout_width="match_parent" | 174 | android:layout_width="match_parent" |
| @@ -190,152 +182,14 @@ | @@ -190,152 +182,14 @@ | ||
| 190 | </FrameLayout> | 182 | </FrameLayout> |
| 191 | 183 | ||
| 192 | <FrameLayout | 184 | <FrameLayout |
| 185 | + android:id="@+id/fra_videoPlay_answer" | ||
| 193 | android:layout_width="match_parent" | 186 | android:layout_width="match_parent" |
| 187 | + android:visibility="gone" | ||
| 194 | android:layout_height="@dimen/ui_titlebar_height"> | 188 | android:layout_height="@dimen/ui_titlebar_height"> |
| 195 | - <RelativeLayout | 189 | + <com.mang.xdy.demo.widget.answersheet.AnswerSheetView |
| 190 | + android:id="@+id/asv_videoPlay_answer" | ||
| 196 | android:layout_width="match_parent" | 191 | android:layout_width="match_parent" |
| 197 | android:layout_height="match_parent"> | 192 | android:layout_height="match_parent"> |
| 198 | - <!--倒计时--> | ||
| 199 | - <RelativeLayout | ||
| 200 | - android:id="@+id/ll_home_tv_exam_countdown" | ||
| 201 | - android:layout_width="wrap_content" | ||
| 202 | - android:layout_height="match_parent" | ||
| 203 | - android:orientation="vertical"> | ||
| 204 | - <TextView | ||
| 205 | - android:id="@+id/tv_exam_countdown" | ||
| 206 | - android:layout_width="wrap_content" | ||
| 207 | - android:layout_height="wrap_content" | ||
| 208 | - android:layout_marginRight="5dp" | ||
| 209 | - android:layout_alignParentLeft="true" | ||
| 210 | - android:text="30s" | ||
| 211 | - android:textColor="@color/actionsheet_red" | ||
| 212 | - android:background="@color/white" | ||
| 213 | - /> | ||
| 214 | - </RelativeLayout> | ||
| 215 | - <RelativeLayout | ||
| 216 | - android:layout_marginLeft="5dp" | ||
| 217 | - android:layout_toRightOf="@+id/ll_home_tv_exam_countdown" | ||
| 218 | - android:layout_width="match_parent" | ||
| 219 | - android:layout_height="match_parent" | ||
| 220 | - > | ||
| 221 | - <!--单选多选--> | ||
| 222 | - <LinearLayout | ||
| 223 | - android:layout_width="match_parent" | ||
| 224 | - android:layout_height="match_parent" | ||
| 225 | - android:layout_toLeftOf="@+id/ll_exam_submit" | ||
| 226 | - android:gravity="center" | ||
| 227 | - android:visibility="gone" | ||
| 228 | - android:orientation="horizontal" | ||
| 229 | - > | ||
| 230 | - <CheckBox | ||
| 231 | - android:id="@+id/rb_exam_A" | ||
| 232 | - style="@style/exam_cb_style" | ||
| 233 | - android:drawableLeft="@drawable/selector_exam" | ||
| 234 | - android:text="A" /> | ||
| 235 | - | ||
| 236 | - <CheckBox | ||
| 237 | - android:id="@+id/rb_exam_B" | ||
| 238 | - style="@style/exam_cb_style" | ||
| 239 | - android:drawableLeft="@drawable/selector_exam" | ||
| 240 | - android:text="B" /> | ||
| 241 | - | ||
| 242 | - <CheckBox | ||
| 243 | - android:id="@+id/rb_exam_C" | ||
| 244 | - style="@style/exam_cb_style" | ||
| 245 | - android:drawableLeft="@drawable/selector_exam" | ||
| 246 | - android:text="C" /> | ||
| 247 | - | ||
| 248 | - <CheckBox | ||
| 249 | - android:id="@+id/rb_exam_D" | ||
| 250 | - style="@style/exam_cb_style" | ||
| 251 | - android:drawableLeft="@drawable/selector_exam" | ||
| 252 | - android:text="D" /> | ||
| 253 | - </LinearLayout> | ||
| 254 | - <!--对错--> | ||
| 255 | - <LinearLayout | ||
| 256 | - android:id="@+id/ll_exam_selectRightOrWrong" | ||
| 257 | - android:layout_width="match_parent" | ||
| 258 | - android:layout_height="match_parent" | ||
| 259 | - android:layout_toLeftOf="@+id/ll_exam_submit" | ||
| 260 | - android:gravity="center" | ||
| 261 | - android:visibility="gone" | ||
| 262 | - android:orientation="horizontal" | ||
| 263 | - > | ||
| 264 | - <CheckBox | ||
| 265 | - android:id="@+id/cb_exam_R" | ||
| 266 | - style="@style/exam_cb_style" | ||
| 267 | - android:drawableLeft="@drawable/selector_exam" | ||
| 268 | - android:text="正确" /> | ||
| 269 | - | ||
| 270 | - <CheckBox | ||
| 271 | - android:id="@+id/cb_exam_W" | ||
| 272 | - style="@style/exam_cb_style" | ||
| 273 | - android:drawableLeft="@drawable/selector_exam" | ||
| 274 | - android:text="错误" /> | ||
| 275 | - </LinearLayout> | ||
| 276 | - | ||
| 277 | - <LinearLayout | ||
| 278 | - android:id="@+id/ll_exam_filling" | ||
| 279 | - android:layout_width="match_parent" | ||
| 280 | - android:layout_height="match_parent" | ||
| 281 | - android:layout_toLeftOf="@+id/ll_exam_submit" | ||
| 282 | - android:gravity="center" | ||
| 283 | - android:orientation="horizontal" | ||
| 284 | - > | ||
| 285 | - <EditText | ||
| 286 | - android:layout_width="wrap_content" | ||
| 287 | - android:layout_height="wrap_content" | ||
| 288 | - android:layout_weight="1" | ||
| 289 | - android:hint="一" | ||
| 290 | - /> | ||
| 291 | - <EditText | ||
| 292 | - android:layout_width="wrap_content" | ||
| 293 | - android:layout_height="wrap_content" | ||
| 294 | - android:layout_weight="1" | ||
| 295 | - android:hint="二" | ||
| 296 | - /> | ||
| 297 | - | ||
| 298 | - <EditText | ||
| 299 | - android:layout_width="wrap_content" | ||
| 300 | - android:layout_height="wrap_content" | ||
| 301 | - android:layout_weight="1" | ||
| 302 | - android:hint="输入答案" | ||
| 303 | - /> | ||
| 304 | - </LinearLayout> | ||
| 305 | - <!--提交--> | ||
| 306 | - <LinearLayout | ||
| 307 | - android:id="@+id/ll_exam_submit" | ||
| 308 | - android:layout_width="wrap_content" | ||
| 309 | - android:layout_height="match_parent" | ||
| 310 | - android:orientation="horizontal" | ||
| 311 | - android:gravity="center" | ||
| 312 | - android:layout_marginLeft="10dp" | ||
| 313 | - android:layout_alignParentRight="true" | ||
| 314 | - > | ||
| 315 | - <TextView | ||
| 316 | - android:id="@+id/tv_exam_up" | ||
| 317 | - android:layout_width="match_parent" | ||
| 318 | - android:layout_height="wrap_content" | ||
| 319 | - android:layout_weight="1" | ||
| 320 | - android:text="提交" | ||
| 321 | - android:layout_gravity="center_vertical" | ||
| 322 | - android:textColor="@android:color/white" | ||
| 323 | - android:background="@drawable/shape_bg_full_circle_blue" | ||
| 324 | - android:layout_marginRight="10dp" | ||
| 325 | - /> | ||
| 326 | - <TextView | ||
| 327 | - android:id="@+id/tv_exam_cancle" | ||
| 328 | - android:layout_width="match_parent" | ||
| 329 | - android:layout_height="wrap_content" | ||
| 330 | - android:layout_weight="1" | ||
| 331 | - android:text="放弃" | ||
| 332 | - android:layout_gravity="center_vertical" | ||
| 333 | - android:textColor="@android:color/white" | ||
| 334 | - android:background="@drawable/shape_bg_full_circle_blue" | ||
| 335 | - android:layout_marginRight="10dp" | ||
| 336 | - /> | ||
| 337 | - </LinearLayout> | ||
| 338 | - </RelativeLayout> | ||
| 339 | - </RelativeLayout> | 193 | + </com.mang.xdy.demo.widget.answersheet.AnswerSheetView> |
| 340 | </FrameLayout> | 194 | </FrameLayout> |
| 341 | </LinearLayout> | 195 | </LinearLayout> |
| 1 | -#Fri May 05 18:08:22 CST 2017 | 1 | +#Mon May 08 17:38:00 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 | -#Fri May 05 18:04:58 CST 2017 | 1 | +#Mon May 08 17:37:17 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 |
| @@ -6,8 +6,8 @@ D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hd | @@ -6,8 +6,8 @@ D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hd | ||
| 6 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\actionsheet_middle_selector.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable\\actionsheet_middle_selector.xml | 6 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\actionsheet_middle_selector.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable\\actionsheet_middle_selector.xml |
| 7 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\anim\\actionsheet_dialog_in.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\anim\\actionsheet_dialog_in.xml | 7 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\anim\\actionsheet_dialog_in.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\anim\\actionsheet_dialog_in.xml |
| 8 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\alertdialog_left_selector.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable\\alertdialog_left_selector.xml | 8 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\alertdialog_left_selector.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable\\alertdialog_left_selector.xml |
| 9 | -D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\trans_bg.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\trans_bg.png | ||
| 10 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_middle_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\actionsheet_middle_pressed.9.png | 9 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_middle_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\actionsheet_middle_pressed.9.png |
| 10 | +D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\trans_bg.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\trans_bg.png | ||
| 11 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\actionsheet_bottom_selector.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable\\actionsheet_bottom_selector.xml | 11 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\actionsheet_bottom_selector.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable\\actionsheet_bottom_selector.xml |
| 12 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\alert_btn_right_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\alert_btn_right_pressed.9.png | 12 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\alert_btn_right_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\alert_btn_right_pressed.9.png |
| 13 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\alert_btn_left_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\alert_btn_left_pressed.9.png | 13 | D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\alert_btn_left_pressed.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\bundles\\release\\res\\drawable-hdpi-v4\\alert_btn_left_pressed.9.png |
| 1 | package com.mang.xdy.utils; | 1 | package com.mang.xdy.utils; |
| 2 | 2 | ||
| 3 | +import android.content.Context; | ||
| 3 | import android.text.TextUtils; | 4 | import android.text.TextUtils; |
| 4 | import android.util.Log; | 5 | import android.util.Log; |
| 5 | 6 | ||
| @@ -75,4 +76,8 @@ public class XdyStringUtils { | @@ -75,4 +76,8 @@ public class XdyStringUtils { | ||
| 75 | .toString(); | 76 | .toString(); |
| 76 | } | 77 | } |
| 77 | } | 78 | } |
| 79 | + | ||
| 80 | + public static int dp2px(Context context, float dp) { | ||
| 81 | + return (int) Math.ceil(context.getResources().getDisplayMetrics().density * dp); | ||
| 82 | + } | ||
| 78 | } | 83 | } |
-
请 注册 或 登录 后发表评论