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
00affc7a
Commit
00affc7a
authored
Sep 11, 2018
by
徐丛奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nnnnn
parent
f50b2c35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
22 deletions
+23
-22
EyeTestActivity.java
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
+19
-21
activity_eye_test.xml
app/src/main/res/layout/activity_eye_test.xml
+4
-1
No files found.
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
View file @
00affc7a
...
@@ -5,7 +5,6 @@ import android.os.CountDownTimer;
...
@@ -5,7 +5,6 @@ import android.os.CountDownTimer;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
...
@@ -233,7 +232,7 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -233,7 +232,7 @@ public class EyeTestActivity extends BaseActivity {
nextE
(
true
);
nextE
(
true
);
}
}
}.
start
();
}.
start
();
speak
(
"请遮住您的"
+
eye
+
"眼"
);
speak
(
"
测试马上开始,
请遮住您的"
+
eye
+
"眼"
);
mCollect
.
clear
();
mCollect
.
clear
();
}
}
...
@@ -248,8 +247,6 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -248,8 +247,6 @@ public class EyeTestActivity extends BaseActivity {
*/
*/
private
void
drewE
(
E
e
)
{
private
void
drewE
(
E
e
)
{
int
angle
=
0
;
int
angle
=
0
;
ToastUtil
.
showLongMessage
(
"getDirect:"
+
e
.
getDirect
());
LogUtil
.
e
(
"getDirect:"
+
e
.
getDirect
());
switch
(
e
.
getDirect
()){
switch
(
e
.
getDirect
()){
case
TOP:
case
TOP:
angle
=
0
;
angle
=
0
;
...
@@ -500,7 +497,6 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -500,7 +497,6 @@ public class EyeTestActivity extends BaseActivity {
}
else
{
}
else
{
verifyErrorCount
=
0
;
verifyErrorCount
=
0
;
}
}
ToastUtil
.
showLongMessage
(
"verifyErrorCount:"
+
verifyErrorCount
+
"---errorCount:"
+
errorCount
);
//必须答对一半才往下走一行的
//必须答对一半才往下走一行的
//如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
//如果错误次数超过一半 (默认位置时上一行没有数据时候)回退一行
if
(
errorCount
>=
verifyErrorCount
)
{
if
(
errorCount
>=
verifyErrorCount
)
{
...
@@ -691,22 +687,22 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -691,22 +687,22 @@ public class EyeTestActivity extends BaseActivity {
return
Double
.
parseDouble
(
levelByIndex
);
return
Double
.
parseDouble
(
levelByIndex
);
}
}
@Override
//
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
//
public boolean onTouchEvent(MotionEvent event) {
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_DOWN
){
//
if(event.getAction() == MotionEvent.ACTION_DOWN){
//两次点击大于1秒
//
//两次点击大于1秒
long
currentTime
=
System
.
currentTimeMillis
();
//
long currentTime = System.currentTimeMillis();
if
(
mLastOnKeyTime
>
0
&&
currentTime
-
mLastOnKeyTime
<
500
)
{
//
if (mLastOnKeyTime > 0 && currentTime - mLastOnKeyTime < 500) {
return
true
;
//
return true;
}
//
}
mLastOnKeyTime
=
currentTime
;
//
mLastOnKeyTime = currentTime;
if
(
isKeyDwon
)
{
//
if(isKeyDwon) {
userChooseError
();
//
userChooseError();
}
//
}
}
//
}
return
super
.
onTouchEvent
(
event
);
//
return super.onTouchEvent(event);
//
}
//
}
@Override
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
...
@@ -726,6 +722,8 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -726,6 +722,8 @@ public class EyeTestActivity extends BaseActivity {
int
next
=
currentIndex
+
1
;
int
next
=
currentIndex
+
1
;
if
(
next
<
mStudentList
.
size
())
{
if
(
next
<
mStudentList
.
size
())
{
prepareStudentTest
(
next
);
prepareStudentTest
(
next
);
}
else
{
finish
();
}
}
break
;
break
;
}
}
...
...
app/src/main/res/layout/activity_eye_test.xml
View file @
00affc7a
...
@@ -129,7 +129,9 @@
...
@@ -129,7 +129,9 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"40dp"
android:textColor=
"#4A4A4A"
android:textColor=
"#4A4A4A"
android:textSize=
"
12
sp"
android:textSize=
"
20
sp"
android:id=
"@+id/test_distance"
/>
android:id=
"@+id/test_distance"
/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
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