Commit 661cf3db by chengxiuhong

test main

parent 26ea9322
......@@ -6,6 +6,7 @@
android:name="com.app.baselibrary.base.app.BaseApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@drawable/nav2"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
......@@ -22,21 +23,25 @@
</activity>
<activity android:name=".activity.SinglePeopleTestActivity"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
android:launchMode="singleTop"></activity>
<activity android:name=".activity.MorePeopleTestActivity"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
android:screenOrientation="landscape"
android:launchMode="singleTop"></activity>
<activity android:name=".activity.TestListActivity"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
android:screenOrientation="landscape"
android:launchMode="singleTop"></activity>
<activity android:name=".activity.TestResurtListActivity"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
android:screenOrientation="landscape"
android:launchMode="singleTop"></activity>
<activity
android:name="com.oo.eye.activity.BeforeEyeTestActivity"
android:screenOrientation="landscape" />
<activity
android:name="com.oo.eye.activity.EyeTestActivity"
android:name="com.oo.eye.activity.EyeTestActivityF"
android:screenOrientation="landscape" />
<activity
android:name="com.oo.eye.activity.AfterEyeTestActivity"
......
......@@ -78,7 +78,7 @@ public class BeforeEyeTestActivity extends BaseActivity {
mLlBeforeEyePrepare1.setVisibility(View.VISIBLE);
speak("调节测视距离,请等待");
// DaemonSender.startEyeTestMotor(this);
Intent intent2 = new Intent(BeforeEyeTestActivity.this,EyeTestActivity.class);
Intent intent2 = new Intent(BeforeEyeTestActivity.this,EyeTestActivityF.class);
startActivity(intent2);
finish();
}
......
package com.oo.eye.activity;
import android.view.View;
import android.widget.TextView;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.commonUtil.PreferencesUtils;
import com.app.baselibrary.commonUtil.ToastUtil;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
import com.oo.eye.R2;
import com.oo.seex.sys_state.widget.StateView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
*/
public class EyeSettingActivity extends BaseActivity{
public class EyeSettingActivity extends BaseActivity {
@BindView(R2.id.state_view)
StateView mStateView;
@BindView(R2.id.tv_eye_setting_normal)
TextView normalText;
@BindView(R2.id.tv_eye_setting_decimals)
TextView decimalsText;
@BindView(R.id.group_decimal)
RadioGroup mGroupDecimal;
@BindView(R.id.group_distance)
RadioGroup mGroupDistance;
@BindView(R.id.group_direction)
RadioGroup mGroupDirection;
@BindView(R.id.group_wait)
RadioGroup mGroupWait;
@BindView(R.id.group_report)
RadioGroup mGroupReport;
@BindView(R.id.group_help)
RadioGroup mGroupHelp;
private int selectId;
......@@ -48,47 +56,25 @@ public class EyeSettingActivity extends BaseActivity{
@Override
protected void init() {
selectId = PreferencesUtils.getInt( EyeConfig.EYE_SETTING_KEY,selectId);
normalText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
normalText.setTextColor(getResources().getColor(R.color.e_test_color));
}else{
normalText.setTextColor(getResources().getColor(R.color.white));
}
}
});
normalText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectId = 0;
PreferencesUtils.putInt( EyeConfig.EYE_SETTING_KEY,selectId);
ToastUtil.showLongMessage("选择5分法成功");
selectId = PreferencesUtils.getInt(EyeConfig.EYE_SETTING_KEY, selectId);
for (int i = 0; i < mGroupDecimal.getChildCount(); i++) {
RadioButton rb = (RadioButton) mGroupDecimal.getChildAt(i);
if (rb.isChecked()) {
//txtSex.setText(rb.getText());
break;
}
});
decimalsText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
decimalsText.setTextColor(getResources().getColor(R.color.e_test_color));
selectId = 1;
}else{
decimalsText.setTextColor(getResources().getColor(R.color.white));
}
}
});
decimalsText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectId = 1;
PreferencesUtils.putInt( EyeConfig.EYE_SETTING_KEY,selectId);
ToastUtil.showLongMessage("选择小数法成功");
}
});
if(selectId == 1){
decimalsText.requestFocus();
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
@OnClick(R.id.about_lay)
public void onClick() {
}
}
package com.oo.eye.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.commonUtil.LogUtil;
import com.app.baselibrary.commonUtil.NibiruUtils;
import com.app.baselibrary.commonUtil.PreferencesUtils;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
import com.oo.eye.R2;
import com.oo.eye.bean.Eye;
import com.oo.eye.bean.Eye.E;
import com.oo.eye.bean.EyeHistroyBean;
import com.oo.eye.manager.DaemonSender;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import static com.oo.eye.bean.Eye.getLineSumByIndex;
/**
*/
public class EyeTestActivity extends BaseActivity {
static final int TOP = 0;
static final int RIGHT = 1;
static final int BOTTOM = 2;
static final int LEFT = 3;
private E mSelectE;
@BindView(R2.id.rl_eye_test_center_time1)
RelativeLayout timeLayout1;
@BindView(R2.id.tv_eye_test_center_time1)
TextView timeText1;
@BindView(R2.id.rl_eye_test_center_e1)
RelativeLayout eLayout1;
@BindView(R2.id.iv_eye_test_center_e1)
ImageView eImageView1;
@BindView(R2.id.view_eye_test_mask1)
View maskView1;
@BindView(R2.id.view_eye_test_mask2)
View maskView2;
@BindView(R2.id.rl_eye_test_center_time2)
RelativeLayout timeLayout2;
@BindView(R2.id.tv_eye_test_center_time2)
TextView timeText2;
@BindView(R2.id.rl_eye_test_center_e2)
RelativeLayout eLayout2;
@BindView(R2.id.iv_eye_test_center_e2)
ImageView eImageView2;
@BindView(R2.id.tv_eye_vision1)
TextView eyeVision1;
@BindView(R2.id.tv_eye_vision_count1)
TextView count1;
@BindView(R2.id.tv_eye_vision_allow1)
TextView allow1;
@BindView(R2.id.tv_eye_vision_right1)
TextView right1;
@BindView(R2.id.tv_eye_vision_error1)
TextView error1;
@BindView(R2.id.tv_eye_vision2)
TextView eyeVision2;
@BindView(R2.id.tv_eye_vision_count2)
TextView count2;
@BindView(R2.id.tv_eye_vision_allow2)
TextView allow2;
@BindView(R2.id.tv_eye_vision_right2)
TextView right2;
@BindView(R2.id.tv_eye_vision_error2)
TextView error2;
private int test_dis = 0;
private ArrayList<ArrayList<E>> mList = new ArrayList<>();
private int mLocation;
private int mLevelIndex = -1;
private LinkedHashMap<Integer, List<E>> mCollect = new LinkedHashMap<>();
private EyeHistroyBean mHistroyBean;
//是否是右眼训练
private boolean isSecondTest;
private double mLeftEye = 5.0;
private int mLeftLine = 0;
private double mRightEye = 5.0;
private int mRightLine = 0;
private long mLastOnKeyTime = -1;
private boolean isTestSuccess = false;
private boolean isStartTest = false;
private long totalTime = 5000;
private long intervalTime = 1000;
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected int getLayoutId() {
return R.layout.activity_eye_test;
}
@Override
protected void init() {
NibiruUtils.switchVR(true);
DaemonSender.startEyeTest(this);
speak("视力测试马上开启");
initialize();
prepareQueue();
}
private void initialize() {
mList.clear();
for (int i = 0; i < 14; i++) {
mList.add(initLineList(i));
}
}
private void prepareQueue() {
mHistroyBean = EyeConfig.getInstance().getCuurentBean();
continueTest();
}
private void continueTest() {
if (!isStartTest) {
isStartTest = true;
resetView(true);
}
}
/**
* 开始测试
*
* @param isNewTest true 代表测试的第一只眼 代表左眼 false代表测量另一只眼 右眼
*/
private void resetView(final boolean isNewTest) {
mLevelIndex = -1;
isSecondTest = !isNewTest;
String eye = isNewTest ? "右" : "左";
if (isNewTest) {
if (mHistroyBean != null) {
mLeftEye = mHistroyBean.getLeft_eye();
mRightEye = mHistroyBean.getRight_eye();
}
}
timeLayout1.setVisibility(View.VISIBLE);
timeLayout2.setVisibility(View.VISIBLE);
eLayout1.setVisibility(View.GONE);
eLayout2.setVisibility(View.GONE);
maskView1.setVisibility(View.GONE);
maskView2.setVisibility(View.GONE);
new CountDownTimer(totalTime, intervalTime) {
@Override
public void onTick(long millisUntilFinished) {
long time = millisUntilFinished / 1000;
timeText1.setText(time + "");
timeText2.setText(time + "");
float f = millisUntilFinished * 1.0f / totalTime;
if (isSecondTest) {
maskView1.setAlpha(1 - f);
maskView1.setVisibility(View.VISIBLE);
maskView2.setVisibility(View.GONE);
} else {
maskView2.setAlpha(1 - f);
maskView1.setVisibility(View.GONE);
maskView2.setVisibility(View.VISIBLE);
}
LogUtil.e("onTick");
}
@Override
public void onFinish() {
LogUtil.e("onFinish");
timeLayout1.setVisibility(View.GONE);
timeLayout2.setVisibility(View.GONE);
eLayout1.setVisibility(View.VISIBLE);
eLayout2.setVisibility(View.VISIBLE);
double e = 5.0;
//如果是左眼次测试
if (isNewTest) {
if (mHistroyBean != null) {
e = mHistroyBean.getLeft_eye();
}
maskView1.setVisibility(View.GONE);
maskView2.setAlpha(1);
maskView2.setVisibility(View.VISIBLE);
} else {
//右眼测试
if (isSecondTest) {
if (mHistroyBean != null) {
e = mHistroyBean.getRight_eye();
}
}
maskView1.setAlpha(1);
maskView1.setVisibility(View.VISIBLE);
maskView2.setVisibility(View.GONE);
}
mLevelIndex = Eye.getIndexByValue(e, true) - 1;
next(true);
}
}.start();
speak("请遮住您的" + eye + "眼");
mCollect.clear();
}
private void speak(String text) {
DaemonSender.sendDBTTS(this, text);
}
/**
* 描画E字
*
* @param e
*/
private void drewE(E e) {
//视力等级
float level = e.getLevel();
//视标边长
int px = Eye.getDip(this, level);
// RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(px, px);
// eImageView1.setLayoutParams(params);
// eImageView2.setLayoutParams(params);
//视标方向
int resId;
switch (e.getDirect()) {
default:
case TOP:
resId = R.drawable.e_up;
break;
case RIGHT:
resId = R.drawable.e_right;
break;
case BOTTOM:
resId = R.drawable.e_down;
break;
case LEFT:
resId = R.drawable.e_left;
break;
}
eImageView1.setImageResource(resId);
eImageView2.setImageResource(resId);
}
/**
* 随机生成每一行的视标E
*
* @param index 第几行
* @return list
*/
private ArrayList<E> initLineList(int index) {
float level = Eye.getLevelSizeByIndex(index);
int sum = getLineSumByIndex(index);
//随机数生成方向
Random random = new Random();
E e;
ArrayList<E> list = new ArrayList<>();
int direct = getFirstDirect(random, index);
for (int i = 0; i < sum; i++) {
if (i > 0) {
direct = getRandomDirect(list, direct, sum);
}
e = new E(i, direct, level);
list.add(e);
}
return list;
}
/**
* 获取第一个E;
*
* @param random
* @param index
* @return
*/
private int getFirstDirect(Random random, int index) {
int direct = random.nextInt(4);
if (index > 0) {
if (mList.get(index - 1).get(0).getDirect() == direct)
direct = getFirstDirect(random, index);
}
return direct;
}
/**
* 获取下一个E的方向的判断;
*
* @param list
* @param direct
* @param sum
* @return
*/
private int getRandomDirect(ArrayList<E> list, int direct, int sum) {
int lastDirect = direct;
direct = randomDirect(direct);
int num = sum / 2;
if (sum % 2 == 0 && sum / 2 > 1) {
num = sum / 2 - 1;
}
if (getEDirectorNum(list, direct) >= num) {
direct = getRandomDirect(list, lastDirect, sum);
}
return direct;
}
/**
* 获取该行出现的形同方向的E的个数;
*
* @param list
* @param direct
* @return
*/
private int getEDirectorNum(ArrayList<E> list, int direct) {
int num = 0;
if (list == null || list.size() == 0)
return num;
for (E e :
list) {
if (e.getDirect() == direct)
num++;
}
return num;
}
/**
* 相邻的两个不能是同一个方向
*
* @param lastDirect 上一次的方向
* @return 新的方向
*/
private int randomDirect(int lastDirect) {
//随机数生成方向
Random random = new Random();
int newDirect = random.nextInt(4);
//相邻的不能一样
while (lastDirect == newDirect) {
newDirect = random.nextInt(4);
}
return newDirect;
}
/**
* 下一个测试
*/
private void next(boolean isNextLine) {
if (isNextLine) {
mLevelIndex++;
mLocation = 0;
eyeVision1.setText("" + Eye.getLevelByIndex(mLevelIndex, true));
eyeVision2.setText("" + Eye.getLevelByIndex(mLevelIndex, true));
count1.setText("");
count2.setText("");
allow1.setText("");
allow2.setText("");
right1.setText("");
right2.setText("");
error1.setText("");
error2.setText("");
} else {
mLocation++;
}
mSelectE = mList.get(mLevelIndex).get(mLocation);
drewE(mSelectE);
}
/**
* 选择的方向
*
* @param direct
*/
private void userChoose(int direct) {
LogUtil.e("direct:" + direct);
LogUtil.e("mLevelIndex:" + mLevelIndex);
//获取当前行答过的e
List<E> list = mCollect.get(mLevelIndex);
if (null == list || list.size() == 0) {
list = new ArrayList<>();
}
mSelectE.setUserChoose(direct);
list.add(mSelectE);
mCollect.put(mLevelIndex, list);
judge();
// int verifyErrorCount = 0;
// //获取每行有多少个e
// int lineSum = getLineSumByIndex(mLevelIndex);
// //获取每行答对几个e
// int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
// LogUtil.e("leastAnswerCount:"+leastAnswerCount);
//package com.oo.eye.activity;
//
//import android.content.Intent;
//import android.os.Bundle;
//import android.os.CountDownTimer;
//import android.view.KeyEvent;
//import android.view.View;
//import android.widget.ImageView;
//import android.widget.RelativeLayout;
//import android.widget.TextView;
//
//import com.app.baselibrary.base.common.BaseActivity;
//import com.app.baselibrary.commonUtil.LogUtil;
//import com.app.baselibrary.commonUtil.NibiruUtils;
//import com.app.baselibrary.commonUtil.PreferencesUtils;
//import com.oo.eye.EyeConfig;
//import com.oo.eye.R;
//import com.oo.eye.R2;
//import com.oo.eye.bean.Eye;
//import com.oo.eye.bean.Eye.E;
//import com.oo.eye.bean.EyeHistroyBean;
//import com.oo.eye.manager.DaemonSender;
//
//import java.util.ArrayList;
//import java.util.LinkedHashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Random;
//
//import butterknife.BindView;
//import butterknife.ButterKnife;
//import butterknife.OnClick;
//
//import static com.oo.eye.bean.Eye.getLineSumByIndex;
//
///**
// */
//
//public class EyeTestActivity extends BaseActivity {
//
// static final int TOP = 0;
// static final int RIGHT = 1;
// static final int BOTTOM = 2;
// static final int LEFT = 3;
// private E mSelectE;
//
// @BindView(R2.id.rl_eye_test_center_time1)
// RelativeLayout timeLayout1;
// @BindView(R2.id.tv_eye_test_center_time1)
// TextView timeText1;
//
// @BindView(R2.id.rl_eye_test_center_e1)
// RelativeLayout eLayout1;
//
// @BindView(R2.id.iv_eye_test_center_e1)
// ImageView eImageView1;
//
// @BindView(R2.id.view_eye_test_mask1)
// View maskView1;
//
// @BindView(R2.id.view_eye_test_mask2)
// View maskView2;
//
// @BindView(R2.id.rl_eye_test_center_time2)
// RelativeLayout timeLayout2;
// @BindView(R2.id.tv_eye_test_center_time2)
// TextView timeText2;
//
// @BindView(R2.id.rl_eye_test_center_e2)
// RelativeLayout eLayout2;
//
// @BindView(R2.id.iv_eye_test_center_e2)
// ImageView eImageView2;
//
// @BindView(R2.id.tv_eye_vision1)
// TextView eyeVision1;
// @BindView(R2.id.tv_eye_vision_count1)
// TextView count1;
// @BindView(R2.id.tv_eye_vision_allow1)
// TextView allow1;
// @BindView(R2.id.tv_eye_vision_right1)
// TextView right1;
// @BindView(R2.id.tv_eye_vision_error1)
// TextView error1;
//
// @BindView(R2.id.tv_eye_vision2)
// TextView eyeVision2;
// @BindView(R2.id.tv_eye_vision_count2)
// TextView count2;
// @BindView(R2.id.tv_eye_vision_allow2)
// TextView allow2;
// @BindView(R2.id.tv_eye_vision_right2)
// TextView right2;
// @BindView(R2.id.tv_eye_vision_error2)
// TextView error2;
//
// private int test_dis = 0;
//
// private ArrayList<ArrayList<E>> mList = new ArrayList<>();
// private int mLocation;
// private int mLevelIndex = -1;
// private LinkedHashMap<Integer, List<E>> mCollect = new LinkedHashMap<>();
// private EyeHistroyBean mHistroyBean;
// //是否是右眼训练
// private boolean isSecondTest;
// private double mLeftEye = 5.0;
// private int mLeftLine = 0;
// private double mRightEye = 5.0;
// private int mRightLine = 0;
// private long mLastOnKeyTime = -1;
// private boolean isTestSuccess = false;
// private boolean isStartTest = false;
//
// private long totalTime = 5000;
// private long intervalTime = 1000;
//
// @Override
// protected void onResume() {
// super.onResume();
// }
//
// @Override
// protected void onPause() {
// super.onPause();
// }
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_eye_test;
// }
//
// @Override
// protected void init() {
// NibiruUtils.switchVR(true);
// DaemonSender.startEyeTest(this);
// speak("视力测试马上开启");
// initialize();
// prepareQueue();
// }
//
// private void initialize() {
// mList.clear();
// for (int i = 0; i < 14; i++) {
// mList.add(initLineList(i));
// }
// }
//
// private void prepareQueue() {
// mHistroyBean = EyeConfig.getInstance().getCuurentBean();
// continueTest();
// }
//
// private void continueTest() {
// if (!isStartTest) {
// isStartTest = true;
// resetView(true);
// }
// }
//
// /**
// * 开始测试
// *
// * @param isNewTest true 代表测试的第一只眼 代表左眼 false代表测量另一只眼 右眼
// */
// private void resetView(final boolean isNewTest) {
// mLevelIndex = -1;
// isSecondTest = !isNewTest;
//
// String eye = isNewTest ? "右" : "左";
//
// if (isNewTest) {
// if (mHistroyBean != null) {
// mLeftEye = mHistroyBean.getLeft_eye();
// mRightEye = mHistroyBean.getRight_eye();
// }
// }
// timeLayout1.setVisibility(View.VISIBLE);
// timeLayout2.setVisibility(View.VISIBLE);
// eLayout1.setVisibility(View.GONE);
// eLayout2.setVisibility(View.GONE);
// maskView1.setVisibility(View.GONE);
// maskView2.setVisibility(View.GONE);
// new CountDownTimer(totalTime, intervalTime) {
// @Override
// public void onTick(long millisUntilFinished) {
// long time = millisUntilFinished / 1000;
// timeText1.setText(time + "");
// timeText2.setText(time + "");
// float f = millisUntilFinished * 1.0f / totalTime;
// if (isSecondTest) {
// maskView1.setAlpha(1 - f);
// maskView1.setVisibility(View.VISIBLE);
// maskView2.setVisibility(View.GONE);
//
// } else {
// maskView2.setAlpha(1 - f);
// maskView1.setVisibility(View.GONE);
// maskView2.setVisibility(View.VISIBLE);
// }
// LogUtil.e("onTick");
// }
//
// @Override
// public void onFinish() {
// LogUtil.e("onFinish");
// timeLayout1.setVisibility(View.GONE);
// timeLayout2.setVisibility(View.GONE);
// eLayout1.setVisibility(View.VISIBLE);
// eLayout2.setVisibility(View.VISIBLE);
// double e = 5.0;
// //如果是左眼次测试
// if (isNewTest) {
// if (mHistroyBean != null) {
// e = mHistroyBean.getLeft_eye();
// }
// maskView1.setVisibility(View.GONE);
// maskView2.setAlpha(1);
// maskView2.setVisibility(View.VISIBLE);
// } else {
// //右眼测试
// if (isSecondTest) {
// if (mHistroyBean != null) {
// e = mHistroyBean.getRight_eye();
// }
// }
// maskView1.setAlpha(1);
// maskView1.setVisibility(View.VISIBLE);
// maskView2.setVisibility(View.GONE);
// }
// mLevelIndex = Eye.getIndexByValue(e, true) - 1;
// next(true);
// }
// }.start();
// speak("请遮住您的" + eye + "眼");
// mCollect.clear();
// }
//
// private void speak(String text) {
// DaemonSender.sendDBTTS(this, text);
// }
//
// /**
// * 描画E字
// *
// * @param e
// */
// private void drewE(E e) {
// //视力等级
// float level = e.getLevel();
// //视标边长
// int px = Eye.getDip(this, level);
//// RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(px, px);
//// eImageView1.setLayoutParams(params);
//// eImageView2.setLayoutParams(params);
// //视标方向
// int resId;
// switch (e.getDirect()) {
// default:
// case TOP:
// resId = R.drawable.e_up;
// break;
// case RIGHT:
// resId = R.drawable.e_right;
// break;
// case BOTTOM:
// resId = R.drawable.e_down;
// break;
// case LEFT:
// resId = R.drawable.e_left;
// break;
// }
// eImageView1.setImageResource(resId);
// eImageView2.setImageResource(resId);
// }
//
// /**
// * 随机生成每一行的视标E
// *
// * @param index 第几行
// * @return list
// */
// private ArrayList<E> initLineList(int index) {
// float level = Eye.getLevelSizeByIndex(index);
// int sum = getLineSumByIndex(index);
// //随机数生成方向
// Random random = new Random();
// E e;
// ArrayList<E> list = new ArrayList<>();
// int direct = getFirstDirect(random, index);
// for (int i = 0; i < sum; i++) {
// if (i > 0) {
// direct = getRandomDirect(list, direct, sum);
// }
// e = new E(i, direct, level);
// list.add(e);
// }
// return list;
// }
//
// /**
// * 获取第一个E;
// *
// * @param random
// * @param index
// * @return
// */
// private int getFirstDirect(Random random, int index) {
// int direct = random.nextInt(4);
// if (index > 0) {
// if (mList.get(index - 1).get(0).getDirect() == direct)
// direct = getFirstDirect(random, index);
// }
// return direct;
// }
//
// /**
// * 获取下一个E的方向的判断;
// *
// * @param list
// * @param direct
// * @param sum
// * @return
// */
// private int getRandomDirect(ArrayList<E> list, int direct, int sum) {
// int lastDirect = direct;
// direct = randomDirect(direct);
// int num = sum / 2;
// if (sum % 2 == 0 && sum / 2 > 1) {
// num = sum / 2 - 1;
// }
// if (getEDirectorNum(list, direct) >= num) {
// direct = getRandomDirect(list, lastDirect, sum);
// }
// return direct;
// }
//
// /**
// * 获取该行出现的形同方向的E的个数;
// *
// * @param list
// * @param direct
// * @return
// */
// private int getEDirectorNum(ArrayList<E> list, int direct) {
// int num = 0;
// if (list == null || list.size() == 0)
// return num;
// for (E e :
// list) {
// if (e.getDirect() == direct)
// num++;
// }
// return num;
// }
//
//
// /**
// * 相邻的两个不能是同一个方向
// *
// * @param lastDirect 上一次的方向
// * @return 新的方向
// */
// private int randomDirect(int lastDirect) {
// //随机数生成方向
// Random random = new Random();
// int newDirect = random.nextInt(4);
// //相邻的不能一样
// while (lastDirect == newDirect) {
// newDirect = random.nextInt(4);
// }
//
// return newDirect;
// }
//
//
// /**
// * 下一个测试
// */
// private void next(boolean isNextLine) {
// if (isNextLine) {
// mLevelIndex++;
// mLocation = 0;
// eyeVision1.setText("" + Eye.getLevelByIndex(mLevelIndex, true));
// eyeVision2.setText("" + Eye.getLevelByIndex(mLevelIndex, true));
// count1.setText("");
// count2.setText("");
// allow1.setText("");
// allow2.setText("");
// right1.setText("");
// right2.setText("");
// error1.setText("");
// error2.setText("");
// } else {
// mLocation++;
// }
//
// mSelectE = mList.get(mLevelIndex).get(mLocation);
// drewE(mSelectE);
// }
//
// /**
// * 选择的方向
// *
// * @param direct
// */
// private void userChoose(int direct) {
// LogUtil.e("direct:" + direct);
// LogUtil.e("mLevelIndex:" + mLevelIndex);
// //获取当前行答过的e
// List<E> list = mCollect.get(mLevelIndex);
// if (null == list || list.size() == 0) {
......@@ -428,29 +413,107 @@ public class EyeTestActivity extends BaseActivity {
// }
// mSelectE.setUserChoose(direct);
// list.add(mSelectE);
// mCollect.put(mLevelIndex, list);
// judge();
//// int verifyErrorCount = 0;
//// //获取每行有多少个e
//// int lineSum = getLineSumByIndex(mLevelIndex);
//// //获取每行答对几个e
//// int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
//// LogUtil.e("leastAnswerCount:"+leastAnswerCount);
//// //获取当前行答过的e
//// List<E> list = mCollect.get(mLevelIndex);
//// if (null == list || list.size() == 0) {
//// list = new ArrayList<>();
//// }
//// mSelectE.setUserChoose(direct);
//// list.add(mSelectE);
////
//// int rightAnswerCount = 0;
//// for (E e : list) {
//// if (e.isCorrect()) {
//// rightAnswerCount++;
//// }
//// }
//// LogUtil.e("rightAnswerCount:"+rightAnswerCount);
//// //当前行答错的数
//// int errorCount = list.size() - rightAnswerCount;
//// LogUtil.e("errorCount:"+errorCount);
//// //判断是否满足答对的要求
//// boolean isNextLine = rightAnswerCount >= leastAnswerCount;
//// LogUtil.e("isNextLine:"+isNextLine);
//// mCollect.put(mLevelIndex, list);
////
//// if(isNextLine){
//// if(mLevelIndex == 13){
//// showResult();
//// return;
//// }else {
//// List<E> nextList = mCollect.get(mLevelIndex + 1);
//// if(nextList != null && nextList.size() > 0){
//// showResult();
//// return;
//// }
//// }
//// }
////
//// //防止出现-1的现象;
//// if (lineSum - leastAnswerCount > 0) {
//// verifyErrorCount = lineSum - leastAnswerCount;
//// } else {
//// verifyErrorCount = 0;
//// }
//// //必须答对一半才往下走一行的
//// //如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
//// if (errorCount > verifyErrorCount) {
//// //如果上一行数据不为空 结束测试
//// if (mLevelIndex == 0 || (mCollect.containsKey(mLevelIndex - 1) &&
//// mCollect.get(mLevelIndex - 1) != null && mCollect.get(mLevelIndex - 1).size() > 0)) {
//// if(isSecondTest){
//// mRightLine = leastAnswerCount;
//// }else{
//// mLeftLine = leastAnswerCount;
//// }
//// showResult();
//// return;
//// }else {
//// backLastLine();
//// return;
//// }
//// }
//// next(isNextLine);
// }
//
// private void judge() {
// int verifyErrorCount = 0;
// //获取每行有多少个e
// int lineSum = getLineSumByIndex(mLevelIndex);
// //获取每行答对几个e
// int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
// //获取当前行答过的e
// List<E> list = mCollect.get(mLevelIndex);
// int rightAnswerCount = 0;
// for (E e : list) {
// if (e.isCorrect()) {
// rightAnswerCount++;
// }
// }
// LogUtil.e("rightAnswerCount:"+rightAnswerCount);
// LogUtil.e("rightAnswerCount:" + rightAnswerCount);
// //当前行答错的数
// int errorCount = list.size() - rightAnswerCount;
// LogUtil.e("errorCount:"+errorCount);
// LogUtil.e("errorCount:" + errorCount);
// //判断是否满足答对的要求
// boolean isNextLine = rightAnswerCount >= leastAnswerCount;
// LogUtil.e("isNextLine:"+isNextLine);
// LogUtil.e("isNextLine:" + isNextLine);
// mCollect.put(mLevelIndex, list);
//
// if(isNextLine){
// if(mLevelIndex == 13){
// if (isNextLine) {
// if (mLevelIndex == 13) {
// showResult();
// return;
// }else {
// } else {
// List<E> nextList = mCollect.get(mLevelIndex + 1);
// if(nextList != null && nextList.size() > 0){
// if (nextList != null && nextList.size() > 0) {
// showResult();
// return;
// }
......@@ -463,306 +526,243 @@ public class EyeTestActivity extends BaseActivity {
// } else {
// verifyErrorCount = 0;
// }
// count1.setText("总共:" + lineSum);
// count2.setText("总共:" + lineSum);
// allow1.setText("正确数:" + leastAnswerCount);
// allow2.setText("正确数:" + leastAnswerCount);
// right1.setText("答对数:" + rightAnswerCount);
// right2.setText("答对数:" + rightAnswerCount);
// error1.setText("错误数:" + errorCount);
// error2.setText("错误数:" + errorCount);
// //必须答对一半才往下走一行的
// //如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
// if (errorCount > verifyErrorCount) {
// //如果上一行数据不为空 结束测试
// if (mLevelIndex == 0 || (mCollect.containsKey(mLevelIndex - 1) &&
// mCollect.get(mLevelIndex - 1) != null && mCollect.get(mLevelIndex - 1).size() > 0)) {
// if(isSecondTest){
// if (isSecondTest) {
// mRightLine = leastAnswerCount;
// }else{
// } else {
// mLeftLine = leastAnswerCount;
// }
// showResult();
// return;
// }else {
// } else {
// backLastLine();
// return;
// }
// }
// next(isNextLine);
}
private void judge() {
int verifyErrorCount = 0;
//获取每行有多少个e
int lineSum = getLineSumByIndex(mLevelIndex);
//获取每行答对几个e
int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
//获取当前行答过的e
List<E> list = mCollect.get(mLevelIndex);
int rightAnswerCount = 0;
for (E e : list) {
if (e.isCorrect()) {
rightAnswerCount++;
}
}
LogUtil.e("rightAnswerCount:" + rightAnswerCount);
//当前行答错的数
int errorCount = list.size() - rightAnswerCount;
LogUtil.e("errorCount:" + errorCount);
//判断是否满足答对的要求
boolean isNextLine = rightAnswerCount >= leastAnswerCount;
LogUtil.e("isNextLine:" + isNextLine);
mCollect.put(mLevelIndex, list);
if (isNextLine) {
if (mLevelIndex == 13) {
showResult();
return;
} else {
List<E> nextList = mCollect.get(mLevelIndex + 1);
if (nextList != null && nextList.size() > 0) {
showResult();
return;
}
}
}
//防止出现-1的现象;
if (lineSum - leastAnswerCount > 0) {
verifyErrorCount = lineSum - leastAnswerCount;
} else {
verifyErrorCount = 0;
}
count1.setText("总共:" + lineSum);
count2.setText("总共:" + lineSum);
allow1.setText("正确数:" + leastAnswerCount);
allow2.setText("正确数:" + leastAnswerCount);
right1.setText("答对数:" + rightAnswerCount);
right2.setText("答对数:" + rightAnswerCount);
error1.setText("错误数:" + errorCount);
error2.setText("错误数:" + errorCount);
//必须答对一半才往下走一行的
//如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
if (errorCount > verifyErrorCount) {
//如果上一行数据不为空 结束测试
if (mLevelIndex == 0 || (mCollect.containsKey(mLevelIndex - 1) &&
mCollect.get(mLevelIndex - 1) != null && mCollect.get(mLevelIndex - 1).size() > 0)) {
if (isSecondTest) {
mRightLine = leastAnswerCount;
} else {
mLeftLine = leastAnswerCount;
}
showResult();
return;
} else {
backLastLine();
return;
}
}
next(isNextLine);
}
/**
* 答错
*/
private void userChooseError() {
int direct = mSelectE.getDirect() + 1;
//获取当前行答过的e
List<E> list = mCollect.get(mLevelIndex);
if (null == list || list.size() == 0) {
list = new ArrayList<>();
}
mSelectE.setUserChoose(direct);
list.add(mSelectE);
mCollect.put(mLevelIndex, list);
judge();
// int verifyErrorCount = 0;
// int lineSum = getLineSumByIndex(mLevelIndex);
// int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
// int rightAnswerCount = 0;
// int direct = mSelectE.getDirect()+1;
// }
//
// /**
// * 答错
// */
// private void userChooseError() {
// int direct = mSelectE.getDirect() + 1;
// //获取当前行答过的e
// List<E> list = mCollect.get(mLevelIndex);
// if (null == list || list.size() == 0) {
// list = new ArrayList<>();
// }
// mSelectE.setUserChoose(direct);
// list.add(mSelectE);
// mCollect.put(mLevelIndex, list);
// judge();
//// int verifyErrorCount = 0;
//// int lineSum = getLineSumByIndex(mLevelIndex);
//// int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
//// int rightAnswerCount = 0;
//// int direct = mSelectE.getDirect()+1;
////
//// //获取当前行答过的e
//// List<E> list = mCollect.get(mLevelIndex);
//// mSelectE.setUserChoose(direct);
//// list.add(mSelectE);
////
//// if (null == list || list.size() == 0) {
//// list = new ArrayList<>();
//// } else {
//// for (E e : list) {
//// if (e.isCorrect()) {
//// rightAnswerCount++;
//// }
//// }
//// }
//// //当前行答错的数
//// int errorCount = list.size() - rightAnswerCount;
////
//// //判断是否满足答对的要求
//// boolean isNextLine = rightAnswerCount >= leastAnswerCount;
////
//// mCollect.put(mLevelIndex, list);
////
//// if(isNextLine){
//// if(mLevelIndex == 13){
//// showResult();
//// return;
//// }else {
//// List<E> nextList = mCollect.get(mLevelIndex + 1);
//// if(nextList != null && nextList.size() > 0){
//// showResult();
//// return;
//// }
//// }
//// }
////
//// //防止出现-1的现象;
//// if (lineSum - leastAnswerCount > 0) {
//// verifyErrorCount = lineSum - leastAnswerCount;
//// } else {
//// verifyErrorCount = 0;
//// }
//// //必须答对一半才往下走一行的
//// //如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
//// if (errorCount > verifyErrorCount) {
//// //如果上一行数据不为空 结束测试
//// if (mLevelIndex == 0 || (mCollect.containsKey(mLevelIndex - 1) &&
//// mCollect.get(mLevelIndex - 1) != null && mCollect.get(mLevelIndex - 1).size() > 0)) {
//// if (isSecondTest) {
//// showResult();
//// return;
//// }
////
//// mLeftEye = getResult();
//// resetView(false);
//// return;
//// }else {
//// backLastLine();
//// return;
//// }
//// }
//// next(isNextLine);
// }
//
// if (null == list || list.size() == 0) {
// list = new ArrayList<>();
// } else {
// for (E e : list) {
// if (e.isCorrect()) {
// rightAnswerCount++;
//
// //返回到上一行
// private void backLastLine() {
// mLevelIndex = mLevelIndex - 2;
// next(true);
// }
//
// /**
// * 单眼测试结束
// */
// private void showResult() {
// //如果不是手动提交
// final Double eyeResult = getResult();
// if (isSecondTest) {//右眼训练
// mRightEye = eyeResult;
// showStudentTestDialog();
// } else {//左眼训练
// mLeftEye = eyeResult;
// resetView(false);
// return;
// }
// }
// //当前行答错的数
// int errorCount = list.size() - rightAnswerCount;
//
// //判断是否满足答对的要求
// boolean isNextLine = rightAnswerCount >= leastAnswerCount;
//
// mCollect.put(mLevelIndex, list);
// private void showStudentTestDialog() {
// int selectId = PreferencesUtils.getInt(EyeConfig.EYE_SETTING_KEY, 0);
// String text = ("测视结束左眼视力" + mLeftEye + "右眼视力" + mRightEye).replace(".", "点");
// if (selectId == 1) {
// text = ("测视结束左眼视力" + Eye.transformSmall(mLeftEye) + "右眼视力" +
// Eye.transformSmall(mRightEye)).replace(".", "点");
// }
// speak(text);
// Intent intent = new Intent(this, AfterEyeTestActivity.class);
// intent.putExtra("leftEye", mLeftEye);
// intent.putExtra("rightEye", mRightEye);
// intent.putExtra("leftLine", mLeftLine);
// intent.putExtra("rightLine", mRightLine);
// startActivity(intent);
// finish();
// }
//
// @Override
// public boolean dispatchKeyEvent(KeyEvent event) {
// if (event.getAction() == KeyEvent.ACTION_UP) {
// //两次点击大于1秒
// long currentTime = System.currentTimeMillis();
// if (mLastOnKeyTime > 0 && currentTime - mLastOnKeyTime < 500) {
// return true;
// }
// mLastOnKeyTime = currentTime;
// switch (event.getKeyCode()) {
// case KeyEvent.KEYCODE_BUTTON_X:
// userChoose(TOP);
// return true;
// case KeyEvent.KEYCODE_BUTTON_B:
// userChoose(BOTTOM);
// return true;
// case KeyEvent.KEYCODE_BUTTON_A:
// userChoose(LEFT);
// return true;
// case KeyEvent.KEYCODE_BUTTON_Y:
// userChoose(RIGHT);
// return true;
// case KeyEvent.KEYCODE_DPAD_UP:
// userChoose(TOP);
// return true;
// case KeyEvent.KEYCODE_DPAD_DOWN:
// userChoose(BOTTOM);
// return true;
// case KeyEvent.KEYCODE_DPAD_LEFT:
// userChoose(LEFT);
// return true;
// case KeyEvent.KEYCODE_DPAD_RIGHT:
// userChoose(RIGHT);
// return true;
// case KeyEvent.KEYCODE_DPAD_CENTER://遥控中间键
// //用户点击返回键:
// userChooseError();
// return true;
//
// if(isNextLine){
// if(mLevelIndex == 13){
// showResult();
// return;
// }else {
// List<E> nextList = mCollect.get(mLevelIndex + 1);
// if(nextList != null && nextList.size() > 0){
// showResult();
// return;
// }
// return true;
// }
// return super.dispatchKeyEvent(event);
// }
//
// //防止出现-1的现象;
// if (lineSum - leastAnswerCount > 0) {
// verifyErrorCount = lineSum - leastAnswerCount;
// private double getResult() {
// if (null == mCollect || mCollect.size() == 0) {
// if (test_dis == 0) {
// return 4.0;
// } else {
// verifyErrorCount = 0;
// return 3.8;
// }
// //必须答对一半才往下走一行的
// //如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
// if (errorCount > verifyErrorCount) {
// //如果上一行数据不为空 结束测试
// if (mLevelIndex == 0 || (mCollect.containsKey(mLevelIndex - 1) &&
// mCollect.get(mLevelIndex - 1) != null && mCollect.get(mLevelIndex - 1).size() > 0)) {
// if (isSecondTest) {
// showResult();
// return;
// }
// int result = 0;
// for (LinkedHashMap.Entry<Integer, List<E>> entry : mCollect.entrySet()) {
// result = entry.getKey();
// }
// final String levelByIndex = "" + Eye.getLevelByIndex(result, test_dis == 0);
// return Double.parseDouble(levelByIndex);
// }
//
// mLeftEye = getResult();
// resetView(false);
// return;
// }else {
// backLastLine();
// return;
// @Override
// public boolean onKeyDown(int keyCode, KeyEvent event) {
// if (keyCode == KeyEvent.KEYCODE_BACK) {
// finish();
// return true;
// }
// return super.onKeyDown(keyCode, event);
// }
// next(isNextLine);
}
//返回到上一行
private void backLastLine() {
mLevelIndex = mLevelIndex - 2;
next(true);
}
/**
* 单眼测试结束
*/
private void showResult() {
//如果不是手动提交
final Double eyeResult = getResult();
if (isSecondTest) {//右眼训练
mRightEye = eyeResult;
showStudentTestDialog();
} else {//左眼训练
mLeftEye = eyeResult;
resetView(false);
return;
}
}
private void showStudentTestDialog() {
int selectId = PreferencesUtils.getInt(EyeConfig.EYE_SETTING_KEY, 0);
String text = ("测视结束左眼视力" + mLeftEye + "右眼视力" + mRightEye).replace(".", "点");
if (selectId == 1) {
text = ("测视结束左眼视力" + Eye.transformSmall(mLeftEye) + "右眼视力" +
Eye.transformSmall(mRightEye)).replace(".", "点");
}
speak(text);
Intent intent = new Intent(this, AfterEyeTestActivity.class);
intent.putExtra("leftEye", mLeftEye);
intent.putExtra("rightEye", mRightEye);
intent.putExtra("leftLine", mLeftLine);
intent.putExtra("rightLine", mRightLine);
startActivity(intent);
finish();
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
//两次点击大于1秒
long currentTime = System.currentTimeMillis();
if (mLastOnKeyTime > 0 && currentTime - mLastOnKeyTime < 500) {
return true;
}
mLastOnKeyTime = currentTime;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BUTTON_X:
userChoose(TOP);
return true;
case KeyEvent.KEYCODE_BUTTON_B:
userChoose(BOTTOM);
return true;
case KeyEvent.KEYCODE_BUTTON_A:
userChoose(LEFT);
return true;
case KeyEvent.KEYCODE_BUTTON_Y:
userChoose(RIGHT);
return true;
case KeyEvent.KEYCODE_DPAD_UP:
userChoose(TOP);
return true;
case KeyEvent.KEYCODE_DPAD_DOWN:
userChoose(BOTTOM);
return true;
case KeyEvent.KEYCODE_DPAD_LEFT:
userChoose(LEFT);
return true;
case KeyEvent.KEYCODE_DPAD_RIGHT:
userChoose(RIGHT);
return true;
case KeyEvent.KEYCODE_DPAD_CENTER://遥控中间键
//用户点击返回键:
userChooseError();
return true;
}
return true;
}
return super.dispatchKeyEvent(event);
}
private double getResult() {
if (null == mCollect || mCollect.size() == 0) {
if (test_dis == 0) {
return 4.0;
} else {
return 3.8;
}
}
int result = 0;
for (LinkedHashMap.Entry<Integer, List<E>> entry : mCollect.entrySet()) {
result = entry.getKey();
}
final String levelByIndex = "" + Eye.getLevelByIndex(result, test_dis == 0);
return Double.parseDouble(levelByIndex);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
@OnClick({R.id.next_left, R.id.next_right})
public void onClick(View view) {
switch (view.getId()) {
case R.id.next_left:
break;
case R.id.next_right:
break;
}
}
}
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// // TODO: add setContentView(...) invocation
// ButterKnife.bind(this);
// }
//
// @OnClick({R.id.next_left, R.id.next_right})
// public void onClick(View view) {
// switch (view.getId()) {
// case R.id.next_left:
// break;
// case R.id.next_right:
// break;
// }
// }
//}
package com.oo.eye.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.commonUtil.LogUtil;
import com.app.baselibrary.commonUtil.NibiruUtils;
import com.app.baselibrary.commonUtil.PreferencesUtils;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
import com.oo.eye.R2;
import com.oo.eye.bean.Eye;
import com.oo.eye.bean.Eye.E;
import com.oo.eye.bean.EyeHistroyBean;
import com.oo.eye.manager.DaemonSender;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Random;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import static com.oo.eye.bean.Eye.getLineSumByIndex;
/**
*/
public class EyeTestActivityF extends BaseActivity {
static final int TOP = 0;
static final int RIGHT = 1;
static final int BOTTOM = 2;
static final int LEFT = 3;
static final int LEFT_TOP = 4;
static final int RIGHT_TOP = 5;
static final int LEFT_BOTTOM = 6;
static final int RIGHT_BOTTOM= 7;
private E mSelectE;
@BindView(R2.id.rl_eye_test_center_time1)
RelativeLayout timeLayout1;
@BindView(R2.id.tv_eye_test_center_time1)
TextView timeText1;
@BindView(R2.id.rl_eye_test_center_e1)
RelativeLayout eLayout1;
@BindView(R2.id.iv_eye_test_center_e1)
ImageView eImageView1;
@BindView(R2.id.view_eye_test_mask1)
View maskView1;
@BindView(R2.id.tv_eye_vision1)
TextView eyeVision1;
@BindView(R2.id.tv_eye_vision_count1)
TextView count1;
@BindView(R2.id.tv_eye_vision_allow1)
TextView allow1;
@BindView(R2.id.tv_eye_vision_right1)
TextView right1;
@BindView(R2.id.tv_eye_vision_error1)
TextView error1;
private int test_dis = 0;
private ArrayList<ArrayList<E>> mList = new ArrayList<>();
private int mLocation;
private int mLevelIndex = -1;
private LinkedHashMap<Integer, List<E>> mCollect = new LinkedHashMap<>();
private EyeHistroyBean mHistroyBean;
//是否是右眼训练
private boolean isSecondTest;
private double mLeftEye = 5.0;
private int mLeftLine = 0;
private double mRightEye = 5.0;
private int mRightLine = 0;
private long mLastOnKeyTime = -1;
private boolean isTestSuccess = false;
private boolean isStartTest = false;
private long totalTime = 5000;
private long intervalTime = 1000;
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected int getLayoutId() {
return R.layout.activity_eye_test;
}
@Override
protected void init() {
NibiruUtils.switchVR(true);
DaemonSender.startEyeTest(this);
speak("视力测试马上开启");
initialize();
prepareQueue();
}
private void initialize() {
mList.clear();
for (int i = 0; i < 14; i++) {
mList.add(initLineList(i));
}
}
private void prepareQueue() {
mHistroyBean = EyeConfig.getInstance().getCuurentBean();
continueTest();
}
private void continueTest() {
if (!isStartTest) {
isStartTest = true;
resetView(true);
}
}
/**
* 开始测试
*
* @param isNewTest true 代表测试的第一只眼 代表左眼 false代表测量另一只眼 右眼
*/
private void resetView(final boolean isNewTest) {
mLevelIndex = -1;
isSecondTest = !isNewTest;
String eye = isNewTest ? "右" : "左";
if (isNewTest) {
if (mHistroyBean != null) {
mLeftEye = mHistroyBean.getLeft_eye();
mRightEye = mHistroyBean.getRight_eye();
}
}
timeLayout1.setVisibility(View.VISIBLE);
eLayout1.setVisibility(View.GONE);
maskView1.setVisibility(View.GONE);
new CountDownTimer(totalTime, intervalTime) {
@Override
public void onTick(long millisUntilFinished) {
long time = millisUntilFinished / 1000;
timeText1.setText(time + "");
float f = millisUntilFinished * 1.0f / totalTime;
if (isSecondTest) {
maskView1.setAlpha(1 - f);
maskView1.setVisibility(View.VISIBLE);
} else {
maskView1.setVisibility(View.GONE);
}
LogUtil.e("onTick");
}
@Override
public void onFinish() {
LogUtil.e("onFinish");
timeLayout1.setVisibility(View.GONE);
eLayout1.setVisibility(View.VISIBLE);
double e = 5.0;
//如果是左眼次测试
if (isNewTest) {
if (mHistroyBean != null) {
e = mHistroyBean.getLeft_eye();
}
maskView1.setVisibility(View.GONE);
} else {
//右眼测试
if (isSecondTest) {
if (mHistroyBean != null) {
e = mHistroyBean.getRight_eye();
}
}
maskView1.setAlpha(1);
maskView1.setVisibility(View.VISIBLE);
}
mLevelIndex = Eye.getIndexByValue(e, true) - 1;
next(true);
}
}.start();
speak("请遮住您的" + eye + "眼");
mCollect.clear();
}
private void speak(String text) {
DaemonSender.sendDBTTS(this, text);
}
/**
* 描画E字
*
* @param e
*/
private void drewE(E e) {
//视力等级
float level = e.getLevel();
//视标边长
int px = Eye.getDip(this, level);
// RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(px, px);
// eImageView1.setLayoutParams(params);
// eImageView2.setLayoutParams(params);
//视标方向
int resId;
switch (e.getDirect()) {
default:
case TOP:
resId = R.drawable.c_top;
break;
case RIGHT:
resId = R.drawable.c_right;
break;
case BOTTOM:
resId = R.drawable.c_bottom;
break;
case LEFT:
resId = R.drawable.c_left;
break;
case LEFT_TOP:
resId = R.drawable.c_left_top;
break;
case RIGHT_TOP:
resId = R.drawable.c_right_top;
break;
case LEFT_BOTTOM:
resId = R.drawable.c_left_bottom;
break;
case RIGHT_BOTTOM:
resId = R.drawable.c_right_bottom;
break;
}
eImageView1.setImageResource(resId);
}
/**
* 随机生成每一行的视标E
*
* @param index 第几行
* @return list
*/
private ArrayList<E> initLineList(int index) {
float level = Eye.getLevelSizeByIndex(index);
int sum = getLineSumByIndex(index);
//随机数生成方向
Random random = new Random();
E e;
ArrayList<E> list = new ArrayList<>();
int direct = getFirstDirect(random, index);
for (int i = 0; i < sum; i++) {
if (i > 0) {
direct = getRandomDirect(list, direct, sum);
}
e = new E(i, direct, level);
list.add(e);
}
return list;
}
/**
* 获取第一个E;
*
* @param random
* @param index
* @return
*/
private int getFirstDirect(Random random, int index) {
int direct = random.nextInt(4);
if (index > 0) {
if (mList.get(index - 1).get(0).getDirect() == direct)
direct = getFirstDirect(random, index);
}
return direct;
}
/**
* 获取下一个E的方向的判断;
*
* @param list
* @param direct
* @param sum
* @return
*/
private int getRandomDirect(ArrayList<E> list, int direct, int sum) {
int lastDirect = direct;
direct = randomDirect(direct);
int num = sum / 2;
if (sum % 2 == 0 && sum / 2 > 1) {
num = sum / 2 - 1;
}
if (getEDirectorNum(list, direct) >= num) {
direct = getRandomDirect(list, lastDirect, sum);
}
return direct;
}
/**
* 获取该行出现的形同方向的E的个数;
*
* @param list
* @param direct
* @return
*/
private int getEDirectorNum(ArrayList<E> list, int direct) {
int num = 0;
if (list == null || list.size() == 0)
return num;
for (E e :
list) {
if (e.getDirect() == direct)
num++;
}
return num;
}
/**
* 相邻的两个不能是同一个方向
*
* @param lastDirect 上一次的方向
* @return 新的方向
*/
private int randomDirect(int lastDirect) {
//随机数生成方向
Random random = new Random();
int newDirect = random.nextInt(4);
//相邻的不能一样
while (lastDirect == newDirect) {
newDirect = random.nextInt(4);
}
return newDirect;
}
/**
* 下一个测试
*/
private void next(boolean isNextLine) {
if (isNextLine) {
mLevelIndex++;
mLocation = 0;
eyeVision1.setText("" + Eye.getLevelByIndex(mLevelIndex, true));
count1.setText("");
allow1.setText("");
right1.setText("");
error1.setText("");
} else {
mLocation++;
}
mSelectE = mList.get(mLevelIndex).get(mLocation);
drewE(mSelectE);
}
/**
* 选择的方向
*
* @param direct
*/
private void userChoose(int direct) {
LogUtil.e("direct:" + direct);
LogUtil.e("mLevelIndex:" + mLevelIndex);
//获取当前行答过的e
List<E> list = mCollect.get(mLevelIndex);
if (null == list || list.size() == 0) {
list = new ArrayList<>();
}
mSelectE.setUserChoose(direct);
list.add(mSelectE);
mCollect.put(mLevelIndex, list);
judge();
// int verifyErrorCount = 0;
// //获取每行有多少个e
// int lineSum = getLineSumByIndex(mLevelIndex);
// //获取每行答对几个e
// int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
// LogUtil.e("leastAnswerCount:"+leastAnswerCount);
// //获取当前行答过的e
// List<E> list = mCollect.get(mLevelIndex);
// if (null == list || list.size() == 0) {
// list = new ArrayList<>();
// }
// mSelectE.setUserChoose(direct);
// list.add(mSelectE);
//
// int rightAnswerCount = 0;
// for (E e : list) {
// if (e.isCorrect()) {
// rightAnswerCount++;
// }
// }
// LogUtil.e("rightAnswerCount:"+rightAnswerCount);
// //当前行答错的数
// int errorCount = list.size() - rightAnswerCount;
// LogUtil.e("errorCount:"+errorCount);
// //判断是否满足答对的要求
// boolean isNextLine = rightAnswerCount >= leastAnswerCount;
// LogUtil.e("isNextLine:"+isNextLine);
// mCollect.put(mLevelIndex, list);
//
// if(isNextLine){
// if(mLevelIndex == 13){
// showResult();
// return;
// }else {
// List<E> nextList = mCollect.get(mLevelIndex + 1);
// if(nextList != null && nextList.size() > 0){
// showResult();
// return;
// }
// }
// }
//
// //防止出现-1的现象;
// if (lineSum - leastAnswerCount > 0) {
// verifyErrorCount = lineSum - leastAnswerCount;
// } else {
// verifyErrorCount = 0;
// }
// //必须答对一半才往下走一行的
// //如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
// if (errorCount > verifyErrorCount) {
// //如果上一行数据不为空 结束测试
// if (mLevelIndex == 0 || (mCollect.containsKey(mLevelIndex - 1) &&
// mCollect.get(mLevelIndex - 1) != null && mCollect.get(mLevelIndex - 1).size() > 0)) {
// if(isSecondTest){
// mRightLine = leastAnswerCount;
// }else{
// mLeftLine = leastAnswerCount;
// }
// showResult();
// return;
// }else {
// backLastLine();
// return;
// }
// }
// next(isNextLine);
}
private void judge() {
int verifyErrorCount = 0;
//获取每行有多少个e
int lineSum = getLineSumByIndex(mLevelIndex);
//获取每行答对几个e
int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
//获取当前行答过的e
List<E> list = mCollect.get(mLevelIndex);
int rightAnswerCount = 0;
for (E e : list) {
if (e.isCorrect()) {
rightAnswerCount++;
}
}
LogUtil.e("rightAnswerCount:" + rightAnswerCount);
//当前行答错的数
int errorCount = list.size() - rightAnswerCount;
LogUtil.e("errorCount:" + errorCount);
//判断是否满足答对的要求
boolean isNextLine = rightAnswerCount >= leastAnswerCount;
LogUtil.e("isNextLine:" + isNextLine);
mCollect.put(mLevelIndex, list);
if (isNextLine) {
if (mLevelIndex == 13) {
showResult();
return;
} else {
List<E> nextList = mCollect.get(mLevelIndex + 1);
if (nextList != null && nextList.size() > 0) {
showResult();
return;
}
}
}
//防止出现-1的现象;
if (lineSum - leastAnswerCount > 0) {
verifyErrorCount = lineSum - leastAnswerCount;
} else {
verifyErrorCount = 0;
}
count1.setText("总共:" + lineSum);
allow1.setText("正确数:" + leastAnswerCount);
right1.setText("答对数:" + rightAnswerCount);
error1.setText("错误数:" + errorCount);
//必须答对一半才往下走一行的
//如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
if (errorCount > verifyErrorCount) {
//如果上一行数据不为空 结束测试
if (mLevelIndex == 0 || (mCollect.containsKey(mLevelIndex - 1) &&
mCollect.get(mLevelIndex - 1) != null && mCollect.get(mLevelIndex - 1).size() > 0)) {
if (isSecondTest) {
mRightLine = leastAnswerCount;
} else {
mLeftLine = leastAnswerCount;
}
showResult();
return;
} else {
backLastLine();
return;
}
}
next(isNextLine);
}
/**
* 答错
*/
private void userChooseError() {
int direct = mSelectE.getDirect() + 1;
//获取当前行答过的e
List<E> list = mCollect.get(mLevelIndex);
if (null == list || list.size() == 0) {
list = new ArrayList<>();
}
mSelectE.setUserChoose(direct);
list.add(mSelectE);
mCollect.put(mLevelIndex, list);
judge();
// int verifyErrorCount = 0;
// int lineSum = getLineSumByIndex(mLevelIndex);
// int leastAnswerCount = Eye.getLeastAnswerCount(mLevelIndex);
// int rightAnswerCount = 0;
// int direct = mSelectE.getDirect()+1;
//
// //获取当前行答过的e
// List<E> list = mCollect.get(mLevelIndex);
// mSelectE.setUserChoose(direct);
// list.add(mSelectE);
//
// if (null == list || list.size() == 0) {
// list = new ArrayList<>();
// } else {
// for (E e : list) {
// if (e.isCorrect()) {
// rightAnswerCount++;
// }
// }
// }
// //当前行答错的数
// int errorCount = list.size() - rightAnswerCount;
//
// //判断是否满足答对的要求
// boolean isNextLine = rightAnswerCount >= leastAnswerCount;
//
// mCollect.put(mLevelIndex, list);
//
// if(isNextLine){
// if(mLevelIndex == 13){
// showResult();
// return;
// }else {
// List<E> nextList = mCollect.get(mLevelIndex + 1);
// if(nextList != null && nextList.size() > 0){
// showResult();
// return;
// }
// }
// }
//
// //防止出现-1的现象;
// if (lineSum - leastAnswerCount > 0) {
// verifyErrorCount = lineSum - leastAnswerCount;
// } else {
// verifyErrorCount = 0;
// }
// //必须答对一半才往下走一行的
// //如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
// if (errorCount > verifyErrorCount) {
// //如果上一行数据不为空 结束测试
// if (mLevelIndex == 0 || (mCollect.containsKey(mLevelIndex - 1) &&
// mCollect.get(mLevelIndex - 1) != null && mCollect.get(mLevelIndex - 1).size() > 0)) {
// if (isSecondTest) {
// showResult();
// return;
// }
//
// mLeftEye = getResult();
// resetView(false);
// return;
// }else {
// backLastLine();
// return;
// }
// }
// next(isNextLine);
}
//返回到上一行
private void backLastLine() {
mLevelIndex = mLevelIndex - 2;
next(true);
}
/**
* 单眼测试结束
*/
private void showResult() {
//如果不是手动提交
final Double eyeResult = getResult();
if (isSecondTest) {//右眼训练
mRightEye = eyeResult;
showStudentTestDialog();
} else {//左眼训练
mLeftEye = eyeResult;
resetView(false);
return;
}
}
private void showStudentTestDialog() {
int selectId = PreferencesUtils.getInt(EyeConfig.EYE_SETTING_KEY, 0);
String text = ("测视结束左眼视力" + mLeftEye + "右眼视力" + mRightEye).replace(".", "点");
if (selectId == 1) {
text = ("测视结束左眼视力" + Eye.transformSmall(mLeftEye) + "右眼视力" +
Eye.transformSmall(mRightEye)).replace(".", "点");
}
speak(text);
Intent intent = new Intent(this, AfterEyeTestActivity.class);
intent.putExtra("leftEye", mLeftEye);
intent.putExtra("rightEye", mRightEye);
intent.putExtra("leftLine", mLeftLine);
intent.putExtra("rightLine", mRightLine);
startActivity(intent);
finish();
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
//两次点击大于1秒
long currentTime = System.currentTimeMillis();
if (mLastOnKeyTime > 0 && currentTime - mLastOnKeyTime < 500) {
return true;
}
mLastOnKeyTime = currentTime;
LogUtil.e("----点击的Key值----"+event.getKeyCode());
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BUTTON_X:
userChoose(TOP);
return true;
case KeyEvent.KEYCODE_BUTTON_B:
userChoose(BOTTOM);
return true;
case KeyEvent.KEYCODE_BUTTON_A:
userChoose(LEFT);
return true;
case KeyEvent.KEYCODE_BUTTON_Y:
userChoose(RIGHT);
return true;
case KeyEvent.KEYCODE_DPAD_UP:
userChoose(TOP);
return true;
case KeyEvent.KEYCODE_DPAD_DOWN:
userChoose(BOTTOM);
return true;
case KeyEvent.KEYCODE_DPAD_LEFT:
userChoose(LEFT);
return true;
case KeyEvent.KEYCODE_DPAD_RIGHT:
userChoose(RIGHT);
return true;
case KeyEvent.KEYCODE_DPAD_CENTER://遥控中间键
//用户点击返回键:
userChooseError();
return true;
}
return true;
}
return super.dispatchKeyEvent(event);
}
private double getResult() {
if (null == mCollect || mCollect.size() == 0) {
if (test_dis == 0) {
return 4.0;
} else {
return 3.8;
}
}
int result = 0;
for (LinkedHashMap.Entry<Integer, List<E>> entry : mCollect.entrySet()) {
result = entry.getKey();
}
final String levelByIndex = "" + Eye.getLevelByIndex(result, test_dis == 0);
return Double.parseDouble(levelByIndex);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
@OnClick({R.id.next_left})
public void onClick(View view) {
switch (view.getId()) {
case R.id.next_left:
break;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid android:color="@color/btn_focus_bg" />
<corners android:radius="@dimen/dp_4"></corners>
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/btn_focus_bg" />
<corners android:radius="@dimen/dp_4"></corners>
</shape>
</item>
<!--<item android:state_focused="true" android:state_window_focused="false">-->
<!--<shape>-->
<!--<solid android:color="@color/btn_focus_bg" />-->
<!--<stroke android:width="1dp" android:color="@color/white" />-->
<!--</shape>-->
<!--</item>-->
<item>
<shape>
<solid android:color="@color/e_test_color" />
<corners android:radius="@dimen/dp_4"></corners>
</shape>
</item>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/select1_sel" android:state_checked="true"/>
<item android:drawable="@drawable/select1_nor" android:state_checked="false"/>
<item android:drawable="@drawable/select1_nor"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportHeight="10"
android:viewportWidth="10">
<path
android:fillColor="#ff040000"
android:pathData="M8,0h2v10h-2z"/>
<path
android:fillColor="#ff040000"
android:pathData="M0,0h10v2.5h-10z"/>
<path
android:fillColor="#ff040000"
android:pathData="M4,0h2v10h-2z"/>
<path
android:fillColor="#ff040000"
android:pathData="M0,0h2v10h-2z"/>
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportHeight="10"
android:viewportWidth="10">
<path
android:fillColor="#ff040000"
android:pathData="M0,8h10v2h-10z"/>
<path
android:fillColor="#ff040000"
android:pathData="M7.5,0h2.5v10h-2.5z"/>
<path
android:fillColor="#ff040000"
android:pathData="M0,4h10v2h-10z"/>
<path
android:fillColor="#ff040000"
android:pathData="M0,0h10v2h-10z"/>
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportHeight="10"
android:viewportWidth="10">
<path
android:fillColor="#ff040000"
android:pathData="M0,0h10v2h-10z"/>
<path
android:fillColor="#ff040000"
android:pathData="M0,0h2.5v10h-2.5z"/>
<path
android:fillColor="#ff040000"
android:pathData="M0,4h10v2h-10z"/>
<path
android:fillColor="#ff040000"
android:pathData="M0,8h10v2h-10z"/>
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportHeight="10"
android:viewportWidth="10">
<path
android:fillColor="#ff040000"
android:pathData="M0,0h2v10h-2z"/>
<path
android:fillColor="#ff040000"
android:pathData="M0,7.5h10v2.5h-10z"/>
<path
android:fillColor="#ff040000"
android:pathData="M4,0h2v10h-2z"/>
<path
android:fillColor="#ff040000"
android:pathData="M8,0h2v10h-2z"/>
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid android:color="@color/white" />
<corners android:radius="18dp"/>
<stroke android:width="1dp" android:color="@color/transparent" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/gray_white" />
<corners android:radius="18dp"/>
<stroke android:width="1dp" android:color="@color/transparent" />
</shape>
</item>
<item>
<shape>
<solid android:color="@color/transparent" />
<corners android:radius="18dp"/>
<stroke android:width="1dp" android:color="@color/white" />
</shape>
</item>
</selector>
......@@ -6,7 +6,7 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/etest_bg_default">
android:background="@color/e_test_color">
<TextView
android:layout_width="wrap_content"
......
......@@ -2,55 +2,447 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:background="@drawable/etest_bg_default">
android:background="@color/white">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_44"
android:background="@color/e_test_color">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="设置"
android:textColor="@color/white"
android:textSize="20sp"/>
android:textSize="22sp" />
<LinearLayout
android:id="@+id/about_lay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_30"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/about" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/dp_6"
android:text="关于"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
<com.oo.seex.sys_state.widget.StateView
android:id="@+id/state_view"
android:layout_width="match_parent"
android:layout_height="15dp"/>
android:layout_height="15dp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/title_lay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:layout_marginLeft="@dimen/dp_40"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_48"
android:gravity="right"
android:orientation="vertical">
<TextView
android:id="@+id/tv_eye_setting_normal"
android:layout_width="240dp"
android:layout_height="40dp"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_gravity="right"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="使用5分法显示视力数据(如5.0)"
android:textColor="@color/white"
android:textSize="14dp"
android:background="@drawable/eye_setting_btn_bg"/>
android:gravity="center_vertical"
android:text="小数发/五分法"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_eye_setting_decimals"
android:layout_width="240dp"
android:layout_height="40dp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_gravity="right"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="使用小数法显示视力数据(如1.0)"
android:textColor="@color/white"
android:textSize="14dp"
android:background="@drawable/eye_setting_btn_bg"/>
android:gravity="center_vertical"
android:text="测试距离"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_gravity="right"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:text="C字视标"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_gravity="right"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:text="测视等待时长"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_gravity="right"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:text="检视报告"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_gravity="right"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:text="测视帮助"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:id="@+id/decimal_lay"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_marginTop="@dimen/dp_48"
android:layout_toRightOf="@+id/title_lay">
<RadioGroup
android:id="@+id/group_decimal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RadioButton
android:id="@+id/checkbox_decimal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="小数法(1.0)"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_number5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="55dip"
android:layout_toRightOf="@+id/checkbox_decimal"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="五分法(5.0) "
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_alignParentBottom="true"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:id="@+id/distance_lay"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_below="@+id/decimal_lay"
android:layout_toRightOf="@+id/title_lay">
<RadioGroup
android:id="@+id/group_distance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RadioButton
android:id="@+id/checkbox_distance5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="小数法(1.0)"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_distance2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="55dip"
android:layout_toRightOf="@+id/checkbox_distance5"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="2.5米(快速)"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_alignParentBottom="true"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:id="@+id/direction_lay"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_below="@+id/distance_lay"
android:layout_toRightOf="@+id/title_lay">
<RadioGroup
android:id="@+id/group_direction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RadioButton
android:id="@+id/checkbox_direction4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="4个方向(快捷)"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_direction8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_30"
android:layout_toRightOf="@+id/checkbox_direction4"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="8个方向(特需)"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_alignParentBottom="true"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:id="@+id/wait_lay"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_below="@+id/direction_lay"
android:layout_toRightOf="@+id/title_lay">
<RadioGroup
android:id="@+id/group_wait"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RadioButton
android:id="@+id/checkbox_wait_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="3秒"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_wait_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_35"
android:layout_toRightOf="@+id/checkbox_wait_3"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="5秒"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_wait_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_30"
android:layout_toRightOf="@+id/checkbox_wait_5"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="8秒"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_wait_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_35"
android:layout_toRightOf="@+id/checkbox_wait_8"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="10秒"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_wait_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_35"
android:layout_toRightOf="@+id/checkbox_wait_10"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="不启用"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_alignParentBottom="true"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:id="@+id/report_lay"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_below="@+id/wait_lay"
android:layout_toRightOf="@+id/title_lay">
<RadioGroup
android:id="@+id/group_report"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RadioButton
android:id="@+id/checkbox_report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="电子报告单"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_report_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="55dip"
android:layout_toRightOf="@+id/checkbox_report"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="电子报告单+纸质报告单(测视完成自动打印)"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_alignParentBottom="true"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:id="@+id/help_lay"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_below="@+id/report_lay"
android:layout_toRightOf="@+id/title_lay">
<RadioGroup
android:id="@+id/group_help"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RadioButton
android:id="@+id/checkbox_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="测视前展示"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<RadioButton
android:id="@+id/checkbox_close_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="55dip"
android:layout_toRightOf="@+id/checkbox_help"
android:button="@drawable/checkbox"
android:paddingLeft="@dimen/sp_10"
android:text="关闭测视帮助"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_alignParentBottom="true"
android:background="@color/line_color"></View>
</RelativeLayout>
</RelativeLayout>
......@@ -7,7 +7,7 @@
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:background="@drawable/etest_bg_default">
android:background="@color/e_test_color">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -5,10 +5,10 @@
android:background="@color/white"
android:keepScreenOn="true"
android:orientation="horizontal"
android:weightSum="2">
>
<RelativeLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
......@@ -23,6 +23,7 @@
android:textSize="@dimen/sp_22" />
<TextView
android:layout_marginTop="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_20"
android:id="@+id/next_left"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
......@@ -43,7 +44,7 @@
android:background="#60000000">
<RelativeLayout
android:layout_width="240dip"
android:layout_width="346dip"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@color/white"
......@@ -88,16 +89,17 @@
<TextView
android:id="@+id/tv_eye_test_center_time1"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_below="@+id/tv_eye_test_center_ready1"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:background="@drawable/circle_white_bg"
android:gravity="center"
android:text="5"
android:textStyle="bold"
android:textColor="#585E60"
android:textSize="24sp" />
android:textSize="40sp" />
</RelativeLayout>
</RelativeLayout>
......@@ -163,8 +165,8 @@
<ImageView
android:id="@+id/iv_eye_test_center_e1"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
</RelativeLayout>
......@@ -189,184 +191,184 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:layout_marginTop="@dimen/dp_16"
android:layout_centerHorizontal="true"
android:id="@+id/title_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5.0 -3"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_22" />
<TextView
android:layout_marginTop="@dimen/dp_16"
android:id="@+id/next_right"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="X 放弃当前,跳到下一位"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_16" />
<RelativeLayout
android:id="@+id/rl_eye_test_center2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true">
<RelativeLayout
android:id="@+id/rl_eye_test_center_time2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#60000000">
<RelativeLayout
android:layout_width="240dip"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="@dimen/dp_20">
<LinearLayout
android:id="@+id/tv_name_lay_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_name_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="游客11,"
android:textColor="@color/text_color"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="开始测试"
android:textColor="@color/text_color"
android:textSize="20sp" />
</LinearLayout>
<TextView
android:id="@+id/tv_eye_test_center_ready2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name_lay_right"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_8"
android:text="请闭上您的左眼"
android:textColor="@color/text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_eye_test_center_time2"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_below="@+id/tv_eye_test_center_ready2"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:background="@drawable/circle_white_bg"
android:gravity="center"
android:text="5"
android:textColor="#585E60"
android:textSize="24sp" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_eye_test_center_e2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_eye_test_e2"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal">
<TextView
android:id="@+id/tv_eye_vision2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="10sp" />
<TextView
android:id="@+id/tv_eye_vision_count2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="@color/white"
android:textSize="10sp" />
<TextView
android:id="@+id/tv_eye_vision_allow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="@color/white"
android:textSize="10sp" />
<TextView
android:id="@+id/tv_eye_vision_right2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="@color/white"
android:textSize="10sp" />
<TextView
android:id="@+id/tv_eye_vision_error2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="@color/white"
android:textSize="10sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_eye_test_e2"
android:layout_width="115dp"
android:layout_height="115dp"
android:layout_centerInParent="true"
android:background="@drawable/white_bg">
<ImageView
android:id="@+id/iv_eye_test_center_e2"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:text="当前测视距离为5米"
android:textColor="@color/text_color"
android:textSize="12sp" />
</RelativeLayout>
<View
android:id="@+id/view_eye_test_mask2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:visibility="gone" />
</RelativeLayout>
<!--<RelativeLayout-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_weight="1">-->
<!--<TextView-->
<!--android:layout_marginTop="@dimen/dp_16"-->
<!--android:layout_centerHorizontal="true"-->
<!--android:id="@+id/title_right"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="5.0 -3"-->
<!--android:textColor="@color/text_color"-->
<!--android:textSize="@dimen/sp_22" />-->
<!--<TextView-->
<!--android:layout_marginTop="@dimen/dp_16"-->
<!--android:id="@+id/next_right"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="X 放弃当前,跳到下一位"-->
<!--android:textColor="@color/text_color"-->
<!--android:textSize="@dimen/sp_16" />-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_eye_test_center2"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_centerInParent="true">-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_eye_test_center_time2"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:background="#60000000">-->
<!--<RelativeLayout-->
<!--android:layout_width="240dip"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_centerInParent="true"-->
<!--android:background="@color/white"-->
<!--android:gravity="center_horizontal"-->
<!--android:orientation="vertical"-->
<!--android:padding="@dimen/dp_20">-->
<!--<LinearLayout-->
<!--android:id="@+id/tv_name_lay_right"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_centerHorizontal="true"-->
<!--android:orientation="horizontal">-->
<!--<TextView-->
<!--android:id="@+id/tv_name_right"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="游客11,"-->
<!--android:textColor="@color/text_color"-->
<!--android:textSize="20sp"-->
<!--android:textStyle="bold" />-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="开始测试"-->
<!--android:textColor="@color/text_color"-->
<!--android:textSize="20sp" />-->
<!--</LinearLayout>-->
<!--<TextView-->
<!--android:id="@+id/tv_eye_test_center_ready2"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_below="@+id/tv_name_lay_right"-->
<!--android:layout_centerHorizontal="true"-->
<!--android:layout_marginTop="@dimen/dp_8"-->
<!--android:text="请闭上您的左眼"-->
<!--android:textColor="@color/text_color"-->
<!--android:textSize="13sp" />-->
<!--<TextView-->
<!--android:id="@+id/tv_eye_test_center_time2"-->
<!--android:layout_width="70dp"-->
<!--android:layout_height="70dp"-->
<!--android:layout_below="@+id/tv_eye_test_center_ready2"-->
<!--android:layout_centerHorizontal="true"-->
<!--android:layout_marginTop="20dp"-->
<!--android:background="@drawable/circle_white_bg"-->
<!--android:gravity="center"-->
<!--android:text="5"-->
<!--android:textColor="#585E60"-->
<!--android:textSize="24sp" />-->
<!--</RelativeLayout>-->
<!--</RelativeLayout>-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_eye_test_center_e2"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:visibility="gone">-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_above="@+id/rl_eye_test_e2"-->
<!--android:layout_marginBottom="20dp"-->
<!--android:gravity="center_horizontal">-->
<!--<TextView-->
<!--android:id="@+id/tv_eye_vision2"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textColor="@color/white"-->
<!--android:textSize="10sp" />-->
<!--<TextView-->
<!--android:id="@+id/tv_eye_vision_count2"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="10dp"-->
<!--android:textColor="@color/white"-->
<!--android:textSize="10sp" />-->
<!--<TextView-->
<!--android:id="@+id/tv_eye_vision_allow2"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="10dp"-->
<!--android:textColor="@color/white"-->
<!--android:textSize="10sp" />-->
<!--<TextView-->
<!--android:id="@+id/tv_eye_vision_right2"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="10dp"-->
<!--android:textColor="@color/white"-->
<!--android:textSize="10sp" />-->
<!--<TextView-->
<!--android:id="@+id/tv_eye_vision_error2"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="10dp"-->
<!--android:textColor="@color/white"-->
<!--android:textSize="10sp" />-->
<!--</LinearLayout>-->
<!--<RelativeLayout-->
<!--android:id="@+id/rl_eye_test_e2"-->
<!--android:layout_width="115dp"-->
<!--android:layout_height="115dp"-->
<!--android:layout_centerInParent="true"-->
<!--android:background="@drawable/white_bg">-->
<!--<ImageView-->
<!--android:id="@+id/iv_eye_test_center_e2"-->
<!--android:layout_width="20dp"-->
<!--android:layout_height="20dp"-->
<!--android:layout_centerInParent="true" />-->
<!--</RelativeLayout>-->
<!--</RelativeLayout>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentBottom="true"-->
<!--android:layout_centerHorizontal="true"-->
<!--android:layout_marginBottom="30dp"-->
<!--android:text="当前测视距离为5米"-->
<!--android:textColor="@color/text_color"-->
<!--android:textSize="12sp" />-->
<!--</RelativeLayout>-->
<!--<View-->
<!--android:id="@+id/view_eye_test_mask2"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:background="#000000"-->
<!--android:visibility="gone" />-->
<!--</RelativeLayout>-->
</LinearLayout>
\ No newline at end of file
......@@ -4,10 +4,9 @@
android:layout_height="match_parent"
android:background="@color/e_test_color"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingLeft="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin">
android:paddingTop="@dimen/dp_20">
<LinearLayout
android:id="@+id/test_setting"
......@@ -28,7 +27,7 @@
android:layout_marginLeft="@dimen/dp_8"
android:text="设置"
android:textColor="@color/white"
android:textSize="16sp" />
android:textSize="20sp" />
</LinearLayout>
<ImageView
......@@ -45,7 +44,7 @@
android:layout_marginTop="@dimen/dp_8"
android:text="欧欧智能自动测试仪"
android:textColor="@color/white"
android:textSize="24sp"
android:textSize="30sp"
android:textStyle="bold" />
<LinearLayout
......@@ -68,7 +67,7 @@
android:layout_marginRight="@dimen/dp_8"
android:text="海航招飞测试专业版"
android:textColor="@color/white"
android:textSize="16sp" />
android:textSize="20sp" />
<ImageView
android:layout_width="wrap_content"
......@@ -84,8 +83,8 @@
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen_100"
android:layout_width="700dip"
android:layout_height="@dimen/dp_120"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_70"
android:orientation="horizontal">
......@@ -108,12 +107,12 @@
android:src="@drawable/nav1" />
<TextView
android:layout_width="@dimen/dimen_130"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="单人测试"
android:textColor="@color/e_test_color"
android:textSize="20dp"
android:textSize="22dp"
android:textStyle="bold" />
</LinearLayout>
......@@ -138,12 +137,12 @@
<TextView
android:id="@+id/tv_eye_test_histroy"
android:layout_width="@dimen/dimen_130"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="多人测试"
android:textColor="@color/e_test_color"
android:textSize="20dp"
android:textSize="22dp"
android:textStyle="bold" />
</LinearLayout>
......@@ -166,12 +165,12 @@
android:src="@drawable/nav3" />
<TextView
android:layout_width="@dimen/dimen_130"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="临时测试"
android:textColor="@color/e_test_color"
android:textSize="20dp"
android:textSize="22dp"
android:textStyle="bold" />
</LinearLayout>
......@@ -194,12 +193,12 @@
android:src="@drawable/nav4" />
<TextView
android:layout_width="@dimen/dimen_130"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="结果报表"
android:textColor="@color/e_test_color"
android:textSize="20dp"
android:textSize="22dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
......@@ -208,7 +207,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_30"
android:text="Copyright © 2019 北京星辰万有"
android:textColor="@color/white"
android:textSize="13sp" />
......
......@@ -107,19 +107,19 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dimen_120"
android:layout_marginTop="@dimen/dp_120"
android:background="@color/white"></LinearLayout>
<LinearLayout
android:id="@+id/ddd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_120"
android:layout_marginTop="@dimen/dp_120"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_20">
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -144,7 +144,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_180"
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -166,7 +166,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -188,7 +188,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_140"
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -210,7 +210,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -235,12 +235,12 @@
<TextView
android:layout_marginTop="@dimen/dp_12"
android:id="@+id/begin_test"
android:layout_width="100dip"
android:layout_width="130dip"
android:layout_height="40dip"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_30"
android:background="@drawable/btn_single_focus_selector"
android:background="@drawable/after_btn_bg"
android:gravity="center"
android:text="生成测试队列"
android:textColor="@color/white"
......
......@@ -63,20 +63,20 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dimen_120"
android:layout_marginTop="@dimen/dp_120"
android:background="@color/white"></LinearLayout>
<LinearLayout
android:id="@+id/ddd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_120"
android:layout_marginTop="@dimen/dp_120"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_20">
<RelativeLayout
android:layout_width="@dimen/dimen_180"
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -103,7 +103,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -125,7 +125,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_140"
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -147,7 +147,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -190,7 +190,7 @@
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_40"
android:background="@drawable/btn_single_focus_selector"
android:background="@drawable/after_btn_bg"
android:gravity="center"
android:text="开始测试"
android:textColor="@color/white"
......
......@@ -27,19 +27,19 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dimen_120"
android:layout_marginTop="@dimen/dp_120"
android:background="@color/white"></LinearLayout>
<LinearLayout
android:id="@+id/ddd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_120"
android:layout_marginTop="@dimen/dp_120"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_20">
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -67,7 +67,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_180"
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -89,7 +89,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -111,7 +111,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_140"
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -133,7 +133,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -163,7 +163,7 @@
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_12"
android:background="@drawable/btn_single_focus_selector"
android:background="@drawable/after_btn_bg"
android:gravity="center"
android:text="生成测试队列"
android:textColor="@color/white"
......
......@@ -88,9 +88,10 @@
<ImageView
android:id="@+id/selete2_iv"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/select2_sel" />
android:src="@drawable/select3_sel" />
<TextView
android:id="@+id/selete2_tv"
......@@ -144,20 +145,20 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dimen_120"
android:layout_marginTop="@dimen/dp_127"
android:background="@color/white"></LinearLayout>
<LinearLayout
android:id="@+id/ddd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_120"
android:layout_marginTop="@dimen/dp_120"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_20">
<RelativeLayout
android:layout_width="@dimen/dimen_180"
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -184,7 +185,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -206,7 +207,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_140"
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -228,7 +229,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -250,7 +251,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -272,7 +273,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -296,13 +297,13 @@
<TextView
android:id="@+id/begin_test"
android:layout_width="100dip"
android:layout_width="130dip"
android:layout_height="40dip"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_12"
android:background="@drawable/btn_single_focus_selector"
android:background="@drawable/after_btn_bg"
android:gravity="center"
android:text="生成测试队列"
android:textColor="@color/white"
......
......@@ -8,7 +8,7 @@
android:orientation="horizontal">
<RelativeLayout
android:layout_width="@dimen/dimen_180"
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -35,7 +35,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -57,7 +57,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_140"
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -79,7 +79,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......
......@@ -8,7 +8,7 @@
android:orientation="horizontal">
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -26,7 +26,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_180"
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -53,7 +53,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -75,7 +75,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_140"
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -97,7 +97,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......
......@@ -8,7 +8,7 @@
android:orientation="horizontal">
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -28,7 +28,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_180"
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -55,7 +55,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -77,7 +77,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_140"
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -99,7 +99,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......
......@@ -8,7 +8,7 @@
android:orientation="horizontal">
<RelativeLayout
android:layout_width="@dimen/dimen_180"
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -35,7 +35,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_120"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -57,7 +57,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_140"
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -79,7 +79,7 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -100,7 +100,7 @@
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -121,7 +121,7 @@
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/dimen_160"
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......
......@@ -3,9 +3,10 @@
<dimen name="activity_horizontal_margin">115dp</dimen>
<dimen name="activity_vertical_margin">38dp</dimen>
<dimen name="dimen_130">130dp</dimen>
<dimen name="dimen_100">100dp</dimen>
<dimen name="dimen_120">120dp</dimen>
<dimen name="dimen_140">140dp</dimen>
<dimen name="dimen_160">160dp</dimen>
<dimen name="dimen_180">180dip</dimen>
<dimen name="dp_120">120dip</dimen>
<dimen name="item_dimen_1">80dp</dimen>
<dimen name="item_dimen_2">100dp</dimen>
<dimen name="item_dimen_3">120dp</dimen>
<dimen name="item_dimen_4">140dp</dimen>
<dimen name="item_dimen_5">160dip</dimen>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment