huangxinbao

add teacher client operate student

正在显示 31 个修改的文件 包含 1594 行增加57 行删除
... ... @@ -5,7 +5,21 @@
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/gradle/2.2.0" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/XdyDemo" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/easeUI_CN" />
<option value="$PROJECT_DIR$/iOS_Dialog_Library" />
<option value="$PROJECT_DIR$/myapplication2" />
<option value="$PROJECT_DIR$/mylibrary" />
<option value="$PROJECT_DIR$/sdklibraryssss" />
<option value="$PROJECT_DIR$/smartPlayer" />
<option value="$PROJECT_DIR$/xdy" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
... ... @@ -10,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="true" assert-keyword="false" jdk-15="false">
<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">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
... ...
... ... @@ -3,6 +3,15 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/MyApplication.iml" filepath="$PROJECT_DIR$/MyApplication.iml" />
<module fileurl="file://$PROJECT_DIR$/XdyDemo/XdyDemo.iml" filepath="$PROJECT_DIR$/XdyDemo/XdyDemo.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/easeUI_CN/easeUI_CN.iml" filepath="$PROJECT_DIR$/easeUI_CN/easeUI_CN.iml" />
<module fileurl="file://$PROJECT_DIR$/iOS_Dialog_Library/iOS_Dialog_Library.iml" filepath="$PROJECT_DIR$/iOS_Dialog_Library/iOS_Dialog_Library.iml" />
<module fileurl="file://$PROJECT_DIR$/myapplication2/myapplication2.iml" filepath="$PROJECT_DIR$/myapplication2/myapplication2.iml" />
<module fileurl="file://$PROJECT_DIR$/mylibrary/mylibrary.iml" filepath="$PROJECT_DIR$/mylibrary/mylibrary.iml" />
<module fileurl="file://$PROJECT_DIR$/sdklibraryssss/sdklibraryssss.iml" filepath="$PROJECT_DIR$/sdklibraryssss/sdklibraryssss.iml" />
<module fileurl="file://$PROJECT_DIR$/smartPlayer/smartPlayer.iml" filepath="$PROJECT_DIR$/smartPlayer/smartPlayer.iml" />
<module fileurl="file://$PROJECT_DIR$/xdy/xdy.iml" filepath="$PROJECT_DIR$/xdy/xdy.iml" />
</modules>
</component>
</project>
\ No newline at end of file
... ...
... ... @@ -43,7 +43,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:windowSoftInputMode="adjustPan|stateHidden"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
... ... @@ -52,7 +52,9 @@
</intent-filter>
</activity>
<activity android:name=".activity.VideoPlayActivity"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden"
>
</activity>
</application>
... ...
... ... @@ -14,7 +14,6 @@ import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
... ... @@ -43,6 +42,7 @@ import com.mang.xdy.demo.adapter.SimpleFragmentPagerAdapter;
import com.mang.xdy.demo.bean.ErrorEntity;
import com.mang.xdy.demo.bean.InitClassSuccessEntity;
import com.mang.xdy.demo.bean.JoinClass;
import com.mang.xdy.demo.bean.ProcessVideoOrAudioByTeacherEntity;
import com.mang.xdy.demo.bean.ResponseEntity;
import com.mang.xdy.demo.bean.TimeEntity;
import com.mang.xdy.demo.bean.VideoOrAudioStopEntity;
... ... @@ -50,7 +50,6 @@ import com.mang.xdy.demo.fragment.ChatFragment;
import com.mang.xdy.demo.fragment.DocFragment;
import com.mang.xdy.demo.utils.JsonUtil;
import com.mang.xdy.demo.utils.ToastUtil;
import com.mang.xdy.demo.widget.answersheet.AnswerSheetView;
import com.mang.xdy.demo.widget.dialog.LoginDialog;
import com.mang.xdy.demo.widget.view.NoScrollViewPager;
import com.mang.xdy.listener.ObserverListener;
... ... @@ -224,6 +223,17 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
case Constants.RECORD_PLAYBACK_UPDATE:
handleRecord(responseEntity.getParam());
break;
case Constants.VIDEO_BROADCAST:
if(!replay) {
processVideoOrAudioByTeacher(responseEntity.getParam(),true);
}
break;
case Constants.AUDIO_BROADCAST:
if(!replay) {
processVideoOrAudioByTeacher(responseEntity.getParam(),false);
}
break;
}
... ... @@ -279,18 +289,8 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
mFramenLayout_stopPublish.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isPublsishVideoMode) {
xdySdk.api("stopPublishVideo", "");
} else {
xdySdk.api("stopPublishAudio", "");
}
stopPublish();
fra_videoPlay_start.setEnabled(true);
mFramenLayout_stopPublish.setEnabled(false);
mFramenLayout_stopPublish.setVisibility(View.GONE);
fra_videoPlay_start.setVisibility(View.VISIBLE);
surfaceView_publish.setVisibility(View.GONE);
mIamgeView_PublishAudio.setVisibility(View.GONE);
}
});
... ... @@ -298,7 +298,11 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
@Override
public void onClick(View v) {
//
showSelectPublishMode();
if(isTablet(VideoPlayActivity.this)){
publishVideo();
}else {
showSelectPublishMode();
}
// AnswerSheetDialog answerSheetDialog= new AnswerSheetDialog(VideoPlayActivity.this);
// answerSheetDialog.builder().show();
// new AnswerSheetDialog(VideoPlayActivity.this).builder().show();
... ... @@ -351,16 +355,18 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
@Override
public void onClick(int which) {
//填写事件
mFramenLayout_stopPublish.setVisibility(View.VISIBLE);
fra_videoPlay_start.setVisibility(View.GONE);
surfaceView_publish.setVisibility(View.VISIBLE);
fra_videoPlay_start.setEnabled(false);
mFramenLayout_stopPublish.setEnabled(true);
sh = surfaceView_publish.getHolder();
sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
surfaceView_publish.setZOrderMediaOverlay(true);
xdySdk.api("publishVideo", "", surfaceView_publish, VideoPlayActivity.this);
isPublsishVideoMode = true;
// coverStudent(true);
// mFramenLayout_stopPublish.setVisibility(View.VISIBLE);
// fra_videoPlay_start.setVisibility(View.GONE);
// surfaceView_publish.setVisibility(View.VISIBLE);
// fra_videoPlay_start.setEnabled(false);
// mFramenLayout_stopPublish.setEnabled(true);
// sh = surfaceView_publish.getHolder();
// sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
// surfaceView_publish.setZOrderMediaOverlay(true);
// xdySdk.api("publishVideo", "", surfaceView_publish, VideoPlayActivity.this);
// isPublsishVideoMode = true;
publishVideo();
}
})
.addSheetItem(getResources().getString(R.string.home_dialog_pushAudio), ActionSheetDialog.SheetItemColor.Blue
... ... @@ -368,14 +374,16 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
@Override
public void onClick(int which) {
//填写事件
mFramenLayout_stopPublish.setVisibility(View.VISIBLE);
fra_videoPlay_start.setVisibility(View.GONE);
surfaceView_publish.setVisibility(View.GONE);
mIamgeView_PublishAudio.setVisibility(View.VISIBLE);
fra_videoPlay_start.setEnabled(false);
mFramenLayout_stopPublish.setEnabled(true);
xdySdk.api(Constants.PUBLISH_AUDIO, "", null, VideoPlayActivity.this);
isPublsishVideoMode = false;
// coverStudent(true);
// mFramenLayout_stopPublish.setVisibility(View.VISIBLE);
// fra_videoPlay_start.setVisibility(View.GONE);
// surfaceView_publish.setVisibility(View.GONE);
// mIamgeView_PublishAudio.setVisibility(View.VISIBLE);
// fra_videoPlay_start.setEnabled(false);
// mFramenLayout_stopPublish.setEnabled(true);
// xdySdk.api(Constants.PUBLISH_AUDIO, "", null, VideoPlayActivity.this);
// isPublsishVideoMode = false;
publishAudio();
}
})
.addSheetItem("单选或者多选", ActionSheetDialog.SheetItemColor.Blue
... ... @@ -589,6 +597,27 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
ToastUtil.showToastshort(getResources().getString(R.string.home_msg_play_audio_init), VideoPlayActivity.this);
}
}
/*教师端主动开始视频,或关闭视频*/
public void processVideoOrAudioByTeacher(String parameter,boolean video){
ProcessVideoOrAudioByTeacherEntity entity=JsonUtil.parseJsonToBean(parameter,ProcessVideoOrAudioByTeacherEntity.class);
if(entity!=null&&entity.getToNodeId()!=0){
switch (entity.getActionType()){
case 1:
//开启
if(video) {
publishVideo();
}else {
publishAudio();
}
break;
case 2:
//关闭
stopPublish();
break;
}
}
}
@Override
public void onBackPressed() {
... ... @@ -1305,29 +1334,94 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
/********************************平板*********************************************************/
private LinearLayout llvideoPlayright;
private FrameLayout fra_videoPlay_student_cover;
/*打开音频*/
private FrameLayout fra_videoPlay_start_audio;
/*推流*/
private RelativeLayout rel_videoPlay_publish;
public void initTablet(){
if(!isTablet(this)){
return;
}
//如果是横排,则改为竖排
if(getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
DisplayMetrics metric = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(metric);
int winWidth = metric.widthPixels; // 屏幕宽度(像素)
int winHeight = metric.heightPixels; // 屏幕高度(像素)
int offset=30;//默认偏移
double ratio_tablet=(winWidth*1.0)/winHeight;
double ratio_width=4;
llVideo_table_chat= (LinearLayout) findViewById(R.id.ll_videoPlay_tablet_chat);
LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(winWidth/4,winWidth/3);
XdyLogUtil.e("学点云Tablet:",""+winWidth/3+"::"+winWidth/4+":"+winWidth);
llVideo_table_chat.setLayoutParams(layoutParams);
//如果是横排,则改为竖排
if(getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
llvideoPlayright= (LinearLayout) findViewById(R.id.ll_videoPlay_right);
fra_videoPlay_student_cover= (FrameLayout) findViewById(R.id.fra_videoPlay_student_cover);
fra_videoPlay_start_audio= (FrameLayout) findViewById(R.id.fra_videoPlay_start_audio);
rel_videoPlay_publish= (RelativeLayout) findViewById(R.id.rel_videoPlay_publish);
if(replay){
rel_videoPlay_publish.setVisibility(View.GONE);
}else {
rel_videoPlay_publish.setVisibility(View.VISIBLE);
}
if(ratio_tablet>1.4){
//偏移尽量小,或者偏移不
offset=30;
ratio_width=4.5;
}else{
offset=75;
ratio_width=4;
}
XdyLogUtil.e("学点云Tablet:",""+winWidth/4+"::"+(5*winWidth)/(16)+":"+winWidth+"offset:"+offset+"ratio_width:"+ratio_width);
RelativeLayout.LayoutParams layoutParams_right=new RelativeLayout.LayoutParams((int) (winWidth/ratio_width), RelativeLayout.LayoutParams.MATCH_PARENT);
layoutParams_right.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
layoutParams_right.setMargins(0,0,XdyStringUtils.dp2px(this,5),0);
llvideoPlayright.setLayoutParams(layoutParams_right);
LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams((int)(winWidth/ratio_width),(int)(winWidth/ratio_width+offset));
layoutParams.setMargins(0,XdyStringUtils.dp2px(this,8),0,0);
llVideo_table_chat.setLayoutParams(layoutParams);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
transaction.add(R.id.ll_videoPlay_tablet_chat,ChatFragment.newInstance(replay),"tag");
transaction.commit();
setListenerPublishAudio();
}
/*打开音频*/
public void setListenerPublishAudio(){
fra_videoPlay_start_audio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
publishAudio();
}
});
}
/*显示或隐藏Audio按钮*/
public void tabletShowAudio(boolean show){
if(!isTablet(this)){
return;
}
if(show){
fra_videoPlay_start_audio.setVisibility(View.GONE);
}else{
fra_videoPlay_start_audio.setVisibility(View.VISIBLE);
}
}
/*显示或隐藏学生播放Cover*/
public void coverStudent(boolean show){
if(!isTablet(this)){
return;
}
if(show) {
fra_videoPlay_student_cover.setVisibility(View.GONE);
}else{
fra_videoPlay_student_cover.setVisibility(View.VISIBLE);
}
}
/**
* 判断当前设备是手机还是平板,代码来自 Google I/O App for Android
... ... @@ -1337,5 +1431,52 @@ public class VideoPlayActivity extends FragmentActivity implements ObserverListe
public static boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
/******************************************************公共**********************************/
/*播放视频*/
public void publishVideo(){
//填写事件
coverStudent(true);
tabletShowAudio(true);
mFramenLayout_stopPublish.setVisibility(View.VISIBLE);
fra_videoPlay_start.setVisibility(View.GONE);
surfaceView_publish.setVisibility(View.VISIBLE);
fra_videoPlay_start.setEnabled(false);
mFramenLayout_stopPublish.setEnabled(true);
sh = surfaceView_publish.getHolder();
sh.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
surfaceView_publish.setZOrderMediaOverlay(true);
xdySdk.api("publishVideo", "", surfaceView_publish, VideoPlayActivity.this);
isPublsishVideoMode = true;
}
/*播放音频*/
public void publishAudio(){
coverStudent(true);
tabletShowAudio(true);
mFramenLayout_stopPublish.setVisibility(View.VISIBLE);
fra_videoPlay_start.setVisibility(View.GONE);
surfaceView_publish.setVisibility(View.GONE);
mIamgeView_PublishAudio.setVisibility(View.VISIBLE);
fra_videoPlay_start.setEnabled(false);
mFramenLayout_stopPublish.setEnabled(true);
xdySdk.api(Constants.PUBLISH_AUDIO, "", null, VideoPlayActivity.this);
isPublsishVideoMode = false;
}
/*停止推流*/
public void stopPublish(){
if (isPublsishVideoMode) {
xdySdk.api("stopPublishVideo", "");
} else {
xdySdk.api("stopPublishAudio", "");
}
coverStudent(false);
fra_videoPlay_start.setEnabled(true);
mFramenLayout_stopPublish.setEnabled(false);
mFramenLayout_stopPublish.setVisibility(View.GONE);
fra_videoPlay_start.setVisibility(View.VISIBLE);
surfaceView_publish.setVisibility(View.GONE);
mIamgeView_PublishAudio.setVisibility(View.GONE);
tabletShowAudio(false);
}
}
... ...
package com.mang.xdy.demo.bean;
/**
* 教师端主动开启视频
*/
public class ProcessVideoOrAudioByTeacherEntity {
/**
* fromNodeId : 663230246
* toNodeId : 565646
* actionType : 1
* data : 开始视频推流1487675015981
*/
private int fromNodeId;
private int toNodeId;
private int actionType;
private String data;
public int getFromNodeId() {
return fromNodeId;
}
public void setFromNodeId(int fromNodeId) {
this.fromNodeId = fromNodeId;
}
public int getToNodeId() {
return toNodeId;
}
public void setToNodeId(int toNodeId) {
this.toNodeId = toNodeId;
}
public int getActionType() {
return actionType;
}
public void setActionType(int actionType) {
this.actionType = actionType;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
... ...
... ... @@ -467,7 +467,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
this.setOnTouchListener(this);
// 设置背景为透明 否则是黑色
this.setZOrderOnTop(true);
this.getHolder().setFormat(PixelFormat.TRANSPARENT);
this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
// this.setZOrderMediaOverlay(true);
screenWidth = DisplayUtil.getScreenWidth(getContext());
... ...
package com.mang.xdy.demo.widget.dialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.os.CountDownTimer;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.mang.xdy.demo.R;
import com.mang.xdy.demo.utils.ToastUtil;
import com.mang.xdy.utils.XdyLogUtil;
import com.mang.xdy.utils.XdyStringUtils;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by abao on 2017/5/9.
*/
public class AnswerSheetDialog {
/*单选多选类型*/
public final static int ANSWER_TYPE_SINGLE_OR_MORE = 1;
/*对错类型*/
public final static int ANSWER_TYPE_RIGHT_OR_WRONG = 2;
/*填空*/
public final static int ANSWER_TYPE_FILLING = 3;
/*单前的type*/
private static int ANSWER_CURRENT_TYPE = 1;
/*倒计时时间 s*/
public static int ANSWER_TIMEOUT = 30;
@BindView(R.id.tv_exam_countdown)
TextView tvExamCountdown;
@BindView(R.id.rel_home_tv_exam_countdown)
RelativeLayout relHomeTvExamCountdown;
@BindView(R.id.cb_exam_A)
CheckBox cbExamA;
@BindView(R.id.cb_exam_B)
CheckBox cbExamB;
@BindView(R.id.cb_exam_C)
CheckBox cbExamC;
@BindView(R.id.cb_exam_D)
CheckBox cbExamD;
@BindView(R.id.ll_exam_SingleOrMore)
LinearLayout llExamSingleOrMore;
@BindView(R.id.rb_exam_R)
RadioButton rbExamR;
@BindView(R.id.rb_exam_W)
RadioButton rbExamW;
@BindView(R.id.ll_exam_selectRightOrWrong)
LinearLayout llExamSelectRightOrWrong;
@BindView(R.id.ll_exam_filling)
LinearLayout llExamFilling;
@BindView(R.id.tv_exam_up)
TextView tvExamUp;
@BindView(R.id.tv_exam_cancle)
TextView tvExamCancle;
@BindView(R.id.ll_exam_submit)
LinearLayout llExamSubmit;
@BindView(R.id.rel_exam_layout)
RelativeLayout relExamLayout;
@BindView(R.id.ll_exam_answer)
LinearLayout llExamAnswer;
@BindView(R.id.ll_exam_Myanswer)
LinearLayout llExamMyanswer;
@BindView(R.id.ll_exam_Correctanswer)
LinearLayout llExamCorrectanswer;
@BindView(R.id.cb_exam_spreadOrfold)
CheckBox cbxamSpreadOrfold;
@BindView(R.id.ll_exam_spreadOrfold)
LinearLayout llExamSpreadOrfold;
private AnswerCount mAnswerCount;
private StringBuffer sb = new StringBuffer();
private Context mContext;
private String character_close = "关闭";
private String character_cancle = "放弃";
private OnAnswerLayoutChangeListener onAnswerLayoutChangeListener;
public interface OnAnswerLayoutChangeListener {
/**
* 改变显示布局的大小
*
* @param
*/
void setAnswerSheetFramLayout(int num);
void setAnswerSheetNormal(int num);
}
public void setOnAnswerLayoutChangeListener(OnAnswerLayoutChangeListener onAnswerLayoutChangeListener) {
this.onAnswerLayoutChangeListener = onAnswerLayoutChangeListener;
}
private Dialog dialog;
private TextView txt_title;
private TextView txt_cancel;
private LinearLayout lLayout_content;
private ScrollView sLayout_content;
private boolean showTitle = false;
// private List<ActionSheetDialog.SheetItem> sheetItemList;
private Display display;
public AnswerSheetDialog(Context context) {
this.mContext = context;
WindowManager windowManager = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
display = windowManager.getDefaultDisplay();
}
public AnswerSheetDialog builder() {
View view = LayoutInflater.from(mContext).inflate(
R.layout.item_answer, null);
ButterKnife.bind(this, view);
view.setMinimumWidth(display.getWidth());
dialog = new Dialog(mContext, R.style.AnswerSheetDialogStyle);
dialog.setContentView(view);
Window dialogWindow = dialog.getWindow();
dialogWindow.setGravity(Gravity.LEFT | Gravity.BOTTOM);
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
lp.x = 0;
lp.y = 0;
dialogWindow.setAttributes(lp);
return this;
}
public void show() {
dialog.show();
}
/*选择答题类型*/
public void selectAnswerSheetType(int type) {
tvExamCountdown.setText("_s");
llExamAnswer.setVisibility(View.GONE);
tvExamUp.setVisibility(View.VISIBLE);
tvExamCancle.setText(character_cancle);
// llExamSubmit.setLayoutParams(new RelativeLayout.LayoutParams(XdyStringUtils.dp2px(mContext,100), RelativeLayout.LayoutParams.MATCH_PARENT));
switch (type) {
case ANSWER_TYPE_SINGLE_OR_MORE:
ANSWER_CURRENT_TYPE = ANSWER_TYPE_SINGLE_OR_MORE;
llExamSingleOrMore.setVisibility(View.VISIBLE);
llExamSelectRightOrWrong.setVisibility(View.GONE);
llExamFilling.setVisibility(View.GONE);
break;
case ANSWER_TYPE_RIGHT_OR_WRONG:
ANSWER_CURRENT_TYPE = ANSWER_TYPE_RIGHT_OR_WRONG;
llExamSingleOrMore.setVisibility(View.GONE);
llExamSelectRightOrWrong.setVisibility(View.VISIBLE);
llExamFilling.setVisibility(View.GONE);
break;
case ANSWER_TYPE_FILLING:
ANSWER_CURRENT_TYPE = ANSWER_TYPE_FILLING;
llExamSingleOrMore.setVisibility(View.GONE);
llExamSelectRightOrWrong.setVisibility(View.GONE);
llExamFilling.setVisibility(View.VISIBLE);
break;
}
}
@OnClick({R.id.tv_exam_up, R.id.tv_exam_cancle,R.id.cb_exam_spreadOrfold})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_exam_up:
//提交需要获取结果,清除数据,时间清理
// relExamLayout.setVisibility(GONE);
handleAnswer(ANSWER_CURRENT_TYPE);
ToastUtil.showToastshort("选择答案:" + sb.toString() + sb.length(), mContext);
recoverStatus();
setSubmitAnswer();
break;
case R.id.tv_exam_cancle:
recoverStatus();
if (relExamLayout.isShown()) {
relExamLayout.setVisibility(View.GONE);
}
if (dialog != null) {
dialog.dismiss();
}
break;
case R.id.cb_exam_spreadOrfold:
// imgExamSpreadOrfold.setImageResource(R.mipmap.foldback);
break;
}
}
/*开始倒计时*/
public void startCountTimerAndResizeLayout(int time, int dimens) {
ANSWER_TIMEOUT = time;
cancleCountTimer();
mAnswerCount = new AnswerCount(ANSWER_TIMEOUT * 1000, 1000);
mAnswerCount.start();
//提交需要获取结果,清除数据,时间清理
relExamLayout.setVisibility(View.VISIBLE);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, XdyStringUtils.dp2px(mContext, dimens));
relExamLayout.setLayoutParams(layoutParams);
}
/*销毁倒计时*/
public void cancleCountTimer() {
if (mAnswerCount != null) {
mAnswerCount.cancel();
}
}
/**
* 处理结果,拼装答案
*
* @param type
*/
public void handleAnswer(int type) {
switch (type) {
case ANSWER_TYPE_SINGLE_OR_MORE:
handleSingleOrMore();
break;
case ANSWER_TYPE_RIGHT_OR_WRONG:
handleRightOrWrong();
break;
case ANSWER_TYPE_FILLING:
break;
}
}
/*单选,多选答案拼接*/
public void handleSingleOrMore() {
sb.setLength(0);
if (cbExamA.isChecked()) {
sb.append("A");
}
if (cbExamB.isChecked()) {
sb.append("B");
}
if (cbExamC.isChecked()) {
sb.append("C");
}
if (cbExamD.isChecked()) {
sb.append("D");
}
}
/*处理对错*/
public void handleRightOrWrong() {
sb.setLength(0);
if (rbExamR.isChecked()) {
sb.append("对");
} else {
sb.append("错");
}
}
/*恢复状态*/
public void recoverStatus() {
switch (ANSWER_CURRENT_TYPE) {
case ANSWER_TYPE_SINGLE_OR_MORE:
cbExamA.setChecked(false);
cbExamB.setChecked(false);
cbExamC.setChecked(false);
cbExamD.setChecked(false);
break;
case ANSWER_TYPE_RIGHT_OR_WRONG:
rbExamR.setChecked(true);
rbExamW.setChecked(false);
break;
case ANSWER_TYPE_FILLING:
break;
}
}
/*隐藏所有题目*/
private void hideAllTitle() {
llExamSingleOrMore.setVisibility(View.GONE);
llExamSelectRightOrWrong.setVisibility(View.GONE);
llExamFilling.setVisibility(View.GONE);
}
/*设置显示答案布局大小*/
public void setAnswerLayout(int num) {
if (onAnswerLayoutChangeListener != null) {
onAnswerLayoutChangeListener.setAnswerSheetFramLayout(num);
}
// RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,XdyStringUtils.dp2px(mContext,num));
// llExamAnswer.setLayoutParams(layoutParams);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, XdyStringUtils.dp2px(mContext, num));
relExamLayout.setLayoutParams(layoutParams);
llExamAnswer.setVisibility(View.VISIBLE);
//改变取消按钮布局大小
RelativeLayout.LayoutParams layoutParams_submit = new RelativeLayout.LayoutParams(XdyStringUtils.dp2px(mContext, 50), RelativeLayout.LayoutParams.MATCH_PARENT);
layoutParams_submit.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
llExamSubmit.setLayoutParams(layoutParams_submit);
}
/*设置显示答案布局大小*/
public void setAnsNormalLayout(int num) {
if (onAnswerLayoutChangeListener != null) {
onAnswerLayoutChangeListener.setAnswerSheetNormal(num);
}
}
/*提交答案 设置*/
private void setSubmitAnswer() {
hideAllTitle();
cancleCountTimer();
tvExamUp.setVisibility(View.GONE);
tvExamCancle.setText(character_close);
setAnswerLayout(100);
char[] myAnswer = new char[sb.length()];
for (int i = 0; i < sb.length(); i++) {
myAnswer[i] = sb.charAt(i);
}
showAnswer(myAnswer, myAnswer);
}
/*设置答案*/
public void showAnswer(char[] myAnswer, char[] currectAnswer) {
llExamMyanswer.removeAllViews();
llExamCorrectanswer.removeAllViews();
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(5, 0, 5, 0);
for (int i = 0; i < myAnswer.length; i++) {
TextView textView = new TextView(mContext);
textView.setBackgroundResource(R.drawable.shape_bg_circle_answer_normal);
textView.setText(myAnswer[i] + "");
textView.setTextSize(15);
XdyLogUtil.e("答题卡,单双选择:", "" + XdyStringUtils.dp2px(mContext, 12));
textView.setTextColor(Color.WHITE);
textView.setGravity(Gravity.CENTER);
textView.setLayoutParams(layoutParams);
llExamMyanswer.addView(textView);
}
for (int i = 0; i < currectAnswer.length; i++) {
TextView textView = new TextView(mContext);
textView.setBackgroundResource(R.drawable.shape_bg_circle_answer_red);
textView.setText(currectAnswer[i] + "");
textView.setTextSize(15);
textView.setGravity(Gravity.CENTER);
textView.setTextColor(Color.WHITE);
textView.setLayoutParams(layoutParams);
llExamCorrectanswer.addView(textView);
}
}
@OnClick(R.id.ll_exam_answer)
public void onViewClicked() {
}
/*倒计时处理*/
class AnswerCount extends CountDownTimer {
/**
* @param millisInFuture The number of millis in the future from the call
* to {@link #start()} until the countdown is done and {@link #onFinish()}
* is called.
* @param countDownInterval The interval along the way to receive
* {@link #onTick(long)} callbacks.
*/
public AnswerCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onTick(long millisUntilFinished) {
if (millisUntilFinished < 10) {
tvExamCountdown.setText(" " + millisUntilFinished / 1000 + "s");
} else {
tvExamCountdown.setText(millisUntilFinished / 1000 + "s");
}
}
@Override
public void onFinish() {
//这个结束应该做自动提交答案的工作
tvExamCountdown.setText("0s");
}
}
}
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.mang.xdy.demo.MainActivity">
<RelativeLayout
android:id="@+id/rl_home_close"
android:layout_width="@dimen/ui_DIMEN_98.0PX"
android:layout_height="@dimen/ui_DIMEN_98.0PX">
<ImageView
style="@style/ui_wrap_wrap"
android:layout_centerInParent="true"
android:src="@mipmap/close"/>
</RelativeLayout>
<ImageView
android:id="@+id/iv_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/ui_DIMEN_24.0PX"
android:src="@mipmap/logo_home"/>
<RelativeLayout
android:id="@+id/rl_classid"
style="@style/home_input_style"
android:layout_marginTop="@dimen/ui_DIMEN_80.0PX">
<TextView
android:id="@+id/tv_home_classid"
style="@style/home_input_title_style"
android:layout_centerVertical="true"
android:text="@string/home_classid_hint"/>
<android.support.v7.widget.AppCompatEditText
android:id="@+id/edt_home_classId"
android:layout_toRightOf="@+id/tv_home_classid"
style="@style/home_input_edit_style"
android:hint="classId"
android:inputType="number"
android:text="118417229"/>
<View
style="@style/ui_divider_line_horizontal"
android:layout_alignParentBottom="true"
android:background="#cccccc"/>
</RelativeLayout>
<!--role-->
<RelativeLayout
android:id="@+id/rl_userrole"
style="@style/home_input_style"
android:layout_below="@id/rl_classid">
<TextView
android:id="@+id/tv_home_userrole"
style="@style/home_input_title_style"
android:layout_centerVertical="true"
android:text="@string/home_role_hint"/>
<EditText
android:id="@+id/edt_home_role"
android:layout_toRightOf="@+id/tv_home_userrole"
style="@style/home_input_edit_style"
android:hint="role"
android:text="normal"
/>
<View
style="@style/ui_divider_line_horizontal"
android:layout_alignParentBottom="true"
android:background="#cccccc"/>
</RelativeLayout>
<!--portal-->
<RelativeLayout
android:id="@+id/rl_portal"
style="@style/home_input_style"
android:layout_below="@id/rl_userrole">
<TextView
android:id="@+id/tv_home_portal"
style="@style/home_input_title_style"
android:layout_centerVertical="true"
android:text="@string/home_portal_hint"/>
<EditText
android:id="@+id/edt_home_serviceIp"
android:layout_toRightOf="@+id/tv_home_portal"
style="@style/home_input_edit_style"
android:hint="portal"
android:text="112.126.80.182:90"
/>
<View
style="@style/ui_divider_line_horizontal"
android:layout_alignParentBottom="true"
android:background="#cccccc"/>
</RelativeLayout>
<!-- userid -->
<RelativeLayout
android:id="@+id/rl_userid"
style="@style/home_input_style"
android:layout_below="@id/rl_portal">
<TextView
android:id="@+id/tv_home_userid"
style="@style/home_input_title_style"
android:layout_centerVertical="true"
android:text="@string/home_userid_hint"/>
<EditText
android:id="@+id/edt_home_userId"
android:layout_toRightOf="@+id/tv_home_userid"
style="@style/home_input_edit_style"
android:hint="userId"
android:text="0"
/>
<View
style="@style/ui_divider_line_horizontal"
android:layout_alignParentBottom="true"
android:background="#cccccc"/>
</RelativeLayout>
<Button
android:id="@+id/btn_home_enter_class"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/home_enter_class"
android:textColor="@color/white"
android:background="@drawable/home_selector_bottom_btn_blue"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="55dp"
/>
<Button
android:id="@+id/btn_home_enter_publisher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:text="@string/home_enter_replay"
android:textColor="@color/white"
android:background="@drawable/home_selector_bottom_btn_green"
/>
</LinearLayout>
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:my="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/ui_DIMEN_24.0PX"
android:paddingRight="@dimen/ui_DIMEN_24.0PX">
<TextView
android:id="@+id/chat_item_date"
android:layout_width="@dimen/ui_DIMEN_80.0PX"
android:layout_height="@dimen/ui_DIMEN_35.0PX"
android:layout_gravity="center_horizontal"
android:background="@drawable/home_chat_item_date_bg"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/ui_DIMEN_22.0PX"
android:visibility="gone"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/ui_DIMEN_6.0PX">
<ImageView
android:id="@+id/chat_item_avatar"
style="@style/home_chat_item_avatar"
android:layout_alignParentRight="true"/>
<LinearLayout
android:id="@+id/ll_item_name_parent"
android:orientation="horizontal"
android:layout_marginRight="@dimen/ui_DIMEN_20.0PX"
android:layout_toLeftOf="@id/chat_item_avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/chat_item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/COLOR_808080"
android:textSize="@dimen/ui_DIMEN_22.0PX"/>
<TextView
android:id="@+id/chat_item_taacher_bg"
android:textColor="@color/white"
android:text="老师"
android:visibility="gone"
android:paddingLeft="@dimen/ui_DIMEN_10.0PX"
android:paddingRight="@dimen/ui_DIMEN_10.0PX"
android:gravity="center"
android:layout_marginLeft="@dimen/ui_DIMEN_8.0PX"
android:textSize="@dimen/ui_DIMEN_20.0PX"
android:background="@drawable/home_chat_teacher_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<RelativeLayout
android:id="@+id/chat_item_layout_content"
style="@style/home_chat_item_content"
android:layout_below="@id/ll_item_name_parent"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/ui_DIMEN_6.0PX"
android:layout_toLeftOf="@id/chat_item_avatar"
android:gravity="end">
<com.mang.xdy.demo.widget.emoji.EmoticonsTextView
android:id="@+id/chat_item_content_text"
style="@style/home_chat_item_text_content"
android:layout_centerVertical="true"
android:background="@drawable/chat_pop_send"
android:gravity="start|center_vertical"
android:textColor="@color/white"
android:includeFontPadding="false"
android:paddingLeft="@dimen/ui_DIMEN_10.0PX"
android:paddingRight="@dimen/ui_DIMEN_20.0PX"
tools:text=""
my:emojiconSize="@dimen/ui_DIMEN_40.0PX"/>
<ImageView
android:id="@+id/chat_item_content_image"
style="@style/home_chat_item_image_content"/>
</RelativeLayout>
<ImageView
android:id="@+id/chat_item_fail"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/chat_item_layout_content"
android:background="@mipmap/msg_state_fail_resend"
android:focusable="false"
android:visibility="gone"/>
<ProgressBar
android:id="@+id/chat_item_progress"
style="@android:style/Widget.ProgressBar.Small.Inverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/chat_item_layout_content"
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<LinearLayout
android:id="@+id/chat_menu_images"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:clickable="true"
android:focusable="false"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:text="图片"/>
</LinearLayout>
<LinearLayout
android:id="@+id/chat_menu_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@id/chat_menu_images"
android:clickable="true"
android:focusable="false"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:text="拍照"/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/messageToolBox"
android:layout_width="match_parent"
android:layout_height="@dimen/ui_DIMEN_96.0PX"
android:background="#f1f1f1"
android:orientation="horizontal">
<ImageView
android:id="@+id/toolbox_btn_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/ui_DIMEN_24.0PX"
android:layout_marginRight="@dimen/ui_DIMEN_24.0PX"
android:src="@drawable/home_selector_chat_send_btn" />
<!-- android:background="@drawable/selector_chat_more"-->
<CheckBox
android:id="@+id/toolbox_btn_more"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_toRightOf="@+id/toolbox_btn_face"
android:visibility="gone"
android:button="@null"/>
<com.mang.xdy.demo.widget.emoji.EmoticonsEditText
android:id="@+id/toolbox_et_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/toolbox_btn_send"
android:layout_toRightOf="@+id/toolbox_btn_face"
android:background="@drawable/home_chat_input_bg"
android:inputType="textMultiLine"
android:maxHeight="@dimen/ui_DIMEN_68.0PX"
android:paddingLeft="@dimen/ui_DIMEN_8.0PX"
android:minHeight="@dimen/ui_DIMEN_68.0PX"
android:singleLine="false"
android:textSize="@dimen/ui_DIMEN_26.0PX" />
<CheckBox
android:id="@+id/toolbox_btn_face"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/ui_DIMEN_24.0PX"
android:layout_marginRight="@dimen/ui_DIMEN_24.0PX"
android:background="@drawable/home_selector_chat_emoji_btn"
android:button="@null" />
<LinearLayout
android:id="@+id/ll_cover"
android:orientation="horizontal"
android:background="@color/transparent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/toolbox_layout_face"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<android.support.v4.view.ViewPager
android:id="@+id/toolbox_pagers_face"
android:layout_width="match_parent"
android:layout_height="160dp"></android.support.v4.view.ViewPager>
<com.mang.xdy.demo.widget.chat.PagerSlidingTabStrip
android:id="@+id/toolbox_tabs"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@+id/toolbox_pagers_face"
android:background="#ffffff"
android:visibility="visible"
app:home_pstsDividerColor="#a7a5a5"
app:home_pstsIndicatorColor="#ffffff"
app:home_pstsShouldExpand="true"
app:home_pstsTabPaddingLeftRight="14dip"
app:home_pstsUnderlineColor="#ffffff" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="@dimen/ui_DIMEN_500.0PX"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/radius_solid_white_stroke_999"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/ui_DIMEN_20.0PX">
<EditText
android:id="@+id/et_username"
style="@style/home_login_edit_style"
android:hint="@string/home_enter_username"/>
<EditText
android:id="@+id/et_password"
style="@style/home_login_edit_style"
android:hint="@string/home_enter_password"
android:inputType="textPassword"
android:visibility="gone"/>
<Button
android:id="@+id/btn_login"
style="@style/home_site_btn_style"
android:text="@string/home_enter_login"
android:textColor="@color/white"/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/gradient_play"/>
<RelativeLayout
android:paddingLeft="@dimen/ui_DIMEN_20.0PX"
android:id="@+id/rl_operation_play"
android:layout_width="@dimen/ui_DIMEN_70.0PX"
android:layout_centerVertical="true"
android:layout_height="@dimen/ui_DIMEN_70.0PX">
<ImageButton
android:layout_marginLeft="@dimen/ui_DIMEN_20.0PX"
android:id="@+id/iv_operation_play"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:background="@null"
android:src="@mipmap/play"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_meadia_contriller_right"
android:gravity="center"
android:layout_toRightOf="@id/rl_operation_play"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/ui_DIMEN_6.0PX"
android:layout_height="@dimen/ui_DIMEN_70.0PX">
<TextView
android:id="@+id/tv_current_time"
style="@style/ui_wrapTvBaseStyle"
android:minWidth="@dimen/ui_DIMEN_100.0PX"
android:textColor="@color/white"
android:gravity="end"
tools:text="12:00:12"/>
<TextView
android:id="@+id/tv_end_time"
style="@style/ui_wrapTvBaseStyle"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/ui_DIMEN_30.0PX"
android:textColor="@color/white"
tools:text="12:00"/>
<SeekBar
android:id="@+id/sb_live"
style="@style/home_seek_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/tv_end_time"
android:layout_toRightOf="@id/tv_current_time"/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tool="http://schemas.android.com/tools"
android:layout_width="match_parent"
tool:visibility="visible"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:id="@+id/ll_exam_spreadOrfold"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginBottom="-20dp"
android:layout_gravity="right"
android:visibility="gone"
android:orientation="vertical">
</LinearLayout>
<CheckBox
android:id="@+id/cb_exam_spreadOrfold"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginBottom="-17dp"
android:layout_gravity="right"
android:button="@null"
android:drawableRight="@drawable/selector_exam_fold"/>
<!--<CheckBox-->
<!--android:id="@+id/cb_exam_A"-->
<!--style="@style/exam_cb_style_SingleOrMore"-->
<!--android:drawableLeft="@drawable/selector_exam"-->
<!--android:text="A" />-->
<!--倒计时-->
<RelativeLayout
android:layout_width="match_parent"
android:background="#e3e3e3"
android:id="@+id/rel_exam_layout"
android:layout_height="90dp">
<RelativeLayout
android:id="@+id/rel_home_tv_exam_countdown"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_exam_countdown"
android:layout_width="23dp"
android:layout_height="15dp"
android:layout_marginRight="5dp"
android:layout_alignParentLeft="true"
android:text="__s"
android:textSize="12dp"
android:textColor="@color/actionsheet_red"
android:background="@color/white"
/>
</RelativeLayout>
<RelativeLayout
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/rel_home_tv_exam_countdown"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!--单选多选-->
<LinearLayout
android:id="@+id/ll_exam_SingleOrMore"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/ll_exam_submit"
android:gravity="center"
android:visibility="gone"
android:orientation="horizontal"
>
<CheckBox
android:id="@+id/cb_exam_A"
style="@style/exam_cb_style_SingleOrMore"
android:drawableLeft="@drawable/selector_exam"
android:text="A" />
<CheckBox
android:id="@+id/cb_exam_B"
style="@style/exam_cb_style_SingleOrMore"
android:drawableLeft="@drawable/selector_exam"
android:text="B" />
<CheckBox
android:id="@+id/cb_exam_C"
style="@style/exam_cb_style_SingleOrMore"
android:drawableLeft="@drawable/selector_exam"
android:text="C" />
<CheckBox
android:id="@+id/cb_exam_D"
style="@style/exam_cb_style_SingleOrMore"
android:drawableLeft="@drawable/selector_exam"
android:text="D" />
</LinearLayout>
<!--对错-->
<LinearLayout
android:id="@+id/ll_exam_selectRightOrWrong"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/ll_exam_submit"
android:gravity="center"
android:visibility="gone"
tool:visibility="visible"
android:orientation="horizontal"
>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<RadioButton
android:id="@+id/rb_exam_R"
style="@style/exam_cb_style_RightOrWrong"
android:drawableLeft="@drawable/selector_exam"
android:checked="true"
android:text="对" />
<RadioButton
android:id="@+id/rb_exam_W"
style="@style/exam_cb_style_RightOrWrong"
android:drawableLeft="@drawable/selector_exam"
android:text="错" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_exam_filling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/ll_exam_submit"
android:gravity="center"
android:visibility="gone"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="一"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="二"
/>
<EditText
android:layout_width="20dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLength="20"
android:singleLine="true"
android:hint="输入答案"
/>
</LinearLayout>
<!--答案-->
<LinearLayout
android:id="@+id/ll_exam_answer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/ll_exam_submit"
android:gravity="center|left"
android:visibility="gone"
tool:visibility="visible"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我的答案:"
/>
<LinearLayout
android:id="@+id/ll_exam_Myanswer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="正确答案:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="4dp"
android:background="@mipmap/lv_bj"
android:gravity="center"
android:textColor="@android:color/white"
android:text="C"
android:visibility="gone"
/>
<LinearLayout
android:id="@+id/ll_exam_Correctanswer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="正确率:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20%"
/>
</LinearLayout>
</LinearLayout>
<!--提交-->
<LinearLayout
android:id="@+id/ll_exam_submit"
android:layout_width="100dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_alignParentRight="true"
>
<TextView
android:id="@+id/tv_exam_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提交"
android:layout_gravity="center_vertical"
android:textColor="@android:color/white"
android:background="@drawable/shape_bg_full_circle_blue"
android:layout_marginRight="10dp"
android:textSize="12sp"
/>
<TextView
android:id="@+id/tv_exam_cancle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="放弃"
android:layout_gravity="center_vertical"
android:textColor="@android:color/white"
android:background="@drawable/shape_bg_full_circle_grey"
android:layout_marginRight="8dp"
android:textSize="12sp"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:background="#e3e3e3"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:text="wo jiusldjflkdjf"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -44,7 +44,7 @@
style="@style/home_input_edit_style"
android:hint="classId"
android:inputType="number"
android:text="124709334"/>
android:text="118417229"/>
<View
style="@style/ui_divider_line_horizontal"
... ...
... ... @@ -97,8 +97,8 @@
/>
<ImageView
android:id="@+id/img_playVideo_publishAudio"
android:layout_width="120dp"
android:layout_height="150dp"
android:layout_width="150dp"
android:layout_height="120dp"
android:background="@mipmap/audio_mode"
android:visibility="gone"
tools:visibility="visible"
... ...
<resources>
<string name="app_name">学点云</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="home_classid_hint">classid</string>
<string name="home_role_hint">userRole</string>
<string name="home_userid_hint">userid</string>
<string name="home_portal_hint">portal</string>
<string name="home_enter_class">Enter the classroom</string>
<string name="home_enter_replay">Enter the recording playback</string>
<string name="home_enter_login">Sign in</string>
<string name="home_enter_password">password</string>
<string name="home_enter_username">username</string>
<string name="home_content_doc">Document</string>
<string name="home_content_chat">Chat</string>
<string name="home_dialog_pushAudio">Push Audio</string>
<string name="home_dialog_pushVideo">Push Video</string>
<string name="home_dialog_selectList">Selective listing</string>
<string name="home_msg_leave_character">Sign out</string>
<string name="home_msg_leave_class_whether">Are you sure you want to end the current class?</string>
<string name="home_msg_exit_class">Have dropped out of the classroom</string>
<string name="home_msg_leave_no">NO</string>
<string name="home_msg_leave_yes">YES</string>
<string name="home_msg_loading">loading</string>
<string name="home_msg_join_class_success">Joining classroom Success</string>
<string name="home_msg_error_net_disconnection">The device network belongs to the off state, please re-enter</string>
<string name="home_msg_verify">Determine</string>
<string name="home_title_back">Back</string>
<string name="home_msg_play_audio_init">Audio playback initialization</string>
<string name="home_msg_play_video_init">Video playback initialization</string>
<!--登录-->
<string name="main_login_error_classId">Please enter class number</string>
<string name="main_login_error_portal">Please enter portal</string>
<string name="main_login_error_role">Please enter role</string>
<string name="main_login_error_userId">Please enter userId</string>
</resources>
... ...
... ... @@ -36,14 +36,14 @@
"source": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_single_normal.9.png"
},
{
"merged": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_top_normal.9.png",
"source": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_top_normal.9.png"
},
{
"merged": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\alert_btn_left_pressed.9.png",
"source": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\alert_btn_left_pressed.9.png"
},
{
"merged": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_top_normal.9.png",
"source": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_top_normal.9.png"
},
{
"merged": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_single_pressed.9.png",
"source": "D:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_single_pressed.9.png"
},
... ...
#Fri May 12 10:52:43 CST 2017
#Mon May 15 14:28:08 CST 2017
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
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
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
... ... @@ -9,8 +9,8 @@ D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\a
D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\trans_bg.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\trans_bg.png
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\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_middle_pressed.9.png
D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\actionsheet_bottom_selector.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable\\actionsheet_bottom_selector.xml
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\\res\\merged\\release\\drawable-hdpi-v4\\alert_btn_left_pressed.9.png
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\\res\\merged\\release\\drawable-hdpi-v4\\alert_btn_right_pressed.9.png
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\\res\\merged\\release\\drawable-hdpi-v4\\alert_btn_left_pressed.9.png
D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_top_normal.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_top_normal.9.png
D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable-hdpi\\actionsheet_middle_normal.9.png=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable-hdpi-v4\\actionsheet_middle_normal.9.png
D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\src\\main\\res\\drawable\\alertdialog_right_selector.xml=D\:\\Android_Sdk\\MyApplication\\iOS_Dialog_Library\\build\\intermediates\\res\\merged\\release\\drawable\\alertdialog_right_selector.xml
... ...
#Fri May 12 10:51:43 CST 2017
#Mon May 15 14:27:37 CST 2017
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
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
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
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
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
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
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
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
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
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
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
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
... ...
... ... @@ -52,6 +52,10 @@ public interface Constants {
*/
String VIDEO_BROADCAST = "video_broadcast";
/**
* 远程开启音频
*/
String AUDIO_BROADCAST="audio_broadcast";
/**
* 错误标记
*/
String ERROR_CODE = "error_event";
... ...
... ... @@ -12,5 +12,6 @@ public class APIContants {
// protected final static String BASE_URL="http://192.168.1.109/xdysdk/web/";
protected final static String BASE_URL="http://h5.test.3mang.com/web/";
// protected final static String BASE_URL="http://192.168.1.120:80/index.html";
}
... ...
... ... @@ -13,6 +13,7 @@ import android.view.SurfaceView;
import com.daniulive.smartpublisher.SmartPublisherJni;
import com.eventhandle.SmartEventCallback;
import com.mang.xdy.utils.SystemUtils;
import com.mang.xdy.utils.XdyLogUtil;
import com.voiceengine.NTAudioRecord;
... ... @@ -262,6 +263,11 @@ public class XdyPublisher implements SurfaceHolder.Callback, Camera.PreviewCallb
camera.addCallbackBuffer(new byte[bufferSize]);
} else {
if (isStart) {
if(SystemUtils.isTablet(mActivity)){
currentOrigentation=LANDSCAPE;
}else{
currentOrigentation=PORTRAIT;
}
xdyPublisher.SmartPublisherOnCaptureVideoData(data, data.length, currentCameraType, currentOrigentation);
}
camera.addCallbackBuffer(data);
... ...
package com.mang.xdy.utils;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
public class SystemUtils {
/**
* @return
*
* 跳转到程序的设置页
*/
@SuppressWarnings("unused")
public static Intent getAppDetailSettingIntent(Context context) {
Intent localIntent=null;
try {
localIntent = new Intent();
localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (Build.VERSION.SDK_INT >= 9) {
localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
localIntent.setData(Uri.fromParts("package", context.getPackageName(),null));
} else if (Build.VERSION.SDK_INT <= 8) {
localIntent.setAction(Intent.ACTION_VIEW);
localIntent.setClassName("com.android.settings","com.android.settings.InstalledAppDetails");
localIntent.putExtra("com.android.settings.ApplicationPkgName", context.getPackageName());
}
} catch (Exception e) {
// TODO: handle exception
}
return localIntent;
}
/**
* 判断当前设备是手机还是平板,代码来自 Google I/O App for Android
* @param context
* @return 平板返回 True,手机返回 False
*/
public static boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
}
... ...