Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haihang
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐丛奇
haihang
Commits
78ee5656
Commit
78ee5656
authored
Sep 04, 2018
by
chengxiuhong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
10534234
4b2dde41
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
339 additions
and
307 deletions
+339
-307
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-7
EyeConfig.java
app/src/main/java/com/oo/eye/EyeConfig.java
+2
-0
BeforeEyeTestActivity.java
app/src/main/java/com/oo/eye/activity/BeforeEyeTestActivity.java
+0
-17
EyeSettingActivity.java
app/src/main/java/com/oo/eye/activity/EyeSettingActivity.java
+18
-25
EyeTestActivity.java
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
+117
-78
EyeTestMainActivity.java
app/src/main/java/com/oo/eye/activity/EyeTestMainActivity.java
+0
-16
MorePeopleTestActivity.java
app/src/main/java/com/oo/eye/activity/MorePeopleTestActivity.java
+14
-7
SinglePeopleTestActivity.java
app/src/main/java/com/oo/eye/activity/SinglePeopleTestActivity.java
+13
-15
TestListActivity.java
app/src/main/java/com/oo/eye/activity/TestListActivity.java
+3
-18
TestResurtListActivity.java
app/src/main/java/com/oo/eye/activity/TestResurtListActivity.java
+0
-10
MorePeopleAdapter.java
app/src/main/java/com/oo/eye/adapter/MorePeopleAdapter.java
+11
-9
SinglePeopleAdapter.java
app/src/main/java/com/oo/eye/adapter/SinglePeopleAdapter.java
+28
-9
TestListAdapter.java
app/src/main/java/com/oo/eye/adapter/TestListAdapter.java
+10
-4
Eye.java
app/src/main/java/com/oo/eye/bean/Eye.java
+15
-0
StudentBean.java
app/src/main/java/com/oo/eye/bean/StudentBean.java
+10
-0
AfterTestDialog.java
app/src/main/java/com/oo/eye/widget/AfterTestDialog.java
+48
-38
activity_eye_test.xml
app/src/main/res/layout/activity_eye_test.xml
+23
-6
activity_testlist.xml
app/src/main/res/layout/activity_testlist.xml
+1
-1
dialog_after_eye_test.xml
app/src/main/res/layout/dialog_after_eye_test.xml
+13
-37
include_people.xml
app/src/main/res/layout/include_people.xml
+0
-4
item_people.xml
app/src/main/res/layout/item_people.xml
+0
-4
BaseRecyclerViewAdapter.java
library/baselibrary/src/main/java/com/app/baselibrary/recycler/adapter/BaseRecyclerViewAdapter.java
+10
-2
No files found.
app/src/main/AndroidManifest.xml
View file @
78ee5656
...
...
@@ -16,7 +16,6 @@
android:screenOrientation=
"landscape"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
</intent-filter>
...
...
@@ -39,18 +38,15 @@
android:launchMode=
"singleTop"
></activity>
<activity
android:name=
"com.oo.eye.activity.BeforeEyeTestActivity"
android:launchMode=
"singleTop"
android:screenOrientation=
"landscape"
/>
<activity
android:name=
"com.oo.eye.activity.EyeTestActivity"
android:screenOrientation=
"landscape"
/>
<activity
android:name=
"com.oo.eye.activity.EyeTestHistroyActivity"
android:screenOrientation=
"landscape"
/>
<activity
android:name=
"com.oo.eye.activity.EyeTestStatisticsActivity"
android:launchMode=
"singleTop"
android:screenOrientation=
"landscape"
/>
<activity
android:name=
"com.oo.eye.activity.EyeSettingActivity"
android:launchMode=
"singleTop"
android:screenOrientation=
"landscape"
/>
</application>
...
...
app/src/main/java/com/oo/eye/EyeConfig.java
View file @
78ee5656
...
...
@@ -17,6 +17,8 @@ public class EyeConfig {
public
static
final
int
EYE_DISTANCE_2
=
2
;
//距离2.5米
public
static
final
int
EYE_DISTANCE_5
=
5
;
//距离5米
public
static
final
String
EYE_DIRECTION_SETTING_KEY
=
"eye_direction_setting_key"
;
//C字视标
public
static
final
int
EYE_DIRECTION_4
=
4
;
//视标4个方向
public
static
final
int
EYE_DIRECTION_8
=
8
;
//视标8个方向
public
static
final
String
EYE_WAIT_SETTING_KEY
=
"eye_setting_wait_key"
;
//测视等待时长
public
static
final
String
EYE_REPORT_SETTING_KEY
=
"eye_report_setting_key"
;
//检视报告
public
static
final
String
EYE_HELP_SETTING_KEY
=
"eye_setting_help_key"
;
//测视帮助
...
...
app/src/main/java/com/oo/eye/activity/BeforeEyeTestActivity.java
View file @
78ee5656
package
com
.
oo
.
eye
.
activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.view.View
;
import
android.widget.LinearLayout
;
...
...
@@ -13,7 +12,6 @@ import com.oo.eye.R;
import
com.oo.eye.R2
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
...
...
@@ -39,15 +37,6 @@ public class BeforeEyeTestActivity extends BaseActivity {
mHandler
=
new
Handler
();
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
}
@OnClick
(
R2
.
id
.
tv_eye_test_start1
)
public
void
click
(
View
view
)
{
...
...
@@ -58,12 +47,6 @@ public class BeforeEyeTestActivity extends BaseActivity {
finish
();
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ButterKnife
.
bind
(
this
);
}
private
void
speak
(
String
text
)
{
BDttsUtils
.
getInstance
().
speak
(
text
);
}
...
...
app/src/main/java/com/oo/eye/activity/EyeSettingActivity.java
View file @
78ee5656
package
com
.
oo
.
eye
.
activity
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.RadioButton
;
import
android.widget.RadioGroup
;
...
...
@@ -12,9 +11,11 @@ import com.oo.eye.EyeConfig;
import
com.oo.eye.R
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
import
static
com
.
oo
.
eye
.
EyeConfig
.
EYE_DIRECTION_4
;
import
static
com
.
oo
.
eye
.
EyeConfig
.
EYE_DIRECTION_8
;
/**
*/
...
...
@@ -82,12 +83,12 @@ public class EyeSettingActivity extends BaseActivity {
@Override
protected
void
init
()
{
int
selectId
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_SETTING_KEY
,
1
);
int
selectId
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_SETTING_KEY
,
EyeConfig
.
EYE_SETTING_5
);
switch
(
selectId
)
{
case
0
:
case
EyeConfig
.
EYE_SETTING_1
:
mCheckboxDecimal
.
setChecked
(
true
);
break
;
case
1
:
case
EyeConfig
.
EYE_SETTING_5
:
mCheckboxNumber5
.
setChecked
(
true
);
break
;
}
...
...
@@ -97,21 +98,21 @@ public class EyeSettingActivity extends BaseActivity {
public
void
onCheckedChanged
(
RadioGroup
group
,
int
checkedId
)
{
switch
(
checkedId
)
{
case
R
.
id
.
checkbox_decimal
:
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_SETTING_KEY
,
0
);
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_SETTING_KEY
,
EyeConfig
.
EYE_SETTING_1
);
break
;
case
R
.
id
.
checkbox_number5
:
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_SETTING_KEY
,
5
);
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_SETTING_KEY
,
EyeConfig
.
EYE_SETTING_
5
);
break
;
}
}
});
//测试距离
int
distance
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
5
);
int
distance
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
EyeConfig
.
EYE_DISTANCE_
5
);
switch
(
distance
)
{
case
2
:
case
EyeConfig
.
EYE_DISTANCE_
2
:
mCheckboxDistance2
.
setChecked
(
true
);
break
;
case
5
:
case
EyeConfig
.
EYE_DISTANCE_
5
:
mCheckboxDistance5
.
setChecked
(
true
);
break
;
...
...
@@ -121,21 +122,21 @@ public class EyeSettingActivity extends BaseActivity {
public
void
onCheckedChanged
(
RadioGroup
group
,
int
checkedId
)
{
switch
(
checkedId
)
{
case
R
.
id
.
checkbox_distance2
:
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
2
);
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
EyeConfig
.
EYE_DISTANCE_
2
);
break
;
case
R
.
id
.
checkbox_distance5
:
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
5
);
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
EyeConfig
.
EYE_DISTANCE_
5
);
break
;
}
}
});
//C字视标
int
direction
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
4
);
int
direction
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
EYE_DIRECTION_
4
);
switch
(
direction
)
{
case
4
:
case
EYE_DIRECTION_
4:
mCheckboxDirection4
.
setChecked
(
true
);
break
;
case
8
:
case
EYE_DIRECTION_
8:
mCheckboxDirection8
.
setChecked
(
true
);
break
;
...
...
@@ -145,10 +146,10 @@ public class EyeSettingActivity extends BaseActivity {
public
void
onCheckedChanged
(
RadioGroup
group
,
int
checkedId
)
{
switch
(
checkedId
)
{
case
R
.
id
.
checkbox_direction4
:
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
4
);
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
EYE_DIRECTION_
4
);
break
;
case
R
.
id
.
checkbox_direction8
:
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
8
);
PreferencesUtils
.
putInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
EYE_DIRECTION_
8
);
break
;
}
}
...
...
@@ -243,14 +244,6 @@ public class EyeSettingActivity extends BaseActivity {
});
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// TODO: add setContentView(...) invocation
ButterKnife
.
bind
(
this
);
}
@OnClick
({
R
.
id
.
about_lay
,
R
.
id
.
close_lay
})
public
void
onClick
(
View
view
)
{
switch
(
view
.
getId
())
{
...
...
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
View file @
78ee5656
package
com
.
oo
.
eye
.
activity
;
import
android.os.Bundle
;
import
android.os.CountDownTimer
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
...
...
@@ -10,24 +9,30 @@ import android.widget.ImageView;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.app.baselibrary.base.app.AppManager
;
import
com.app.baselibrary.base.common.BaseActivity
;
import
com.app.baselibrary.commonUtil.BDttsUtils
;
import
com.app.baselibrary.commonUtil.CheckUtil
;
import
com.app.baselibrary.commonUtil.LogUtil
;
import
com.app.baselibrary.commonUtil.PreferencesUtils
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.R
;
import
com.oo.eye.bean.Eye
;
import
com.oo.eye.bean.Eye.E
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.eye.widget.AfterTestDialog
;
import
java.util.ArrayList
;
import
java.util.Date
;
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
.
EyeConfig
.
EYE_DIRECTION_4
;
import
static
com
.
oo
.
eye
.
EyeConfig
.
EYE_SETTING_5
;
import
static
com
.
oo
.
eye
.
bean
.
Eye
.
getLineSumByIndex
;
/**
...
...
@@ -39,12 +44,19 @@ public class EyeTestActivity extends BaseActivity {
static
final
int
RIGHT
=
1
;
static
final
int
BOTTOM
=
2
;
static
final
int
LEFT
=
3
;
static
final
int
LEF
T_TOP
=
4
;
static
final
int
RIGHT_
TOP
=
5
;
static
final
int
RIGH
T_TOP
=
4
;
static
final
int
RIGHT_
BOTTOM
=
5
;
static
final
int
LEFT_BOTTOM
=
6
;
static
final
int
RIGHT_BOTTOM
=
7
;
static
final
int
LEFT_TOP
=
7
;
private
E
mSelectE
;
@BindView
(
R
.
id
.
title_eye
)
TextView
mEyeText
;
@BindView
(
R
.
id
.
title_eye_
)
TextView
mEyeText_
;
@BindView
(
R
.
id
.
next_left
)
TextView
mNextText
;
@BindView
(
R
.
id
.
rl_eye_test_center_time1
)
RelativeLayout
timeLayout1
;
@BindView
(
R
.
id
.
tv_name_left
)
...
...
@@ -61,6 +73,8 @@ public class EyeTestActivity extends BaseActivity {
ImageView
eImageView1
;
private
int
mDistance
=
EyeConfig
.
EYE_DISTANCE_5
;
private
int
mDirection
=
EYE_DIRECTION_4
;
private
int
mGroupDecimal
=
EyeConfig
.
EYE_SETTING_5
;
private
ArrayList
<
ArrayList
<
E
>>
mList
=
new
ArrayList
<>();
private
int
mLocation
;
...
...
@@ -72,25 +86,16 @@ public class EyeTestActivity extends BaseActivity {
private
boolean
isSecondTest
;
private
int
currentIndex
;
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
boolean
isKeyDwon
=
false
;
private
long
totalTime
=
5000
;
private
long
intervalTime
=
1000
;
@Override
protected
void
onResume
()
{
super
.
onResume
();
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
}
private
AfterTestDialog
mAfterTestDialog
;
@Override
protected
int
getLayoutId
()
{
...
...
@@ -105,6 +110,9 @@ public class EyeTestActivity extends BaseActivity {
private
void
initialize
()
{
mStudentList
=
EyeConfig
.
getInstance
().
getStudents
();
mDistance
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DISTANCE_SETTING_KEY
,
EyeConfig
.
EYE_DISTANCE_5
);
mDirection
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
EYE_DIRECTION_4
);
mGroupDecimal
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_SETTING_KEY
,
EyeConfig
.
EYE_SETTING_5
);
mList
.
clear
();
for
(
int
i
=
0
;
i
<
14
;
i
++)
{
...
...
@@ -116,6 +124,8 @@ public class EyeTestActivity extends BaseActivity {
if
(
null
!=
mStudentList
&&
mStudentList
.
size
()
>
0
)
{
prepareStudentTest
(
0
);
}
else
{
AppManager
.
getInstance
().
killOtherActivity
(
EyeTestMainActivity
.
class
);
startActivity
(
EyeTestMainActivity
.
class
);
finish
();
}
}
...
...
@@ -140,24 +150,12 @@ public class EyeTestActivity extends BaseActivity {
}
else
{
nameText
.
setText
(
""
);
}
continueTest
();
}
private
void
nextStudent
()
{
final
int
next
=
currentIndex
+
1
;
if
(
next
>=
mStudentList
.
size
())
{
isTestSuccess
=
true
;
speak
(
"本次测试结束"
);
// 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
();
}
else
{
prepareStudentTest
(
next
);
if
(
index
<
mStudentList
.
size
()-
1
){
mNextText
.
setText
(
"放弃当前,跳到下一位"
);
}
else
{
mNextText
.
setText
(
"结束测试"
);
}
continueTest
();
}
/**
...
...
@@ -166,6 +164,7 @@ public class EyeTestActivity extends BaseActivity {
* @param isNewTest true 代表测试的第一只眼 代表左眼 false代表测量另一只眼 右眼
*/
private
void
resetView
(
final
boolean
isNewTest
)
{
isKeyDwon
=
false
;
mLevelIndex
=
-
1
;
isSecondTest
=
!
isNewTest
;
String
eye
=
isNewTest
?
"右"
:
"左"
;
...
...
@@ -222,35 +221,37 @@ public class EyeTestActivity extends BaseActivity {
* @param e
*/
private
void
drewE
(
E
e
)
{
eImageView1
.
setImageResource
(
Eye
.
getBitmapRid
(
e
.
getLevel
(),
mDistance
));
eImageView1
.
setPivotX
(
eImageView1
.
getWidth
()/
2
);
eImageView1
.
setPivotY
(
eImageView1
.
getHeight
()/
2
);
//支点在图片中心
int
angle
=
0
;
LogUtil
.
e
(
"getDirect:"
+
e
.
getDirect
());
switch
(
e
.
getDirect
()){
case
TOP:
eImageView1
.
setRotation
(
0
)
;
angle
=
0
;
break
;
case
RIGHT_TOP:
eImageView1
.
setRotation
(
45
)
;
angle
=
45
;
break
;
case
RIGHT:
eImageView1
.
setRotation
(
90
)
;
angle
=
90
;
break
;
case
RIGHT_BOTTOM:
eImageView1
.
setRotation
(
135
)
;
angle
=
135
;
break
;
case
BOTTOM:
eImageView1
.
setRotation
(
180
)
;
angle
=
180
;
break
;
case
LEFT_BOTTOM:
eImageView1
.
setRotation
(
225
)
;
angle
=
225
;
break
;
case
LEFT:
eImageView1
.
setRotation
(
270
)
;
angle
=
270
;
break
;
case
LEFT_TOP:
eImageView1
.
setRotation
(
315
)
;
angle
=
315
;
break
;
}
eImageView1
.
destroyDrawingCache
();
eImageView1
.
setImageBitmap
(
Eye
.
getBitmap
(
this
,
e
.
getLevel
(),
mDistance
,
angle
));
isKeyDwon
=
true
;
}
/**
...
...
@@ -285,7 +286,7 @@ public class EyeTestActivity extends BaseActivity {
* @return
*/
private
int
getFirstDirect
(
Random
random
,
int
index
)
{
int
direct
=
random
.
nextInt
(
8
);
int
direct
=
random
.
nextInt
(
mDirection
);
if
(
index
>
0
)
{
if
(
mList
.
get
(
index
-
1
).
get
(
0
).
getDirect
()
==
direct
)
direct
=
getFirstDirect
(
random
,
index
);
...
...
@@ -343,10 +344,10 @@ public class EyeTestActivity extends BaseActivity {
private
int
randomDirect
(
int
lastDirect
)
{
//随机数生成方向
Random
random
=
new
Random
();
int
newDirect
=
random
.
nextInt
(
8
);
int
newDirect
=
random
.
nextInt
(
mDirection
);
//相邻的不能一样
while
(
lastDirect
==
newDirect
)
{
newDirect
=
random
.
nextInt
(
8
);
newDirect
=
random
.
nextInt
(
mDirection
);
}
return
newDirect
;
...
...
@@ -357,6 +358,7 @@ public class EyeTestActivity extends BaseActivity {
* 下一个E字标
*/
private
void
nextE
(
boolean
isNextLine
)
{
try
{
if
(
isNextLine
)
{
mLevelIndex
++;
mLocation
=
0
;
...
...
@@ -365,7 +367,18 @@ public class EyeTestActivity extends BaseActivity {
}
mSelectE
=
mList
.
get
(
mLevelIndex
).
get
(
mLocation
);
String
levelByIndex
=
"4.0"
;
if
(
mGroupDecimal
==
EYE_SETTING_5
)
{
levelByIndex
=
""
+
Eye
.
getLevelByIndex
(
mSelectE
.
getLevel
(),
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
}
else
{
levelByIndex
=
""
+
Eye
.
get2LevelByIndex
(
mSelectE
.
getLevel
(),
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
}
mEyeText
.
setText
(
levelByIndex
);
mEyeText_
.
setText
(
""
+
(
mLocation
+
1
));
drewE
(
mSelectE
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
/**
...
...
@@ -428,13 +441,8 @@ public class EyeTestActivity extends BaseActivity {
//如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
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
;
}
if
(
mLevelIndex
==
0
||
(
mCollect
.
containsKey
(
mLevelIndex
-
1
)
&&
!
CheckUtil
.
isEmpty
(
mCollect
.
get
(
mLevelIndex
-
1
))))
{
showResult
();
return
;
}
else
{
...
...
@@ -486,14 +494,35 @@ public class EyeTestActivity extends BaseActivity {
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);
nextStudent
();
final
int
next
=
currentIndex
+
1
;
boolean
isShow
=
false
;
String
nextName
=
""
;
if
(
next
<
mStudentList
.
size
())
{
isShow
=
true
;
nextName
=
mStudentList
.
get
(
next
).
getRealname
();
}
mAfterTestDialog
=
new
AfterTestDialog
.
Builder
(
EyeTestActivity
.
this
,
R
.
style
.
style_common_dialog
)
.
setLeftEye
(
""
+
mLeftEye
)
.
setRightEye
(
""
+
mRightEye
)
.
setUserName
(
""
+
measureStudent
.
getRealname
())
.
setShowContinueText
(
isShow
)
.
setNextName
(
nextName
)
.
setTrainTime
(
new
Date
())
.
setOnLittleHelperListener
(
new
AfterTestDialog
.
AfterTestListener
()
{
@Override
public
void
onFinish
()
{
AppManager
.
getInstance
().
killOtherActivity
(
EyeTestMainActivity
.
class
);
startActivity
(
EyeTestMainActivity
.
class
);
finish
();
}
@Override
public
void
onContinue
()
{
prepareStudentTest
(
next
);
}
}).
create
();
mAfterTestDialog
.
show
();
}
@Override
...
...
@@ -505,6 +534,7 @@ public class EyeTestActivity extends BaseActivity {
return
true
;
}
mLastOnKeyTime
=
currentTime
;
if
(
isKeyDwon
)
{
switch
(
event
.
getKeyCode
())
{
case
KeyEvent
.
KEYCODE_DPAD_UP
:
userChoose
(
TOP
);
...
...
@@ -536,33 +566,42 @@ public class EyeTestActivity extends BaseActivity {
return
true
;
}
return
true
;
}
}
return
super
.
dispatchKeyEvent
(
event
);
}
private
double
getResult
()
{
if
(
null
==
mCollect
||
mCollect
.
size
()
==
0
)
{
if
(
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
)
{
return
4.0
;
}
else
{
return
3.8
;
}
}
int
result
=
0
;
if
(
null
!=
mCollect
&&
mCollect
.
size
()
>
0
)
{
for
(
LinkedHashMap
.
Entry
<
Integer
,
List
<
E
>>
entry
:
mCollect
.
entrySet
())
{
result
=
entry
.
getKey
();
}
final
String
levelByIndex
=
""
+
Eye
.
getLevelByIndex
(
result
,
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
}
String
levelByIndex
=
""
;
if
(
mGroupDecimal
==
EYE_SETTING_5
)
{
levelByIndex
=
""
+
Eye
.
getLevelByIndex
(
result
,
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
}
else
{
levelByIndex
=
""
+
Eye
.
get2LevelByIndex
(
result
,
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
}
return
Double
.
parseDouble
(
levelByIndex
);
}
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_DOWN
){
//两次点击大于1秒
long
currentTime
=
System
.
currentTimeMillis
();
if
(
mLastOnKeyTime
>
0
&&
currentTime
-
mLastOnKeyTime
<
500
)
{
return
true
;
}
mLastOnKeyTime
=
currentTime
;
if
(
isKeyDwon
)
{
userChooseError
();
}
}
return
super
.
onTouchEvent
(
event
);
}
...
...
@@ -570,22 +609,22 @@ public class EyeTestActivity extends BaseActivity {
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
AppManager
.
getInstance
().
killOtherActivity
(
EyeTestMainActivity
.
class
);
startActivity
(
EyeTestMainActivity
.
class
);
finish
();
return
true
;
}
return
super
.
onKeyDown
(
keyCode
,
event
);
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ButterKnife
.
bind
(
this
);
}
@OnClick
({
R
.
id
.
next_left
})
public
void
onClick
(
View
view
)
{
switch
(
view
.
getId
())
{
case
R
.
id
.
next_left
:
int
next
=
currentIndex
+
1
;
if
(
next
<
mStudentList
.
size
())
{
prepareStudentTest
(
next
);
}
break
;
}
}
...
...
app/src/main/java/com/oo/eye/activity/EyeTestMainActivity.java
View file @
78ee5656
package
com
.
oo
.
eye
.
activity
;
import
android.os.Bundle
;
import
android.view.KeyEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.widget.LinearLayout
;
...
...
@@ -19,7 +17,6 @@ import com.oo.eye.mvp.contract.EyeMainContract;
import
java.util.ArrayList
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
/**
...
...
@@ -84,19 +81,6 @@ public class EyeTestMainActivity extends BaseActivity implements EyeMainContract
return
super
.
dispatchTouchEvent
(
ev
);
}
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
LogUtil
.
e
(
"keyCode:"
+
keyCode
);
return
super
.
onKeyDown
(
keyCode
,
event
);
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// TODO: add setContentView(...) invocation
ButterKnife
.
bind
(
this
);
}
@OnClick
({
R
.
id
.
test_setting
,
R
.
id
.
lin_eye_test
,
R
.
id
.
lin_eye_test_histroy
,
R
.
id
.
lin_eye_test_statistics
,
R
.
id
.
lin_eye_test_setting
})
public
void
onClick
(
View
view
)
{
switch
(
view
.
getId
())
{
...
...
app/src/main/java/com/oo/eye/activity/MorePeopleTestActivity.java
View file @
78ee5656
...
...
@@ -15,15 +15,14 @@ import android.widget.RelativeLayout;
import
android.widget.TextView
;
import
com.app.baselibrary.base.common.BaseActivity
;
import
com.app.baselibrary.recycler.listener.IRecycleViewOnItemClickListener
;
import
com.app.baselibrary.commonUtil.CheckUtil
;
import
com.app.baselibrary.commonUtil.ToastUtil
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.R
;
import
com.oo.eye.adapter.MorePeopleAdapter
;
import
com.oo.eye.adapter.PopuAdapter
;
import
com.oo.eye.bean.ChartsBean
;
import
com.oo.eye.bean.StudentBean
;
import
org.w3c.dom.ls.LSException
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -78,8 +77,12 @@ public class MorePeopleTestActivity extends BaseActivity {
mRecycleView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
mStudentBeans
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
StudentBean
chartsBean
=
new
StudentBean
();
mStudentBeans
.
add
(
chartsBean
);
StudentBean
studentBean
=
new
StudentBean
();
studentBean
.
setRealname
(
"测试"
+
i
);
studentBean
.
setNumber
(
"2016010"
+
i
);
studentBean
.
setClasses
(
"动车组"
+
i
);
studentBean
.
setBirthday
(
"2011010"
+
i
);
mStudentBeans
.
add
(
studentBean
);
}
mPeopleAdapter
=
new
MorePeopleAdapter
(
mStudentBeans
,
this
);
mRecycleView
.
setAdapter
(
mPeopleAdapter
);
...
...
@@ -88,7 +91,6 @@ public class MorePeopleTestActivity extends BaseActivity {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// TODO: add setContentView(...) invocation
ButterKnife
.
bind
(
this
);
}
...
...
@@ -114,8 +116,13 @@ public class MorePeopleTestActivity extends BaseActivity {
beanList
.
add
(
bean
);
}
}
if
(!
CheckUtil
.
isEmpty
(
beanList
))
{
EyeConfig
.
getInstance
().
setStudents
(
beanList
);
Intent
intent
=
new
Intent
(
this
,
TestListActivity
.
class
);
startActivity
(
intent
);
}
else
{
ToastUtil
.
showLongMessage
(
"请选择测试人员"
);
}
break
;
}
}
...
...
app/src/main/java/com/oo/eye/activity/SinglePeopleTestActivity.java
View file @
78ee5656
package
com
.
oo
.
eye
.
activity
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Bundle
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
...
...
@@ -12,9 +11,9 @@ import android.widget.RelativeLayout;
import
android.widget.TextView
;
import
com.app.baselibrary.base.common.BaseActivity
;
import
com.app.baselibrary.commonUtil.CheckUtil
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.R
;
import
com.oo.eye.adapter.MorePeopleAdapter
;
import
com.oo.eye.adapter.PopuAdapter
;
import
com.oo.eye.adapter.SinglePeopleAdapter
;
import
com.oo.eye.bean.StudentBean
;
...
...
@@ -23,8 +22,8 @@ import java.util.ArrayList;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
import
retrofit2.http.HEAD
;
/**
* Date : 2018/8/28.
...
...
@@ -38,6 +37,7 @@ public class SinglePeopleTestActivity extends BaseActivity {
TextView
mSeleteAreaTv
;
@BindView
(
R
.
id
.
selete_area_lay
)
LinearLayout
mSeleteAreaLay
;
@BindView
(
R
.
id
.
recycle_view
)
RecyclerView
mRecycleView
;
private
List
<
StudentBean
>
mStudentBeans
;
...
...
@@ -52,19 +52,17 @@ public class SinglePeopleTestActivity extends BaseActivity {
mRecycleView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
mStudentBeans
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
StudentBean
chartsBean
=
new
StudentBean
();
mStudentBeans
.
add
(
chartsBean
);
StudentBean
mStudentBean
=
new
StudentBean
();
mStudentBean
.
setRealname
(
"范特西"
+
i
);
mStudentBean
.
setNumber
(
"20160101"
+
i
);
mStudentBean
.
setClasses
(
"动车组"
+
i
);
mStudentBean
.
setBirthday
(
"20110101"
+
i
);
mStudentBeans
.
add
(
mStudentBean
);
}
mPeopleAdapter
=
new
SinglePeopleAdapter
(
mStudentBeans
,
this
);
mRecycleView
.
setAdapter
(
mPeopleAdapter
);
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ButterKnife
.
bind
(
this
);
}
@OnClick
({
R
.
id
.
selete_area_lay
,
R
.
id
.
do_search
,
R
.
id
.
begin_test
})
public
void
onClick
(
View
view
)
{
switch
(
view
.
getId
())
{
...
...
@@ -74,12 +72,13 @@ public class SinglePeopleTestActivity extends BaseActivity {
case
R
.
id
.
do_search
:
break
;
case
R
.
id
.
begin_test
:
StudentBean
bean
=
mPeopleAdapter
.
getLastSelectBean
();
if
(!
CheckUtil
.
isNull
(
bean
))
{
ArrayList
<
StudentBean
>
list
=
new
ArrayList
<>();
StudentBean
student
=
new
StudentBean
();
student
.
setRealname
(
"游客"
);
list
.
add
(
student
);
list
.
add
(
bean
);
EyeConfig
.
getInstance
().
setStudents
(
list
);
startActivity
(
BeforeEyeTestActivity
.
class
);
}
break
;
}
}
...
...
@@ -105,6 +104,5 @@ public class SinglePeopleTestActivity extends BaseActivity {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
app/src/main/java/com/oo/eye/activity/TestListActivity.java
View file @
78ee5656
package
com
.
oo
.
eye
.
activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.app.baselibrary.base.common.BaseActivity
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.R
;
import
com.oo.eye.adapter.MorePeopleAdapter
;
import
com.oo.eye.adapter.TestListAdapter
;
import
com.oo.eye.bean.ChartsBean
;
import
com.oo.eye.bean.StudentBean
;
import
java.util.ArrayList
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
/**
...
...
@@ -42,24 +38,13 @@ public class TestListActivity extends BaseActivity {
@Override
protected
void
init
()
{
mRecycleView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
List
<
StudentBean
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
StudentBean
chartsBean
=
new
StudentBean
();
list
.
add
(
chartsBean
);
}
List
<
StudentBean
>
list
=
EyeConfig
.
getInstance
().
getStudents
();
mRecycleView
.
setAdapter
(
new
TestListAdapter
(
list
,
this
));
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// TODO: add setContentView(...) invocation
ButterKnife
.
bind
(
this
);
}
@OnClick
(
R
.
id
.
begin_test
)
public
void
onClick
()
{
Intent
intent
=
new
Intent
(
this
,
TestResurtLi
stActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
EyeTe
stActivity
.
class
);
startActivity
(
intent
);
}
}
app/src/main/java/com/oo/eye/activity/TestResurtListActivity.java
View file @
78ee5656
package
com
.
oo
.
eye
.
activity
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Bundle
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
...
...
@@ -17,14 +16,12 @@ import com.app.baselibrary.base.common.BaseActivity;
import
com.oo.eye.R
;
import
com.oo.eye.adapter.PopuAdapter
;
import
com.oo.eye.adapter.TestResultListAdapter
;
import
com.oo.eye.bean.ChartsBean
;
import
com.oo.eye.bean.StudentBean
;
import
java.util.ArrayList
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
/**
...
...
@@ -84,13 +81,6 @@ public class TestResurtListActivity extends BaseActivity {
mRecycleView
.
setAdapter
(
new
TestResultListAdapter
(
list
,
this
));
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// TODO: add setContentView(...) invocation
ButterKnife
.
bind
(
this
);
}
private
boolean
isA
;
@OnClick
({
R
.
id
.
selete_area_lay
,
R
.
id
.
selete_lay
,
R
.
id
.
selete1_lay
,
R
.
id
.
selete2_lay
,
R
.
id
.
do_search
,
R
.
id
.
begin_test
})
...
...
app/src/main/java/com/oo/eye/adapter/MorePeopleAdapter.java
View file @
78ee5656
package
com
.
oo
.
eye
.
adapter
;
import
android.content.Context
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.app.baselibrary.recycler.adapter.BaseRecyclerViewAdapter
;
import
com.app.baselibrary.recycler.itemholder.ItemViewHolder
;
import
com.oo.eye.R
;
import
com.oo.eye.bean.ChartsBean
;
import
com.oo.eye.bean.StudentBean
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -23,13 +21,9 @@ import java.util.List;
public
class
MorePeopleAdapter
extends
BaseRecyclerViewAdapter
<
StudentBean
,
ItemViewHolder
>
{
private
final
LayoutInflater
mInflater
;
private
List
<
StudentBean
>
mBeanList
=
new
ArrayList
<>();
public
MorePeopleAdapter
(
List
<
StudentBean
>
list
,
Context
context
)
{
super
(
list
,
context
);
if
(
list
!=
null
)
{
mBeanList
=
list
;
}
mInflater
=
LayoutInflater
.
from
(
mContext
);
}
...
...
@@ -40,7 +34,15 @@ public class MorePeopleAdapter extends BaseRecyclerViewAdapter<StudentBean, Item
@Override
public
void
onBindViewHolder
(
ItemViewHolder
holder
,
final
int
position
)
{
final
StudentBean
studentBean
=
mBeanList
.
get
(
position
);
final
StudentBean
studentBean
=
mList
.
get
(
position
);
TextView
orderText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_order
);
orderText
.
setText
(
studentBean
.
getNumber
());
TextView
groupText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_group
);
groupText
.
setText
(
studentBean
.
getClasses
());
TextView
nameText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_name
);
nameText
.
setText
(
studentBean
.
getRealname
());
TextView
birthdayText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_birthday
);
birthdayText
.
setText
(
studentBean
.
getBirthday
());
ImageView
imageView
=
(
ImageView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
chick_iv
);
imageView
.
setImageResource
(
studentBean
.
isChick
()
?
R
.
drawable
.
select2_sel
:
R
.
drawable
.
select2_nor
);
holder
.
itemView
.
findViewById
(
R
.
id
.
choice_lay
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
...
...
@@ -55,6 +57,6 @@ public class MorePeopleAdapter extends BaseRecyclerViewAdapter<StudentBean, Item
@Override
public
int
getItemCount
()
{
return
10
;
return
mList
.
size
()
;
}
}
app/src/main/java/com/oo/eye/adapter/SinglePeopleAdapter.java
View file @
78ee5656
...
...
@@ -5,13 +5,14 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.app.baselibrary.commonUtil.CheckUtil
;
import
com.app.baselibrary.recycler.adapter.BaseRecyclerViewAdapter
;
import
com.app.baselibrary.recycler.itemholder.ItemViewHolder
;
import
com.oo.eye.R
;
import
com.oo.eye.bean.StudentBean
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -21,16 +22,22 @@ import java.util.List;
public
class
SinglePeopleAdapter
extends
BaseRecyclerViewAdapter
<
StudentBean
,
ItemViewHolder
>
{
private
final
LayoutInflater
mInflater
;
private
List
<
StudentBean
>
mBeanList
=
new
ArrayList
<>();
private
StudentBean
lastSelectBean
;
public
SinglePeopleAdapter
(
List
<
StudentBean
>
list
,
Context
context
)
{
super
(
list
,
context
);
if
(
list
!=
null
)
{
mBeanList
=
list
;
if
(!
CheckUtil
.
isEmpty
(
mList
)){
lastSelectBean
=
mList
.
get
(
0
);
lastSelectBean
.
setChick
(
true
);
}
mInflater
=
LayoutInflater
.
from
(
mContext
);
}
public
StudentBean
getLastSelectBean
()
{
return
lastSelectBean
;
}
@Override
public
ItemViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
return
new
ItemViewHolder
(
mInflater
.
inflate
(
R
.
layout
.
item_single_people
,
parent
,
false
));
...
...
@@ -38,18 +45,30 @@ public class SinglePeopleAdapter extends BaseRecyclerViewAdapter<StudentBean, It
@Override
public
void
onBindViewHolder
(
ItemViewHolder
holder
,
final
int
position
)
{
final
StudentBean
studentBean
=
mBeanList
.
get
(
position
);
final
StudentBean
studentBean
=
mList
.
get
(
position
);
TextView
orderText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_order
);
orderText
.
setText
(
studentBean
.
getNumber
());
TextView
groupText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_group
);
groupText
.
setText
(
studentBean
.
getClasses
());
TextView
nameText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_name
);
nameText
.
setText
(
studentBean
.
getRealname
());
TextView
birthdayText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_birthday
);
birthdayText
.
setText
(
studentBean
.
getBirthday
());
ImageView
imageView
=
(
ImageView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
chick_iv
);
imageView
.
setImageResource
(
studentBean
.
isChick
()
?
R
.
drawable
.
select1_sel
:
R
.
drawable
.
select1_nor
);
holder
.
itemView
.
findViewById
(
R
.
id
.
choice_lay
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
for
(
int
i
=
0
;
i
<
mBeanList
.
size
();
i
++)
{
StudentBean
bean
=
null
;
for
(
int
i
=
0
;
i
<
mList
.
size
();
i
++)
{
if
(
position
==
i
)
{
mBeanList
.
get
(
i
).
setChick
(!
studentBean
.
isChick
()
);
}
else
{
mBeanList
.
get
(
i
).
setChick
(
false
);
bean
=
mList
.
get
(
i
);
bean
.
setChick
(
true
);
}
}
if
(!
bean
.
getNumber
().
equals
(
lastSelectBean
.
getNumber
()))
{
lastSelectBean
.
setChick
(
false
);
lastSelectBean
=
bean
;
}
notifyDataSetChanged
();
}
...
...
app/src/main/java/com/oo/eye/adapter/TestListAdapter.java
View file @
78ee5656
...
...
@@ -8,7 +8,6 @@ import android.widget.TextView;
import
com.app.baselibrary.recycler.adapter.BaseRecyclerViewAdapter
;
import
com.app.baselibrary.recycler.itemholder.ItemViewHolder
;
import
com.oo.eye.R
;
import
com.oo.eye.bean.ChartsBean
;
import
com.oo.eye.bean.StudentBean
;
import
java.util.List
;
...
...
@@ -33,13 +32,20 @@ public class TestListAdapter extends BaseRecyclerViewAdapter<StudentBean, ItemVi
@Override
public
void
onBindViewHolder
(
ItemViewHolder
holder
,
int
position
)
{
TextView
testOrder
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_order
);
testOrder
.
setText
((
position
+
1
)
+
""
);
final
StudentBean
studentBean
=
mList
.
get
(
position
);
TextView
orderText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_order
);
orderText
.
setText
(
studentBean
.
getNumber
());
TextView
groupText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_group
);
groupText
.
setText
(
studentBean
.
getClasses
());
TextView
nameText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_name
);
nameText
.
setText
(
studentBean
.
getRealname
());
TextView
birthdayText
=
(
TextView
)
holder
.
itemView
.
findViewById
(
R
.
id
.
test_birthday
);
birthdayText
.
setText
(
studentBean
.
getBirthday
());
}
@Override
public
int
getItemCount
()
{
return
10
;
return
mList
.
size
()
;
}
}
app/src/main/java/com/oo/eye/bean/Eye.java
View file @
78ee5656
package
com
.
oo
.
eye
.
bean
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Matrix
;
import
android.graphics.drawable.BitmapDrawable
;
import
com.app.baselibrary.bean.BaseBean
;
import
com.app.baselibrary.commonUtil.DensityUtil
;
import
com.app.baselibrary.commonUtil.LogUtil
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.R
;
...
...
@@ -456,6 +460,17 @@ public class Eye extends BaseBean {
return
DensityUtil
.
px2dip
(
level
);
}
public
static
Bitmap
getBitmap
(
Context
context
,
int
level
,
int
distance
,
int
angle
){
Bitmap
bitmap
=
((
BitmapDrawable
)
context
.
getResources
().
getDrawable
(
getBitmapRid
(
level
,
distance
))).
getBitmap
();
LogUtil
.
e
(
"width:"
+
bitmap
.
getWidth
()+
"----height:"
+
bitmap
.
getHeight
());
int
width
=
bitmap
.
getWidth
();
int
height
=
bitmap
.
getHeight
();
Matrix
matrix
=
new
Matrix
();
matrix
.
setRotate
(
angle
);
Bitmap
resizedBitmap
=
Bitmap
.
createBitmap
(
bitmap
,
0
,
0
,
width
,
height
,
matrix
,
true
);
return
resizedBitmap
;
}
public
static
int
getBitmapRid
(
int
level
,
int
distance
){
int
rid
=
R
.
drawable
.
p5c14
;
switch
(
distance
){
...
...
app/src/main/java/com/oo/eye/bean/StudentBean.java
View file @
78ee5656
...
...
@@ -21,6 +21,7 @@ public class StudentBean extends BaseBean {
private
String
pid
;
private
int
distance
;
//测量距离
private
boolean
isChick
;
private
String
birthday
;
public
boolean
isChick
()
{
return
isChick
;
...
...
@@ -134,6 +135,14 @@ public class StudentBean extends BaseBean {
this
.
distance
=
distance
;
}
public
String
getBirthday
()
{
return
birthday
;
}
public
void
setBirthday
(
String
birthday
)
{
this
.
birthday
=
birthday
;
}
public
StudentBean
copy
(){
StudentBean
student
=
new
StudentBean
();
student
.
setSid
(
this
.
sid
);
...
...
@@ -149,6 +158,7 @@ public class StudentBean extends BaseBean {
student
.
setLeft_eye
(
this
.
left_eye
);
student
.
setRight_eye
(
this
.
right_eye
);
student
.
setDistance
(
this
.
distance
);
student
.
setBirthday
(
this
.
birthday
);
return
student
;
}
...
...
app/src/main/java/com/oo/eye/widget/AfterTestDialog.java
View file @
78ee5656
...
...
@@ -3,26 +3,26 @@ package com.oo.eye.widget;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.view.Display
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.FrameLayout
;
import
android.widget.ListView
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.app.baselibrary.commonUtil.CheckUtil
;
import
com.app.baselibrary.commonUtil.DensityUtil
;
import
com.facebook.drawee.view.SimpleDraweeView
;
import
com.oo.eye.R
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* Date : 2018/5/2.
* Author: cxh
* 测试完成后
*/
public
class
AfterTestDialog
extends
Dialog
implements
View
.
OnClickListener
{
public
class
AfterTestDialog
extends
Dialog
{
private
SimpleDraweeView
mHead_iv
;
private
TextView
mUsername_tv
;
...
...
@@ -30,32 +30,30 @@ public class AfterTestDialog extends Dialog implements View.OnClickListener {
private
TextView
mRightEye
;
private
TextView
mTestTime
;
private
TextView
mNextName
;
private
static
TextView
mPlan_start_train
;
private
TextView
mStart_train_later
;
private
TextView
mGiveUp2
;
private
TextView
mContinueText
;
private
TextView
mFinishText
;
private
String
userName
;
private
String
lefteye
;
private
String
righteye
;
private
String
trainTime
;
private
Date
mDate
;
private
String
nextUserName
;
private
boolean
isShowContinueText
;
private
AfterTestListener
myListener
;
private
SimpleDateFormat
mSimpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
);
public
AfterTestDialog
(
Context
context
,
int
themeResId
)
{
super
(
context
,
themeResId
);
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
getWindow
().
setType
(
WindowManager
.
LayoutParams
.
TYPE_SYSTEM_OVERLAY
);
setContentView
(
R
.
layout
.
dialog_after_eye_test
);
initView
();
setClickListener
();
}
private
void
initView
()
{
RelativeLayout
rootView
=
(
RelativeLayout
)
findViewById
(
R
.
id
.
root_view
);
FrameLayout
.
LayoutParams
params
=
new
FrameLayout
.
LayoutParams
(
DensityUtil
.
getScreenWidth
(),
DensityUtil
.
getScreenHeight
());
...
...
@@ -65,37 +63,44 @@ public class AfterTestDialog extends Dialog implements View.OnClickListener {
mLeftEye
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_result_left
);
mRightEye
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_result_right
);
mTestTime
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_time
);
mPlan_start_train
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_save
);
mStart_train_later
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_give_up
);
mGiveUp2
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_give2
);
mUsername_tv
.
setText
(
userName
);
mLeftEye
.
setText
(
lefteye
);
mRightEye
.
setText
(
righteye
);
mTestTime
.
setText
(
trainTime
);
mContinueText
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_continue
);
mContinueText
.
setVisibility
(
isShowContinueText
?
View
.
VISIBLE
:
View
.
GONE
);
mContinueText
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
myListener
!=
null
){
myListener
.
onContinue
();
}
private
void
setClickListener
()
{
mPlan_start_train
.
setOnClickListener
(
this
);
mStart_train_later
.
setOnClickListener
(
this
);
dismiss
();
}
});
mFinishText
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_finish
);
mFinishText
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
//继续测试
if
(
v
.
getId
()
==
R
.
id
.
tv_after_save
)
{
if
(
myListener
!=
null
)
{
myListener
.
onAfterTestListener
(
v
);
dismiss
();
if
(
myListener
!=
null
){
myListener
.
onFinish
();
}
}
else
{
dismiss
();
}
});
if
(
isShowContinueText
&&
!
CheckUtil
.
isEmpty
(
nextUserName
)){
mNextName
.
setVisibility
(
View
.
VISIBLE
);
mNextName
.
setText
(
"下一位: "
+
nextUserName
);
}
else
{
mNextName
.
setVisibility
(
View
.
GONE
);
}
mUsername_tv
.
setText
(
"姓 名:"
+
userName
);
mLeftEye
.
setText
(
lefteye
);
mRightEye
.
setText
(
righteye
);
mTestTime
.
setText
(
"检测时间: "
+
mSimpleDateFormat
.
format
(
mDate
));
}
public
interface
AfterTestListener
{
void
onAfterTestListener
(
View
view
);
void
onFinish
();
void
onContinue
();
}
public
static
class
Builder
{
...
...
@@ -120,8 +125,16 @@ public class AfterTestDialog extends Dialog implements View.OnClickListener {
return
this
;
}
public
Builder
setTrainTime
(
String
trainTime
)
{
mDialog
.
trainTime
=
trainTime
;
public
Builder
setTrainTime
(
Date
date
)
{
mDialog
.
mDate
=
date
;
return
this
;
}
public
Builder
setShowContinueText
(
boolean
isShow
){
mDialog
.
isShowContinueText
=
isShow
;
return
this
;
}
public
Builder
setNextName
(
String
name
){
mDialog
.
nextUserName
=
name
;
return
this
;
}
...
...
@@ -136,7 +149,4 @@ public class AfterTestDialog extends Dialog implements View.OnClickListener {
}
public
static
TextView
getCountDownTtext
()
{
return
mPlan_start_train
;
}
}
app/src/main/res/layout/activity_eye_test.xml
View file @
78ee5656
...
...
@@ -4,15 +4,33 @@
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:keepScreenOn=
"true"
>
<TextView
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_marginTop=
"@dimen/dp_16"
android:layout_centerHorizontal=
"true"
android:id=
"@+id/title_left"
android:gravity=
"center_vertical"
android:layout_centerHorizontal=
"true"
>
<TextView
android:id=
"@+id/title_eye"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_22"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:text=
"-"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_22"
/>
<TextView
android:id=
"@+id/title_eye_"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:
text=
"5.0 -3
"
android:
layout_marginLeft=
"5dp
"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_22"
/>
</LinearLayout>
<TextView
android:layout_marginTop=
"@dimen/dp_16"
android:layout_marginRight=
"@dimen/dp_20"
...
...
@@ -20,9 +38,8 @@
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"
/>
android:textSize=
"@dimen/sp_16"
/>
<RelativeLayout
android:id=
"@+id/rl_eye_test_center1"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/activity_testlist.xml
View file @
78ee5656
...
...
@@ -165,7 +165,7 @@
android:layout_marginTop=
"@dimen/dp_12"
android:background=
"@drawable/after_btn_bg"
android:gravity=
"center"
android:text=
"
生成测试队列
"
android:text=
"
开始测试
"
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_16"
/>
...
...
app/src/main/res/layout/dialog_after_eye_test.xml
View file @
78ee5656
...
...
@@ -3,29 +3,23 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:id=
"@+id/root_view"
android:background=
"@color/line_color"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
>
android:background=
"@color/line_color"
>
<RelativeLayout
android:id=
"@+id/main_lay"
android:layout_width=
"400dp"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_centerVertical=
"true"
android:layout_centerInParent=
"true"
android:background=
"@color/white"
android:orientation=
"vertical"
android:padding=
"@dimen/dp_
2
0"
>
android:padding=
"@dimen/dp_
3
0"
>
<TextView
android:id=
"@+id/tv_after_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"@dimen/dp_20"
android:text=
"视力检测报告单"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_24"
/>
...
...
@@ -38,7 +32,6 @@
android:layout_marginLeft=
"@dimen/dp_30"
android:layout_marginTop=
"@dimen/dp_22"
android:gravity=
"center"
android:text=
"姓 名: 游客11"
android:textColor=
"@color/text_color"
android:textSize=
"16dp"
/>
...
...
@@ -65,7 +58,6 @@
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_8"
android:gravity=
"center"
android:text=
"5.1"
android:textStyle=
"bold"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_28"
/>
...
...
@@ -85,7 +77,6 @@
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_8"
android:gravity=
"center"
android:text=
"5.1"
android:textStyle=
"bold"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_28"
/>
...
...
@@ -99,17 +90,20 @@
android:layout_marginLeft=
"@dimen/dp_30"
android:layout_marginTop=
"@dimen/dp_8"
android:gravity=
"center"
android:text=
"检测时间: 2018-09-09 13:21:55"
android:textColor=
"@color/text_color"
android:textSize=
"16dp"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_after_time"
android:gravity=
"center_horizontal"
android:layout_marginTop=
"25dp"
>
<TextView
android:id=
"@+id/tv_after_sav
e"
android:id=
"@+id/tv_after_continu
e"
android:layout_width=
"120dip"
android:layout_height=
"@dimen/dp_40"
android:layout_below=
"@+id/tv_after_time"
android:layout_marginLeft=
"@dimen/dp_30"
android:layout_marginTop=
"25dp"
android:background=
"@drawable/after_btn_bg"
android:clickable=
"true"
android:focusable=
"true"
...
...
@@ -120,30 +114,11 @@
android:textSize=
"15dp"
/>
<TextView
android:id=
"@+id/tv_after_give_up
"
android:id=
"@+id/tv_after_finish
"
android:layout_width=
"120dip"
android:layout_height=
"@dimen/dp_40"
android:layout_below=
"@+id/tv_after_time"
android:layout_marginLeft=
"30dp"
android:layout_marginTop=
"25dp"
android:layout_toRightOf=
"@+id/tv_after_save"
android:background=
"@drawable/after_btn_bg"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:gravity=
"center"
android:text=
"完成"
android:textColor=
"@color/white"
android:textSize=
"15dp"
/>
<TextView
android:id=
"@+id/tv_after_give2"
android:layout_width=
"120dip"
android:layout_height=
"@dimen/dp_40"
android:layout_below=
"@+id/tv_after_time"
android:visibility=
"gone"
android:layout_marginLeft=
"30dp"
android:layout_marginTop=
"25dp"
android:layout_centerHorizontal=
"true"
android:layout_marginRight=
"30dp"
android:background=
"@drawable/after_btn_bg"
android:clickable=
"true"
android:focusable=
"true"
...
...
@@ -152,6 +127,7 @@
android:text=
"完成"
android:textColor=
"@color/white"
android:textSize=
"15dp"
/>
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_centerHorizontal=
"true"
...
...
app/src/main/res/layout/include_people.xml
View file @
78ee5656
...
...
@@ -23,7 +23,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"2016010101"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_18"
/>
...
...
@@ -45,7 +44,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"A组"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_18"
/>
...
...
@@ -67,7 +65,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"欧晓迪"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_18"
/>
...
...
@@ -89,7 +86,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"20160101"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_18"
/>
...
...
app/src/main/res/layout/item_people.xml
View file @
78ee5656
...
...
@@ -43,7 +43,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"2016010101"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_18"
/>
...
...
@@ -65,7 +64,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"A组"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_18"
/>
...
...
@@ -87,7 +85,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"欧晓迪"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_18"
/>
...
...
@@ -109,7 +106,6 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"20160101"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_18"
/>
...
...
library/baselibrary/src/main/java/com/app/baselibrary/recycler/adapter/BaseRecyclerViewAdapter.java
View file @
78ee5656
...
...
@@ -44,14 +44,22 @@ public abstract class BaseRecyclerViewAdapter<T, VH extends RecyclerView.ViewHol
* 父类的构造方法
*/
public
BaseRecyclerViewAdapter
(
List
<
T
>
list
)
{
appendTo
List
(
list
);
set
List
(
list
);
}
public
BaseRecyclerViewAdapter
(
List
<
T
>
list
,
Context
context
)
{
appendTo
List
(
list
);
set
List
(
list
);
mContext
=
context
;
}
public
void
setList
(
List
<
T
>
list
){
if
(
list
!=
null
){
this
.
mList
=
list
;
}
else
{
mList
.
clear
();
}
}
/**
* 返回数据源集合
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment