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
c3dde5bb
Commit
c3dde5bb
authored
Sep 04, 2018
by
徐丛奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wwww
parent
72292174
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
196 additions
and
221 deletions
+196
-221
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
+73
-65
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
+3
-4
SinglePeopleTestActivity.java
app/src/main/java/com/oo/eye/activity/SinglePeopleTestActivity.java
+0
-8
TestListActivity.java
app/src/main/java/com/oo/eye/activity/TestListActivity.java
+0
-11
TestResurtListActivity.java
app/src/main/java/com/oo/eye/activity/TestResurtListActivity.java
+0
-10
AfterTestDialog.java
app/src/main/java/com/oo/eye/widget/AfterTestDialog.java
+48
-33
activity_eye_test.xml
app/src/main/res/layout/activity_eye_test.xml
+25
-6
dialog_after_eye_test.xml
app/src/main/res/layout/dialog_after_eye_test.xml
+27
-26
No files found.
app/src/main/java/com/oo/eye/EyeConfig.java
View file @
c3dde5bb
...
...
@@ -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 @
c3dde5bb
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 @
c3dde5bb
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 @
c3dde5bb
package
com
.
oo
.
eye
.
activity
;
import
android.os.Bundle
;
import
android.os.CountDownTimer
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
...
...
@@ -13,21 +12,25 @@ import android.widget.TextView;
import
com.app.baselibrary.base.common.BaseActivity
;
import
com.app.baselibrary.commonUtil.BDttsUtils
;
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 +42,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 +71,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 +84,14 @@ 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
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 +106,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
++)
{
...
...
@@ -140,24 +144,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
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
mNextText
.
setVisibility
(
View
.
GONE
);
}
continueTest
();
}
/**
...
...
@@ -205,6 +197,7 @@ public class EyeTestActivity extends BaseActivity {
}
}
mLevelIndex
=
Eye
.
getIndexByValue
(
e
,
true
)
-
1
;
mEyeText
.
setText
(
""
+
e
);
nextE
(
true
);
}
}.
start
();
...
...
@@ -222,7 +215,7 @@ public class EyeTestActivity extends BaseActivity {
* @param e
*/
private
void
drewE
(
E
e
)
{
eImageView1
.
setImageResource
(
Eye
.
getBitmapRid
(
e
.
getLevel
(),
mDistance
));
LogUtil
.
e
(
"getDirect:"
+
e
.
getDirect
(
));
eImageView1
.
setPivotX
(
eImageView1
.
getWidth
()/
2
);
eImageView1
.
setPivotY
(
eImageView1
.
getHeight
()/
2
);
//支点在图片中心
switch
(
e
.
getDirect
()){
...
...
@@ -251,6 +244,7 @@ public class EyeTestActivity extends BaseActivity {
eImageView1
.
setRotation
(
315
);
break
;
}
eImageView1
.
setImageResource
(
Eye
.
getBitmapRid
(
e
.
getLevel
(),
mDistance
));
}
/**
...
...
@@ -285,7 +279,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 +337,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
;
...
...
@@ -365,6 +359,7 @@ public class EyeTestActivity extends BaseActivity {
}
mSelectE
=
mList
.
get
(
mLevelIndex
).
get
(
mLocation
);
mEyeText_
.
setText
(
""
+(
mLocation
+
1
));
drewE
(
mSelectE
);
}
...
...
@@ -430,11 +425,6 @@ public class EyeTestActivity extends BaseActivity {
//如果上一行数据不为空 结束测试
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
{
...
...
@@ -486,14 +476,33 @@ 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
;
}
else
{
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
()
{
finish
();
}
@Override
public
void
onContinue
()
{
prepareStudentTest
(
next
);
}
}).
create
();
mAfterTestDialog
.
show
();
}
@Override
...
...
@@ -543,18 +552,19 @@ public class EyeTestActivity extends BaseActivity {
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
);
}
...
...
@@ -576,16 +586,14 @@ public class EyeTestActivity extends BaseActivity {
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 @
c3dde5bb
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 @
c3dde5bb
...
...
@@ -18,7 +18,6 @@ import com.app.baselibrary.base.common.BaseActivity;
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
java.util.ArrayList
;
...
...
@@ -73,8 +72,9 @@ public class MorePeopleTestActivity extends BaseActivity {
mRecycleView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
List
<
StudentBean
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
StudentBean
chartsBean
=
new
StudentBean
();
list
.
add
(
chartsBean
);
StudentBean
studentBean
=
new
StudentBean
();
studentBean
.
setRealname
(
"测试"
+
i
);
list
.
add
(
studentBean
);
}
mRecycleView
.
setAdapter
(
new
MorePeopleAdapter
(
list
,
this
));
}
...
...
@@ -82,7 +82,6 @@ public class MorePeopleTestActivity extends BaseActivity {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// TODO: add setContentView(...) invocation
ButterKnife
.
bind
(
this
);
}
...
...
app/src/main/java/com/oo/eye/activity/SinglePeopleTestActivity.java
View file @
c3dde5bb
package
com
.
oo
.
eye
.
activity
;
import
android.os.Bundle
;
import
android.widget.TextView
;
import
com.app.baselibrary.base.common.BaseActivity
;
...
...
@@ -11,7 +10,6 @@ import com.oo.eye.bean.StudentBean;
import
java.util.ArrayList
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
/**
...
...
@@ -33,12 +31,6 @@ public class SinglePeopleTestActivity extends BaseActivity {
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ButterKnife
.
bind
(
this
);
}
@OnClick
(
R
.
id
.
begin_test
)
public
void
onClick
()
{
ArrayList
<
StudentBean
>
list
=
new
ArrayList
<>();
...
...
app/src/main/java/com/oo/eye/activity/TestListActivity.java
View file @
c3dde5bb
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
;
...
...
@@ -9,16 +8,13 @@ import android.widget.TextView;
import
com.app.baselibrary.base.common.BaseActivity
;
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
;
/**
...
...
@@ -50,13 +46,6 @@ public class TestListActivity extends BaseActivity {
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
,
TestResurtListActivity
.
class
);
...
...
app/src/main/java/com/oo/eye/activity/TestResurtListActivity.java
View file @
c3dde5bb
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/widget/AfterTestDialog.java
View file @
c3dde5bb
...
...
@@ -5,19 +5,22 @@ import android.content.Context;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
com.app.baselibrary.commonUtil.CheckUtil
;
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
;
...
...
@@ -25,15 +28,17 @@ 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
);
...
...
@@ -47,7 +52,6 @@ public class AfterTestDialog extends Dialog implements View.OnClickListener {
getWindow
().
setType
(
WindowManager
.
LayoutParams
.
TYPE_SYSTEM_OVERLAY
);
setContentView
(
R
.
layout
.
dialog_after_eye_test
);
initView
();
setClickListener
();
}
...
...
@@ -56,38 +60,44 @@ public class AfterTestDialog extends Dialog implements View.OnClickListener {
mNextName
=
(
TextView
)
findViewById
(
R
.
id
.
tv_nest_name
);
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
);
mTestTime
=
(
TextView
)
findViewById
(
R
.
id
.
tv_after_time_value
);
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
);
public
void
onFinish
();
public
void
onContinue
();
}
public
static
class
Builder
{
...
...
@@ -112,8 +122,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
;
}
...
...
@@ -128,7 +146,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 @
c3dde5bb
...
...
@@ -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,10 @@
android:layout_alignParentRight=
"true"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
X
放弃当前,跳到下一位"
android:text=
"放弃当前,跳到下一位"
android:textColor=
"@color/text_color"
android:textSize=
"@dimen/sp_16"
/>
android:textSize=
"@dimen/sp_16"
android:visibility=
"gone"
/>
<RelativeLayout
android:id=
"@+id/rl_eye_test_center1"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/dialog_after_eye_test.xml
View file @
c3dde5bb
...
...
@@ -98,51 +98,51 @@
android:layout_marginLeft=
"@dimen/dp_30"
android:layout_marginTop=
"@dimen/dp_8"
android:gravity=
"center"
android:text=
"检测时间: 2018-09-09 13:21:55
"
android:text=
"检测时间:
"
android:textColor=
"@color/text_color"
android:textSize=
"16dp"
/>
<TextView
android:id=
"@+id/tv_after_save"
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"
android:focusableInTouchMode=
"true"
android:id=
"@+id/tv_after_time_value"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/test_result_lay"
android:layout_toRightOf=
"@+id/tv_after_time"
android:layout_marginLeft=
"@dimen/dp_20"
android:layout_marginTop=
"@dimen/dp_8"
android:gravity=
"center"
android:text=
"
继续测试
"
android:textColor=
"@color/
white
"
android:textSize=
"1
5
dp"
/>
android:text=
"
2018-09-09 13:21:55
"
android:textColor=
"@color/
text_color
"
android:textSize=
"1
6
dp"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_after_time"
android:layout_centerHorizontal=
"true"
android:orientation=
"horizontal"
android:layout_marginTop=
"25dp"
>
<TextView
android:id=
"@+id/tv_after_give_up
"
android:id=
"@+id/tv_after_continue
"
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:layout_marginLeft=
"@dimen/dp_30"
android:background=
"@drawable/after_btn_bg"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:gravity=
"center"
android:text=
"完成
"
android:text=
"继续测试
"
android:textColor=
"@color/white"
android:textSize=
"15dp"
/>
android:textSize=
"15dp"
android:visibility=
"gone"
/>
<TextView
android:id=
"@+id/tv_after_give2
"
android:id=
"@+id/tv_after_finish
"
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"
...
...
@@ -151,6 +151,7 @@
android:text=
"完成"
android:textColor=
"@color/white"
android:textSize=
"15dp"
/>
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_centerHorizontal=
"true"
...
...
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